Wialon IPS en V 2 0
Wialon IPS en V 2 0
Wialon IPS en V 2 0
0
Communication protocol
Changes
All data are sent and received in plain text format over TCP
protocol and has the following format:
#TP#msg\r\n
# Start byte
TP Type of packet, all possible types are listed in table 1
# Separator
msg Message
\r\n End of message, <CR><LF> symbols (0D0A in HEX)
1
Packet types
2
Login packet
#L#protocol_version;imei;password;crc16\r\n
Example:
#AL#1\r\n
#AL#0\r\n
#SD#date;time;lat1;lat2;lon1;lon2;speed;course;height;sats;crc16\r
\n
If date and time fields is NA, server will set current time for packet.
3
Server sends ASD packet as an answer to SD packet:
“-1” – packet structure error
“0” – incorrect time
“1” – packet successfully registered
“10” – error getting coordinates
“11” – error getting height, speed or course
“12” – error getting amount of satellites
“13” – error verifying checksum
Example:
#ASD#1\r\n
#ASD#0\r\n
#ASD#10\r\n
Data packet
#D#date;time;lat1;lat2;lon1;lon2;speed;course;height;sats;hdop;in
puts;outputs;adc;ibutton;params;crc16\r\n
4
sent
params Set of additional parameters separated by comma. Each
parameter has the following format: NAME:TYPE:VALUE
NAME – custom string
TYPE – parameter type, 1 – int/long long, 2 – double, 3 –
string
VALUE – parameter value, depends on type
Example: count1:1:564,fuel:2:45.8,hw:3:V4.5
сrc16 Checksum (Appendix 1)
If date and time fields is NA, server will set current time for packet.
Example:
#AD#1\r\n
#AD#0\r\n
#AD#10\r\n
#AD#11\r\n
...
#AD#15\r\n
5
Ping (heartbeat) packet
#P#\r\n
Blackbox packet
#B#msg\r\n
Example:
#B#date;time;lat1;lat2;lon1;lon2;speed;course;height;sats|
date;time;lat1;lat2;lon1;lon2;speed;course;height;sats|
date;time;lat1;lat2;lon1;lon2;speed;course;height;sats|crc16\r\n
Example:
#AB#3\r\n
#AB#0\r\n
Example:
#AB#\r\n
6
Message to driver
#M#msg;crc16\r\n
Example:
#AM#1\r\n
#AM#0\r\n
#I#sz;ind;count;date;time;name;crc16\r\nBIN
7
time time in HHMMSS format, in UTC
name name of transmitting photo
crc16 checksum (Appendix 1)
BIN photo's binary block
#AI#ind;result\r\n
ind – the number of the transmitted block
result – packet processing result:
“1” – packet with block of photo is received
“0” – error receiving packet
“01” – error verifying checksum
Example:
Tracker: #I#51200;0;1;070512;124010;sample.jpg;crc16\r\nBIN
Server: #AI#0;1\r\n
Tracker: #I#28923;1;1;070512;124010;sample.jpg;crc16\r\nBIN
Server: #AI#1;1\r\n
Server: #AI#1\r\n
#QT#driverid\r\n
This packet type must be sent to the server before sending a ddd-
file.
8
#IT#date;time;driverid;code;count;crc16\r\n
#AIT#state\r\n
#T#code;sz;ind;crc16\r\nBIN
9
crc16 checksum for BIN part
(Appendix 1)
BIN file binary part of sz size
#AT#ind;state\r\n
#AT#1\r\n
All #T# packets with ddd-file blocks must be transmitted within the
same TCP-connection as #IT# packet.
10
Incoming data (UDP)
All data are sent and received in plain text format and have
the same structure as in TCP protocol, but with adding of protocol
version and IMEI in the beginning of packet. Protocol version field
must contain value “2.0”. For example, short data packet will look in
the following way:
2.0;imei#SD#date;time;lat1;lat2;lon1;lon2;speed;course;height;sat
s;crc16\r\n
11
Data compression
Appendix 1
12
Crc16 must be a hexadecimal number with a big-endian order of
bytes without leading zeroes on the left, for example:
AA13BB which is 11146171 in a decimal format.
The part of a packet between #TP# and crc16 is used for checksum
calculation in packets L, SD, D, B and M.
Packet sample:
#SD#date;time;lat1;lat2;lon1;lon2;speed;course;height;sats;crc16\r
\n
In this case crc16 is calculated for the following part of the packet:
date;time;lat1;lat2;lon1;lon2;speed;course;height;sats;
Packet sample:
#B#date;time;lat1;lat2;lon1;lon2;speed;course;height;sats|
date;time;lat1;lat2;lon1;lon2;speed;course;height;sats|crc16\r\n
In this case crc16 is calculated for the following part of the packet:
date;time;lat1;lat2;lon1;lon2;speed;course;height;sats|
date;time;lat1;lat2;lon1;lon2;speed;course;height;sats|
Packet sample:
#I#51200;0;1;070512;124010;sample.jpg;crc16\r\nBIN
13
С language code sample for crc16 calculation:
while (data_size--)
crc = (crc >> 8) ^ crc16_table[(unsigned char)crc ^ *buf++];
return crc;
}
14