Standard
1、The server issues MQTT instructions, usually in JSON format.
2、The cabinet replies with execution results, usually in Hex format.
3、4. The server for device authentication, initial configuration, online upgrade, whole machine reporting, and screen advertising update needs to provide HTTP API interface
Command Send ▼
Subscribe to topic:/powerbank/{uuid}/user/get
Data format: JSON string
Name | Identification code | Data type | Remarks |
---|---|---|---|
command name | cmd | string | command name |
command data | data | string | command data |
Main control board serial port | io | string | Default: 0; Range: 0-1 |
Example, send an instruction to pop up position No. 2
{ "cmd":"popup", "data":"2", "io":"0" }
command Reply △
Publish to topic:/powerbank/{uuid}/user/update
Data format: bytecode data, Hex, hexadecimal analysis
Bytecode | Name | Identification code | Remarks |
---|---|---|---|
Byte[0] | Head code | head | Default: 0xA8 |
Byte[1~2] | Packet length | length | For example: 0x00 0x14, converted to decimal, the packet length is 20 |
Byte[3] | Command name | cmd | For example: 0x21, means the device replies: Position pop-up result |
Byte[4~n] | Custom data | data | Report different data according to different instructions |
Byte[n+1] | Check code | verify | Packet complement check |
Example: Reply to the pop-up No. 2 warehouse result
A8 00 14 21 10 01 01 02 00 00 00 00 00 00 00 00 00 00 00 00
json
A8 ------------------------------------------------------ Byte[0] Head code
00 14 --------------------------------------------------- Byte[1~2] Packet length:20
21 ------------------------------------------------------ Byte[3] Command name
10 01 01 02 00 00 00 00 00 00 00 00 00 00 00 ------------ Byte[4~n] Custom data
00 ------------------------------------------------------ Byte[n+1] Check code