-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand_type.h
More file actions
49 lines (37 loc) · 1.21 KB
/
command_type.h
File metadata and controls
49 lines (37 loc) · 1.21 KB
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
#ifndef COMMAND_TYPE_H
#define COMMAND_TYPE_H
#include <vector>
#include <iostream>
#include <iomanip>
#define TELEGRAM_BEGIN (0xC5)
#define TELEGRAM_END (0x5C)
#define TELEGRAM_EOT (0x80)
#define KNX_READ (0x00)
#define KNX_RESPONSE (0x01)
#define KNX_WRITE (0x02)
#define KNX_MEMWRITE (0x0A)
#define KNX_CACHE_VALUE (0x11)
#define CMD_SUBSCRIBE (0x81)
#define CMD_UNSUBSCRIBE (0x82)
#define CMD_SUBSCRIBE_DMZ (0x83)
#define CMD_UNSUBSCRIBE_DMZ (0x84)
#define CMD_DUMP_CACHED (0x85)
#define CMD_REQUEST_VALUE (0x86)
#define CMD_SETDEBUG (0x88)
#define CMD_SEND_WRITE (0x87)
#define CMD_READ (0x88)
#define CMD_SEND_RESPONSE (0x8A)
inline void dump_telegram(const std::vector<unsigned char> &message)
{
std::cout << "[" << std::hex << std::setfill('0') << std::setw(2);
for(const auto &i: message)
{
std::cout << std::hex << std::setfill('0') << std::setw(2) << int(i) << ":";
}
std::cout << "\b]" << std::dec;
}
inline unsigned short telegram_to_gad(const std::vector<unsigned char> &message)
{
return static_cast<unsigned short>(message[4] << 8 | message[5]);
}
#endif // COMMAND_TYPE_H