This shows you the differences between two versions of the page.
— |
protocol [2011/12/09 19:03] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Protocol ====== | ||
+ | |||
+ | Information provided here may change in future. | ||
+ | |||
+ | Packet size is always 32 (content is filled with random stuff if needed) | ||
+ | |||
+ | ===== Header ===== | ||
+ | |||
+ | ^ Size ^ Content ^ | ||
+ | | 1 | Source node id | | ||
+ | | 1 | Destination node id (0xFF -> broadcast) | | ||
+ | | 1 | Router node id (used to forward a packet) | | ||
+ | | 1 | Packet type | | ||
+ | | 2 | Packet counter | | ||
+ | | 26 | Data (See data description) | | ||
+ | |||
+ | ===== Packet type ===== | ||
+ | |||
+ | ^ Value ^ Meaning ^ | ||
+ | | 0x01 | Hello | | ||
+ | | 0x02 | Ping | | ||
+ | | 0x03 | Pong | | ||
+ | | 0x04 | Get value | | ||
+ | | 0x05 | Set value | | ||
+ | | 0x06 | Values | | ||
+ | |||
+ | ===== Data content (Packet type: 0x01, Hello) ===== | ||
+ | |||
+ | ===== Data content (Packet type: 0x02, Ping) ===== | ||
+ | |||
+ | ===== Data content (Packet type: 0x03, Pong) ===== | ||
+ | |||
+ | ===== Data content (Packet type: 0x04, Get value) ===== | ||
+ | |||
+ | The following data structure may be repeated several times in data until you reach the packet size or both device id equal 0xFF.\\ | ||
+ | |||
+ | After sending this packet, you should receive one or more value packet (depending on the data size) | ||
+ | |||
+ | ^ Size ^ Content ^ | ||
+ | | 1 | Source device id (Warning: we talk about device here, not node) | | ||
+ | | 1 | Destination device id (Warning: we talk about device here, not node) | | ||
+ | |||
+ | |||
+ | ===== Data content (Packet type: 0x05, Set values) ===== | ||
+ | |||
+ | They are the same than VALUES packet except the packet type | ||
+ | |||
+ | ===== Data content (Packet type: 0x06, Values) ===== | ||
+ | |||
+ | The following data structure may be repeated several times in data.\\ | ||
+ | ** TODO: Add a marker to define data end ** | ||
+ | |||
+ | ^ Size ^ Content ^ | ||
+ | | 1 | Source device id (Warning: we talk about device here, not node) | | ||
+ | | 1 | Destination device id (Warning: we talk about device here, not node) | | ||
+ | | 1 | Type (I: int16, S: string) | | ||
+ | | *2 | I: value int16 (Little endian) | | ||
+ | | *or 1+n | S: size (uint8) + n octets of string value | | ||