Devices Communication Network Protocol
From endrobene wiki :: ITE
Contents |
Packet header
Header is the beginning of each command.
const UCHAR NET_SIGNATURE1 = 0xFF; const UCHAR NET_SIGNATURE2 = 0xFE; // header follows any response or request (see code section) typedef struct tagNET_PACKETHEADER { UCHAR signature1; UCHAR signature2; UCHAR length; UCHAR cmd; } NET_PACKETHEADER;
Packet data
After header there is binary data of size length defined in header. Its size is <= 255 bytes. Recommended size shall not exceed 64 bytes. Receiver shall always read (or skip) all given data from the incoming byte sequence. What data bytes actually mean depends on the cmd value.
Commands
The set of commands supported depends highly on the device class. Device class is the single byte number, indicating the type of the device, or the functionality of the device, in other words.
General commands
// this is a request code, MCU answers by setting highest bit to the answer cmd const UCHAR NET_ANS_COMMAND_MASK = 0b10000000; // All command codes must be less than 127 const UCHAR NET_CAMCMD_REQ_ECHO = 0x01; const UCHAR NET_CAMCMD_REQ_DEVICECLASS = 0x02; // this command requests device class const UCHAR NET_CAMCMD_REQ_DEVICENAME = 0x03; // this command requests version
Echo command
Echo command has 0 bytes length data request and 0 bytes length reply.