NT20 Protocol Rev3.21
NT20 Protocol Rev3.21
www.x3tech.com.br
CONTENT
I. COMMUNICATION PROTOCOL 3
Introduction 3
5.2. Location Data Packet (combined information package of GPS and LBS) 10
2
Protocolo NT20
i. Communication Protocol
Introduction
This document defines instructions about interface protocol on application layer of vehicles GPS
tracker and location-based service platform. Related interface protocol only applies in the interaction
between the platform and the position terminal.
2. If the GPRS connection is established unsuccessfully, the terminal will not be able to
send the login message packet. The terminal will start schedule reboot in twenty
minutes if the GPRS connection is failed three times. Within twenty minutes, if the
terminal successfully connects to the server and receives the data packet from the
server as the server’s response to the login message packet sent by the terminal, the
schedule reboot will be off and the terminal will not be rebooted; otherwise, the
terminal will be rebooted automatically in twenty minutes.
3. After receiving the login message packet, the server will return a response data packet.
If the terminal doesn’t receive packet from the server within five seconds after
sending the login message packet or the status information package, the current
connection is regarded as an abnormal connection. The terminal will start a
3
Protocolo NT20
retransmission function for GPS tracking data, which will cause the terminal to
disconnect the current GPRS connection, rebuild a new GPRS connection and send
a login message packet again.
4. If the connection is regarded to be abnormal, and the data packet as a response from
the server is failed to be received three times after a connection is established and a
login message packet or status information package is sent, the terminal will start
schedule reboot and the scheduled time is ten minutes. Within ten minutes, if the
terminal successfully connects to the server and receives the data packet responded
by the server, the schedule reboot will be off and the terminal will not be rebooted;
otherwise, the terminal will be rebooted automatically in ten minutes.
5. In case of the normal connection, the terminal will send a combined information
package of GPS and LBS to the server after the GPS information is changed; and
the server may set a default protocol for transmission by using commands.
6. To ensure the effectiveness of the connection, the terminal will send status information
to the server at regular intervals, and the server will return response data packets to
confirm the connection.
7. For the terminal which doesn’t register an IMEI number, the server will reply the
terminal with a login request response and heartbeat packet response, rather than
directly disconnect the connection. (If the connection is directly disconnected or the
server doesn’t reply to the terminal, it will lead to a continuous reconnected by the
terminal and the GPRS traffic will be consumed heavily.
4
Protocolo NT20
greater than
establish GPRS reconnection time
20 min,
connection? fail ?
reboot
successful
send login data packet to server send login message packet less than 20min, reconnect reconnection time?
Yes
backend data server
connection is
alarm status
successful
interval of
alarm packet location data packet heartbeat packet
heartbeat packet
5
Protocolo NT20
-8-
6
Protocolo NT20
Information Serial Number (including “Packet Length” and “Information Serial Number”) , are
values of CRC-ITU.
CRC error occur when the received information is calculated, the receiver will ignore and
discard the data packet.
4.7. Stop Bit
Fixed value in HEX 0x0D 0x0A.
7
Protocolo NT20
Protocol
1 0x01
Login Message Number
Packet(18 Terminal ID 8 0x01 0x23 0x45 0x67 0x89 0x01 0x23 0x45
Byte) Information
8
Protocolo NT20
Byte) Number
Information
The response packet from the server to the terminal: the protocol number in the response packet
is identical to the protocol number in the data packet sent by the terminal.
5.1.2.1. Start Bit
For details see Data Packet Format section 4.1.
5.1.2.2. Packet Length
For details see Data Packet Format section 4.2.
5.1.2.3. Protocol Number
For details see Data Packet Format section 4.3.
5.1.2.4. Information Serial Number
For details see Data Packet Format section 4.5.
5.1.2.5. Error Check
For details see Data Packet Format section 4.6.
5.1.2.6. Stop Bit
For details see Data Packet Format section 4.7.
5.1.3. Examples
Examples of the login message packet sent by the terminal to the server and the response packet
sent by the server to the terminal are as follows: (in the examples the terminal ID is
123456789012345.
9
Protocolo NT20
5.2. Location Data Packet (combined information package of GPS and LBS)
GPS
1 0xCF
information
GPS
satellites
Information
Latitude 4 0x02 0x7A 0xC7 0xEB
Information
Longitude 4 0x0C 0x46 0x58 0x49
Content
Speed 1 0x00
Course,
2 0x14 0x8F
Status
10
Protocolo NT20
Then the value is: 0x0A 0x03 0x17 0x0F 0x32 0x17
5.2.1.7. Longitude
Four bytes are consumed, defining the longitude value of location data. The range of the value is
0-324000000, indicating a range of 0°-180°.
The conversion method herein is same to the method mentioned in Latitude (see
section 5.2.1.6).
5.2.1.8. Speed
One byte is consumed, defining the running Speed of GPS. The value ranges from 0x00 to 0xFF
indicating a range from 0 to 225km/h.
e.g. 0x00 represents 0 km/h.
0x10 represents 16km/h.
0xFF represents 255 km/h.
- 13 -
11
Protocolo NT20
Note: The status information in the data packet is the status corresponding to the time bit recorded in
the data packet.
For example: the value is 0x15 0x4C, the corresponding binary is 00010101 01001100,
BYTE_1 Bit7 0
BYTE_1 Bit6 0
BYTE_1 Bit5 0 (real time GPS)
BYTE_1 Bit4 1 (GPS has been positioned)
BYTE_1 Bit3 0 (East Longitude)
BYTE_1 Bit2 1 (North Latitude)
BYTE_1 Bit1 0
BYTE_1 Bit0 1
BYTE_2 Bit7 0
BYTE_2 Bit6 1
BYTE_2 Bit5 0 Course 332° (0101001100 in Binary, or 332 in decimal)
BYTE_2 Bit4 0
BYTE_2 Bit3 1
BYTE_2 Bit2 1
BYTE_2 Bit1 0
BYTE_2 Bit0 0
which means GPS tracking is on, real time GPS, location at north latitude, east longitude and the course is 332°.
12
Protocolo NT20
5.2.1.10. MCC
The country code to which a mobile user belongs, i.e., Mobile Country Code(MCC).
Example: Chinese MCC is 460 in decimal, or 0x01 0xCC in Hex (that is, a decimal value of 460
converting into a hexadecimal value, and 0 is added at the left side because the converted hexadecimal
value is less than four digits).
Herein the range is 0x0000 ~ 0x03E7.
5.2.1.11. MNC
Mobile Network Code(MNC)
Example: Chinese MNC is 0x00.
5.2.1.12. LAC
Location Area Code (LAC) included in LAI consists of two bytes and is encoded in hexadecimal.
The available range is 0x0001-0xFFFE, and the code group 0x0000 and 0xFFFF cannot be used. (see
GSM specification 03.03, 04.08 and 11.11).
5.2.1.13. Cell ID
Cell Tower ID (Cell ID), which value ranges from 0x000000 to 0xFFFFFF.
5.2.1.14. Information Serial Number
For details see Data Packet Format section 4.5.
5.2.1.15. Error Check
For details see Data Packet Format section 4.6.
5.2.1.16. Stop Bit
For details see Data Packet Format section 4.7.
0x0C 0x46 0x58 0x49 0x00 0x14 0x8F 0x01 0xCC 0x00 0x28 0x7D 0x00 0x1F 0xB8 0x00 0x03
Course
Longitude Speed MCC MNC LAC Cell ID Serial No.
Status
13
Protocolo NT20
Start Bit 2
Packet Length 1
Protocol Number 1
Date Time 6
Latitude 4
GPS
Longitude 4
Information
Speed 1
Course, Status 2
LBS Length 1
Information
MCC 2
Content LBS
MNC 1
Information
LAC 2
Cell ID 3
Alarm/Language 2
Serial Number 2
Error Check 2
Stop Bit 2
Alarm packet is consisted by adding status information to location packet, so does the encoding
format of the protocol.
5.3.1.1. Start Bit
For details see Data Packet Format section 4.1.
5.3.1.2. Packet Length
For details see Data Packet Format section 4.2.
5.3.1.3. Protocol Number
For details see Data Packet Format section 4.3.
5.3.1.4. Date Time
For details see Location Data Packet Format section 5.2.1.4.
5.3.1.5. Length of GPS information, quantity of positioning satellites
For details see Location Data Packet Format section 5.2.1.5.
5.3.1.6. Latitude
For details see Location Data Packet Format section 5.2.1.6.
5.3.1.7. Longitude
For details see Location Data Packet Format section 5.2.1.7.
5.3.1.8. Speed
For details see Location Data Packet Format section 5.2.1.8.
5.3.1.9. Status and Course
14
Protocolo NT20
15
Protocolo NT20
5.3.1.17. Alarm/Language
0x00 (former bit) 0x01 (latter bit)
former bit: terminal alarm status (suitable for alarm packet and electronic
fence project) latter bit: the current language used in the terminal
0x00: normal
0x01: SOS
0x02: Power Cut Alarm
former bit
0x03: Shock Alarm
0x04: Fence In Alarm
0x05: Fence Out Alarm
0x01: Chinese
latter bit
0x02: English
Examples:
No Alarm and Language is Chinese:
0x00 0x01 No Alarm and Language
is English: 0x00 0x02
To increase the reliability of alarm information, labeling the alarm information repeatedly; in most
cases, the alarm information keeps consistent with information of former terminal, while the
inconsistencies are as follows:
A. Low Battery Alarm occurred in the information of the terminal
B. Fence in and out Alarm in the Alarm/Language information
16
Protocolo NT20
5.3.2. Examples
0x78 0x78 0x25 0x16 0x0B 0x0B 0x0F 0x0E 0x24 x01D 0xCF 0x02 0x7A 0xC8 0x87
Quantity of GPS
Protocol
Start Bit Length Date Time information Latitude
No.
satellites
0x0C 0x46 0x57 0xE6 0x00 0x14 0x02 0x09 0x01 0xCC 0x00 0x28 0x7D 0x00 0x1F 0x72
Course LBS
Longitude Speed MCC MNC LAC Cell ID
Status Length
0x65 0x06 0x04 0x01 0x01 0x00 0x36 0x56 0xA4 0x0D 0x0A
Terminal
GSM Signal
Information Voltage Level Alarm/Language Serial No. Error Check Stop Bit
Strength
Content
Note: The status information in the data packet is the status corresponding to the time
bit recorded in the data packet.
17
Protocolo NT20
Start Bit 2
Packet Length 1
Protocol Number 1
Terminal Information
1
Content
Information Status
Voltage Level 1
Content Information
GSM Signal Strength 1
Alarm/Language 2
Serial Number 2
Error Check 2
Stop Bit 2
18
Protocolo NT20
normal without any alarm, charge on, ACC is low, and deactivated.
Examples:
No Alarm and Language is Chinese:
0x00 0x01 No Alarm and Language
is English: 0x00 0x02
5.4.1.8. Information Serial Number
For details see Data Packet Format section 4.5.
5.4.1.9. Error Check
For details see Data Packet Format section 4.6.
5.4.1.10. Stop Bit
For details see Data Packet Format section 4.7.
19
Protocolo NT20
5.4.3. Examples
20
Protocolo NT20
21
Protocolo NT20
- (0x01) Tracking is the packet generated by the TIMER parameter, with configurable
communication interval respecting the state of the ignition, or in movement (virtual ignition).
- (0x02) Static is the packet generated by the STATIC parameter, with configurable
communication interval with the ignition off and stopped.
- (0x03) ALARM is sent every time an input, ignition on/off, main power connected or
disconnected, or output is changed state, or alarm event (similar to that generated by
Command 0x16)
5.5.1.5. Terminal ID
For details see Data Packet Format section 5.1.1.4.
5.5.1.9. Latitude
For details see Location Data Packet Format section 5.2.1.6.
5.5.1.10. Longitude
For details see Location Data Packet Format section 5.2.1.7.
5.5.1.11. Speed
For details see Location Data Packet Format section Location type
22
Protocolo NT20
5.5.1.14. MNC
For details see Location Data Packet Format section 5.2.1.11.
5.5.1.15. MNC
For details see Location Data Packet Format section 5.2.1.11.
5.5.1.16. LAC
For details see Location Data Packet Format section 5.2.1.12.
5.5.1.17. Cell ID
For details see Location Data Packet Format section 5.2.1.13.
23
Protocolo NT20
Exemple:
Voltage 4,1Vdc 3,5Vdc
Response Hexadecimal 191 Hex 162 Hex
Decimal 41 Dec 354 Dec
5.5.1.22. Alarm/Language
For details see Location Data Packet Format section 5.3.1.17.
5.5.1.23. Milleage
Sum of kilometers (Milleage), with ignition ACC=ON. With movement but with ACC=OFF is not
added.
5.5.1.24. TotalHoursSum
Sum of time ACC=ON in hours, with ignition ACC=ON. When the vehicle is moving but with
ACC=OFF the time is not added.
24
Protocolo NT20
25
Protocolo NT20
26
Protocolo NT20
Explain: which means: N23d5.1708m, E114d23.6212m, Course: 120, Speed: 53.02km/h, Date Time: 08-09-12 14:52:36.
27
Protocolo NT20
Server send:
787816 80120000000C484659442C30303030303023000C EC28 0D0A
Terminal answer:
78786615000000000C484659443D53756363657373210000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000010025AC21
BEND,1,40#
If sucessful: BEND=Success!
Server send:
787814 80100000000F42454E442C312C343023000FA 2E60 D0A
Terminal answer:
78781A15180000000F42454E443D537563636573732101003B0031F6A2
6.7.2. WHERE
WHERE#
Lat:S23.463425,Lon:W46.878248,Course:0.00,Speed:0.00,DateTime:2019-07-16 01:10:26
Server send:
787810 800C0000000A574845524523000A3 26F0 D0A
Terminal answer:
78786615000000000A4C61743A5332332E3436333432352C4C6F6E3A5734362E3837383234382C436F
757273653A302E30302C53706565643A302E30302C4461746554696D653A323031392D30372D313620
30313A31303A32360000000000000000000001001D377078781A15180000000F42454E443D537563636
573732101003B0031F6A2
28
Protocolo NT20
29
Protocolo NT20
6.8.1.8. Speed
For details see Location Data Packet Format section 5.2.1.8.
6.8.1.9. Course
For details see Location Data Packet Format section 5.2.1.9.
6.8.1.10. Phone Number
The SOS phone number used for requesting address query, which is converted by ASCII and 0
is added at the right side if less than 21 bits.
6.8.1.11. Language
A bit indicates the current language used in the terminal.
Chinese: 0x00 0x01
English: 0x00 0x02
Protocol Number 1
Length of Command 1
## 2
Check Bit 2
Stop Bit 2
30
Protocolo NT20
Considering the address or other foreign address in English is generally longer than that in
Chinese, one data bit is not enough, so the data bit is occupied in 2 bytes. Note:
only the length of data bit corresponding to the protocol number of response address information is
changed into two bytes.
Start Bit 2
Protocol Number 1
Length of Command 2
Check Bit 2
Stop Bit 2
- 30 -
31
Protocolo NT20
32
Protocolo NT20
Code fragment of the CRC-ITU lookup table algorithm implemented based on C language is as
follow:
static const U16 crctab16[] =
{
0X0000, 0X1189, 0X2312, 0X329B, 0X4624, 0X57AD, 0X6536, 0X74BF,
0X8C48, 0X9DC1, 0XAF5A, 0XBED3, 0XCA6C, 0XDBE5, 0XE97E, 0XF8F7,
0X1081, 0X0108, 0X3393, 0X221A, 0X56A5, 0X472C, 0X75B7, 0X643E,
0X9CC9, 0X8D40, 0XBFDB, 0XAE52, 0XDAED, 0XCB64, 0XF9FF, 0XE876,
0X2102, 0X308B, 0X0210, 0X1399, 0X6726, 0X76AF, 0X4434, 0X55BD,
0XAD4A, 0XBCC3, 0X8E58, 0X9FD1, 0XEB6E, 0XFAE7, 0XC87C, 0XD9F5,
0X3183, 0X200A, 0X1291, 0X0318, 0X77A7, 0X662E, 0X54B5, 0X453C,
0XBDCB, 0XAC42, 0X9ED9, 0X8F50, 0XFBEF, 0XEA66, 0XD8FD, 0XC974,
0X4204, 0X538D, 0X6116, 0X709F, 0X0420, 0X15A9, 0X2732, 0X36BB,
0XCE4C, 0XDFC5, 0XED5E, 0XFCD7, 0X8868, 0X99E1, 0XAB7A, 0XBAF3,
0X5285, 0X430C, 0X7197, 0X601E, 0X14A1, 0X0528, 0X37B3, 0X263A,
0XDECD, 0XCF44, 0XFDDF, 0XEC56, 0X98E9, 0X8960, 0XBBFB, 0XAA72,
0X6306, 0X728F, 0X4014, 0X519D, 0X2522, 0X34AB, 0X0630, 0X17B9,
0XEF4E, 0XFEC7, 0XCC5C, 0XDDD5, 0XA96A, 0XB8E3, 0X8A78, 0X9BF1,
0X7387, 0X620E, 0X5095, 0X411C, 0X35A3, 0X242A, 0X16B1, 0X0738,
0XFFCF, 0XEE46, 0XDCDD, 0XCD54, 0XB9EB, 0XA862, 0X9AF9, 0X8B70,
0X8408, 0X9581, 0XA71A, 0XB693, 0XC22C, 0XD3A5, 0XE13E, 0XF0B7,
0X0840, 0X19C9, 0X2B52, 0X3ADB, 0X4E64, 0X5FED, 0X6D76, 0X7CFF,
0X9489, 0X8500, 0XB79B, 0XA612, 0XD2AD, 0XC324, 0XF1BF, 0XE036,
0X18C1, 0X0948, 0X3BD3, 0X2A5A, 0X5EE5, 0X4F6C, 0X7DF7, 0X6C7E,
0XA50A, 0XB483, 0X8618, 0X9791, 0XE32E, 0XF2A7, 0XC03C, 0XD1B5,
0X2942, 0X38CB, 0X0A50, 0X1BD9, 0X6F66, 0X7EEF, 0X4C74, 0X5DFD,
0XB58B, 0XA402, 0X9699, 0X8710, 0XF3AF, 0XE226, 0XD0BD, 0XC134,
0X39C3, 0X284A, 0X1AD1, 0X0B58, 0X7FE7, 0X6E6E, 0X5CF5, 0X4D7C,
0XC60C, 0XD785, 0XE51E, 0XF497, 0X8028, 0X91A1, 0XA33A, 0XB2B3,
0X4A44, 0X5BCD, 0X6956, 0X78DF, 0X0C60, 0X1DE9, 0X2F72, 0X3EFB,
0XD68D, 0XC704, 0XF59F, 0XE416, 0X90A9, 0X8120, 0XB3BB, 0XA232,
0X5AC5, 0X4B4C, 0X79D7, 0X685E, 0X1CE1, 0X0D68, 0X3FF3, 0X2E7A,
0XE70E, 0XF687, 0XC41C, 0XD595, 0XA12A, 0XB0A3, 0X8238, 0X93B1,
0X6B46, 0X7ACF, 0X4854, 0X59DD, 0X2D62, 0X3CEB, 0X0E70, 0X1FF9,
0XF78F, 0XE606, 0XD49D, 0XC514, 0XB1AB, 0XA022, 0X92B9, 0X8330,
0X7BC7, 0X6A4E, 0X58D5, 0X495C, 0X3DE3, 0X2C6A, 0X1EF1, 0X0F78,
};
33
Protocolo NT20
Status packet:
transmission: 78 78 0A 13 44 01 04 00 01 00 05 08 45 0D 0A
reception: 78 78 05 13 00 05 AF D5 0D 0A
The content sent by the server is: Locating: Wenhua Rd. 1, Huizhou, Guangdong, about 32 meters from
Huizhou Anzhong Accounting Firm, about 32 meters from Huizhou Foreign Investment Service
Center.
Mobile Phone Number is 66366.
English:
transmission: 78 78 2E 1A 0B 0B 0F 0E 1E 08 CF 02 7A C8 A2 0C 46 57 D7 00 14 02 36 36 33 36 36 00
03 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 32 04 3A 0D 0A
reception: 78 78 00 E9 97 00 E2 00 00 00 01 41 44 44 52 45 53 53 26 26 00 50 00 72 00 65 00 63 00 69
00 73 00 65 00 6C 00 79 00 20 00 4C 00 6F 00 63 00 61 00 74 00 69 00 6E 00 67 00 3A 00 31 00 30 53
F7 00 20 00 59 00 75 00 6E 00 73 00 68 00 61 00 6E 00 20 00 57 00 65 00 73 00 74 00 20 00 52 00 64 00
2C 00 48 00 75 00 69 00 63 00 68 00 65 00 6E 00 67 00 2C 00 48 00 75 00 69 00 7A 00 68 00 6F 00 75
00 2C 00 47 00 75 00 61 00 6E 00 67 00 64 00 6F 00 6E 00 67 00 2C 00 35 00 31 00 36 00 30 00 30 00
33 00 28 00 4E 00 32 00 33 00 2E 00 31 00 31 00 31 00 37 00 37 00 2C 00 45 00 31 00 31 00 34 00 2E 00
34 00 30 00 39 00 32 00 32 00 29 26 26 36 36 33 36 36 00 03 00 04 00 00 00 00 00 00 00 00 00 00 00 00
23 23 00 01 AF 4D 0D 0A
The content sent by the server is: Precisely Locating:10 号 Yunshan West
Rd,Huicheng,Huizhou,Guangdong,516003(N23.11177,E114.40922)
Mobile Phone Number is 66366.
Process of Alarm packet:
Short message in Chinese:
transmission: 78 78 25 16 0B 0B 0F 0E 24 1D CF 02 7A C8 87 0C 46 57 E6 00 14 02 09 01 CC 00 28 7D
00 1F 72 65 06 04 01 01 00 36 56 A4 0D 0A
reception: 78 78 05 16 00 36 95 70 0D 0A
reception: 78 78 BE 17 B8 00 00 00 01 41 4C 41 52 4D 53 4D 53 26 26 7D 27 60 25 54 7C 53 EB 00 3A
5E 7F 4E 1C 77 01 60 E0 5D DE 5E 02 4E 91 5C 71 89 7F 8D EF 00 2E 65 87 53 4E 4E 00 8D EF 00 2E
79 BB 4E 2D 88 4C 00 41 00 54 00 4D 7E A6 00 33 00 31 7C 73 00 2E 79 BB 4E 2D 88 4C 6C 5F 53 17
65 2F 88 4C 7E A6 00 33 00 31 7C 73 00 2E 00 2C 00 31 00 31 00 2D 00 31 00 31 00 2D 00 31 00 35 00
20 00 31 00 34 00 3A 00 33 00 36 00 3A 00 32 00 39 26 26 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 23 23 00 01 B6 D8
0D 0A
Content of Short message is: Emergency Call: Wenhua Rd. 1, Huizhou, Guangdong, about 31 meters
away from ATM machine of Bank of China, about 31 meters away from Jiangbei branch of of Bank
35
Protocolo NT20
36
Protocolo NT20
- 36 -
37
Protocolo NT20
t Bit
B (language)
i
t
2 1 1 1 1 1 2 2 2 2
38