Changes

1,533 bytes added ,  10:17, 31 October 2018
Line 373: Line 373:     
00003fca - CRC-16, 4 Bytes (first 2 are always zeros)
 
00003fca - CRC-16, 4 Bytes (first 2 are always zeros)
 +
 
 
 +
 +
*'''SENDING DATA OVER TCP/IP'''
 +
 +
First when module connects to server, module sends its IMEI. First comes short identifying number of bytes written and then goes IMEI as text (bytes).
 +
 +
For example IMEI 356307042441013 would be sent as 000f333536333037303432343431303133
 +
 +
First two bytes denote IMEI length. In this case 000F means, that imei is 15 bytes long.
 +
 +
After receiving IMEI, server should determine if it would accept data from this module. If yes server will reply to module 01 if not 00. Note that confirmation should be sent as binary packet. I.e. 1 byte 0x01 or 0x00.
 +
 +
Then module starts to send first AVL data packet. After server receives packet and parses it, server must report to module number of data received as integer (four bytes).
 +
 +
If sent data number and reported by server doesn’t match module resends sent data.
 +
 +
 +
Example:
 +
 +
Module connects to server and sends IMEI:
 +
 +
000f333536333037303432343431303133
 +
 +
Server accepts the module:
 +
 +
01
 +
 +
Module sends data packet:
 +
{| class="wikitable"
 +
|-
 +
! style="background: black; color: white;"|AVL data packet header !! style="background: black; color: white;"|AVL data array !! style="background: black; color: white;"| CRC
 +
|-
 +
| Four zero bytes,
 +
‘AVL data array’ length – 254
 +
|| CodecId – 08,
 +
NumberOfData – 2.
 +
(Encoded using continuous bit stream. Last byte padded to align to byte boundary)
 +
|| CRC of ‘AVL data array’
 +
|-
 +
| 00000000000000FE || 0802...(data elements)...02 || 00008612
 +
|}
 +
 +
Server acknowledges data reception (2 data elements):
 +
00000002