Tracker Protocol V1.3
Tracker Protocol V1.3
1
Revision history
1.4 2021-08-16 Andrea Add configure value of remaining battary report function
Add record value type of remaining battary report
1.5 2021-08-17 Andrea Modification record value type of remaining battary
report
1.6 2021.-09-01 Andrea Add record value for Engine idling alarm
2
Table of contents
Revision history 2
Table of contents 3
3
Protocol for uplink
All data transfer from the device to an upstream server should use an efficient binary
protocol. This also includes commands sent from the server to the device for configuration.
Message type
The first byte defines the message type:
Message Message
type description(directio
n)
0x01 Login request(device->platform)
Packet identifier
The second byte of a packet is the packet identifier. This field acts as a correlation
identifier between the requests and responses. Each reply message should contain a
packet identifier matching the unique identifier of the request message. The packet
identifier is only 1 byte so there is a wrap around after reaching 255. In normal state, we
should add 1 to the identifier each time we send a packet.
Payload length
4
This field indicates the variable length of the payload in bytes.This field contains two
bytes, so the maximum packet length supported theoretically is 65535, but the actual
length is related to CPU ram resources.
Payload
The payload depends on the packet type. Please check the documentation of each
specific packet type to get the correct encoding.
CRC
The CRC field contains an error-detecting code, used to verify the packet's validity. For
calculation we are using CRC-16/IBM. The CRC is calculated over the full packet, which
includes the following fields:
● Message type
● Packet identifier
● Payload length
● Payload data
Example code and lookup table for CRC16-CCITT can be found below:
5
0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827,
0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c,
0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0,
0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d,
0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07,
0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba,
0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74,
0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
};
size_t count;
unsigned int crc = 0xffff;
unsigned int temp;
6
Login request
The packet is used for the device authorization on the server. Every TCP connection starts
with sending this packet from the device to the server. Other data should be transferred
only after the server confirms the successful authorization of the device. The login payload
looks as follows:
Protocol major 1 byte The major protocol version, as an unsigned byte (0 - 255)
version
Protocol minor 1 byte The minor protocol version, as an unsigned byte (0 - 255)
version
IMEI length 1 byte The length of the IMEI field, in bytes as an unsigned byte (0-255)
Model length 1 byte The length of the next make / model field, in bytes as an
unsigned byte (0-255)
Firmware version 1 byte The length of the next firmware version field, in bytes as an
length unsigned byte (0-255)
Firmware version variable The firmware version of the tracker (eg. V3.12.0.18.2004171625-b0)
Password length 1 byte The length of the password field, in bytes as an unsigned byte
(0-255). Can be ‘0’ if no password is configured.
Login reply
After sending the login request, the device waits for the login reply from the server. The
login replay payload looks like this:
Success = 0
Failure codes:
● 1 = Unsupported protocol
● 2 = Authentication required
● 3 = Invalid password
● 4 = Unknown device
● 5 = Server busy
7
Heartbeat request
Heartbeats are used to test GPRS connection status and maintain GPRS connectivity. If a
GPRS connection is established successfully, the terminal will send heartbeat information
to the platform when no data is received for a configurable time using the following
parameters:
After receiving the heartbeat information, the platform should send a heartbeat reply. If
no heartbeat reply is received after ‘heartbeat_timeout’ milliseconds, the tracker closes
the connection and only reconnects again when data has to be sent. When the platform
closes the connection, the tracker also only reconnects when data has to be sent.
Heartbeat response
After receiving the heartbeat information, the platform should send a heartbeat reply. If
no response is sent within this period, the tracker will close the connection. As with any
other response, a heartbeat response is only valid if the packet identifier matches with the
request.
8
Record report
Record count 1 byte The number of records in this report. The maximum number or
records in a single report is limited to 255 entries.
List of records Variable The list of appended records. A record is described in the table
size below.
Record format
Record field name Length Record field description
Record timestamp 4 bytes The exact timestamp when the data in this record was
captured, as an epoch time in seconds (UTC,from 1970
to 2099)
List of values Variable The list of appended values. A value is described in the table
size below.
Value format
Value type 1byte The type id of the value (see type id’s below). Encoded as a
variable type field.
Value Variable The captured value. Size and encoding depends on the value
size type.
Where:
d – Degrees
m – Minutes
s – Seconds
ms – Milliseconds
p – Precision (10000000)
Coordinates in the western hemisphere multiply the longitude by -1, coordinates on the
southern hemisphere multiply the latitude by -1. Multiplying the coordinates by minus
one is done following the two’s complement.
Example:
A 4-byte integer latitude value of 1E 61 47 2B. First bit is ‘0’ which means a positive
9
coordinate. Converting this integer to decimal gives: 509691691. Applying the precision
again to get a decimal coordinate gives you 50.9691691° and in north hemisphere.
A 4-byte integer longitude value of E8 73 42 65. First bit is ‘1’ which means a negative
coordinate. Converting this integer to decimal gives: 1752384101. Applying the precision
again to get a decimal coordinate gives you 175.2384101° and in western hemisphere.
Speed: 2 byte
calculated from satellites, in 1/10th of a
km/h, encoded as a 2-byte unsigned integer.
Directon: 2 byte
Degrees from the North pole, as an angle
ranging from 0 up to 36000, in 1/100th of a
degree, as a 2 byte unsigned value.
10
acceleration 2-byte value.
11
Car ACC status 0x21 1 byte Ignition input state:
0x00 = Not active
0x01 = Active
Car Short drive 0x23 2 bytes Car Short mileage value in 1/10th of a km,
mileage calculated from GPS location
Car Short drive 0x24 2 bytes Short drive time value in minutes,
time calculated from car ACC status
12
byte value.
13
Elapsed Engine Hours: 1 byte
value in hour, encoded as a 1-byte unsigned
integer
Latitude: 4 byte
This coordinate is encoded as a 4 byte
signed integer value.
See coordinate type definition Coordinates
encoding (lat / lon)
Longitude: 4 byte
This coordinate is encoded as a 4 byte
signed integer value.
See coordinate type definition Coordinates
encoding (lat / lon)
Event: Driver’s
0x43 1 byte Time Zone Offset from UTC: 1 byte
Certification of Own
Records encoded as a 1-byte unsigned interger
14
Car total work time: 4 byte
value in hour, encoded as a 4-byte unsigned
integer
Event: ELD
0x46 9 byte Malfunction/Diagnostic Code: 1 byte
Malfunction and
Data encoded as a 1-byte character(ASCII code)
Diagnostics
Occurrence Car total mileage: 4 byte
value in miles, encoded as a 4-byte
unsigned integer
15
Configure value types
Device section
FTP address 0x78 Variable size Firmware update ftp server IP address or
host name as a zero (0x00) terminated
string
FTP URL 0x79 Variable size Firmware update ftp server URL/ path as a
zero (0x00) terminated string
FTP user name 0x7A Variable size Firmware update ftp server username as
a zero (0x00) terminated string
FTP password 0x7B Variable size Firmware update ftp server password as
a zero (0x00) terminated string
APN name 0x7D Variable size The name of Mobile APN as a zero (0x00)
terminated string
APN username 0x7E Variable size The username of Mobile APN as a zero
(0x00) terminated string
APN password 0x7F Variable size The password of Mobile APN as a zero
(0x00) terminated string
SOS number 1 0x80 Variable size SOS number 1 as a zero (0x00) terminated
string
SOS number 2 0x81 Variable size SOS number 2 as a zero (0x00) terminated
string
16
SOS number 3 0x82 Variable size SOS number 3 as a zero (0x00) terminated
string
SOS number 4 0x83 Variable size SOS number 4 as a zero (0x00) terminated
string
17
(0)/enabled (1):
1st bit: reportoninterval
2nd bit: reportoffinterval
3rd bit: reportangle
4th bit: reportdistance
Report interval 0x9A 2 bytes Time interval for GPS position report while
power on ignition is on, in seconds. Encoded as a 2
byte unsigned value.
Report interval 0x9B 2 bytes Time interval for GPS position report while
power off ignition is off, in seconds. Encoded as a 2
byte unsigned value.
Report distance 0x9C 2 bytes Distance for GPS position report, in meters.
Encoded as a 2 byte unsigned value.
GPS location state 0xA0 1 byte GPS location state change report switch
report 0x00 = disabled
0x01 = enabled
18
Geo-fence rectangle 0xA3 13 bytes Geo-fence ID number: 1 byte
set
Value from 0-255
Latitude top-left of rectangle: 4 byte
This coordinate is encoded as a 4 byte
signed integer value.
See coordinate type definition Coordinates
encoding (lat / lon)
Longitude top-left of rectangle: 4 byte
This coordinate is encoded as a 4 byte
signed integer value.
See coordinate type definition Coordinates
encoding (lat / lon)
Latitude right-bottom of rectangle: 4 byte
This coordinate is encoded as a 4 byte
signed integer value.
See coordinate type definition Coordinates
encoding (lat / lon)
Longitude right-bottom of rectangle: 4 byte
This coordinate is encoded as a 4 byte
signed integer value.
See coordinate type definition Coordinates
encoding (lat / lon)
19
Power safe mode switch
Power safe mode 0xAC 1 byte
0x00 = disabled
0x01 = enabled
20
BT scan timeout as a 1 byte unsigned
BLE scan timeout 0xCA 1 byte
value. Value can range from 5-60 seconds.
Note: for variable size configure item, the max size should not large than 50 bytes
Record acknowledgement
Every record report needs to be acknowledged to make sure that the platform has
successfully received and stored the records. The platform can confirm this by sending a
Record acknowledgement packet. A tracker can only mark records as delivered or ‘acked’
once this message is received, with the correct packet identifier.
21
Read request
A read request allows the platform to read out configuration parameters and values ad-
hoc.
Field name Length Field description
List of requested Variable A list of requested type ids where each type id is encoded as a
value type size variable type id. These types can both be record value types as
config value types
Read response
After a read request, the tracker responds with a read response containing the values.
Number of 1 byte The number of response value types, which should match with
response value the number of requested value types
types
List of response Variable A list of response values, which contain the value type id, result
values size code and value (see below)
Response value
A response value contains a readout result for a single value. It can indicate a success
(with data) or a failure.
Value type id 1 byte The type id, encoded as a variable type id in 1 byte.
Result code 1 byte A value of ‘0’ means success, any other value is an error code.
Value Variable This field is available in case of a success result code and is
size encoded according to the value type.
22
Write request
A read request allows the platform to write configuration parameters.
List of new write Variable A list of new parameter values to write. Each item to write is
parameter values size encoded as defined in the table below
Write parameter id 1 byte The type id, encoded as a variable type id in 1 byte.
Write parameter Variable The new parameter value, encoded according to the value type.
value size
Write response
The device reports the results of a write request back to the platform using a write
response.
List of write results Variable A list of write results, containing the written parameter id and a
size result code (success / error). See below
Value type id 1 byte The type id, encoded as a variable type id in 1 byte.
Result code 1 byte A value of ‘0’ means success, any other value is an error code.
23
Action request
An action request is used to execute a certain procedure on the device.
Action type 1 byte The action that should be executed on the device. A list of
different action types can be found below.
Action payload Variable The optional payload or parameters required for the given
length command. This value depends on the action type
Action types
Reset 1 0 bytes Resets the unit (reboot). This action has no payload.
Factory 2 0 bytes Reverts the units settings back to factory defaults and
does a reboot. This action has no payload.
Action response
Each action has a result, which is reported from the device back to the platform using an
action response.
Action type 1 byte The action type that was triggered on the device.
Result code 1 byte The result of the action, where ‘0’ means success and any other
value is an error code.
Action response Variable The optional response of the action, depending on the action
size type.
24