-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPocsag.h
78 lines (56 loc) · 1.54 KB
/
Pocsag.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// pocsag.h
// Author: Kristoff Bonne ([email protected])
// Copyright (C) 2014 Kristoff Bonne (ON1ARF)
//
#ifndef POCSAG_H
#define POCSAG_H
class Pocsag {
public:
// enum's:
typedef enum {
POCSAGRC_UNDETERMINED = 0, // Undetermined error
POCSAGRC_INVALIDADDRESS, // RETURN CODE FOR INVALID ADDRESS
POCSAGRC_INVALIDSOURCE, // RETURN CODE FOR INVALID ADDRESS SOURCE
POCSAGRC_INVALIDBATCH2OPT, // RETURN CODE FOR INVALUD "BATCH2" OPTION
POCSAGRC_INVALIDINVERTOPT // RETURN CODE FOR INVALID "INVERT" OPTION
} Pocsag_error;
typedef enum {
POCSAG_FAILED = 0, // failed
POCSAG_SUCCESS // success
} Pocsag_rc;
// structures
// a 2-batch pocsag message
typedef struct {
unsigned char sync[72];
// batch 1
unsigned char synccw1[4];
uint32_t batch1[16];
// batch 2
unsigned char synccw2[4];
uint32_t batch2[16];
} Pocsagmsg_s; // end struct
// data
Pocsagmsg_s Pocsagmsg;
// methodes
// constructor
Pocsag();
// create Pocsag Message
int CreatePocsag(long int, int, char *, int, int);
// get state
int GetState();
// get size
int GetSize();
// get error
int GetError();
// get pointer to data
void * GetMsgPointer();
private:
// vars
int state;
int size;
int error;
uint32_t createcrc(uint32_t);
unsigned char flip7charbitorder(unsigned char);
void replaceline(Pocsag::Pocsagmsg_s *, int, uint32_t);
}; // end class Pocsag
#endif