-
Notifications
You must be signed in to change notification settings - Fork 9
/
Telegram.h
56 lines (45 loc) · 1.32 KB
/
Telegram.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
#include "UserData.h"
#ifndef TELEGRAM_H
#define TELEGRAM_H
enum TelegramTypeEnum
{
None,
Single,
Short,
Control,
Long
};
class Telegram
{
public:
Telegram();
virtual ~Telegram();
bool parse(byte pData[]);
static unsigned char checkSum(byte pData[], int pStart, int pLength);
TelegramTypeEnum TelegramFormat;
byte CField;
byte AField;
byte CIField;
long IdentNumber;
char Manufacturer[4];
byte Version;
byte Medium;
byte Access;
byte Status;
bool MoreTelegrams;
UserData* Data;
protected:
private:
bool parseShort(byte pData[]);
bool parseControl(byte pData[]);
bool parseLong(byte pData[]);
bool parseUserData(byte pData[], int pStart, int pLength);
bool parseVariableDataStructure(byte pData[], int pStart, int pLength);
bool parseManufacturer(byte pData[], int pStart);
int LSBFIRSTtoInt16(byte pData[], int pStart);
long LSBFIRSTtoBCD(byte pData[], int pStart, int pLength);
long MSBFIRSTtoBCD(byte pData[], int pStart, int pLength);
bool getMode();
UserData* readData(byte pData[], int pStart, int pLength);
};
#endif // TELEGRAM_H