VG01 Protocol 220403
VG01 Protocol 220403
COMMUNICATION
PROTOCOL
VERSION: V1.0
1
CONTENTS
Communication Channel........................................................................................................... 3
Packet head、Packet end .......................................................................................................... 3
Packet length ............................................................................................................................. 3
Verify(XOR) ........................................................................................................................ 3
Pseudo Ip address ...................................................................................................................... 3
Rollcall-30 .............................................................................................................................. 3
Timing interval-34 .................................................................................................................. 4
Stop the alarm-37 ................................................................................................................... 4
Enable engine-38 .................................................................................................................... 5
Disable engine-39 ................................................................................................................... 5
Set Overspeed threshold-3F ................................................................................................... 5
Reset the mileage—6B.............................................................................................................. 5
Change time zone—6C ............................................................................................................. 6
Remote update—AA ................................................................................................................. 6
2
I. Explain the concept of glossary
Communication Channel
The device communicate with the server on TCP channel.
Packet head、Packet end
The packet head menas the beginning of the data stream.
The packet end means the end of the data sream.
Packet length
Packet length means the length of the data content,It is from the next byte of the packet length until the packet
end.
Explain:The packet length in some of the example of this protocol may be wrong,please according to this
algorithm.
Verify(XOR)
From the packet head of the data stream XOR with the next byte,until the previous byte of the calibration byte
Pseudo Ip address
Using specfic algorithm change the SIM card number to Pseudo IP address,the algorithm in Appendix C
Packet head Main order Packet length Pseudo IP calibration Packet end
Address
For
example:
Self number: 13512345005
Platform sent:
24 24 30 00 06 0C A2 32 85 2F 0D 24 24 21 00 05 CB 81 00 6E 0D
Device feedback:
24 24 81 00 23 0C A2 32 85 10 03 06 14 59 07 02 23 46 90 11 35 29 47 00 00 00 00 C0 40 01 01 2C 0E 11 00
00 00 21 CB 0D
3
21 is responding to main signaling
00 05 is the length
CB is checksum the data of rollcall
81 and 00 is corresponded to main signalling and sub-signalling
6E is checksum
0D is the terminator
24 24 81 00 23 0C A2 32 85 10 03 06 14 59 07 02 23 46 90 11 35 29 47 00 00 00 00 C0 40 01 01 2C 0E 11 00
00 00 21 CB 0D is the data responded to the rollcall
24 24 tip binding
81 main signalling
00 23 length
0C A2 32 85 is the pseudo IP translated by self number
10 03 06 14 59 07 02 23 46 90 11 35 29 47 00 00 00 00 C0 40 01 01 2C 0E 11 00 00 00 21 is the location
information of device
CB checksum
0D terminator
Timing interval-34
[Function] Modify the timing interval of the position data sending, device will reply with command
85.
[Direction] from server to device
[Format]
24 24 34 00 06 0D
Packet Main Packet Pseudo IP Parameter1 Parameter Parameter calibration Packet
head order length Address 2 3 end
[Instruction explanation]
Parameter1:double byte,hexadecimal form,means the ACC on time horizon(form 1 second to 18.2 hours).
Parameter2:double byte,hexadecimal form,means the ACC off time horizon(from 1 second to 18.2 hours).
Parameter3:single byte(choosing)when close the heartbeat functio,this instruction doesn’t include the
parameter 3 the packet length is 0x0A,the heartbeat time is 31 seconds or 61 seconds or 91
seconds.
24 24 37 00 06 0D
Packet head Main order Packet length Pseudo IP calibration Packet end
Address
4
Enable engine-38
[Function] control the relay to enable the engine, device will reply with command 85.
[Direction] from server to device
[Format]
24 24 38 00 06 0D
Packet head Main order Packet length Pseudo IP calibration Packet end
Address
Disable engine-39
[Function] control the relay to disable the engine, device will reply with command 85.
[Direction] from server to device
[Format]
24 24 39 00 07 0D
Packet head Main order Packet length Pseudo IP calibration Packet end
Address
24 24 3F 00 7 0D
Packet head Main order Packet length Pseudo IP Setting value calibration Packet end
Address
[Instruction explantion]
Setting value is the upper limit threshold value of the overspeed alarm,when the setting value
is 0,the overspeed alarm function is closed(form 0 to 255 km/hour)single byte, hexadecimal
form.
Reset the mileage—6B
[Function] reset the mileage from device, device will reply with command 85.
[Direction] from server to device
[Format]
24 24 6B 00 06 XOR 0D
Packet head Main order Packet length Pseudo IP parameter calibration Packet end
Address
5
[instruction explanation]
parameter:the value of the mileage(unit:km)
Change time zone—6C
[Function] change time zone, device will reply with command 85.
[Direction] from server to device
[Format]
24 24 6C 00 08 XOR 0D
Packet head Main order Packet length Pseudo IP parameter calibration Packet end
Address
[instruction explanation]
Parameters:
Issue th differential value based on GMT, (unit: hours:minutes, )
remarks:
minute follows hour, the high order of hour is to decide whether plus or minus, if the high order is O, it means
the timezone should be adjust as GMT+time parameters
e.g.:
the 8 area east: parameters is 0x08 0x1E, current time= GMT+8hours30minutes
[Instruction explanation]
Calibration value: It is the value of the return data of the vehicle.(1 byte)
Main order:It is the main order of the return data of the vehicle (1 byte);
Sub-order:It is the slave order of the return data of the vehicle (1 byte);
6
IV. From device to server
Heart beat packet function 99
[Function] keep the connection with server alive, server should reply with command 21.
[Direction] from device to server
[Format]
24 24 99 00 06 0D
Pseudo IP calibration
Packet head Main order Packet length Packet end
Address
Position data-80
[Function] device report location to the server, server should reply with command 21.
[Direction] from device to server
[Format]
24 24 80 00 23 (33Byte) 0D
Pseudo IP
Packet head Main order Packet length Position data calibration Packet end
Address
[instruction explanation]
Position data form
04 12 12 08 12 00
Date &Time latitude longitude speed direction position I/O Ignition GSM Voltage mileage
angle Signal
D7 Mark flag
0 Not locate
1 Locate
D6 Differential positioning
0 no
1 yes
D5 D4 introduction
X X reserved
D3 D2 D1 D0 satellite
0 0 0 0 range:0—15
1 1 1 1
I/O status:
:
D7
D6 1:default system use
D5 No load or full load examination(1:full 0:no)
D4 Antenna short(0,normal,<> 0 short)
D3 Antenna open(0,normal,<> 0 open)
D2 Air conditioning examination(0:open 1:close)
D1 Break-in examination(0:open 1:close)
D0 Low voltage examination(0:open 1:close)(G-sensor
version)
Ignition:
1:Ignition on 0:Igntion off
8
AD Data=GSM signal&Voltage (double byte Hexadecimal form )
The first 2 bytes are GSM signal, the latter two are voltage value.
Example: 50 ohm is 01F4
Example: 0000H is 0 V; 0B3AH is 11.58 V
Voltage conversion step:
1. The 16 bits of the first two byte were changed to the interger of the voltage.
2. The last two bytes were change to decimal.
Mileage:
The current mileage of the vehicle.unit:m/s
The return of rollcall-81
[Function] device reply to command 30 from the server for reporting new location , server should
reply with command 21.
[Direction] from device to server
[Format]
24 24 81 00 23 (33Byte) 0D
Pseudo IP
Packet head Main order Packet length Position data calibration Packet end
Address
Alarm data-82
[Function] Terminal send the alarm data, server should reply with command 21. and then reply with
command 37.
[Direction] from device to server
[Format]
24 24 82 00 25 (33Byte) 0D
Packet Main Packet Pseudo IP Position data Alarm data calibration Packet end
head order length Address
[Instruction explanation]
Alarm data(dobule Hexadecimal byte)
The first byte
D7 D6 D5 D4 D3 D2 D1 D0
1:alarm
0:no alarm
24 24 85 00 0B (5Byte) 0D
Packet Main Packet Pseudo IP Answer calibr Packe
head order length Address data ation t end
[Instruction explantion]
The format of return data
Appendix
Here I give you a example to tell you how to reply the command data from device, this is the data that you
received:
24 24 80 00 25 37 E3 00 A0 13 01 18 07 28 35 02 41 71 15 05 43 86 88 00 00 00 00 C0 47 00 07 A8 19 28 01
16 A0 1D 00 FF E2 0D
Header: 24 24
Main order: 80
11
Length: 00 25
Pseudo IP address: 37 E3 00 A0
Date: 13 01 18
Time: 07 28 35
Latitude: 02 41 71 15
Longitude: 05 43 86 88
Speed: 00 00
Angle: 00 00
GPS status: C0
Detection setting status: 47
Ignition status: 00
Oil resistance: 07 A8
Voltage: 19 28
Mileage(meter): 01 16 A0 1D
Temperature: 00 FF
Calibration: E2
Footer: 0D
Here I give you some function in C# to help you parse the data:
/// <summary>
/// Convert Pseudo IP address to System No
/// </summary>
/// <param name="ip"> Pseudo IP address, if you receive 0x37, 0xE3, 0x00, 0x A0, then please give
param value55.227.0.160</param>
/// <returns>System No</returns>
public string IPToNumber(string ip)
{
long iHight = 0;
string sTemp = null;
try
{
string[] sIp = ip.Split(new char[] { '.' }, 4);
byte[] bSimNo = new byte[sIp.Length];
for (int i = 0; i < bSimNo.Length; i++)
12
{
bSimNo[i] = Convert.ToByte(sIp[i]);
}
if ((bSimNo[0] & 0x80) != 0)
{
iHight = iHight + 8;
}
bSimNo[0] = Convert.ToByte(bSimNo[0] & 0x7F);
if ((bSimNo[1] & 0x80) != 0)
{
iHight = iHight + 4;
}
bSimNo[1] = Convert.ToByte(bSimNo[1] & 0x7F);
if ((bSimNo[2] & 0x80) != 0)
{
iHight = iHight + 2;
}
bSimNo[2] = Convert.ToByte(bSimNo[2] & 0x7F);
if ((bSimNo[3] & 0x80) != 0)
{
iHight = iHight + 1;
}
bSimNo[3] = Convert.ToByte(bSimNo[3] & 0x7F);
sTemp = "1" + Convert.ToString(30 + iHight) + bSimNo[0].ToString("00")
+ bSimNo[1].ToString("00") + bSimNo[2].ToString("00") + bSimNo[3].ToString("00");
}
catch
{
sTemp = null;
}
return sTemp;
}
/// <summary>
/// Convert System No to Pseudo IP address
/// </summary>
/// <param name="sim">System No, for example: 13555990032</param>
/// <returns> Pseudo IP address</returns>
public string NumToIp(string sim)
{
string[] Temp = new string[4];
int iHigt;
switch (sim.Length)
{
case 11:
Temp[0] = sim.Substring(3, 2);
13
Temp[1] = sim.Substring(5, 2);
Temp[2] = sim.Substring(7, 2);
Temp[3] = sim.Substring(9, 2);
iHigt = Convert.ToInt32(sim.Substring(1, 2)) - 30;
break;
case 10:
Temp[0] = sim.Substring(2, 2);
Temp[1] = sim.Substring(4, 2);
Temp[2] = sim.Substring(6, 2);
Temp[3] = sim.Substring(8, 2);
iHigt = Convert.ToInt32(sim.Substring(0, 2)) - 30;
break;
case 9:
Temp[0] = sim.Substring(1, 2);
Temp[1] = sim.Substring(3, 2);
Temp[2] = sim.Substring(5, 2);
Temp[3] = sim.Substring(7, 2);
iHigt = Convert.ToInt32(sim.Substring(0, 1));
break;
default:
switch (sim.Length)
{
case 8:
return NumToIp("140" + sim);
case 7:
return NumToIp("1400" + sim);
case 6:
return NumToIp("14000" + sim);
case 5:
return NumToIp("140000" + sim);
case 4:
return NumToIp("1400000" + sim);
case 3:
return NumToIp("14000000" + sim);
case 2:
return NumToIp("140000000" + sim);
case 1:
return NumToIp("1400000000" + sim);
default:
return "";
}
}
int[] sIp = new int[4];
14
sIp[0] = Convert.ToInt32(Temp[0]) | 128;
else
sIp[0] = Convert.ToInt32(Temp[0]);
/// <summary>
/// Get calibration value
/// </summary>
/// <param name="tmp">the whole package data</param>
/// <param name="len">the length which will be used to calculate the calibration value </param>
/// <returns> calibration value </returns>
public static byte GetCheckXor(byte[] tmp, int len)
{
byte A = 0;
for (int i = 0; i < len; i++)
{
A ^= tmp[i];
}
return A;
}
For example :
Bytes=37,E3,00,A0
Id=13555990032
15