1.Data Type

Data type Description
BYTE Unsigned single-byte integer type(8 bits)
WORD Unsigned double-byte integer type(16 bits)
DWORD Unsigned four bytes integer type(32 bits)
BYTE[n] n bytes
BCD[n] 8421 code, n bytes
STRING GBK code, leave blank if no data

2.Transmission Rule

This protocol uses big-endian mode to transfer WORD and DWORD. Agreed as follow:
——BYTE transfer agreement: transfer as the byte streams.
——WORD transfer agreement: transmit high 8 bits, and then transmit low 8 bits.
——DWORD transfer agreement: transmit the highest 8 bits(b31,b24),then higher 8 bits(b23,b16), then the lower 8 bits(b15,b8), then the lowest 8 bits(b7,b0).

3.Protocol Message Format

3.1.Message Structure

The message is consisted of flag, message header, and message body and checksum code. The structure is shown as the below figure:

3.2.Flag

The start/end flag is 0x7E, if there 0x7E exists in the checksum, message header or message body, it must be transferred meaning, the transferred meaning rules is shown as the below:
0x7E<————>0x7D followed with 0x02
0x7D<————>0x7D followed with 0x01
Transferred meaning process is described as following:
Send message: pack message ——>calculate and fill the checksum ——>transferred meaning.
Receive message: transferred meaning——>verify checksum code——>parse message
Example:
Send packet as 0x30 0x7E 0x08 0x7D 0x55,
After packing, the packet should be:
0x7E 0x30 0x7D 0x02 0x08 0x7D 0x01 0x55 0x7E

3.3.Message Header

3.3.1.Message Body Properties


Bit15: Reserved.
Bit14: This bit is reserved as 0 by default;
Bit13: Reserved, do not use, default is 0.
Bit12-10: Data encryption mode:
– When all three bits are 0, it means the message body is not encrypted.
– When the tenth bit are 1, it means the message body is encrypted by the RSA algorithm.
Bit9-0: Length of message body.

3.4.Checksum

Checksum is calculated via XOR from the start of message header to the last byte before checksum. The Checksum occupies 1 byte.

4.Protocol Interaction Process

  1. The tracker device shall register to platform server firstly and then device will get the authentication code from server. The authentication code will be used when tracker device login to the server.
  2. The registered device only needs to log in with the saved authentication code.
  3. The tracker device would report the message (including status and alarm information refer to message 0x0200 for details ) to platform server after login and authentication are completed.
  4. The platform server can actively configure and query tracker device parameters as well.

4.1.Message Interaction Response


作者:admin  创建时间:2023-05-06 21:17
最后编辑:admin  更新时间:2023-05-06 22:17