GPRS Vehicle Tracker Protocol - 34
GPRS Vehicle Tracker Protocol - 34
GPRS Vehicle Tracker Protocol - 34
------------------------------------------------------------------------------------------------------------------------------------------
GPS&GMS/GPRS Vehicle tracker protocol
2 types:
1. Message list
1.1Shake_hand Request
Tracker send to server, server will save the last IP and port of tracker, it will use the IP and Port while
server send command to tracker;
CMD_ShakeHandReq 0x0000
No. Field TYPE Length description
1 packetLen short 2 Length of packet
2 CMD short 2 0x0000
3 sUserID char 11 Device ID
Data sample:
0f 00 00 00 4e 52 30 39 47 30 32 34 38 32 00
Decode the data:
0f 00 nPackLen = 0x000f (15byte)
00 00 nFlag = 0x0000
4e 52 30 39 47 30 32 34 38 32 00 deviceID: (NR09G02482)
Tell the tracker that server has received the shake hand message
No. Field TYPE Length description
1 sMark char 6 Flag of message (\r\n*KW\0)
2 packetLen short 2 Message Length
3 CMD short 2 0x8000
------------------------------------------------------------------------------------------------------------------------------------------
GPS&GMS/GPRS Vehicle tracker protocol
Tracker will upload the position message pre interval second that user set ,the interval will be
change to 10times when engine is off , For example:if the interval is 30s, tracker will upload the
position data pre 30s while engine is on(ACC is ON) , it will upload the position data pre 300s when the
engine is off( ACC is off)
------------------------------------------------------------------------------------------------------------------------------------------
GPS&GMS/GPRS Vehicle tracker protocol
77 00 nDirection
24 03 58 40 -->Long = 3.37519
65 4B D0 40 -->lat = 6.50920
2E F5 F8 32 -->data and time=2012-11-28 15:20:46 (YYYY-MM-DD HH:MM:SS)
4E 52 30 39 47 30 34 37 39 38 00 deviceID:NR09G04798
00 nIO
00 nOil
Note:
nDateTime has compress to 4BYTE (32bit)
26~31bit Year
22~25bitmonth
17~21bitday
12~16bitHour
6~11bit Minite
0~5bit second
ndate = nDateTime>>12&0x1f;//hour
sDateTime[9] = ndate/10 +'0';
sDateTime[10] = ndate%10 +'0';
sDateTime[11] = ':';
ndate = nDateTime>>6&0x3f;//minute
sDateTime[12] = ndate/10 +'0';
sDateTime[13] = ndate%10 +'0';
sDateTime[14] = ':';
ndate = nDateTime&0x3f;//second
sDateTime[15] = ndate/10 +'0';
sDateTime[16] = ndate%10 +'0';
sDateTime[17] = 0;
------------------------------------------------------------------------------------------------------------------------------------------
GPS&GMS/GPRS Vehicle tracker protocol
If the alarm has been trigger, it will upload alarm message to server,
No. Field TYPE Length description
1 packetLen short 2 Message length
2 CMD short 2 0x0003
1 bEnable unsigned char 1 Status:
0bit is locating
1bit Main power
;2,3,4,5bit is NULL;
6bit ACC status ;
7bit poff
2 bAlarm unsigned char 1 Default 0x80
SOS alarm:0x81
overSpeed alarm:0x82
geo_fence alarm :0x83
Main Power cut alarm:0x89
Pin8 alarm: 0x8f
3 nSpeed char 1 Speed
4 nDirection short 2 Direction angle
5 fLongitude double 4 Longitude
6 fLatitude double 4 Latitude
7 nDateTime long 4 Date
8 sUserID char 11 Device ID
9 nIOState char 1 I/Ostatus
10 nOilState char 1 Value of fuel
Server can sent command to tracker to get the realtime position , and server can send other command to
set the other parameter by this command, you only modify the string of sData
No. Field TYPE Length description
1 sMark char 6 Flag of message (\r\n*KW\0)
2 packetLen short 2 Message Length
3 CMD short 2 0x0002
4 nGisIp int 4 GIS User client IP
5 nPort short 2 GIS User client port
------------------------------------------------------------------------------------------------------------------------------------------
GPS&GMS/GPRS Vehicle tracker protocol
CMD_CommandResp 0x8009
No. Field TYPE Length description
1 packetLen short 2 Message Length
2 CMD short 2 0x8009
3 nGisIp int 4 GIS User IP
4 nPort Unsigned int 2 GIS User ID
5 bEnable unsigned char 1 Status 0 is locating ;
1bit main power;
2,3,4,5bit NULL;
6bit ACC status;
7pOff
6 bAlarm unsigned char 1 0x80;
7 nSpeed char 1 Speed
8 nDirection short 2 Direction angle
9 fLongitude float 4 Longitude
10 fLatitude float 4 Latitude
11 nDateTime long 4 Date
12 sUserID char 11 Device ID
13 nIOState char 1 I/O status
14 nOilState char 1 Value of fuel
15 cErrorCode Char 1 >0 is OK,<0 is failed
It will take a photo (JPG file) while server send command to take a photo or turn on the
engine ,tracker will send a message to tell the server much the JPG file is,
No. Field TYPE Length Description
1 packetLen short 2 Message Length
2 CMD short 2 0x0200
3 sUserID char 11 Device ID
4 nDate long 4 date
5 nTime long 4 time
6 nFileLen unsigned short 2 Size of image (jpg file)
------------------------------------------------------------------------------------------------------------------------------------------
GPS&GMS/GPRS Vehicle tracker protocol
Tracker will upload the JPG file by small packet(506), because the packet is too large to limited by
internet.
No. Field TYPE Length description
1 packetLen short 2 Message Length
2 CMD short 2 0x0200
3 sUserID char 11 Device ID
4 nPage unsigned short 2 Index of jpg file block
5 nPageLen unsigned short 2 block length nPageLen<506, it
means the last block
6 sData char 506 Image data,
CMD_SendJpgResp 0x8201
No. Field TYPE Le description
ng
th
1 sMark char 6 Flag of message (\r\n*KW\0)
2 packetLen short 2 Message Length
3 CMD short 2 0x8201
4 nPage unsigned 2 Index of jpg file block
short
5 cErrorCode char 1 Status code
6 sEnd char 2 message end "\r\n"
------------------------------------------------------------------------------------------------------------------------------------------
GPS&GMS/GPRS Vehicle tracker protocol
NR024 can be add temperature sensor, so we add a new message for the version
No. Field TYPE Length description
1 packetLen short 2 Message length
2 CMD short 2 0x0032
1 bEnable unsigned char 1 Status:
0bit is locating
1bit Main power
;2,3,4,5bit is NULL;
6bit ACC status ;
7bit poff
2 bAlarm unsigned char 1 Default 0x80
SOS alarm:0x81
overSpeed alarm:0x82
geo_fence alarm :0x83
Main Power cut alarm:0x89
Pin8 alarm: 0x8f
3 nSpeed char 1 Speed
4 nDirection short 2 Direction angle
5 fLongitude float 4 Longitude
6 fLatitude float 4 Latitude
7 nDateTime long 4 Date
8 sUserID char 11 Device ID
9 nIOState char 1 I/Ostatus
10 nOilState char 1 Value of fuel
11 nTempNum ; short 2 tempareture
12 nDistance float 4 Total mileage from engine is on
24 03 58 40 -->Long = 3.37519
65 4B D0 40 -->lat = 6.50920
2E F5 F8 32 -->data and time=2012-11-28 15:20:46 (YYYY-MM-DD HH:MM:SS)
4E 52 30 39 47 30 35 31 30 30 00 -->device ID:NR09G05100
00 -->IO status
00 -->fuel data
19 00 -->temperature
A9 4A 47 49 -->millege
NR024 can be add temperature sensor, so we add a new message for the version
No. Field TYPE Length description
1 packetLen short 2 Message length
2 CMD short 2 0x0033
1 bEnable unsigned char 1 Status:
0bit is locating
1bit Main power
;2,3,4,5bit is NULL;
6bit ACC status ;
7bit poff
2 bAlarm unsigned char 1 Default 0x80
3 nSpeed char 1 Speed
4 nDirection short 2 Direction angle
5 fLongitude float 4 Longitude
6 fLatitude float 4 Latitude
7 nDateTime long 4 Date
8 sUserID char 11 Device ID
9 nIOState char 1 I/Ostatus
10 nOilState char 1 Value of fuel
11 RFID; Char 11 RFID card number
12 nDistance float 4 Total mileage from engine is on
Sample data:
31 00 33 00 83 80 00 C9 00 A5 36 9B 42EC A8 4E 41 5E 73 AA 34 4E 52 30 39 47 30 34 38 32 32 00 00
00 30 39 30 30 34 38 32 34 30 62 00 00 00 20 41
Decode :
31 00 nPackLen
33 00 nFlag
83 bEnable
80 nAlarm
------------------------------------------------------------------------------------------------------------------------------------------
GPS&GMS/GPRS Vehicle tracker protocol
00 nSpeed
C9 00 nDirection
A5 36 9B 42 //Log
EC A8 4E 41 //lat
5E 73 AA 34 //time
4E 52 30 39 47 30 34 38 32 32 00 //deviceID=NR09G04822
00
00
30 39 30 30 34 38 32 34 30 32 00 //ID card =0900482402
00 00 20 41 //ndistance
NR024 can be add temperature sensor, so we add a new message for the version
No. Field TYPE Length description
1 packetLen short 2 Message length
2 CMD short 2 0x0037
1 bEnable unsigned char 1 Status:
0bit is locating
1bit Main power
;2,3,4,5bit is NULL;
6bit ACC status ;
7bit poff
2 bAlarm unsigned char 1 Default 0x80
SOS alarm:0x81
overSpeed alarm:0x82
geo_fence alarm :0x83
Main Power cut alarm:0x89
Pin8 alarm: 0x8f
3 nSpeed char 1 Speed
4 nDirection short 2 Direction angle
5 fLongitude double 4 Longitude
6 fLatitude double 4 Latitude
7 nDateTime long 4 Date
8 sUserID char 11 Device ID
9 nIOState char 1 I/Ostatus
10 nOilState char 1 Value of fuel
11 nFuel2 short 2 Value of Fuel2(ultra fuel
sensor,unit :mm)
12 nFuel3 short 2 Value of Fuel3
13 nFuel4 short 2 Value of Fuel4
11 nTempNum ; short 2 tempareture
12 nDistance float 4 Total mileage from engine is on
------------------------------------------------------------------------------------------------------------------------------------------
GPS&GMS/GPRS Vehicle tracker protocol
2. Appendix A
sData[50] = *KW,DeviceID,000,082309#
Sample Date: *KW,NR09G00001,000,082309#
It is to get realtime position of NR09G00001
=01 100m
=02 200m
=03 300m
=04 400m
=05 500m
Example: Set Distance (1100)M:
*KW,NR09G00001,006,080765,11#
------------------------------------------------------------------------------------------------------------------------------------------