mqtt转发协议
模仿MODBUS协议而写的mqtt转发协议,普通单片机发给带wifi的单片机,从而转发到网络上的服务器
devices ID | functions CODE | DATA | CRC16 |
---|---|---|---|
8bit | 8bit | n*8bit | 16bit |
one Packet
1. devices ID
devices ID | 0x01 | 0x01 | 0x02 | 0x03 | ... | 0xff |
---|---|---|---|---|---|---|
Description | wifi_forward | master | slave | slave | slave | broadcast |
2.functions CODE
there are two ranges of user-defined function codes, i.e. 65 to 72 and from 100 to 110 decimal.
functions CODE | 0x00 | 0x41 | 0x42 | 0X43 | |
---|---|---|---|---|---|
Description | reserve | MQTT | MAC | TIME |
3. DATA
SUB/PUB/SUB_UPDATA | byte count of topic | TOPIC | byte count of message | MESSAGE |
---|---|---|---|---|
8bit | 8bit | n*8bit | 8bit | n*8bit |
0X00/0XFF/0X88 | ... | ... | ... | ... |
4. CRC16
checksum of all packet
网友评论