GPRS Communication Protocol
Between GPS Tracker and Server
I Command Format
Command format of GPRS packet is as follows: From server to tracking unit:
@@<L><ID (7 bytes)><command (2 bytes)><data><checksum (2 bytes)>\r\n
From tracking unit to server:
$$<L><ID (7 bytes)><command (2 bytes)><data><checksum (2 bytes)>\r\n
Note:
Do not input ‘<’ and ‘>’ when writing a command.
All multi-byte data complies with the following sequence: High byte prior to low byte
Item |
Specification |
@@ |
2 bytes. It means the header of packet from server to tracking unit. It is in ASCII
code (Hex code: 0x40) |
$$ |
2 bytes. It is the header of packet from tracking unit to server, It is in ASCII code
(Hex code: 0x24) |
L |
2 bytes. It means the length of the whole packet including the header and ending character and it is in hex code |
ID |
7 bytes, the unused byte will be stuffed by ‘f’ or ‘0xff’. It is in the format of hex code. For example, if ID is 13612345678, then it will be shown as follows: 0x13, 0x61, 0x23, 0x45, 0x67, 0x8f, 0xff. |
Command |
2 bytes. The command code is in hex code. Please refer to the command list below. |
Data |
Min 0 byte, max 100 bytes. |
Checksum |
2 bytes. It indicates CRC-CCITT(default is 0xffff) checksum of all data (not
including CRC itself and the ending character). It is in hex code. For example: 24 24 00 11 13 61 23 45 67 8f ff 50 00 05 d8 0d 0a
0x05d8 = CRC-CCITT (24 24 00 11 13 61 23 45 67 8f ff 50 00) |
\r\n |
2 bytes. It is the ending character and in hex code (0x0d,0x0a in hex code) |
II Command List
Command |
Definition |
0x0001 |
Heart Beat |
0x0002 |
Get IP and port |
0x4101 |
Request one single location report |
0x4102 |
Set time interval for continuous tracking |
0x4103 |
Set authorized phone number |
0x4130 |
Set telephone number for wiretapping |
0x9003 |
Read authorized phone number |
0x9955 |
Single location report |
0x9956 |
Black box report |
0x9957 |
Send SMS |
0x9958 |
Get plain address |
III Command Details
1. Heart Beat
Command code: 0x0001
Command from tracking unit to server:
$$<L><ID><0x0001><checksum>\r\n
Message from server to tracking unit:
@@<L><ID><0x0001 ><Flag><checksum> \r\n
If Flag
=0x00, it means operation failed;
=0x01, it means operation succeeded.
2. Get IP and port
Command code: 0x0002
Command from tracking unit to server:
$$<L><ID><0x0002><checksum>\r\n
Message from server to tracking unit:
@@<L><ID><0x0002 ><IP:port><checksum> \r\n
IP: The IP address of server
Port: The port of server
For example:
@@<L><ID><0x0002 ><118.128.198.38: 8090><checksum> \r\n
3. Request One Single Location Report
Command code: 0x4101
Command from server to tracking unit:
@@<L><ID><0x4101><checksum>\r\n
Upon receipt of the above command, the tracking unit will send the following message with its current
location to the server:
$$<L><ID><0x9955><data><checksum>\r\n
Please refer to annex 1 for detailed description of ‘data’.
4. Set TIME Interval for Continuous Tracking
Command code: 0x4102
Command from server to tracking unit:
@@<L><ID><0x4102><timer interval in hex code (2 bytes)><checksum>\r\n
Note:
2 bytes of timer interval is in format of 1 seconds and if
=0, it means stop tracking
Max time interval = 65535*10 seconds
Message from tracking unit to server:
$$<L><ID><0x5100><Flag (1byte)> <timer interval (2 bytes)><checksum>\r\n
Note: If Flag
=0, it means setting failed,
=1, it means setting succeeded
When time interval is set successfully, the tracking unit will send the following message with its current
location to the server at the interval specified:
$$<L><ID><0x9955><data><checksum>\r\n
Please refer to annex 1 for detailed description of ‘data’.
5. Set Authorized Phone Number
Command code: 0x4103
Command from server to tracking unit:
@@<L><ID><0x4103><button number><authorized phone number for receiving
SMS><authorized phone number for receiving call><checksum>\r\n
Remarks:
Button number – 1 byte and in hex code. It can support up to 4 buttons. Currently only have three speed dial buttons (SOS, button 1, button2 and button3). Therefore for these trackers, if button number,
= 0x01, to set authorized phone number for SOS button;
= 0x02, to set authorized phone number for button 1;
= 0x03, to set authorized phone number for button 2.
= 0x04, to set authorized phone number for button 3.
Authorized phone number – 16 bytes in ASCII. If the phone number is less than 16 bytes, the blank byte(s) should read as ‘0x00’. For example:
If the authorized number is 8613612345678, then is should be written as follows:
0x38 0x36 0x31 0x33 0x36 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x00 0x00 0x00
If all 16 bytes data are 0x00, it means the authorized number is invalid.
After the above command is received, the tracking unit will send the following message back to the server:
$$<L><ID><0x4103><Flag><checksum>\r\n
If Flag (1byte)
=0x00, it means setting failed;
=0x01, it means setting succeeded.
6. Set Telephone Number for Wiretapping (Listen Only)
Command code: 0x4130
9
Command from server to tracking unit:
@@<L><ID><0x4130><data><checksum>\r\n
Data is the telephone number for wiretapping and it should be numbers or ‘+’ and numbers. Max
16 digits. In
ASCII code.
Message from tracking unit to server:
$$<L><ID><0x4130><Flag><checksum> \r\n
If Flag
=0x00, it means operation failed;
=0x01, it means operation succeeded.
7. Read Authorized Phone Number
Command code: 0x9003
Command from server to tracking unit:
@@<L><ID><0x9003><button number><checksum>\r\n
Button number: 1 byte and in hex code, it should be in the range form 1 to 4. When button name is
0xff, it is
to read all authorized numbers.
Message from tracking unit to server:
$$<L><ID><0x9003><authorized phone number for receiving SMS><authorized phone number for receiving call><checksum>\r\n
Authorized phone number: 16 bytes in ASCII. If the phone number is less than 16 bytes, the blank byte(s)
read as ‘0x00’.
8. Report Black Box Location
Command code: 0x9956
Command from tracking unit to server:
$$<L><ID><0x9956><data;data;data;data;data;data;data;…data;data;data;><checksum>\r\n
Remarks:
The max number of data is 40.
Please refer to annex 1 for detailed description of ‘data’.
Message from server to tracking unit:
@@<L><ID><0x9956 ><Flag><checksum> \r\n
If Flag
=0x00, it means operation failed;
=0x01, it means operation succeeded.
9. Send SMS
Command code: 0x9957
Command from server to tracking unit:
@@<L><ID><0x9957><phone number><SMS data><checksum>\r\n
Remarks:
phone number-16 bytes in ASCII. If the phone number is less than 16 bytes, the blank byte(s)
should read as ‘0x00’. For example:
If the authorized number is 8613612345678, then is should be written as follows:
0x38 0x36 0x31 0x33 0x36 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x00 0x00 0x00
If all 16 bytes data are 0x00, it means the authorized number is invalid.
SMS data-Max 70*4 bytes in Unicode. For example:
If the SMS data is “深圳市南山区”, then is should be written as follows:
0xF1 0x6D 0x33 0x57 0x02 0x5E 0x57 0x53 0x71 0x5C 0x3A 0x53 0x00 0x00
This field must use 0x00 0x00 for end.
After the above command is received, the tracking unit will send the following message back to the server:
$$<L><ID><0x9957><Flag><checksum>\r\n
If Flag (1byte)
=0x00, it means setting failed;
=0x01, it means setting succeeded.
10. Get plain address
Command code: 0x9958
Command from tracking unit to server:
$$<L><ID><0x9958><phone number><GPS/Cell data><checksum>\r\n
Remarks:
phone number-16 bytes in ASCII. If the phone number is less than 16 bytes, the blank byte(s)
should read as ‘0x00’. For example:
If the authorized number is 8613612345678, then is should be written as follows:
0x38 0x36 0x31 0x33 0x36 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x00 0x00 0x00
If all 16 bytes data are 0x00, it means the authorized number is invalid. Please refer to annex 2 for detailed description of ‘GPS/Cell data’.
Message from server to tracking unit:
@@<L><ID><0x9958><phone number><SMS data><checksum>\r\n
12
SMS data-Max 70*4 bytes in Unicode. For example:
If the SMS data is “深圳市南山区”, then is should be written as follows:
0xF1 0x6D 0x33 0x57 0x02 0x5E 0x57 0x53 0x71 0x5C 0x3A 0x53 0x00 0x00
This field must use 0x00 0x00 for end.
Annex 1: Description of data
1, Data
Data consists of: GPRMC | HDOP | Altitude | Cell | State | Alarm | Battery | Signal
For example:
100008.000,A,2232.4679,N,11356.7805,E,0.204,89.22,210911,,|7.49|152.6|3571,9763,00,460|0000|00|100|100
(9) GPRMC includes: hhmmss.dd,S,xxmm.dddd,<N|S>,yyymm.dddd,<E|W>,s.s,h.h,ddmmyy For example:
134829.486,A,1126.6639,S,11133.3299,W,58.31,309.62,110200
Details:
Parameter |
Description |
Example |
hhmmss.dd |
UTC time hh = hours; mm = minutes; ss = seconds;
dd = decimal part of seconds |
13:48:29.486 |
S |
Status indicator, A = valid, V = invalid |
A=Valid |
xxmm.dddd |
Latitude
xx = degrees;
mm = minutes; dddd = decimal part of minutes |
11 deg. 26.6639 min |
<N|S> |
Either character N or character S N = North, S = South |
S = South |
yyymm.dddd |
Longitude
yyy = degrees;
mm = minutes; dddd = decimal part of minutes |
111 deg. 33.3299 min |
<E|W> |
Either character E or character W E = East, W = West |
W=West |
s.s |
Speed, knots |
58.31 Knots |
h.h |
Heading |
309.62 deg |
ddmmyy |
Date
dd = date;
mm = month’ yy = year |
11th, Aug. 2000 |
(2) | is list separator in ASCII (=0x7c)
(3) HDOP, in ASCII code, 0.5-99.9. HDOP is blank when the tracking unit has no GPS fix.
17
CITYEASY GPRS Communication Protocol
(4) Altitude, in algorism.
(5) Cell, includes: cid,lac,mnc,mcc For example:
4272,10147,00,460
Details:
Parameter |
Description |
Example |
cid |
Cell ID |
4272 |
lac |
LAC |
10147 |
mnc |
MNC |
00 |
mcc |
MCC |
460 |
(6) State: Status of input and output
Bit0~Bit7: Reserved and default as ‘0’
Bit8: Status of Input1
If Bit8=0: Input1 is inactive; Bit8=1: Input1 is active (SOS button is pressed)
Bit9: Status of Input2
If Bit9=0: Input2 is inactive; Bit9=1: Input2 is active (Button 1 is pressed)
Bit10: Status of Input3
If Bit10=0: Input3 is inactive; Bit10=1: Input3 is active (Button 2 is pressed)
Bit11: Status of Input4
If Bit11=0: Input4 is inactive; Bit11=1: Input4 is active (Button 3 is pressed)
Bit12: Status of Input5
If Bit12=0: Input5 is inactive; Bit12=1: Input5 is active (Answer button is pressed)
Bit13: Status of Input6
If Bit13=0: Input6 is inactive; Bit13=1: Input6 is active (“Hang up/Power key” button is pressed)
(7) Alarm: Alarm command
Alarm code |
Definition |
=0x01 |
SOS button is pressed |
=0x02 |
2nd button is pressed |
=0x03 |
3rd button is pressed |
=0x04 |
First button is pressed |
=0x05 |
Reserved |
=0x10 |
Low battery alarm |
=0x11 |
Over speed alarm |
18
CITYEASY GPRS Communication Protocol
=0x12 |
Movement alarm |
=0x13 |
Reserved |
=0x14 |
Alarm of tracking unit being turned on |
=0x15 |
Alarm of tracking unit entering blind area |
=0x16 |
Alarm of tracking unit leaving blind area |
=0x31 |
SOS button is released |
=0x32 |
2nd button is released |
=0x33 |
3rd button is released |
=0x34 |
First button is released |
=0x35 |
Reserved |
=0x40 |
Vibrate alarm |
(8) Battery: Percentage of the battery voltage
(9) Signal: Percentage of the signal strength