IQRF Gateway Daemon
UdpMessage.h
Go to the documentation of this file.
1 
17 #pragma once
18 
19 #include <string>
20 
21 typedef std::basic_string<unsigned char> ustring;
22 
23 const unsigned IQRF_UDP_BUFFER_SIZE = 1024;
24 
25 const unsigned char IQRF_UDP_GW_ADR = 0x20; // 3rd party or user device
26 const unsigned char IQRF_UDP_HEADER_SIZE = 9; //header length
27 const unsigned char IQRF_UDP_CRC_SIZE = 2; // CRC has 2 bytes
28 
29 //--- IQRF UDP commands (CMD) ---
30 const unsigned char IQRF_UDP_GET_GW_INFO = 0x01; // Returns GW identification
31 const unsigned char IQRF_UDP_GET_GW_STATUS = 0x02; // Returns GW status
32 const unsigned char IQRF_UDP_WRITE_IQRF = 0x03; // Writes data to the TR module's SPI
33 const unsigned char IQRF_UDP_IQRF_SPI_DATA = 0x04; // Data from TR module's SPI (async)
34 
35 //--- IQRF UDP subcommands (SUBCMD) ---
36 const unsigned char IQRF_UDP_ACK = 0x50; // Positive answer
37 const unsigned char IQRF_UDP_NAK = 0x60; // Negative answer
38 const unsigned char IQRF_UDP_BUS_BUSY = 0x61; // Communication channel (IQRF SPI or RS485) is busy
39 
40 //TODO
42  wr_OK = 0x50,
43  wr_Error_Len = 0x60, //(number of data = 0 or more than TR buffer COM length)
44  wr_Error_SPI = 0x61, //(SPI bus busy)
45  wr_Error_IQRF = 0x62 //(IQRF - CRCM Error)
46 };
47 
48 //--- IQRF UDP header ---
50 {
52  cmd,
60 };
61 
62 //--- IQRF UDP GW status ---
64 {
65  trStatus, //DB1 TR module status(see the IQRF SPI protocol)
66  unused2, //DB2 no used
67  supplyExt, //DB3 0x01 supplied from external source
68  timeSec, //DB4 GW time – seconds(see Time and date coding)
69  timeMin, //DB5 GW time – minutes
70  timeHour, //DB6 GW time – hours
71  timeWday, //DB7 GW date – day of the week
72  timeMday, //DB8 GW date – day
73  timeMon, //DB9 GW date – month
74  timeYear, //DB10 GW date – year
75  unused11, //DB11 no used
76  unused12, //DB12 no used
77 };
const unsigned IQRF_UDP_BUFFER_SIZE
Definition: UdpMessage.h:23
Definition: UdpMessage.h:75
const unsigned char IQRF_UDP_IQRF_SPI_DATA
Definition: UdpMessage.h:33
const unsigned char IQRF_UDP_BUS_BUSY
Definition: UdpMessage.h:38
UdpHeader
Definition: UdpMessage.h:49
Definition: UdpMessage.h:69
Definition: UdpMessage.h:52
const unsigned char IQRF_UDP_ACK
Definition: UdpMessage.h:36
Definition: UdpMessage.h:56
Definition: UdpMessage.h:53
std::basic_string< unsigned char > ustring
Definition: UdpMessage.h:21
Definition: UdpMessage.h:58
Definition: UdpMessage.h:51
Definition: UdpMessage.h:70
UdpGwStatus
Definition: UdpMessage.h:63
const unsigned char IQRF_UDP_GW_ADR
Definition: UdpMessage.h:25
const unsigned char IQRF_UDP_NAK
Definition: UdpMessage.h:37
Definition: UdpMessage.h:55
const unsigned char IQRF_UDP_WRITE_IQRF
Definition: UdpMessage.h:32
IqrfWriteResults
Definition: UdpMessage.h:41
Definition: UdpMessage.h:72
Definition: UdpMessage.h:57
Definition: UdpMessage.h:54
Definition: UdpMessage.h:65
Definition: UdpMessage.h:73
const unsigned char IQRF_UDP_GET_GW_INFO
Definition: UdpMessage.h:30
const unsigned char IQRF_UDP_CRC_SIZE
Definition: UdpMessage.h:27
Definition: UdpMessage.h:59
Definition: UdpMessage.h:43
Definition: UdpMessage.h:66
Definition: UdpMessage.h:76
Definition: UdpMessage.h:74
Definition: UdpMessage.h:71
Definition: UdpMessage.h:44
Definition: UdpMessage.h:67
Definition: UdpMessage.h:42
Definition: UdpMessage.h:45
const unsigned char IQRF_UDP_GET_GW_STATUS
Definition: UdpMessage.h:31
const unsigned char IQRF_UDP_HEADER_SIZE
Definition: UdpMessage.h:26
Definition: UdpMessage.h:68