|
|
(54 intermediate revisions by 21 users not shown) |
Line 1: |
Line 1: |
− | ='''<big>Introduction</big>'''= | + | |
− | A codec is a device or computer program for encoding or decoding a digital data stream or signal. Codec is a portmanteau of coder – decoder. A codec encodes a data stream or a signal for transmission and storage, possibly in encrypted form, and the decoder function reverses the encoding for playback or editing. <br> <br> | + | == '''<big>Introduction</big>''' == |
− | Below you will see a table of all Codec types with ID’s:
| + | A codec is a device or computer program for encoding or decoding a digital data stream or signal. Codec is a portmanteau of coder-decoder. |
− | {| class="nd-othertables_2" style="width:100%;"
| + | A codec encodes a data stream or a signal for transmission and storage, possibly in encrypted form, and the decoder function reverses the encoding for playback or editing. |
− | |+
| + | |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec 8
| + | |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec 8 Extended
| + | |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec 16
| + | Codec ID table |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec 12
| + | {| class="wikitable" |
− | ! colspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec 13
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec 14
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |0x08
| + | ! style="background: black; color: white;"| Codec 8 |
− | | style="vertical-align: middle; text-align: center;" |0x8E
| + | ! style="background: black; color: white;"| Codec 8 extended |
− | | style="vertical-align: middle; text-align: center;" |0x10
| + | ! style="background: black; color: white;"| Codec 12 |
− | | style="vertical-align: middle; text-align: center;" |0x0C
| + | ! style="background: black; color: white;"| Codec 13 |
− | | style="vertical-align: middle; text-align: center;" |0x0D
| + | ! style="background: black; color: white;"| Codec 16 |
− | | style="vertical-align: middle; text-align: center;" |0x0E
| |
| |- | | |- |
| + | | 0x08 || 0x8E || 0x0C || 0x0D || 0x10 |
| |} | | |} |
− | Also, there are using two data transport protocols: TCP and UDP. But it is not important which one will be used in Codec.
| |
| | | |
− | ='''<big>Codec for device data sending</big>'''= | + | == '''<big>Codec 8</big>''' == |
− | In this chapter you will find information about every Codec protocol which are using for device data sending and differences between them.
| |
| | | |
− | =='''<big>Codec 8</big>'''==
| + | *''AVL data packet'' |
| + | Because the smallest information amount that can be written is one bit, there can be some bits left unused when result is byte array. Any unused bits should be left blank. |
| | | |
− | *'''<big>Protocol Overview</big>'''
| + | Below table represents AVL data packet structure. |
| | | |
− | Codec8 – a main FM device protocol that is used for sending data to server. <br>
| |
| | | |
− | *'''<big>Codec 8 protocol sending over TCP</big>'''
| + | {| class="wikitable" |
− | | |
− | TCP is a connection-oriented protocol that is used for communication between devices. The workings of this type of protocol is described below in the '''communication with server''' section. <br>
| |
− | | |
− | *'''AVL Data Packet'''
| |
− | | |
− | Below table represents AVL Data Packet structure:
| |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x00000000 (Preamble)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Data Field Length
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec ID
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Number of Data 1
| |
− | ! colspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Number of Data 2
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| + | ! style="background: black; color: white;"| 4 zeros |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| + | ! style="background: black; color: white;"| Data field length |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| + | ! style="background: black; color: white;"| Codec ID |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| + | ! style="background: black; color: white;"| Number of Data 1 |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| + | ! style="background: black; color: white;"| AVL Data |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| + | ! style="background: black; color: white;"| Number of Data 2 |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| + | ! style="background: black; color: white;"| CRC-16 |
| |- | | |- |
| + | | 4 bytes || 4 bytes || 1 byte || 1 byte || 30-147 bytes || 1 byte || 4 bytes |
| |} | | |} |
| | | |
| + | Number of data – number of encoded data (number of records). |
| + | Codec ID is constant 08. |
| + | |
| + | Data field length is the length of bytes [codec id, number of data 2]. |
| + | Number of data 1 should always be equal to number of data 2 byte. |
| + | CRC-16 is 4 bytes, but first two are zeroes and last two are CRC-16 calculated for [codec id, number of data 2] |
| + | Minimum AVL packet size is 45 bytes (all IO elements disabled). |
| + | Maximum AVL packet size for one record is 783 bytes. |
| | | |
− | '''Preamble''' – the packet starts with four zero bytes. <br>
| |
− | '''Data Field Length''' – size is calculated starting from Codec ID to Number of Data 2. <br>
| |
− | '''Codec ID''' – in Codec8 it is always <code>0x08</code>. <br>
| |
− | '''Number of Data 1''' – a number which defines how many records is in the packet. <br>
| |
− | '''AVL Data''' – actual data in the packet (more information below). <br>
| |
− | '''Number of Data 2''' – a number which defines how many records is in the packet. This number must be the same as “Number of Data 1”. <br>
| |
− | '''CRC-16''' – calculated from Codec ID to the Second Number of Data. CRC (Cyclic Redundancy Check) is an error-detecting code using for detect accidental changes to RAW data. For calculation we are using [[Codec#CRC-16|CRC-16/IBM]].<br> <br>
| |
− | '''Note:''' for [[FMB630]], [[FMB640]] and [[FM6300|FM63XY]], minimum AVL record size is 45 bytes (all IO elements disabled). Maximum AVL record size is 255 bytes. Maximum AVL packet size is 512 bytes. For other devices, minimum AVL record size is 45 bytes (all IO elements disabled). Maximum AVL packet size is 1280 bytes. <br>
| |
| | | |
− | *AVL Data | + | *''AVL data'' |
| | | |
− | Below table represents AVL Data structure.
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Timestamp
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Priority
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |GPS Element
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |IO Element
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |8 bytes
| + | ! style="background: black; color: white;"| Timestamp |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| + | ! style="background: black; color: white;"| Priority |
− | | style="vertical-align: middle; text-align: center;" |15 bytes
| + | ! style="background: black; color: white;"| GPS Element |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| + | ! style="background: black; color: white;"| IO element |
| |- | | |- |
| + | | 8 bytes || 1 byte || 15 bytes || 6-123 |
| |} | | |} |
| | | |
| | | |
− | '''Timestamp''' – a difference, in milliseconds, between the current time and midnight, January, 1970 UTC (UNIX time). <br>
| + | Timestamp – difference, in milliseconds, between the current time and midnight, January 1, 1970 UTC |
− | '''Priority''' – field which define AVL data priority (more information below). <br>
| |
− | '''GPS Element''' – location information of the AVL data (more information below). <br>
| |
− | '''IO Element''' – additional configurable information from device (more information below). <br>
| |
| | | |
− | *Priority | + | *''Priority'' |
| | | |
− | Below table represents Priority values. Packet priority depends on device configuration and records sent.
| + | |
− | {| class="nd-othertables_2" style="width:25%;" | + | {| class="wikitable" |
− | |+
| |
− | ! colspan="2" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Priority
| |
| |- | | |- |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |0
| + | |
− | | style="vertical-align: middle; text-align: center;" |Low | + | |- |
| + | | style="background: black; color: white;"|0 || Low |
| |- | | |- |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |1
| + | | style="background: black; color: white;"|1 || High |
− | | style="vertical-align: middle; text-align: center;" |High | |
| |- | | |- |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |2
| + | | style="background: black; color: white;"|2 || Panic |
− | | style="vertical-align: middle; text-align: center;" |Panic | + | |} |
− | |}<br /> | + | |
| + | |
| + | *''GPS Element'' |
| | | |
− | *GPS element
| |
| | | |
− | Below table represents GPS Element structure:
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Longitude
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Latitude
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Altitude
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Angle
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Satellites
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Speed
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| + | ! style="background: black; color: white;"| Longitude |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| + | ! style="background: black; color: white;"| Latitude |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| + | ! style="background: black; color: white;"| Altitude |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| + | ! style="background: black; color: white;"| Angle |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| + | ! style="background: black; color: white;"| Satellites |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| + | ! style="background: black; color: white;"| Speed |
| |- | | |- |
| + | | 4 bytes || 4 bytes || 2 bytes || 2 bytes || 1 bytes || 2 bytes |
| |} | | |} |
| | | |
| + | X Longitude |
| + | |
| + | Y Latitude1 |
| + | |
| + | Altitude In meters above sea level1 |
| | | |
− | '''Longitude''' – east – west position. <br>
| + | Angle In degrees, 0 is north, increasing clock-wise 1 |
− | '''Latitude''' – north – south position. <br>
| |
− | '''Altitude''' – meters above sea level. <br>
| |
− | '''Angle''' – degrees from north pole. <br>
| |
− | '''Satellites''' – number of visible satellites. <br>
| |
− | '''Speed''' – speed calculated from satellites. <br> <br>
| |
− | '''Note:''' If record are without valid coordinates – (there were no GPS fix in the moment of data acquisition) – Longitude, Latitude and Altitude values are last valid fix, and Angle, Satellites and Speed are 0. <br> <br>
| |
− | Longitude and latitude are integer values built from degrees, minutes, seconds and milliseconds by formula: <br>
| |
− | [[Image:GPS.png]]
| |
− | <br>
| |
− | Where: <br>
| |
− | d – Degrees; m – Minutes; s – Seconds; ms – Milliseconds; p – Precision (10000000) <br>
| |
− | If longitude is in west or latitude in south, multiply result by –1. <br> <br>
| |
− | Note: <br>
| |
− | To determine if the coordinate is negative, convert it to binary format and check the very first bit. If it is 0, coordinate is positive, if it is 1, coordinate is negative. <br> <br>
| |
− | Example: <br>
| |
− | Received value: <code>20 9C CA 80</code> converted to BIN: <code>00100000 10011100 11001010 10000000</code> first bit is 0, which means coordinate is positive converted to DEC: <code>547146368</code>. For more information see two‘s complement arithmetic. <br>
| |
| | | |
− | *IO Element
| + | Satellites Number of visible satellites1 |
| | | |
− | {| class="nd-othertables_2" style="width:100%;"
| + | Speed in km/h. 0x0000 if GPS data is invalid1 |
− | |+
| + | |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |Event IO ID
| + | Longitude and latitude are integer values built from degrees, minutes, seconds and milliseconds by formula |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| + | |
− | | rowspan="26" style=" width:5%; vertical-align: middle; text-align: left;" |
| + | [[Image:197.png]] |
− | | rowspan="26" style=" width:65%; vertical-align: middle; text-align: left;" |'''Event IO ID''' – if data is acquired on event – this field defines which IO property has changed and generated an event. For example, when if Ignition state changed and it generate event, Event IO ID will be <code>0xEF</code> (AVL ID: 239). If it’s not eventual record – the value is 0. <br>
| + | |
− | '''N''' – a total number of properties coming with record (N = N1 + N2 + N4 + N8). <br>
| + | d - Degrees |
− | '''N1''' – number of properties, which length is 1 byte. <br>
| + | |
− | '''N2''' – number of properties, which length is 2 bytes. <br>
| + | m - Minutes |
− | '''N4''' – number of properties, which length is 4 bytes. <br>
| + | |
− | '''N8''' – number of properties, which length is 8 bytes. <br>
| + | s - Seconds |
− | '''N’th IO ID''' - AVL ID. <br> | + | |
− | '''N’th IO Value''' - AVL ID value. <br>
| + | ms - Milliseconds |
| + | |
| + | p - Precision (10000000) |
| + | |
| + | If longitude is in west or latitude in south, multiply result by –1. To determine if the coordinate is negative, convert it to binary format and check the very first bit. If it is 0, coordinate is positive, if it is 1, coordinate is negative. |
| + | |
| + | Example: |
| + | |
| + | Received value: 20 9c ca 80 |
| + | Converted to BIN: 00100000 10011100 11001010 10000000 first bit is 0, which means coordinate is positive |
| + | Converted to DEC: 547146368 |
| + | For more information see two‘s complement arithmetics. |
| + | |
| + | |
| + | *''IO Element'' |
| + | |
| + | {| class="wikitable" |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N of Total IO
| + | |
− | | style="vertical-align: middle; text-align: center;" |1 byte | + | | style="background: black; color: white;"|Event IO ID || 1 byte |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N1 of One Byte IO
| + | | style="background: black; color: white;"|N of Total IO || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| + | | style="background: black; color: white;"|N1 of One Byte IO || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| + | | style="background: black; color: white;"|1’st IO ID || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |... | + | | style="background: black; color: white;"|1’st IO Value || 1 byte |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N1’th IO ID
| + | | ... || |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N1’th IO Value
| + | | style="background: black; color: white;"|N1’th IO ID || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N2 of Two Bytes
| + | | style="background: black; color: white;"|N1’th IO Value || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| + | | style="background: black; color: white;"|N2 of Two Bytes || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| + | | style="background: black; color: white;"|1’st IO ID || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |... | + | | style="background: black; color: white;"|1’st IO Value || 2 bytes |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N2’th IO ID
| + | | |... || |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N2’th IO Value
| + | | style="background: black; color: white;"|N2’th IO ID || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N4 of Four Bytes
| + | | style="background: black; color: white;"|N2’th IO Value || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| + | | style="background: black; color: white;"|N4 of Four Bytes || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| + | | style="background: black; color: white;"|1’st IO ID || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |4 bytes | |
| |- | | |- |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |... | + | | style="background: black; color: white;"|1’st IO Value || 4 byte |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N4’th IO ID
| + | | |... || |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N4’th IO Value
| + | | style="background: black; color: white;"|N4’th IO ID || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |4 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N8 of Eight Bytes
| + | | style="background: black; color: white;"|N4’th IO Value || 4 bytes |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| + | | style="background: black; color: white;"|N8 of Eight Bytes || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| + | | style="background: black; color: white;"|1’st IO ID || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |8 byte | |
| |- | | |- |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |... | + | | style="background: black; color: white;"|1’st IO Value || 8 bytes |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N8’IO ID
| + | | |... || |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N8’IO Value
| + | | style="background: black; color: white;"|N8’th IO ID || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |8 bytes | |
| |- | | |- |
− | |} <br /> | + | | style="background: black; color: white;"|N8’th IO Value || 8 bytes |
| + | |} |
| + | Event IO ID – if data is acquired on event – this field defines which IO property has changed and generated an event. If data cause is not event – the value is 0. |
| + | |
| + | N total number of properties coming with record (N=N1+N2+N4+N8) |
| | | |
− | *'''Communication with server'''
| + | N1 number of properties, which length is 1 byte |
| + | |
| + | N2 number of properties, which length is 2 bytes |
| + | |
| + | N4 number of properties, which length is 4 bytes |
| + | |
| + | N8 number of properties, which length is 8 bytes |
| + | |
| + | |
| + | '''Example''' |
| + | |
| + | Received data: |
| + | |
| + | |
| + | |
| + | <span style="background-color: #848484">00000000</span><span style="background-color: #A9BCF5">0000008c</span><span style="background-color: #04B45F">08</span><span style="background-color: #FF0000">01</span><span style="background-color: #9F81F7">0000013feb55ff74</span><span style="background-color: #D8D8D8">00</span><span style="background-color: #FFFF00">0f0ea850</span><span style="background-color: #FAAC58">209a6900</span><span style="background-color: #2EFE2E">0094</span><span style="background-color: #088A29">0000</span>120000<span style="background-color: #0040FF">00</span> |
| + | |
| + | <span style="background-color: #A9A9F5">1e</span><span style="background-color: #DF3A01">09</span>010002000300040016014703f0001504c800<span style="background-color: #DF3A01">0c</span>0900730a00460b00501300464306 |
| + | |
| + | d7440000b5000bb60007422e9 |
| + | f180000cd0386ce0001<span style="background-color: #DF3A01">07</span>c700000000f10000601a4600 |
| + | |
| + | 0001344800000bb84900000bb84a00000bb84c00000000<span style="background-color: #DF3A01">02</span>4e0000000000000000cf00 |
| + | |
| + | 00000000000000<span style="background-color: #FF0000">01</span><span style="background-color: #F5DA81">00003fca</span> |
| + | |
| + | In total 152 Bytes |
| + | |
| + | |
| + | <span style="background-color: #848484">00000000</span> 4 zeroes, 4 bytes |
| + | |
| + | <span style="background-color: #A9BCF5">0000008c</span> data length, 4 bytes |
| + | |
| + | <span style="background-color: #04B45F">08</span> – Codec ID |
| + | |
| + | <span style="background-color: #FF0000">01</span> Number of Data (1 record) 1’st record data |
| + | |
| + | |
| + | |
| + | <span style="background-color: #9F81F7">010000013feb55ff74</span> – Timestamp in milliseconds (1374042849140) |
| + | |
| + | GMT: Wed, 17 Jul 2013 06:34:09 GMT |
| + | |
| + | <span style="background-color: #D8D8D8">00</span> – Priority |
| + | |
| + | GPS Element |
| + | |
| + | <span style="background-color: #FFFF00">0f0ea850</span> – Longitude 252618832 = 25,2618832º N |
| + | |
| + | <span style="background-color: #FAAC58">209a6900</span> – Latitude 546990336 = 54,6990336 º E |
| + | |
| + | <span style="background-color: #2EFE2E">0094</span> – Altitude 148 meters |
| + | |
| + | <span style="background-color: #088A29">0000</span> – Angle 0 |
| + | |
| + | <span style="background-color: #088A29">12</span> – 18 Visible satellites |
| + | |
| + | <span style="background-color: #088A29">0000</span> – 0 km/h speed |
| + | |
| + | IO Element |
| + | |
| + | <span style="background-color: #0040FF">00</span> – IO element ID of Event generated (in this case when 00 – data generated not on event) |
| + | |
| + | <span style="background-color: #A9A9F5">1e</span> – 30 IO elements in record (total) |
| + | |
| + | <span style="background-color: #DF3A01">09</span> – 9 IO elements, which length is 1 Byte |
| + | |
| + | 0 – IO element ID = 01 |
| + | |
| + | 0 – IO element’s value = 0 |
| + | |
| + | 02 – IO element ID = 02 |
| + | |
| + | 0 – IO element’s value = 0 |
| + | |
| + | 03 – IO element ID = 03 |
| + | |
| + | 0 – IO element’s value = 0 |
| + | |
| + | 4 – IO element ID = 04 |
| + | |
| + | 0 – IO element’s value = 0 |
| + | |
| + | 16 – IO element ID = 22 (dec) |
| + | |
| + | 0 – IO element’s value = 1 |
| + | |
| + | 47 – IO element ID = 71 (dec) |
| + | |
| + | 03 – IO element’s value = 3 |
| + | |
| + | F0 – IO element ID = 240 (dec) |
| + | |
| + | 0 – IO element’s value = 0 |
| + | |
| + | 15 – IO element ID = 21 (dec) |
| + | |
| + | 04 – IO element’s value = 0 |
| + | |
| + | C8 – IO element ID = 200 (dec) |
| + | |
| + | 0 – IO element’s value = 0 |
| + | |
| + | <span style="background-color: #DF3A01">0c</span> – 12 IO elements, which value length is 2 Bytes |
| + | |
| + | 09 – IO element ID = 9 (dec) |
| + | |
| + | 0073 – IO element’s value |
| + | |
| + | 0a – IO element ID = 10 (dec) |
| + | |
| + | 0046 – IO element’s value |
| + | |
| + | 0b – IO element ID = 11 (dec) |
| + | |
| + | 0050 – IO element’s value |
| + | |
| + | 13 – IO element ID = 19 (dec) |
| + | |
| + | 0046 – IO element’s value |
| + | |
| + | 43 – IO element ID = 67 (dec) |
| + | |
| + | 06d7 – IO element’s value |
| + | |
| + | 1 – IO element ID = 68 (dec) |
| + | |
| + | 0 – IO element’s value |
| + | |
| + | B5 – IO element ID = 181 (dec) |
| + | |
| + | 000b – IO element’s value |
| + | |
| + | B6 – IO element ID = 182 (dec) |
| + | |
| + | 0007 – IO element’s value |
| + | |
| + | 42 – IO element ID = 66 (dec) |
| + | |
| + | 2e9f – IO element’s value |
| + | |
| + | 2 – IO element ID = 24 (dec) |
| + | |
| + | 0 – IO element’s value |
| + | |
| + | cd – IO element ID = 205 (dec) |
| + | |
| + | 3 – IO element’s value |
| + | |
| + | CE – IO element ID = 206 (dec) |
| + | |
| + | 0 – IO element’s value |
| + | |
| + | <span style="background-color: #DF3A01">07</span> – 7 IO elements, which value length is 4 Bytes |
| + | |
| + | C7 – IO element ID = 199 (dec) |
| + | |
| + | 0 – IO element’s value |
| + | |
| + | f1 – IO element ID = 241 (dec) |
| + | |
| + | 0000601a – IO element’s value |
| + | |
| + | 46 – IO element ID = 70 (dec) |
| + | |
| + | 00000134 – IO element’s value |
| + | |
| + | 48 – IO element ID = 72 (dec) |
| + | |
| + | 00000bb8 – IO element’s value |
| + | |
| + | 4 – IO element ID = 73 (dec) |
| + | |
| + | 00000bb8 – IO element’s value |
| + | |
| + | 4a – IO element ID = 74 (dec) |
| + | |
| + | 00000bb8 – IO element’s value |
| + | |
| + | 4c – IO element ID = 76 (dec) |
| + | |
| + | 1 – IO element’s value |
| + | |
| + | <span style="background-color: #DF3A01">02</span> – 2 IO elements, which value length is 8 Bytes |
| + | |
| + | 4e – IO element ID = 78 (dec) |
| + | |
| + | 0 – IO element’s value |
| + | |
| + | cf – IO element ID = 207 (dec) |
| + | |
| + | 0 – IO element’s value |
| + | |
| + | <span style="background-color: #FF0000">01</span> – Number of Data (1 record) |
| + | |
| + | <span style="background-color: #F5DA81">00003fca</span> - CRC-16, 4 Bytes (first 2 are always zeros) |
| + | |
| + | |
| | | |
− | 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). <br>
| + | *'''SENDING DATA OVER TCP/IP''' |
− | For example, IMEI <code>356307042441013</code> would be sent as <code>000F333536333037303432343431303133</code>. <br>
| |
− | First two bytes denote IMEI length. In this case <code>0x000F</code> means, that IMEI is 15 bytes long. <br>
| |
− | After receiving IMEI, server should determine if it would accept data from this module. If yes, server will reply to module <code>01</code>, if not - <code>00</code>. Note that confirmation should be sent as binary packet. I.e. 1 byte <code>0x01</code> or <code>0x00</code>. <br>
| |
− | 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). <br>
| |
− | If sent data number and reported by server doesn’t match module resends sent data. <br>
| |
| | | |
− | *Example: <br>
| + | 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). |
| | | |
− | Module connects to server and sends IMEI: <br>
| + | For example IMEI 356307042441013 would be sent as 000f333536333037303432343431303133 |
− | <code>000F333536333037303432343431303133</code> <br>
| |
− | Server accepts the module: <br>
| |
− | 01 <br>
| |
− | Module sends data packet:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet Header
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Array
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Four Zero Bytes – 0x00000000,
| |
− | “AVL Data Array” length – 0x000000FE
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID – 0x08,
| |
− | Number of Data – '''0x02''' <br>
| |
− | (Encoded using continuous bit stream. Last byte padded to align to byte boundary)
| |
− | | style="vertical-align: middle; text-align: center;" |CRC of “AVL Data Array”
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |00000000000000FE
| |
− | | style="vertical-align: middle; text-align: center;" |08'''02'''...(data elements)...'''02'''
| |
− | | style="vertical-align: middle; text-align: center;" |00008612
| |
− | |-
| |
− | |}
| |
| | | |
| + | First two bytes denote IMEI length. In this case 000F means, that IMEI is 15 bytes long. |
| | | |
− | Server acknowledges data reception (2 data elements): '''<code>00000002</code>''' <br>
| + | 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. |
| | | |
− | *'''Examples'''
| + | 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). |
| | | |
− | Hexadecimal stream of AVL Data Packet receiving and response in these examples are given in hexadecimal form. The different fields of packets are separate into different table columns for better readability and some of them are converted to ASCII values for better understanding. <br>
| + | If sent data number and reported by server doesn’t match module resends sent data. |
| | | |
− | '''1'st example''' <br>
| |
− | Receiving one data record with each element property (1 byte, 2 bytes, 4 byte and 8 byte). <br> <br>
| |
− | Received data in hexadecimal stream: <br>
| |
− | <code>000000000000003608010000016B40D8EA30010000000000000000000000000000000105021503010101425E0F01F10000601A014E0000000000000000010000C7CF</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet
| |
− | |-
| |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |AVL Data Packet Part
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
− | |-
| |
− | | rowspan="4" style="vertical-align: middle; text-align: center;" |
| |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Data Field Length
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 36
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID
| |
− | | style="vertical-align: middle; text-align: center;" |08
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 1 (Records)
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | rowspan="24" style="vertical-align: middle; text-align: center;" |AVL Data
| |
− | | style="vertical-align: middle; text-align: center;" |Timestamp
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 01 6B 40 D8 EA 30 (GMT: Monday, June 10, 2019 10:04:46 AM)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Priority
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Longitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Latitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Altitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Angle
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Satellites
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Speed
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Event IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N of Total ID
| |
− | | style="vertical-align: middle; text-align: center;" |05
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N1 of One Byte IO
| |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |15 (AVL ID: 21, Name: GSM Signal)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |03
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |01 (AVL ID: 1, Name: DIN1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N2 of Two Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |42 (AVL ID: 66, Name: External Voltage)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |5E 0F
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |F1 (AVL ID: 241, Name: Active GSM Operator)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 60 1A
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N8 of Eight Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |4E (AVL ID: 78, Name: iButton)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 00 00 00 00
| |
− | |-
| |
− | | rowspan="2" style="vertical-align: middle; text-align: center;" |
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 2 (Number of Total Records)
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 C7 CF
| |
− | |-
| |
− | |}
| |
| | | |
| + | Example: |
| | | |
− | Server response: <code>00000001</code> <br>
| + | Module connects to server and sends IMEI: |
| | | |
− | '''2'nd example''' <br>
| + | 000f333536333037303432343431303133 |
− | Receiving one data record with one or two different element properties (1 byte, 2 byte). <br> <br>
| |
− | Received data in hexadecimal stream: <br>
| |
− | <code>000000000000002808010000016B40D9AD80010000000000000000000000000000000103021503010101425E100000010000F22A</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet
| |
− | |-
| |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |AVL Data Packet Part
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
− | |-
| |
− | | rowspan="4" style="vertical-align: middle; text-align: center;" |
| |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Data Field Length
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 28
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID
| |
− | | style="vertical-align: middle; text-align: center;" |08
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 1 (Records)
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | rowspan="20" style="vertical-align: middle; text-align: center;" |AVL Data
| |
− | | style="vertical-align: middle; text-align: center;" |Timestamp
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 01 6B 40 D9 AD 80 (GMT: Monday, June 10, 2019 10:05:36 AM)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Priority
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Longitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Latitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Altitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Angle
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Satellites
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Speed
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Event IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N of Total ID
| |
− | | style="vertical-align: middle; text-align: center;" |03
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N1 of One Byte IO
| |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |15 (AVL ID: 21, Name: GSM Signal)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |03
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |01 (AVL ID: 1, Name: DIN1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N2 of Two Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |42 (AVL ID: 66, Name: External Voltage)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |5E 10
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N8 of Eight Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | rowspan="2" style="vertical-align: middle; text-align: center;" |
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 2 (Number of Total Records)
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 F2 2A
| |
− | |-
| |
− | |}
| |
| | | |
| + | Server accepts the module: |
| | | |
− | Server response: <code>00000001</code> <br>
| + | 01 |
| | | |
− | '''3'rd example''' <br>
| + | Module sends data packet: |
− | Receiving two or more data records with one or more different element properties. <br> <br>
| + | {| class="wikitable" |
− | Received data in hexadecimal stream: <br>
| |
− | <code>000000000000004308020000016B40D57B480100000000000000000000000000000001010101000000000000016B40D5C198010000000000000000000000000000000
| |
− | 101010101000000020000252C</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet
| |
| |- | | |- |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |AVL Data Packet Part | + | ! style="background: black; color: white;"|AVL data packet header !! style="background: black; color: white;"|AVL data array !! style="background: black; color: white;"| CRC |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part | |
| |- | | |- |
− | | rowspan="4" style="vertical-align: middle; text-align: center;" | | + | | Four zero bytes, |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes
| + | ‘AVL data array’ length – 254 |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | + | || CodecId – 08, |
| + | NumberOfData – 2. |
| + | (Encoded using continuous bit stream. |
| + | |
| + | Last byte padded to align to byte boundary) |
| + | || CRC of ‘AVL data array’ |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Data Field Length | + | | 00000000000000FE || 0802...(data elements)...02 || 00008612 |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 43
| + | |} |
− | |-
| + | |
− | | style="vertical-align: middle; text-align: center;" |Codec ID
| + | Server acknowledges data reception (2 data elements): |
− | | style="vertical-align: middle; text-align: center;" |08
| + | 00000002 |
− | |- | |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 1 (Records) | |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | rowspan="16" style="vertical-align: middle; text-align: center;" |AVL Data | |
− | (1'st record)
| |
− | | style="vertical-align: middle; text-align: center;" |Timestamp | |
− | | style="vertical-align: middle; text-align: center;" |00 00 01 6B 40 D5 7B 48 (GMT: Monday, June 10, 2019 10:01:01 AM)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Priority
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Longitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Latitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Altitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Angle
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Satellites
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Speed
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Event IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N of Total ID
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N1 of One Byte IO
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |01 (AVL ID: 1, Name: DIN1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N2 of Two Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N8 of Eight Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | rowspan="16" style="vertical-align: middle; text-align: center;" |AVL Data
| |
− | (2'nd record)
| |
− | | style="vertical-align: middle; text-align: center;" |Timestamp
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 01 6B 40 D5 C1 98 (GMT: Monday, June 10, 2019 10:01:19 AM)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Priority
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Longitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Latitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Altitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Angle
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Satellites
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Speed
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Event IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N of Total ID
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N1 of One Byte IO
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |01 (AVL ID: 1, Name: DIN1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N2 of Two Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N8 of Eight Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | rowspan="2" style="vertical-align: middle; text-align: center;" |
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 2 (Number of Total Records)
| |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 25 2C
| |
− | |-
| |
− | |}
| |
| | | |
| | | |
− | Server response: <code>00000002</code> <br>
| + | *'''SENDING DATA OVER UDP/IP''' |
| | | |
− | *'''<big>Codec8 protocol sending over UDP</big>'''
| |
| | | |
− | Codec8 protocol over UDP is a transport layer protocol above UDP/IP to add reliability to plain UDP/IP using acknowledgment packets. <br>
| + | *''UDP channel protocol'' |
| | | |
− | *'''AVL Data Packet'''
| + | UDP channel is a transport layer protocol above UDP/IP to add reliability to plain UDP/IP using acknowledgment packets. The packet structure is as follows: |
| | | |
− | The packet structure is as follows:
| + | {| class="wikitable " |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |UDP Datagram
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Example
| + | ! colspan="4" align="center" style="background: black; color: white;"|UDP datagram |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Packet ID | + | | rowspan="4"| UDP channel packet x N |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | + | | Example || 2 bytes || Packet length (excluding this field) in big ending byte order |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Not Usable Byte | + | | Packet Id || 2 bytes || Packet id unique for this channel |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Packet Payload | + | | Not usable byte || 1 byte || Not usable byte |
− | | style="vertical-align: middle; text-align: center;" |Variable | |
| |- | | |- |
| + | | Packet payload || m bytes || Data payload |
| |} | | |} |
| | | |
| | | |
− | '''Example''' – packet length (excluding this field) in big ending byte order. <br>
| + | {| class="wikitable" |
− | '''Packet ID''' – packet ID unique for this channel. <br>
| + | |- |
− | '''Not Usable Byte''' – not usable byte. <br>
| + | ! colspan="2" align="center" style="background: black; color: white;"|Not usable byte |
− | '''Packet payload''' – data payload. <br>
| + | |
| + | |- |
| + | | 1||Data packet requiring acknowledgment |
| + | |} |
| | | |
− | *Acknowledgment packet
| + | Acknowledgment packet should have the same packet id as acknowledged data packet and empty data payload. Acknowledgement should be sent in binary format |
| | | |
− | Acknowledgment packet should have the same Packet ID as acknowledged data packet and empty Data Payload. Acknowledgement should be sent in binary format.
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | + | |- |
− | |+ | + | ! colspan="3" align="center" style="background: black; color: white;"|Acknowledgment packet |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Acknowledgment Packet | |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Packet Length
| + | | Packet length || 2 bytes || 0x0003 |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Packet ID
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Not Usable Byte
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | + | | Packet id || 2 bytes || same as in acknowledged packet |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
| + | | Not usable byte|| 1 byte || 0x00 |
| |} | | |} |
| | | |
| | | |
− | '''Packet Length''' – packet length by sending/response data. <br> | + | *'''Sending AVL data using UDP channel''' |
− | '''Packet ID''' – same as in acknowledgment packet. <br>
| |
− | '''Not Usable Byte''' – always will be <code>0x01</code>. <br>
| |
| | | |
− | *Sending AVL Packet Payload using UDP channel
| + | AVL data are sent encapsulated in UDP channel packets (Data payload field). |
| | | |
− | Below table represents Sending Packet Payload structure.
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="4" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL data encapsulated in UDP channel packet
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Packet ID
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |IMEI Length
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Module IMEI
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data Array
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| + | ! colspan="3" align="center" style="background: black; color: white;"|AVL data encapsulated in UDP channel packet |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |15 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| |
| |- | | |- |
| + | | AVL packet id (1 byte) || Module IMEI || AVL data array |
| |} | | |} |
− | '''AVL Packet ID''' – ID identifying this AVL packet. <br>
| |
− | '''IMEI Length''' – always will be <code>0x000F</code>. <br>
| |
− | '''Module IMEI''' – IMEI of a sending module encoded the same as with TCP. <br>
| |
− | '''AVL Data Array''' – array of encoded AVL data (same as TCP AVL Data Array). <br>
| |
| | | |
− | *Server response Packet Payload using UDP channel
| + | AVL packet id (1 byte) – id identifying this AVL packet |
| + | Module IMEI – IMEI of a sending module encoded the same as with TCP |
| + | AVL data array – array of encoded AVL data |
| + | |
| | | |
− | Below table represents Server Response Packet Payload structure.
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Server Response to AVL Data Packet
| |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Packet ID | + | ! colspan="3" align="center" style="background: black; color: white;"|Server response to AVL data packet |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Number of Accepted AVL Elements
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |1 byte | + | | AVL packet id (1 byte) ||Number of accepted AVL elements (1 byte) |
− | | style="vertical-align: middle; text-align: center;" |1 byte | + | |} |
− | |-
| + | |
− | |} <br />
| + | |
| + | AVL packet id (1 byte) – id of received AVL data packet |
| + | |
| + | AVL packet id (1 byte) – id of received AVL data packet |
| + | |
| + | Number of AVL data elements accepted (1 byte) – number of AVL data array entries from the beginning of array, which were accepted by the server. |
| | | |
− | *'''Communication with server'''
| + | Scenario: |
| + | Module sends UDP channel packet with encapsulated AVL data packet. |
| + | Server sends UDP channel packet with encapsulated response |
| + | Module validates AVL packet id and Number of accepted AVL elements. If server response with valid AVL packet id is not received within configured timeout, module can retry sending. |
| | | |
− | Module sends UDP channel packet with encapsulated AVL data packet. Server sends UDP channel packet with encapsulated response module validates AVL Packet ID and Number of accepted AVL elements. If server response with valid AVL Packet ID is not received within configured timeout, module can retry sending. <br>
| |
| | | |
− | *Example:
| + | Example: |
| + | Module sends the data: |
| | | |
− | Module sends the data:
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | + | |- |
− | |+ | + | ! style="background: black; color: white;"|UDP channel header !!style="background: black; color: white;"| AVL packet header !!style="background: black; color: white;"| AVL data array |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |UDP Channel Header | |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Packet Header | |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Array | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Length – 0x00FE, | + | | Len – 253, |
− | Packet ID – 0xCAFE <br>
| + | Id – 0xCAFE, |
− | Not Usable Byte – 0x01 | + | |
− | | style="vertical-align: middle; text-align: center;" |AVL Packet ID – 0xDD, | + | Not usable byte – 00 |
− | IMEI Length – 0x000F <br> | + | |
− | IMEI – 0x313233343536373839303132333435
| + | || AVL packet id – 0xDD, |
− | (Encoded using continuous bit stream. Last byte padded to align to byte boundary)
| + | IMEI – 1234567890123456 |
− | | style="vertical-align: middle; text-align: center;" |Codec ID – 0x08, | + | || CodecId – 08, |
− | Number of Data – 0x02 <br>
| + | NumberOfData – 2. |
| (Encoded using continuous bit stream) | | (Encoded using continuous bit stream) |
| + | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |00FECAFE01 | + | | 00FDCAFE01 || DD000F3133343536373839303132333435 || 0802…(data elements)…02 |
− | | style="vertical-align: middle; text-align: center;" |DD000F3133343536373839303132333435
| + | |} |
− | | style="vertical-align: middle; text-align: center;" |0802…(data elements)…02 | + | |
− | |- | |
− | |}
| |
| | | |
| + | Server must respond with acknowledgment: |
| | | |
− | Server must respond with acknowledgment:
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |UDP Channel Header
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Packet Acknowledgment
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Length – 0x0005,
| + | !style="background: black; color: white;"| UDP channel header !!style="background: black; color: white;"| AVL packet acknowledgment |
− | Packet ID – 0xCAFE,
| |
− | Not Usable Byte – 0x01
| |
− | | style="vertical-align: middle; text-align: center;" |AVL Packet ID – 0xDD,
| |
− | Number of Accepted Data – 0x02
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |0005CAFE01 | + | | Len – 5, |
− | | style="vertical-align: middle; text-align: center;" |DD02 | + | Id – 0xABCD, |
| + | |
| + | Not usable byte – 00 |
| + | |
| + | || AVL packet id – 0xDD, |
| + | NumberOfAcceptedData – 2 |
| + | |
| |- | | |- |
− | |}<br /> | + | | 0005ABCD01 || DD02 |
| + | |} |
| | | |
− | *'''Example'''
| + | == '''<big>Codec 8 Extended</big>''' == |
| | | |
− | Hexadecimal stream of AVL Data Packet receiving and response in this example are given in hexadecimal form. The different fields of packet are separate into different table columns for better readability and some of them are converted to ASCII values for better understanding. <br> <br>
| |
− | Received data in hexadecimal stream: <br>
| |
− | <code>003DCAFE0105000F33353230393330383634303336353508010000016B4F815B30010000000000000000000000000000000103021503010101425DBC000001</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet
| |
− | |-
| |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |AVL Data Packet Part
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
− | |-
| |
− | | rowspan="3" style="vertical-align: middle; text-align: center;" |UDP Channel Header
| |
− | | style="vertical-align: middle; text-align: center;" |Length
| |
− | | style="vertical-align: middle; text-align: center;" |00 3D
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Packet ID
| |
− | | style="vertical-align: middle; text-align: center;" |CA FE
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Not usable byte
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | rowspan="3" style="vertical-align: middle; text-align: center;" |AVL Packet Header
| |
− | | style="vertical-align: middle; text-align: center;" |AVL packet ID
| |
− | | style="vertical-align: middle; text-align: center;" |05
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |IMEI Length
| |
− | | style="vertical-align: middle; text-align: center;" |00 0F
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |IMEI
| |
− | | style="vertical-align: middle; text-align: center;" |33 35 32 30 39 33 30 38 36 34 30 33 36 35 35
| |
− | |-
| |
− | | rowspan="23" style="vertical-align: middle; text-align: center;" |AVL Data Array
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID
| |
− | | style="vertical-align: middle; text-align: center;" |08
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 1 (Records)
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Timestamp
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 01 6B 4F 81 5B 30 (GMT: Thursday, June 13, 2019 6:23:26 AM)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Priority
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Longitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Latitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Altitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Angle
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Satellites
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Speed
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Event IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N of Total ID
| |
− | | style="vertical-align: middle; text-align: center;" |03
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N1 of One Byte IO
| |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |15 (AVL ID: 21, Name: GSM Signal)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |03
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |01 (AVL ID: 1, Name: DIN1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N2 of Two Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |42 (AVL ID: 66, Name: External Voltage)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |5D BC
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N8 of Eight Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 2 (Number of Total Records)
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | |}
| |
| | | |
| | | |
− | Server response in hexadecimal stream:
| + | *'''Protocols overview''' |
− | <code>0005CAFE010501</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Server Response to AVL Data Packet
| |
− | |-
| |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |Server Response Part
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
− | |-
| |
− | | rowspan="3" style="vertical-align: middle; text-align: center;" |UDP Channel Header
| |
− | | style="vertical-align: middle; text-align: center;" |Length
| |
− | | style="vertical-align: middle; text-align: center;" |00 05
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Packet ID
| |
− | | style="vertical-align: middle; text-align: center;" |CA FE
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Not usable byte
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | rowspan="2" style="vertical-align: middle; text-align: center;" |AVL Packet Acknowledgment
| |
− | | style="vertical-align: middle; text-align: center;" |AVL packet ID
| |
− | | style="vertical-align: middle; text-align: center;" |05
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Accepted Data
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | |} <br />
| |
| | | |
− | =='''<big>Codec 8 Extended</big>'''==
| |
| | | |
− | *'''<big>Protocols overview</big>'''
| + | Difference between codec8 and codec8 extended |
| | | |
− | Codec8 Extended is using for FMBXXX family devices. This protocol looks familiar like Codec8 but they have some differences. Main differences between are shown in below table:
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec8
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec8 Extended
| |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Codec ID | + | ! style="background: black; color: white;"| !!style="background: black; color: white;"| Codec 8 !!style="background: black; color: white;"| Codec 8 Extended |
− | | style="vertical-align: middle; text-align: center;" |0x08
| |
− | | style="vertical-align: middle; text-align: center;" |0x8E
| |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data IO element length
| + | | Codec ID || 0x08 || 0x8E |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data IO element total IO count length
| + | | AVL Data IO element length || 1 Byte || 2 Bytes |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data IO element IO count length
| + | | AVL Data IO element total IO count length || 1 Byte || 2 Bytes |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data IO element AVL ID length
| + | | AVL Data IO element IO count length || 1 Byte || 2 Bytes |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Variable size IO elements
| + | | AVL Data IO element AVL ID length || 1 Byte || 2 Bytes |
− | | style="vertical-align: middle; text-align: center;" |Does not include | |
− | | style="vertical-align: middle; text-align: center;" |Includes variable size elements | |
| |- | | |- |
− | |} <br /> | + | | Variable size IO elements || Does not include || Includes variable size elements |
| + | |} |
| + | <small>Table 2. Codec 8 and 8 Extended differences |
| + | </small> |
| + | |
| + | Main differences between are shown in above table. AVL data element sizes in codec 8 extended protocol were increased to 2 bytes length and new variable type added. For more detailed description look in codec 8 |
| + | and codec 8 extended chapters. |
| + | |
| | | |
− | *'''<big>Codec 8 Extended protocol sending over TCP</big>''' | + | *'''Codec 8 extended protocol sending over TCP''' |
| | | |
− | *'''AVL data packet'''
| |
| | | |
− | Below table represents AVL data packet structure: | + | '''AVL data packet''' |
− | {| class="nd-othertables_2" style="width:100%;" | + | |
− | |+
| + | Below table represents AVL data packet structure. |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x00000000 (Preamble)
| + | {| class="wikitable" |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Data Field Length
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec ID
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Number of Data 1
| |
− | ! colspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Number of Data 2
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| + | ! style="background: black; color: white;"|4 zeros !! style="background: black; color: white;"|Data field length !! style="background: black; color: white;"|Codec ID !! style="background: black; color: white;"|Number of |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| + | Data 1 |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| + | !! style="background: black; color: white;"|AVL Data !! style="background: black; color: white;"|Number of |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| + | Data 2 |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| + | !! style="background: black; color: white;"|CRC-16 |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
| |- | | |- |
| + | | 4 Bytes || 4 Bytes || 1 Byte || 1 Byte || 38-768 |
| + | Bytes |
| + | || 1 Byte || 4 Bytes |
| |} | | |} |
| + | <small>Table 3. AVL data packet structure</small> |
| + | |
| + | |
| + | Number of data – number of encoded data (number of records). Codec ID is constant 0x8E. |
| + | |
| + | Data field length is the length of bytes [codec id, number of data 2]. Number of data 1 should always be equal to number of data 2 byte. |
| + | |
| + | CRC-16 is 4 bytes, but first two are zeroes and last two are CRC-16 calculated for [codec id, number of data |
| + | 2] |
| | | |
| + | Minimum AVL packet size is 53 bytes (all IO elements disabled). |
| | | |
− | '''Preamble''' – the packet starts with four zero bytes. <br>
| |
− | '''Data Field Length''' – size is calculated starting from Codec ID to Number of Data 2. <br>
| |
− | '''Codec ID''' – in Codec8 Extended it is always <code>0x8E</code>. <br>
| |
− | '''Number of Data 1''' – a number which defines how many records is in the packet. <br>
| |
− | '''AVL Data''' – actual data in the packet (more information below). <br>
| |
− | '''Number of Data 2''' – a number which defines how many records is in the packet. This number must be the same as “Number of Data 1”. <br>
| |
− | '''CRC-16''' – calculated from Codec ID to the Second Number of Data. CRC (Cyclic Redundancy Check) is an error-detecting code using for detect accidental changes to RAW data. For calculation we are using [[Codec#CRC-16|CRC-16/IBM]].<br> <br>
| |
− | '''Note:''' for [[FMB630]], [[FMB640]] and [[FM6300|FM63XY]], minimum AVL packet size is 45 bytes (all IO elements disabled). Maximum AVL packet size is 255 bytes. For other devices, minimum AVL packet size is 45 bytes (all IO elements disabled). Maximum AVL packet size is 1280 bytes. <br>
| |
| | | |
− | *AVL Data | + | *'''AVL Data''' |
| | | |
− | Below table represents AVL Data structure:
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Timestamp
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Priority
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |GPS Element
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |IO Element
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |8 bytes
| + | !style="background: black; color: white;"| Timestamp !!style="background: black; color: white;"| Timestamp Priority !!style="background: black; color: white;"| GPS Element !!style="background: black; color: white;"| IO Element |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |15 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| |
| |- | | |- |
| + | | 8 Bytes || 1 Byte || 15 Bytes || 14 - 744 |
| |} | | |} |
| + | <small>Table 4. AVL data structure</small> |
| | | |
| | | |
− | '''Timestamp''' – a difference, in milliseconds, between the current time and midnight, January, 1970 UTC (UNIX time). <br>
| + | *'''Priority''' |
− | '''Priority''' – field which define AVL data priority (more information below). <br> | + | {| class="wikitable" |
− | '''GPS Element''' – locational information of the AVL data (more information below). <br>
| |
− | '''IO Element''' – additional configurable information from device (more information below). <br>
| |
− | | |
− | *Priority
| |
− | | |
− | Below table represents Priority values. Packet priority depends on device configuration and records sent.
| |
− | {| class="nd-othertables_2" style="width:25%;" | |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Priority
| |
| |- | | |- |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |0
| + | | style="background: black; color: white;"| 0 || Low |
− | | style="vertical-align: middle; text-align: center;" |Low | |
| |- | | |- |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |1
| + | | style="background: black; color: white;"| 1 || High |
− | | style="vertical-align: middle; text-align: center;" |High | |
| |- | | |- |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |2
| + | | style="background: black; color: white;"| 2 || Panic |
− | | style="vertical-align: middle; text-align: center;" |Panic | + | |} |
− | |} <br /> | + | <small>Table 5. Priority element values</small> |
| + | |
| | | |
− | *GPS element | + | *'''GPS Element''' |
| | | |
− | Below table represents GPS Element structure:
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Longitude
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Latitude
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Altitude
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Angle
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Satellites
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Speed
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| + | !style="background: black; color: white;"| Longitude !!style="background: black; color: white;"| Latitude !!style="background: black; color: white;"| Altitude !!style="background: black; color: white;"| Angle !!style="background: black; color: white;"| Satellites !!style="background: black; color: white;"| Speed |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
| |- | | |- |
| + | | 4 Bytes || 4 Bytes || 2 Bytes || 2 Bytes || 1 Byte || 2 Bytes |
| |} | | |} |
| + | <small>Table 6. GPS element structure</small> |
| | | |
| | | |
− | '''Longitude''' – east – west position. <br>
| + | *<big>IO Element</big> |
− | '''Latitude''' – north – south position. <br>
| |
− | '''Altitude''' – meters above sea level. <br>
| |
− | '''Angle''' – degrees from north pole. <br>
| |
− | '''Satellites''' – number of visible satellites. <br>
| |
− | '''Speed''' – speed calculated from satellites. <br> <br>
| |
− | '''Note:''' If record are without valid coordinates – (there were no GPS fix in the moment of data acquisition) – Longitude, Latitude and Altitude values are last valid fix, and Angle, Satellites and Speed are 0. <br> <br>
| |
− | Longitude and latitude are integer values built from degrees, minutes, seconds and milliseconds by formula: <br>
| |
− | [[Image:GPS.png]]
| |
− | <br>
| |
− | Where: <br>
| |
− | d – Degrees; m – Minutes; s – Seconds; ms – Milliseconds; p – Precision (10000000) <br>
| |
− | If longitude is in west or latitude in south, multiply result by –1. <br> <br>
| |
− | Note: <br>
| |
− | To determine if the coordinate is negative, convert it to binary format and check the very first bit. If it is <code>0</code>, coordinate is positive, if it is <code>1</code>, coordinate is negative. <br> <br>
| |
− | Example: <br>
| |
− | Received value: <code>20 9C CA 80</code> converted to BIN: <code>00100000 10011100 11001010 10000000</code> first bit is 0, which means coordinate is positive converted to DEC: <code>547146368</code>. For more information see two‘s complement arithmetic. <br>
| |
− | | |
− | *IO Element
| |
| | | |
− | {| class="nd-othertables_2" style="width:100%;" | + | {| class="wikitable" |
− | |+
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |Event IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | rowspan="33" style=" width:5%; vertical-align: middle; text-align: left;" |
| |
− | | rowspan="33" style=" width:65%; vertical-align: middle; text-align: left;" |'''Event IO ID''' – if data is acquired on event – this field defines which IO property has changed and generated an event. For example, when if Ignition state changed and it generate event, Event IO ID will be 0x00EF (AVL ID: 239). If it’s not eventual record – the value is 0x0000. <br>
| |
− | '''N''' – a total number of properties coming with record (N = N1 + N2 + N4 + N8). <br>
| |
− | '''N1''' – number of properties, which length is 1 byte. <br>
| |
− | '''N2''' – number of properties, which length is 2 bytes. <br>
| |
− | '''N4''' – number of properties, which length is 4 bytes. <br>
| |
− | '''N8''' – number of properties, which length is 8 bytes. <br>
| |
− | '''NX''' – a number of properties, which length is defined by length element.
| |
− | '''N’th IO ID''' - AVL ID. <br>
| |
− | '''N'th Lenght''' - AVL ID value lenght. <br>
| |
− | '''N’th IO Value''' - AVL ID value. <br> <br>
| |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N of Total IO
| + | |style="background: black; color: white;"| Event IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N1 of One Byte IO
| + | |style="background: black; color: white;"| N of Total IO || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| + | |style="background: black; color: white;"| N1 of One Byte IO || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| + | |style="background: black; color: white;"| 1'st IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |... | + | |style="background: black; color: white;"| 1'st IO Value || 1 bytes |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N1’th IO ID
| + | | || |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N1’th IO Value
| + | |style="background: black; color: white;"| N1'th IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |1 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N2 of Two Bytes
| + | |style="background: black; color: white;"| N1'st IO Value || 1 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| + | |style="background: black; color: white;"| N2 of Two Byte IO || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| + | |style="background: black; color: white;"| 1'st IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |... | + | |style="background: black; color: white;"| 1'st IO Value || 2 bytes |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N2’th IO ID
| + | | || |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N2’th IO Value
| + | |style="background: black; color: white;"| N2'th IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N4 of Four Bytes
| + | |style="background: black; color: white;"| N2'st IO Value || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| + | |style="background: black; color: white;"| N4 of Four Byte IO || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| + | |style="background: black; color: white;"| 1'st IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |4 bytes | |
| |- | | |- |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |... | + | |style="background: black; color: white;"| 1'st IO Value || 4 bytes |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N4’th IO ID
| + | | || |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N4’th IO Value
| + | |style="background: black; color: white;"| N4'th IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |4 byte | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N8 of Eight Bytes
| + | |style="background: black; color: white;"| N4'st IO Value || 4 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| + | |style="background: black; color: white;"| N2 of Eight Byte IO || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| + | |style="background: black; color: white;"| 1'st IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |8 byte | |
| |- | | |- |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |... | + | |style="background: black; color: white;"| 1'st IO Value || 8 bytes |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N8’IO ID
| + | | || |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N8’IO Value
| + | |style="background: black; color: white;"| N8'th IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |8 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |NX of X Byte IO
| + | |style="background: black; color: white;"| N8'st IO Value || 8 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| + | |style="background: black; color: white;"| NX of X Byte IO || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Length
| + | |style="background: black; color: white;"| 1'st IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| + | |style="background: black; color: white;"| 1'st IO Length || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |Defined by lenght | |
| |- | | |- |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |... | + | |style="background: black; color: white;"| 1'st IO Value || defined by length |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |NX’th IO ID
| + | | || |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |NX’th Length
| + | |style="background: black; color: white;"| NX'st IO ID || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |2 bytes | |
| |- | | |- |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |NX’th Value
| + | |style="background: black; color: white;"| NX'st IO Length || 2 bytes |
− | | style="vertical-align: middle; text-align: center;" |Defined by lenght | |
| |- | | |- |
− | |} <br /> | + | |style="background: black; color: white;"| NX'st IO Value || defined by length |
| + | |} |
| + | <small>Table 7. IO element structure</small> |
| + | |
| + | N - total number of properties coming with record (N=N1+N2+N4+N8+NX) |
| + | |
| + | N1 - number of properties, which length is 1 byte |
| + | |
| + | N2 - number of properties, which length is 2 bytes |
| + | |
| + | N4 - number of properties, which length is 4 bytes |
| + | |
| + | N8 - number of properties, which length is 8 bytes |
| + | |
| + | NX - number of properties, which length is defined by length element |
| + | |
| | | |
| *'''Communication with server''' | | *'''Communication with server''' |
| | | |
− | Communication with server is the same as with Codec8 protocol, except in Codec8 Extended protocol Codec ID is 0x8E. <br> | + | Communication with server is the same as with codec 8 protocol, except in codec8 extended protocol codec id is 0x8E. |
| + | |
| + | |
| + | Example: |
| + | |
| + | Module connects to server and sends IMEI: |
| + | |
| + | 000f333536333037303432343431303133 |
| + | |
| + | Server accepts the module: |
| + | |
| + | 01 |
| | | |
− | *Example:
| |
| | | |
− | Module connects to server and sends IMEI: <br>
| + | Module sends data packet |
− | <code>000F333536333037303432343431303133</code> <br>
| + | {| class="wikitable" |
− | Server accepts the module: <br>
| |
− | <code>01</code> <br>
| |
− | Module sends data packet: | |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet Header
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Array
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Four Zero Bytes – 0x00000000,
| + | !style="background: black; color: white;"| AVL data packet header !!style="background: black; color: white;"| AVL data array !!style="background: black; color: white;"| CRC |
− | “AVL Data Array” length – 0x000000FE
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID – 0x8E,
| |
− | Number of Data – '''0x02''' <br>
| |
− | (Encoded using continuous bit stream. Last byte padded to align to byte boundary)
| |
− | | style="vertical-align: middle; text-align: center;" |CRC of “AVL Data Array”
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |00000000000000FE | + | | Four zero bytes, |
− | | style="vertical-align: middle; text-align: center;" |8E'''02'''...(data elements)...'''02''' | + | ‘AVL data array’ length – 254 |
− | | style="vertical-align: middle; text-align: center;" |00008612 | + | || Codec Id – 8E, NumberOfData – 02. |
| + | (Encoded using continuous bit stream. |
| + | |
| + | Last byte padded to align to byte boundary) |
| + | || CRC of ‘AVL data array’ |
| |- | | |- |
| + | | 00000000000000FE || 8E02...(data elements)...02 || 00008612 |
| |} | | |} |
| + | <small>Table 8. IO element structure |
| + | </small> |
| + | |
| + | Server acknowledges data reception (2 data elements): |
| + | 00000002 |
| + | |
| + | *'''Example''' |
| + | |
| + | Received data: |
| + | |
| + | |
| + | |
| + | <span style="background-color: #A4A4A4">00000000</span><span style="background-color: #58ACFA">0000005F</span><span style="background-color: #04B431">8E</span><span style="background-color: #FF0000">01</span><span style="background-color: #8000FF">0000015FBA40B620</span><span style="background-color: #81BEF7">00</span><span style="background-color: #F4FA58">0F0DCDE4</span><span style="background-color: #FF8000">20959D30</span><span style="background-color: #3ADF00">008A</span><span style="background-color: #21610B">0000</span>060000<span style="background-color: #58ACFA">0000</span><span style="background-color: #0404B4">0006</span><span style="background-color: #DF7401">0001</span>00EF0 |
| + | 0<span style="background-color: #DF7401">0001</span>0011001E<span style="background-color: #DF7401">0001</span>00100000CBDF<span style="background-color: #DF7401">0002</span>000B000000003544C875000E0000000029BFE4D1<span style="background-color: #DF7401">0001</span>01000011 |
| + | 0000000000000000000000000000000000<span style="background-color: #FF0000">01</span><span style="background-color: #F781F3">0000D153</span> |
| + | |
| + | |
| + | <span style="background-color: #A4A4A4">00000000</span> 4 zeros, 4 bytes |
| + | |
| + | <span style="background-color: #58ACFA">0000005F</span> data length, 4 bytes |
| + | |
| + | <span style="background-color: #04B431">8E</span> – Codec ID |
| + | |
| + | <span style="background-color: #FF0000">01</span>- Number of Data (1 record) |
| + | |
| + | 1’st record data |
| + | |
| + | <span style="background-color: #8000FF">0000015FBA40B620</span> – Timestamp in milliseconds (1510658324000) |
| + | |
| + | GMT: Tuesday, November 14, 2017 11:18:44 AM |
| + | |
| + | <span style="background-color: #81BEF7">00</span> – Priority |
| + | |
| + | '''GPS Element''' |
| + | |
| + | <span style="background-color: #F4FA58">0F0DCDE4</span> – Longitude 252562916 = 25, 2562916º N |
| + | |
| + | <span style="background-color: #FF8000">20959D30</span> – Latitude 546676016 = 54,6676016 º E |
| + | |
| + | <span style="background-color: #3ADF00">008A</span> – Altitude 138 meters |
| + | |
| + | <span style="background-color: #21610B">0000</span> – Angle 0º |
| + | |
| + | 06 – 6 Visible satellites |
| + | |
| + | 0000 – 0 km/h speed |
| + | |
| + | IO Element |
| + | |
| + | <span style="background-color: #58ACFA">0000</span> – IO element ID of Event generated (in this case when 0000 – data generated not on event) |
| + | |
| + | <span style="background-color: #0404B4">0006</span> – 6 IO elements in record (total) |
| + | |
| + | <span style="background-color: #DF7401">0001</span> – 1 IO elements, which length is 1 Byte |
| + | |
| + | 00EF – IO element ID = 239 (dec) |
| + | |
| + | 00 – IO element’s value |
| + | |
| + | <span style="background-color: #DF7401">0001</span> – 1 IO elements, which length is 2 Byte |
| + | |
| + | 0011 – IO element ID = 17 (dec ) |
| + | |
| + | 001E – IO element’s value |
| + | |
| + | <span style="background-color: #DF7401">0001</span> – 1 IO elements, which length is 4 Byte |
| + | |
| + | 0010 – IO element ID = 16 (dec ) |
| + | |
| + | 0000CBDF – IO element’s value = 52191 (dec ) |
| + | |
| + | <span style="background-color: #DF7401">0002</span> – 2 IO elements, which length is 2 Byte |
| + | |
| + | 000B – IO element ID = 11 (dec ) |
| + | |
| + | 000000003544C875 – IO element’s value |
| + | |
| + | 000E – IO element ID = 14 (dec ) |
| + | |
| + | 0000000029BFE4D1 – IO element’s value |
| + | |
| + | <span style="background-color: #FF0000">01</span> – Number of Data (1 record) |
| + | |
| + | <span style="background-color: #F781F3">0000D153</span> – CRC-16, 4 Bytes (first 2 are always zeros |
| + | |
| + | |
| + | '''<big>Codec 8 extended protocol sending over UDP</big>''' |
| + | |
| + | *'''AVL data packet''' |
| | | |
| + | AVL data packet is the same as with codec 8, except codec ID is changed to 0x8E. |
| | | |
− | Server acknowledges data reception (2 data elements): '''<code>00000002</code>''' <br>
| |
| | | |
− | *'''Example'''
| + | Example: |
| | | |
− | Hexadecimal stream of AVL Data Packet receiving and response in this example are given in hexadecimal form. The different fields of packet are separate into different table columns for better readability and some of them are converted to ASCII values for better understanding. <br> <br>
| + | Module sends the data: |
− | Received data in hexadecimal stream: <br>
| + | {| class="wikitable" |
− | <code>000000000000004A8E010000016B412CEE000100000000000000000000000000000000010005000100010100010011001D00010010015E2C880002000B000000003544C87
| |
− | A000E000000001DD7E06A00000100002994</code> <br> <br>
| |
− | Parsed data:
| |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet
| |
| |- | | |- |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |AVL Data Packet Part | + | !style="background: black; color: white;"| UDP channel header !!style="background: black; color: white;"| AVL packet header !!style="background: black; color: white;"| AVL data array |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part | |
| |- | | |- |
− | | rowspan="4" style="vertical-align: middle; text-align: center;" | | + | | Len – 253, |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes | + | Id – 0xCAFE, |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | + | |
| + | Not usable byte – 00 |
| + | |
| + | || AVL packet id – 0xDD, |
| + | IMEI – 1234567890123456 |
| + | || Codec Id – 8E, NumberOfData – 02. |
| + | (Encoded using continuous bit stream |
| + | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Data Field Length | + | | 00FDCAFE01 || DD000F3133343536373839303132333435 ||8E02…(data elements)…02 |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 4A | + | |} |
| + | <small>Table 9. Example packet send to server</small> |
| + | |
| + | |
| + | Server must respond with acknowledgment: |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Codec ID
| + | !style="background: black; color: white;"| UDP channel header!!style="background: black; color: white;"| AVL packet acknowledgment |
− | | style="vertical-align: middle; text-align: center;" |8E
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 1 (Records) | + | | Len – 5, |
− | | style="vertical-align: middle; text-align: center;" |01
| + | Id – 0xCAFE, |
| + | |
| + | Not usable byte – 00 |
| + | |
| + | || AVL packet id -0xDD |
| + | Number of Accepted Data -2 |
| |- | | |- |
− | | rowspan="25" style="vertical-align: middle; text-align: center;" |AVL Data | + | | 0005CAFE01 || DD02 |
− | | style="vertical-align: middle; text-align: center;" |Timestamp
| + | |} |
− | | style="vertical-align: middle; text-align: center;" |00 00 01 6B 41 2C EE 00 (GMT: Monday, June 10, 2019 11:36:32 AM)
| + | <small>Table 10. Example packet server response</small> |
| + | |
| + | |
| + | Example |
| + | |
| + | Server received data: |
| + | |
| + | [[Image:Penkt.png|Penkt.png]] |
| + | |
| + | '''Data length''': 00a1 or 161 Bytes (not counting the first 2 data length bytes) |
| + | |
| + | '''Packet identification''': 0xCAFE 2 bytes |
| + | |
| + | '''Not usable byte''': 00 |
| + | |
| + | '''Packet id''': 1b |
| + | |
| + | '''Imei length''': 000f |
| + | |
| + | '''Actual imei''': 333536333037303432343431303133 |
| + | |
| + | '''Codec id''': 8E |
| + | |
| + | '''Number of data''': 01 |
| + | |
| + | '''Timestamp''': 0000013febdd19c8 |
| + | |
| + | '''Priority''': 00 |
| + | |
| + | '''GPS data''': 0f0e9ff0209a718000690000120000 |
| + | |
| + | == '''<big>Codec 12</big>''' == |
| + | |
| + | *'''About Codec12''' |
| + | |
| + | Codec12 is original Teltonika protocol for device-server communication over GPRS messages. |
| + | |
| + | Codec12 GPRS commands can be used for sending configuration, debug, digital outputs control commands or other (special purpose command on special firmware versions). |
| + | This protocol is also necessary for using FMB63/FM63/FM5300/FM5500/FM4200 features like: Garmin, LCD communication, COM TCP Link Mode. |
| + | |
| + | *'''FM firmware requirements''' |
| + | |
| + | Supported GPRS commands on each device depend on firmware version. For available GPRS commands on each device, please refer to Table1 FM firmware requirement “SMS over GPRS” means that all standard SMS commands text can be sent to device via GPRS in Codec12 format. |
| + | |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Priority | + | !style="background: black; color: white;"| Device !!style="background: black; color: white;"| SMS over GPRS !!style="background: black; color: white;"| SMS over GPRS via UDP !!style="background: black; color: white;"| Special Codec12 GPRS commands |
− | | style="vertical-align: middle; text-align: center;" |01 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Longitude | + | | FM11YX || Available since base firmware 01.11.XX || Since base firmware |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | + | 1.26.00 |
| + | || Available in FM1100 and FM1110 special firmware version 12.XX.XX* |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Latitude | + | | FM12YX || Available since base firmware 01.03.XX || - || Available in FM12YX special firmware 09.XX.XX* |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Altitude | + | | FM10YX || Available since base firmware 00.03.XX || - || Available since base firmware 00.06.XX and later versions** |
− | | style="vertical-align: middle; text-align: center;" |00 00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Angle | + | | FM3400 || Available since base firmware 01.01.XX || - || - |
− | | style="vertical-align: middle; text-align: center;" |00 00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Satellites | + | | FM36YX || Available in base firmware || Since base firmware 01.06.01 || - |
− | | style="vertical-align: middle; text-align: center;" |00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Speed | + | | FM5300 || Available in all firmware versions || - || Available in all firmware versions** |
− | | style="vertical-align: middle; text-align: center;" |00 00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Event IO ID | + | | FM5500 || Available in all firmware versions || - || Available in all firmware versions** |
− | | style="vertical-align: middle; text-align: center;" |00 01 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |N of Total ID | + | | FM2200 || Not available || - || Special firmware version 07.XX.XX* |
− | | style="vertical-align: middle; text-align: center;" |00 05 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |N1 of One Byte IO | + | | FM4200 || Not available || - || Special firmware version 42.XX.XX* |
− | | style="vertical-align: middle; text-align: center;" |00 01 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID | + | | FM63YX || Available in all firmware versions || Since base firmware 00.02.19 || Available in all firmware versions** |
− | | style="vertical-align: middle; text-align: center;" |00 01 (AVL ID: 1, Name: DIN1) | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value | + | | FMB9YX || Available in base firmware || Available in base firmware || - |
− | | style="vertical-align: middle; text-align: center;" |01 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |N2 of Two Bytes IO | + | | FMB0YX || Available in base firmware || Available in base firmware || - |
− | | style="vertical-align: middle; text-align: center;" |00 01 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID | + | | FMB1YX || Available in base firmware || Available in base firmware || - |
− | | style="vertical-align: middle; text-align: center;" |00 11 (AVL ID: 17, Name: Axis X) | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value | + | | FMB6YX || Available in all firmware versions || Since base firmware 00.02.19 || Available in all firmware versions** |
− | | style="vertical-align: middle; text-align: center;" |00 1D | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO | + | | FMA1YX || Available in base firmware || Since base firmware 1.26.00 || Available in special firmware version 12.XX.XX* |
− | | style="vertical-align: middle; text-align: center;" |00 01 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID | + | | FMA2YX || Available in base firmware || Available in base firmware || - |
− | | style="vertical-align: middle; text-align: center;" |00 10 (AVL ID: 16, Name: Total Odometer)
| + | |} |
| + | <small>Table 1. FM firmware requirement</small> |
| + | |
| + | '*' - supported special commands are listed on special firmware description. Please contact Your Teltonika sales manager for more details; |
| + | |
| + | '**' - supported special commands are listed on device user manual, chapter “GPRS Commands” |
| + | |
| + | |
| + | |
| + | *'''GPRS command session''' |
| + | |
| + | Following figure shows how GRPS command session is started over TCP. |
| + | [[Image:wq.png|wq.png]] |
| + | |
| + | First FM opens GPRS session and sends AVL data to server (refer FM protocols). Once all records are sent and correct sent data array acknowledgment is received by FM then GPRS commands in Hex can be sent to FM. |
| + | |
| + | The ACK (acknowledge of IMEI from server) is a one byte constant 0x01. The acknowledgement of each data array send from FMXXXX is four bytes integer – number of records received. |
| + | |
| + | Note, that GPRS session should remain active between FM and server, while GPRS commands are sent. For this reason active datalink timeout (global parameters in FMXXXX configuration) is recommended to be set to 259200 (maximum value). |
| + | |
| + | |
| + | *'''General Codec12 message structure''' |
| + | |
| + | The following diagram shows basic structure of Codec 12 messages. |
| + | |
| + | |
| + | Command message structure |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| + | ! 0x00000000 !! Data size !! 0x0C !! Command quantity !! 0x05 !! Command size !! Command !! <CR><LF> !! Command quantity !! CRC |
− | | style="vertical-align: middle; text-align: center;" |01 5E 2C 88
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |N8 of Eight Bytes IO | + | | 4 bytes || 4 bytes || 1 byte || 1 byte || 1 byte || 4 bytes || X bytes || 0D0A || 1 byte || 4 bytes |
− | | style="vertical-align: middle; text-align: center;" |00 02 | + | |} |
| + | |
| + | |
| + | Response message structure |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| + | ! 0x00000000 !! Data size !! 0x0C !! Command quantity !! 0x06 !! Command size !! Command !! Command quantity !! CRC |
− | | style="vertical-align: middle; text-align: center;" |00 0B (AVL ID: 11, Name: ICCID1)
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value | + | | 4 bytes || 4 bytes || 1 byte || 1 byte || 1 byte || 4 bytes || X bytes || 1 byte || 4 bytes |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 35 44 C8 7A | + | |} |
− | |- | + | |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO ID | + | |
− | | style="vertical-align: middle; text-align: center;" |00 0E (AVL ID: 14, Name: ICCID2) | + | Structure explanation: |
− | |-
| + | |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO Value
| + | The message starts with preamble field - four zero bytes. Then goes four bytes data size field (size is calculated from 0x0C field to the second command or response quantity field). Then follows one byte Codec ID field (in Codec 12 it is always 0x0C). Then goes command or response quantity field (it is ignored when parsing the message). After that goes one byte message type field. It can be 0x05 to denote command or 0x06 to denote response. Then follows four bytes command or response size field. After it follows the command or response field itself. After that goes the second command or response quantity field. At the end there’s four bytes CRC field. |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 1D D7 E0 6A
| + | |
− | |-
| + | Note that difference between commands and responses is message type field: 0x05 means command and 0x06 means response. |
− | | style="vertical-align: middle; text-align: center;" |NX of X Byte IO
| + | |
− | | style="vertical-align: middle; text-align: center;" |00 00
| + | The algorithm to calculate CRC is CRC-16 (also known as CRC-16-IBM). All the fields from codec ID to second command/response quantity field are used to calculate CRC. The algorithm of how to calculate |
− | |-
| + | |
− | | rowspan="2" style="vertical-align: middle; text-align: center;" |
| + | |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 2 (Number of Total Records)
| + | CRC is shown in Figure 3 CRC calculation algorithm. |
− | | style="vertical-align: middle; text-align: center;" |01
| + | |
− | |-
| + | [[Image:qqq.png|qqq.png]] |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| + | <small>Figure 3 CRC calculation algorithm</small> |
− | | style="vertical-align: middle; text-align: center;" |00 00 29 94
| + | |
− | |-
| + | |
− | |} | + | |
| + | *'''Command coding table''' |
| + | |
| + | Command has to be convert from ASCII characters (char) to hexadecimal (Hex) |
| + | |
| + | Table 2 ASCII conversion table |
| + | |
| + | [[Image:asa.png|asa.png]] |
| + | |
| + | |
| + | *'''Command parsing example''' |
| + | |
| + | Hexadecimal stream of command and answer in this example are given in hexadecimal form. The different fields of message are highlighted in gray and yellow for better readability and command is converted in ASCII for better understanding. |
| + | |
| + | '''Server command''' |
| + | |
| + | Hexadecimal stream: |
| + | |
| + | [[Image:sx.png|sx.png]] |
| | | |
| + | Parsed: |
| | | |
− | Server response: <code>00000001</code> <br>
| + | Preamble: 0x00000000 |
| | | |
− | *'''<big>Codec8 Extended protocol sending over UDP</big>'''
| + | Packet Length: 0x00000018 |
| | | |
− | *'''UDP channel protocol'''
| + | Codec: 0x0C |
| | | |
− | AVL data packet is the same as with Codec8, except Codec ID is changed to <code>0x8E</code>. AVL Data encoding performed according to Codec8 Extended protocol. <br>
| + | Quantity of commands: 0x01 |
| | | |
− | *'''Communication with server'''
| + | Command type: 0x05 |
| | | |
− | Module sends UDP channel packet with encapsulated AVL data packet. Server sends UDP channel packet with encapsulated response module validates AVL Packet ID and Number of accepted AVL elements. If server response with valid AVL Packet ID is not received within configured timeout, module can retry sending. <br>
| + | Command size: 0x00000010 |
| | | |
− | *Example:
| + | Command in ASCII after conversion: #GET DATAORDER<CR><LF> |
| | | |
− | Module sends the data:
| + | Quantity of commands: 0x01 |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |UDP Channel Header
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Packet Header
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Array
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Length – 0x00FE,
| |
− | Packet ID – 0xCAFE <br>
| |
− | Not Usable Byte – 0x01
| |
− | | style="vertical-align: middle; text-align: center;" |AVL Packet ID – 0xDD,
| |
− | IMEI Length – 0x000F <br>
| |
− | IMEI – 0x313233343536373839303132333435
| |
− | (Encoded using continuous bit stream. Last byte padded to align to byte boundary)
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID – 0x8E,
| |
− | Number of Data – 0x02 <br>
| |
− | (Encoded using continuous bit stream)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |00FECAFE01
| |
− | | style="vertical-align: middle; text-align: center;" |DD000F3133343536373839303132333435
| |
− | | style="vertical-align: middle; text-align: center;" |8E02…(data elements)…02
| |
− | |-
| |
− | |}
| |
| | | |
| + | CRC: 0x00004990 |
| | | |
− | Server must respond with acknowledgment:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |UDP Channel Header
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Packet Acknowledgment
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Length – 0x0005,
| |
− | Packet ID – 0xCAFE,
| |
− | Not Usable Byte – 0x01
| |
− | | style="vertical-align: middle; text-align: center;" |AVL Packet ID – 0xDD,
| |
− | Number of Accepted Data – 0x02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |0005CAFE01
| |
− | | style="vertical-align: middle; text-align: center;" |DD02
| |
− | |-
| |
− | |} <br />
| |
| | | |
− | *'''Example'''
| + | '''Device answer''' |
| | | |
− | Hexadecimal stream of AVL Data Packet receiving and response in this example are given in hexadecimal form. The different fields of packet are separate into different table columns for better readability and some of them are converted to ASCII values for better understanding. <br> <br> | + | Hexadecimal stream: |
− | Received data in hexadecimal stream: <br>
| |
− | <code>005FCAFE0107000F3335323039333038363430333635358E010000016B4F831C680100000000000000000000000000000000010005000100010100010011009D000100</code>
| |
− | <code>10015E2C880002000B000000003544C87A000E000000001DD7E06A000001</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet
| |
− | |-
| |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |AVL Data Packet Part
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
− | |-
| |
− | | rowspan="3" style="vertical-align: middle; text-align: center;" |UDP Channel Header
| |
− | | style="vertical-align: middle; text-align: center;" |Length
| |
− | | style="vertical-align: middle; text-align: center;" |00 5F
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Packet ID
| |
− | | style="vertical-align: middle; text-align: center;" |CA FE
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Not usable byte
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | rowspan="3" style="vertical-align: middle; text-align: center;" |AVL Packet Header
| |
− | | style="vertical-align: middle; text-align: center;" |AVL packet ID
| |
− | | style="vertical-align: middle; text-align: center;" |05
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |IMEI Length
| |
− | | style="vertical-align: middle; text-align: center;" |00 0F
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |IMEI
| |
− | | style="vertical-align: middle; text-align: center;" |33 35 32 30 39 33 30 38 36 34 30 33 36 35 35
| |
− | |-
| |
− | | rowspan="27" style="vertical-align: middle; text-align: center;" |AVL Data Array
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID
| |
− | | style="vertical-align: middle; text-align: center;" |8E
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 1 (Records)
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Timestamp
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 01 6B 4F 83 1C 68 (GMT: Thursday, June 13, 2019 6:25:21 AM)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Priority
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Longitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Latitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Altitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Angle
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Satellites
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Speed
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Event IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N of Total ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 05
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N1 of One Byte IO
| |
− | | style="vertical-align: middle; text-align: center;" |00 01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 01 (AVL ID: 1, Name: DIN1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00 01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N2 of Two Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00 01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 11 (AVL ID: 17, Name: Axis X)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00 1D
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00 01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 10 (AVL ID: 16, Name: Total Odometer)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |01 5E 2C 88
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N8 of Eight Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00 02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 0B (AVL ID: 11, Name: ICCID1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 35 44 C8 7A
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 0E (AVL ID: 14, Name: ICCID2)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 1D D7 E0 6A
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |NX of X Byte IO
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | |}
| |
| | | |
| + | [[Image:sds.png|sds.png]] |
| | | |
− | Server response in hexadecimal stream:
| |
− | <code>0005CAFE010701</code> <br> <br>
| |
| Parsed: | | Parsed: |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Server Response to AVL Data Packet
| |
− | |-
| |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |Server Response Part
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
− | |-
| |
− | | rowspan="3" style="vertical-align: middle; text-align: center;" |UDP Channel Header
| |
− | | style="vertical-align: middle; text-align: center;" |Length
| |
− | | style="vertical-align: middle; text-align: center;" |00 05
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Packet ID
| |
− | | style="vertical-align: middle; text-align: center;" |CA FE
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Not usable byte
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | rowspan="2" style="vertical-align: middle; text-align: center;" |AVL Packet Acknowledgment
| |
− | | style="vertical-align: middle; text-align: center;" |AVL packet ID
| |
− | | style="vertical-align: middle; text-align: center;" |07
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Accepted Data
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | |} <br>
| |
| | | |
− | =='''<big>Codec 16</big>'''== | + | Preamble: 0x00000000 |
| + | |
| + | Packet Length: 0x00000016 |
| + | |
| + | Codec: 0x0C |
| + | |
| + | Quantity of commands: 0x01 |
| + | |
| + | Command type: 0x06 |
| + | |
| + | Command size: 0x0000000E |
| + | |
| + | Command response is in ASCII after conversion: #DATAORDER=1<CR><LF> |
| + | |
| + | Quantity of commands: 0x01 |
| + | |
| + | CRC: 0x00000095 |
| + | |
| + | |
| + | |
| + | *'''Codec12 GPRS commands examples''' |
| + | |
| + | The example commands given in hexadecimal form separated by dollar signs are suitable to be sent from TCP server during data exchange session between FMXXXX device and server (for more details see Figure 1 Command session) The command can be sent from a terminal program such as Hercules (in TCP server mode). Simply write command as explained below into Hercules Send field and click Send button. The TCP server must be listening on specified port (see field Port and button Listen in Figure 4). |
| + | |
| + | [[Image:he.png|he.png]] |
| + | |
| + | <small>Figure 4 Hercules terminal GUI</small> |
| + | |
| | | |
− | *'''<big>Protocol overview</big>''' | + | *'''SMS over GPRS in Codec12 examples''' |
| | | |
− | Codec16 is using for FMB630/FM63XY devices. This protocol looks familiar like Codec8 but they have some differences. Main differences between are shown in table below:
| + | In case of sending SMS commands over GPRS, do not use SMS logins set during configuration or do not leave empty spaces before command. Devices and firmware versions that support SMS over GPRS are listed in Table1. |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec8
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec16
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Codec ID
| |
− | | style="vertical-align: middle; text-align: center;" |0x08
| |
− | | style="vertical-align: middle; text-align: center;" |0x10
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data IO element ID event length
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data IO element AVL ID length
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Generation Type
| |
− | | style="vertical-align: middle; text-align: center;" |Not Using
| |
− | | style="vertical-align: middle; text-align: center;" |Is Using
| |
− | |-
| |
− | |}
| |
| | | |
| + | '''Example 1: getinfo''' |
| | | |
− | '''Note:''' Codec16 is supported from firmware – 00.03.xx and newer. ([[FMB630]]/FM63XY) || AVL ID‘s which are higher than 255 will can be used only in Codec16 protocol. <br>
| + | Sending “getinfo” SMS command via GPRS Codec12: |
| | | |
− | *'''<big>Codec 16 protocol sending over TCP</big>'''
| + | Server requests: |
| + | |
| + | Hexadecimal stream: |
| | | |
− | *'''AVL data packet'''
| + | 00000000000000110C010500000009676574696E666F0D0A010000DA7E |
| + | |
| + | Parsed: |
| | | |
− | Below table represents AVL data packet structure:
| + | Zero: 0x00000000 |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x00000000 (Preamble)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Data Field Length
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec ID
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Number of Data 1
| |
− | ! colspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Number of Data 2
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | |-
| |
− | |}
| |
| | | |
| + | Packet Length: 0x00000011 |
| | | |
− | '''Preamble''' – the packet starts with four zero bytes. <br>
| + | Codec: 0x0C |
− | '''Data Field Length''' – size is calculated starting from Codec ID to Number of Data 2. <br>
| |
− | '''Codec ID''' – in Codec16 it is always 0x10. <br>
| |
− | '''Number of Data 1''' – a number which defines how many records is in the packet. <br>
| |
− | '''AVL Data''' – actual data in the packet (more information below). <br>
| |
− | '''Number of Data 2''' – a number which defines how many records is in the packet. This number must be the same as “Number of Data 1”. <br>
| |
− | '''CRC-16''' – calculated from Codec ID to the Second Number of Data. CRC (Cyclic Redundancy Check) is an error-detecting code using for detect accidental changes to RAW data. For calculation we are using [[Codec#CRC-16|CRC-16/IBM]].<br> <br>
| |
− | '''Note:''' for [[FMB630]] and FM63XY, minimum AVL packet size is 45 bytes (all IO elements disabled). Maximum AVL packet size is 255 bytes. <br>
| |
| | | |
− | *AVL Data
| + | Quantity of commands: 0x01 |
| | | |
− | Below table represents AVL Data structure:
| + | Command type: 0x05 |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Timestamp
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Priority
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |GPS Element
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |IO Element
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |8 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |15 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| |
− | |-
| |
− | |}
| |
| | | |
| + | Command size: 0x00000009 |
| | | |
− | '''Timestamp''' – a difference, in milliseconds, between the current time and midnight, January, 1970 UTC (UNIX time). <br>
| + | Command: 0x676574696e666f (HEX of getinfo) |
− | '''Priority''' – field which define AVL data priority (more information below). <br>
| |
− | '''GPS Element''' – location information of the AVL data (more information below). <br>
| |
− | '''IO Element''' – additional configurable information from device (more information below). <br>
| |
| | | |
− | *Priority
| + | Command end symbol: 0x0D0A |
| | | |
− | Below table represents Priority values. Packet priority depends on device configuration and records sent.
| + | Quantity of commands: 01 |
− | {| class="nd-othertables_2" style="width:25%;"
| |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Priority
| |
− | |-
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |0
| |
− | | style="vertical-align: middle; text-align: center;" |Low
| |
− | |-
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |1
| |
− | | style="vertical-align: middle; text-align: center;" |High
| |
− | |-
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |2
| |
− | | style="vertical-align: middle; text-align: center;" |Panic
| |
− | |} <br />
| |
| | | |
− | *GPS element
| + | CRC: 0x0000DA7E |
| | | |
− | Below table represents GPS Element structure:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Longitude
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Latitude
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Altitude
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Angle
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Satellites
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Speed
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | |}
| |
| | | |
| + | '''Device response:''' |
| | | |
− | '''Longitude''' – east – west position. <br>
| + | Hexadecimal stream: |
− | '''Latitude''' – north – south position. <br>
| + | |
− | '''Altitude''' – meters above sea level. <br>
| + | 00000000000000820C01060000007A494E493A323031312F312F3120303A30205254433A323031312F312F3120373A3333205253543A33204552523A302053523A3134372042523A302043463A312046473A3020464C3A302055543A3020534D533A30204E4F4750533A303A3134204750533A32205341543A302052533A36204D443A302052463A30010000B8AA |
− | '''Angle''' – degrees from north pole. <br>
| |
− | '''Satellites''' – number of visible satellites. <br>
| |
− | '''Speed''' – speed calculated from satellites. <br> <br>
| |
− | '''Note:''' If record are without valid coordinates – (there were no GPS fix in the moment of data acquisition) – Longitude, Latitude and Altitude values are last valid fix, and Angle, Satellites and Speed are 0. <br> <br>
| |
− | Longitude and latitude are integer values built from degrees, minutes, seconds and milliseconds by formula: <br>
| |
− | [[Image:GPS.png]]
| |
− | <br>
| |
− | Where: <br>
| |
− | d – Degrees; m – Minutes; s – Seconds; ms – Milliseconds; p – Precision (10000000) <br>
| |
− | If longitude is in west or latitude in south, multiply result by –1. <br> <br>
| |
− | Note: <br>
| |
− | To determine if the coordinate is negative, convert it to binary format and check the very first bit. If it is <code>0</code>, coordinate is positive, if it is <code>1</code>, coordinate is negative. <br> <br>
| |
− | Example: <br>
| |
− | Received value: <code>20 9C CA 80</code> converted to BIN: <code>00100000 10011100 11001010 10000000</code> first bit is 0, which means coordinate is positive converted to DEC: <code>547146368</code>. For more information see two‘s complement arithmetic. <br>
| |
| | | |
− | *IO Element
| |
| | | |
− | {| class="nd-othertables_2" style="width:100%;"
| + | Parsed: |
− | |+
| + | |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |Event IO ID
| + | Zero: 0x00000000 |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | rowspan="27" style=" width:5%; vertical-align: middle; text-align: left;" |
| |
− | | rowspan="27" style=" width:65%; vertical-align: middle; text-align: left;" |'''Event IO ID''' – if data is acquired on event – this field defines which IO property has changed and generated an event. For example, when if Ignition state changed and it generate event, Event IO ID will be 0xEF (AVL ID: 239). If it’s not eventual record – the value is 0. <br>
| |
− | '''Generation type''' - data event generation type. More information about it you can find here. <br>
| |
− | '''N''' – a total number of properties coming with record (N = N1 + N2 + N4 + N8). <br>
| |
− | '''N1''' – number of properties, which length is 1 byte. <br>
| |
− | '''N2''' – number of properties, which length is 2 bytes. <br>
| |
− | '''N4''' – number of properties, which length is 4 bytes. <br>
| |
− | '''N8''' – number of properties, which length is 8 bytes. <br>
| |
− | '''N’th IO ID''' - AVL ID. <br>
| |
− | '''N’th IO Value''' - AVL ID value. <br> <br>
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |Generation Type
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N of Total IO
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N1 of One Byte IO
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | |-
| |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |...
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N1’th IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N1’th IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N2 of Two Bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |...
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N2’th IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N2’th IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N4 of Four Bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | |-
| |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |...
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N4’th IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N4’th IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |4 byte
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N8 of Eight Bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |8 byte
| |
− | |-
| |
− | | colspan="2" style="vertical-align: middle; text-align: center;" |...
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N8’IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:15%; vertical-align: middle; text-align: center;" |N8’IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |8 bytes
| |
− | |-
| |
− | |} <br />
| |
| | | |
− | *Generation type
| + | Packet Length: 0x00000082 |
| | | |
− | {| class="nd-othertables_2" style="width:30%;"
| + | Codec: 0C |
− | |+
| |
− | ! rowspan="1" style="width:50%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Value
| |
− | ! rowspan="1" style="width:50%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Record Created
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |0
| |
− | | style="vertical-align: middle; text-align: center;" |On Exit
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1
| |
− | | style="vertical-align: middle; text-align: center;" |On Entrance
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2
| |
− | | style="vertical-align: middle; text-align: center;" |On Both
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |3
| |
− | | style="vertical-align: middle; text-align: center;" |Reserved
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |4
| |
− | | style="vertical-align: middle; text-align: center;" |Hysteresis
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |5
| |
− | | style="vertical-align: middle; text-align: center;" |On Change
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |6
| |
− | | style="vertical-align: middle; text-align: center;" |Eventual
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |7
| |
− | | style="vertical-align: middle; text-align: center;" |Periodical
| |
− | |-
| |
− | |} <br />
| |
| | | |
− | *'''Communication with server'''
| + | Quantity of commands: 01 |
| | | |
− | Communication with server is the same as with Codec8 protocol, except in Codec16 protocol Codec ID is <code>0x10</code> and has generation type. <br>
| + | Command type: 06 |
| | | |
− | *Example:
| + | Command size: 0x0000007A |
| | | |
− | Module connects to server and sends IMEI: <br>
| + | Command response in ASCII after conversion: INI:2011/1/1 0:0 RTC:2011/1/1 7:33 RST:3 ERR:0 SR:147 BR:0 CF:1 FG:0 FL:0 UT:0 SMS:0 NOGPS:0:14 GPS:2 SAT:0 |
− | <code>000F333536333037303432343431303133</code> <br>
| |
− | Server accepts the module: <br>
| |
− | <code>01</code> <br>
| |
− | Module sends data packet:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet Header
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Array
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Four Zero Bytes – 0x00000000,
| |
− | “AVL Data Array” length – 0x000000FE
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID – 0x10,
| |
− | Number of Data – '''0x02''' <br>
| |
− | (Encoded using continuous bit stream. Last byte padded to align to byte boundary)
| |
− | | style="vertical-align: middle; text-align: center;" |CRC of “AVL Data Array”
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |00000000000000FE
| |
− | | style="vertical-align: middle; text-align: center;" |10'''02'''...(data elements)...'''02'''
| |
− | | style="vertical-align: middle; text-align: center;" |00008612
| |
− | |-
| |
− | |}
| |
| | | |
| + | RS:6 MD:0 RF:0 (without <CR><LF>) |
| | | |
− | Server acknowledges data reception (2 data elements): '''<code>00000002</code>''' <br>
| + | Quantity of commands: 01 |
| | | |
− | *'''Example'''
| + | CRC: 0x0000B8AA |
| | | |
− | Hexadecimal stream of AVL Data Packet receiving and response in this example are given in hexadecimal form. The different fields of packet are separate into different table columns for better readability and some of them are converted to ASCII values for better understanding. <br> <br>
| |
− | Received data in hexadecimal stream: <br>
| |
− | <code>000000000000005F10020000016BDBC7833000000000000000000000000000000000000B05040200010000030002000B00270042563A00000000016BDBC78718</code>
| |
− | <code>00000000000000000000000000000000000B05040200010000030002000B00260042563A00000200005FB3</code> <br> <br>
| |
− | Parsed data:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet
| |
− | |-
| |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |AVL Data Packet Part
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
− | |-
| |
− | | rowspan="4" style="vertical-align: middle; text-align: center;" |
| |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Data Field Length
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 5F
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID
| |
− | | style="vertical-align: middle; text-align: center;" |10
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 1 (Records)
| |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | rowspan="23" style="vertical-align: middle; text-align: center;" |AVL Data
| |
− | (1'st record)
| |
− | | style="vertical-align: middle; text-align: center;" |Timestamp
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 01 6B DB C7 83 30 (GMT: Wednesday, July 10, 2019 12:06:54 PM)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Priority
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Longitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Latitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Altitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Angle
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Satellites
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Speed
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Event IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 0B
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Generation Type
| |
− | | style="vertical-align: middle; text-align: center;" |05
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N of Total ID
| |
− | | style="vertical-align: middle; text-align: center;" |04
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N1 of One Byte IO
| |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 01 (AVL ID: 1, Name: DIN1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 03 (AVL ID: 3, Name: DIN3)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N2 of Two Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 0B (AVL ID: 11, Name: ICCID1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00 27
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 42 (AVL ID: 66, Name: External Voltage)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |56 3A
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N8 of Eight Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | rowspan="23" style="vertical-align: middle; text-align: center;" |AVL Data
| |
− | (2'nd record)
| |
− | | style="vertical-align: middle; text-align: center;" |Timestamp
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 01 6B DB C7 87 18 (GMT: Wednesday, July 10, 2019 12:06:55 PM)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Priority
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Longitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Latitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Altitude
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Angle
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Satellites
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Speed
| |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Event IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 0B
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Generation Type
| |
− | | style="vertical-align: middle; text-align: center;" |05
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N of Total ID
| |
− | | style="vertical-align: middle; text-align: center;" |04
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N1 of One Byte IO
| |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 01 (AVL ID: 1, Name: DIN1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 03 (AVL ID: 3, Name: DIN3)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N2 of Two Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 0B (AVL ID: 11, Name: ICCID1)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |00 26
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO ID
| |
− | | style="vertical-align: middle; text-align: center;" |00 42 (AVL ID: 66, Name: External Voltage)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO Value
| |
− | | style="vertical-align: middle; text-align: center;" |56 3A
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |N8 of Eight Bytes IO
| |
− | | style="vertical-align: middle; text-align: center;" |00
| |
− | |-
| |
− | | rowspan="2" style="vertical-align: middle; text-align: center;" |
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 2 (Number of Total Records)
| |
− | | style="vertical-align: middle; text-align: center;" |02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 5F B3
| |
− | |-
| |
− | |}
| |
| | | |
| + | '''Example 2: getio''' |
| | | |
− | Server response: <code>00000002</code> <br> | + | Sending “getio” SMS command via GPRS Codec12: |
| + | |
| + | Server request: |
| + | |
| + | Hexadecimal stream: |
| + | |
| + | 000000000000000F0C010500000007676574696F0D0A0100003349 |
| + | |
| + | Parsed: |
| + | |
| + | Zero: 0x00000000 |
| | | |
− | *'''<big>Codec16 protocol sending over UDP</big>'''
| + | Packet Length: 0x0000000F |
− | *'''UDP channel protocol'''
| |
| | | |
− | AVL data packet is the same as with Codec8, except Codec ID is changed to <code>0x10</code>. AVL Data encoding performed according to Codec16 protocol. <br>
| + | Codec: 0x0C |
| | | |
− | *'''Communication with server'''
| + | Quantity of commands: 0x01 |
| | | |
− | Module sends UDP channel packet with encapsulated AVL data packet. Server sends UDP channel packet with encapsulated response module validates AVL Packet ID and Number of accepted AVL elements. If server response with valid AVL Packet ID is not received within configured timeout, module can retry sending. <br>
| + | Command type: 0x05 |
| | | |
− | *Example:
| + | Command size: 0x00000007 |
| | | |
− | Module sends the data:
| + | Command: 0x676574696f (HEX of getio) |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |UDP Channel Header
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Packet Header
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Array
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Length – 0x00FE,
| |
− | Packet ID – 0xCAFE <br>
| |
− | Not Usable Byte – 0x01
| |
− | | style="vertical-align: middle; text-align: center;" |AVL Packet ID – 0xDD,
| |
− | IMEI Length – 0x000F <br>
| |
− | IMEI – 0x313233343536373839303132333435
| |
− | (Encoded using continuous bit stream. Last byte padded to align to byte boundary) | |
− | | style="vertical-align: middle; text-align: center;" |Codec ID – 0x10,
| |
− | Number of Data – 0x02 <br>
| |
− | (Encoded using continuous bit stream)
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |00FECAFE01
| |
− | | style="vertical-align: middle; text-align: center;" |DD000F3133343536373839303132333435
| |
− | | style="vertical-align: middle; text-align: center;" |1002…(data elements)…02
| |
− | |-
| |
− | |}
| |
| | | |
| + | Command end symbol: 0x0D0A |
| | | |
− | Server must respond with acknowledgment:
| + | Quantity of commands: 01 |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |UDP Channel Header
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Packet Acknowledgment
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Length – 0x0005,
| |
− | Packet ID – 0xCAFE,
| |
− | Not Usable Byte – 0x01
| |
− | | style="vertical-align: middle; text-align: center;" |AVL Packet ID – 0xDD,
| |
− | Number of Accepted Data – 0x02
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |0005CAFE01
| |
− | | style="vertical-align: middle; text-align: center;" |DD02
| |
− | |-
| |
− | |} <br />
| |
| | | |
− | *'''Example'''
| + | CRC: 00003349 |
| + | |
| | | |
− | Hexadecimal stream of AVL Data Packet receiving and response in this example are given in hexadecimal form. The different fields of packet are separate into different table columns for better readability and some of them are converted to ASCII values for better understanding. <br> <br>
| + | '''Device response:''' |
− | Received data in hexadecimal stream: <br>
| + | |
− | <code>015BCAFE0101000F33353230393430383532333135393210070000015117E40FE80000000000000000000000000000000000EF05050400010000030000B4000</code>
| + | Hexadecimal stream: |
− | <code>0EF01010042111A000001</code> <br> <br>
| + | |
| + | 000000000000002C0C0106000000244449313A30204449323A30204449333A302041494E3A323420444F313A3020444F323A30010000F925 |
| + | |
| Parsed: | | Parsed: |
− | {| class="nd-othertables_2" style="width:100%;"
| + | |
− | |+
| + | Zero: 0x00000000 |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |AVL Data Packet
| + | |
| + | Packet Length: 0x0000002C |
| + | |
| + | Codec: 0C |
| + | |
| + | Quantity of commands: 01 |
| + | |
| + | Command type: 06 |
| + | |
| + | Command size: 0x00000024 |
| + | |
| + | Command response in ASCII after conversion: DI1:0 DI2:0 DI3:0 AIN:24 DO1:0 DO2:0 (without <CR><LF>) |
| + | |
| + | Quantity of commands: 01 |
| + | |
| + | CRC: 0x0000F925 |
| + | |
| + | |
| + | |
| + | |
| + | *'''Special Codec12 commands:''' |
| + | |
| + | |
| + | '''Example 1: #GET VERSION''' |
| + | |
| + | Server command - #GET VERSION<CR><LF> |
| + | |
| + | Device response - #VERSION=XXXXXXXX<CR><LF> |
| + | |
| + | XXXXXXXX – Device Firmware Version (up to 8 characters) |
| + | |
| + | $00$00$00$00$00$00$00$16$0C$01$05$00$00$00$0E$23$47$45$54$20$56$45$52$53$49$4f$4e$0D$0A$01$00$00$D0$C8 |
| + | |
| + | |
| + | '''Example 2: #GET NETWORK''' |
| + | |
| + | Server command - #GET NETWORK<CR><LF> |
| + | |
| + | Device response - #NETWORK=XXXXXX<CR><LF> |
| + | |
| + | XXXXXX – GSM Operator Network [0 - 999999] |
| + | |
| + | $00$00$00$00$00$00$00$16$0C$01$05$00$00$00$0E$23$47$45$54$20$4e$45$54$57$4f$52$4b$0D$0A$01$00$00$ED$61 |
| + | |
| + | == '''<big>Codec 13</big>''' == |
| + | |
| + | *'''About Codec13''' |
| + | |
| + | Codec13 is original Teltonika protocol for device-server communication over GPRS messages. This protocol is necessary for using following FM features: COM TCP Link Mode (binary/ASCII/binary buffered/ASCII buffered) if message timestamp parameter is enabled in device configuration. Codec13 messages are one way only (Codec 13 is used for FM->Server sending). |
| + | |
| + | *'''FM firmware requirements''' |
| + | |
| + | Codec13 availability depends on device and firmware version. |
| + | |
| + | |
| + | {| class="wikitable" |
| |- | | |- |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |AVL Data Packet Part | + | !style="background: black; color: white;"| Device !!style="background: black; color: white;"| Availability |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part | |
| |- | | |- |
− | | rowspan="3" style="vertical-align: middle; text-align: center;" |UDP Channel Header | + | | FM11YX || Available since base firmware 01.18.XX |
− | | style="vertical-align: middle; text-align: center;" |Length
| |
− | | style="vertical-align: middle; text-align: center;" |01 5B
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Packet ID | + | | FM12YX || Not available |
− | | style="vertical-align: middle; text-align: center;" |CA FE | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Not usable byte | + | | FM10YX || Not available |
− | | style="vertical-align: middle; text-align: center;" |01
| |
| |- | | |- |
− | | rowspan="3" style="vertical-align: middle; text-align: center;" |AVL Packet Header | + | | FM3400 || Not available |
− | | style="vertical-align: middle; text-align: center;" |AVL packet ID | |
− | | style="vertical-align: middle; text-align: center;" |07
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |IMEI Length | + | | FM5300 || Not available |
− | | style="vertical-align: middle; text-align: center;" |00 0F | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |IMEI | + | | FM5500 || Not available |
− | | style="vertical-align: middle; text-align: center;" |33 35 32 30 39 34 30 38 35 32 33 31 35 39 32 | |
| |- | | |- |
− | | rowspan="28" style="vertical-align: middle; text-align: center;" |AVL Data Array | + | | FM2200 || Not available |
− | | style="vertical-align: middle; text-align: center;" |Codec ID | |
− | | style="vertical-align: middle; text-align: center;" |10
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 1 (Records) | + | | FM4200 || Not available |
− | | style="vertical-align: middle; text-align: center;" |01 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Timestamp | + | | FM6320 || Available in base |
− | | style="vertical-align: middle; text-align: center;" |00 00 01 51 17 E4 0F E8 (GMT: Wednesday, November 18, 2015 12:00:01 AM) | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Priority | + | | FMAXX || Not available |
− | | style="vertical-align: middle; text-align: center;" |00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Longitude | + | | FMBXX || Available in base |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Latitude | + | | FMB630 || Available in base |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | + | |} |
| + | <small>Table 1. FM firmware requirements</small> |
| + | |
| + | |
| + | *'''GPRS command session''' |
| + | |
| + | Following figure shows how GRPS command session is started over TCP. |
| + | [[Image:fd.png]] |
| + | |
| + | <small>Figure 1. Command session</small> |
| + | |
| + | First FM opens GPRS session and sends AVL data to server (refer FM protocols). |
| + | |
| + | After all records are sent and correct sent data array acknowledgment is received by FM, it will begin TCP link mode message sending. |
| + | |
| + | TCP Link mode messages do not require ACK. |
| + | |
| + | |
| + | *'''General Codec13 message structure''' |
| + | |
| + | The following diagram shows basic structure of Codec 13 messages. |
| + | |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Altitude | + | ! 0x00000000 !! Data size !! 0x0D !!style="background: yellow; color: red;"| 0x01 !!style="background: black; color: red;"| 0x06 !! Command size !! Timestamp !! Payload !!style="background: yellow; color: red;"| 0x01 !! CRC |
− | | style="vertical-align: middle; text-align: center;" |00 00
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Angle | + | | 4 bytes || 4 bytes || 1 byte || 1 byte || 1 byte || 4 bytes || 4 bytes || X bytes || 1 byte || 1 byte |
− | | style="vertical-align: middle; text-align: center;" |00 00 | + | |} |
| + | |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Satellites
| + | !style="background: black; color: red;"| 0x06||Message type filed - 0x06 = packet FM -> Server |
− | | style="vertical-align: middle; text-align: center;" |00 | + | |} |
| + | |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Speed
| + | !style="background: yellow; color: red;"| 0x01||Ignored bytes |
− | | style="vertical-align: middle; text-align: center;" |00 00 | + | |} |
− | |- | + | |
− | | style="vertical-align: middle; text-align: center;" |Event IO ID
| + | |
− | | style="vertical-align: middle; text-align: center;" |00 EF
| + | <small>Figure 2. Structure of Codec 13 messages</small> |
− | |-
| + | |
− | | style="vertical-align: middle; text-align: center;" |Generation type
| + | Structure explanation: |
− | | style="vertical-align: middle; text-align: center;" |05
| + | |
− | |-
| + | *'''Preamble field''' - four zero bytes. |
− | | style="vertical-align: middle; text-align: center;" |N of Total ID
| + | |
− | | style="vertical-align: middle; text-align: center;" |05
| + | *'''Data size field''' (size is calculated from: |
− | |-
| + | |
− | | style="vertical-align: middle; text-align: center;" |N1 of One Byte IO
| + | <small>CID(0x0D = 1 byte) |
− | | style="vertical-align: middle; text-align: center;" |04
| + | |
− | |-
| + | NOD(0x01 = 1 byte) |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| + | |
− | | style="vertical-align: middle; text-align: center;" |00 01 (AVL ID: 1, Name: DIN1)
| + | CMD_TYPE(0x06 = 1 byte) |
− | |-
| + | |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| + | CMD_SIZE(variable = 4 bytes, includes size of timestamp field too) |
− | | style="vertical-align: middle; text-align: center;" |00
| + | |
− | |-
| + | PAYLOAD(variable size, stored in CMD_SIZE field) |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO ID
| + | |
− | | style="vertical-align: middle; text-align: center;" |00 03 (AVL ID: 3, Name: DIN3)
| + | NOD(0x01 = 1 byte)) |
− | |-
| + | </small> |
− | | style="vertical-align: middle; text-align: center;" |2’nd IO Value
| + | *'''Codec ID field''' (in Codec 13 it is always 0x0D). |
− | | style="vertical-align: middle; text-align: center;" |00
| + | |
− | |-
| + | *'''NOD field''' (0x01, it is ignored when parsing the message). |
− | | style="vertical-align: middle; text-align: center;" |3’rd IO ID
| + | |
− | | style="vertical-align: middle; text-align: center;" |00 B4 (AVL ID: 180, Name: DOUT2)
| + | *'''Message type field'''. It is always 0x06 since the packet is direction is FM->Server. |
− | |-
| + | |
− | | style="vertical-align: middle; text-align: center;" |3’rd IO Value
| + | *'''Command size field'''. Command size field includes size of timestamp too, so it is equal to size of payload + size of timestamp. |
− | | style="vertical-align: middle; text-align: center;" |00
| + | |
− | |-
| + | *'''Timestamp field''' – UNIX timestamp (since 1970/01/01 00:00:00 UTC) |
− | | style="vertical-align: middle; text-align: center;" |4’th IO ID
| + | |
− | | style="vertical-align: middle; text-align: center;" |00 EF (AVL ID: 239, Name: Ignition)
| + | *'''Payload field''' – actual received data |
− | |-
| + | |
− | | style="vertical-align: middle; text-align: center;" |4’th IO Value
| + | *'''NOD field''' (0x01, it is ignored when parsing the message) |
− | | style="vertical-align: middle; text-align: center;" |00
| + | |
− | |-
| + | *'''CRC field''' – CRC-16-IBM |
− | | style="vertical-align: middle; text-align: center;" |N2 of Two Bytes IO
| + | |
− | | style="vertical-align: middle; text-align: center;" |01
| + | |
− | |-
| + | The algorithm to calculate CRC is CRC-16 (also known as CRC-16-IBM). All the fields from codec ID to last NOD field are used to calculate CRC. The algorithm of how to calculate CRC is shown in figure 3. |
− | | style="vertical-align: middle; text-align: center;" |1’st IO ID
| + | |
− | | style="vertical-align: middle; text-align: center;" |42 (AVL ID: 66, Name: External Voltage)
| + | '''NOTE''' – Codec13 packets are used only when “Message Timestamp” parameter in RS232 settings is enabled. |
− | |-
| + | |
− | | style="vertical-align: middle; text-align: center;" |1’st IO Value
| + | [[Image:111.png|111.png]] |
− | | style="vertical-align: middle; text-align: center;" |11 1A
| + | |
− | |-
| + | <small>Figure 3. CRC calculation algorithm</small> |
− | | style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO
| + | |
− | | style="vertical-align: middle; text-align: center;" |00
| + | |
− | |-
| + | *'''Command parsing example''' |
− | | style="vertical-align: middle; text-align: center;" |N8 of Eight Bytes IO
| + | |
− | | style="vertical-align: middle; text-align: center;" |00
| + | The different fields of message are highlighted in gray and yellow for better readability. |
− | |-
| + | |
− | | style="vertical-align: middle; text-align: center;" |Number of Data 2 (Number of Total Records)
| + | Hexadecimal stream: |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | |}
| |
| | | |
| + | [[Image:22.png|22.png]] |
| | | |
− | Server response in hexadecimal stream:
| |
− | <code>0005CAFE010701</code> <br> <br>
| |
| Parsed: | | Parsed: |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Server Response to AVL Data Packet
| |
− | |-
| |
− | ! colspan="2" rowspan="1" style="width:60%; vertical-align: middle; text-align: center;" |Server Response Part
| |
− | ! rowspan="1" style="width:40%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
− | |-
| |
− | | rowspan="3" style="vertical-align: middle; text-align: center;" |UDP Channel Header
| |
− | | style="vertical-align: middle; text-align: center;" |Length
| |
− | | style="vertical-align: middle; text-align: center;" |00 05
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Packet ID
| |
− | | style="vertical-align: middle; text-align: center;" |CA FE
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Not usable byte
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | rowspan="2" style="vertical-align: middle; text-align: center;" |AVL Packet Acknowledgment
| |
− | | style="vertical-align: middle; text-align: center;" |AVL packet ID
| |
− | | style="vertical-align: middle; text-align: center;" |07
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Number of Accepted Data
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | |} <br />
| |
| | | |
− | =='''<big>Differences between Codec 8, Codec 8 Extended and Codec 16</big>'''==
| + | Preamble: 0x00000000 |
− | In the table below you will see differences between Codec8, Codec8 Extended and Codec16.
| + | |
− | {| class="nd-othertables_2" style="width:100%;"
| + | Packet Length: 0x0000001C |
− | |+
| + | |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |
| + | Codec: 0x0D |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec8
| + | |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec8 Extended
| + | NOD: 0x01 |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec16
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Codec ID
| |
− | | style="vertical-align: middle; text-align: center;" |0x08
| |
− | | style="vertical-align: middle; text-align: center;" |0x8E
| |
− | | style="vertical-align: middle; text-align: center;" |0x10
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data IO element length
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data IO element total IO count length
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Generation Type
| |
− | | style="vertical-align: middle; text-align: center;" |Not Using
| |
− | | style="vertical-align: middle; text-align: center;" |Not Using
| |
− | | style="vertical-align: middle; text-align: center;" |Is Using
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data IO element IO count length
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL Data IO element AVL ID length
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |2 bytes
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Variable size IO elements
| |
− | | style="vertical-align: middle; text-align: center;" |Does not include
| |
− | | style="vertical-align: middle; text-align: center;" |Includes variable size elements
| |
− | | style="vertical-align: middle; text-align: center;" |Does not include
| |
− | |-
| |
− | |} <br />
| |
| | | |
− | ='''<big>Codec for communication over GPRS messages</big>'''=
| + | Command type: 0x06 |
− | In this chapter you will find information about every Codec protocol which are using for communication over GPRS messages and differences between them.
| |
| | | |
− | =='''<big>Codec 12</big>'''==
| + | Command size: 0x00000014 |
| | | |
− | *'''<big>About Codec12</big>'''
| + | Timestamp: 1458119714 – 03/16/2016 @ 9:15am UTC |
| | | |
− | Codec12 is the original and main Teltonika protocol for device-server communication over GPRS messages. Codec12 GPRS commands can be used for sending configuration, debug, digital outputs control commands or other (special purpose command on special firmware versions). This protocol is also necessary for using [[FMB630]]/[[FM6300]]/FM5300/FM5500/FM4200 features like: Garmin, LCD communication, COM TCP Link Mode. <br>
| + | Command: #GET DATAORDER<CR><LF> |
| | | |
− | *'''<big>FM firmware requirements</big>'''
| + | NOD: 0x01 |
| | | |
− | Supported GPRS commands on each device depending on the firmware version. For available GPRS commands on each device, please refer to the table below.
| + | CRC: 0x00004990 |
− | {| class="nd-othertables" style="width:75%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:25%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Device
| |
− | ! rowspan="1" style="width:25%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |SMS over GPRS via TCP
| |
− | ! rowspan="1" style="width:25%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |SMS over GPRS via UDP
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: left;" |FM36YX
| |
− | | style="vertical-align: middle; text-align: center;" |Available in base firmware
| |
− | | style="vertical-align: middle; text-align: center;" |Since base firmware 01.06.01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: left;" |FM63YX
| |
− | | style="vertical-align: middle; text-align: center;" |Available in base firmware
| |
− | | style="vertical-align: middle; text-align: center;" |Since base firmware 00.02.19
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: left;" |FMB, FMC, FMM, FMU family devices (exclude FMB6YX, [[FMC640]], [[FMM640]])
| |
− | | style="vertical-align: middle; text-align: center;" |Available in base firmware
| |
− | | style="vertical-align: middle; text-align: center;" |Available in base firmware
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: left;" |FMB6YX
| |
− | | style="vertical-align: middle; text-align: center;" |Available in base firmware
| |
− | | style="vertical-align: middle; text-align: center;" |Since base firmware 00.02.19
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: left;" |[[FMC640]], [[FMM640]]
| |
− | | style="vertical-align: middle; text-align: center;" |Available in base firmware
| |
− | | style="vertical-align: middle; text-align: center;" |Available in base firmware
| |
− | |-
| |
− | |} <br />
| |
− | '''Note:''' “SMS over GPRS” means that all standard SMS commands text can be sent to the device via GPRS in Codec12 format. <br>
| |
− | '''Note:''' UDP commands are sent the same exact way as TCP commands.
| |
| | | |
− | *'''<big>GPRS command session</big>'''
| |
| | | |
− | The following figure shows how the GRPS command session is started over TCP. <br>
| + | *'''<big>FMB630/FM6320/5300/FM5500 and Codec12 functionality</big>''' |
− | [[File:Codec12.png|1150px]]
| |
− | First, the Teltonika device opens the GPRS session and sends AVL data to the server (refer device protocols). Once all records are sent and correct sent data array acknowledgment is received by device then GPRS commands in Hex can be sent to the device. <br>
| |
− | The ACK (acknowledge of IMEI from server) is a one-byte constant 0x01. The acknowledgment of each data array send from the device is four bytes integer – the number of records received. <br>
| |
− | Note, that the GPRS session should remain active between device and server, while GPRS commands are sent. For this reason, active datalink timeout (global parameters in device configuration) is recommended to be set to 259200 (maximum value). <br>
| |
| | | |
− | *'''<big>General Codec12 message structure</big>''' | + | *'''Garmin''' |
| | | |
− | The following diagram shows basic structure of Codec12 messages. <br> <br>
| + | All information is provided in “FMB6 FM6320 FM5300 FM5500 and Garmin development.pdf” document. |
− | '''Command message structure:''' | + | |
− | {| class="nd-othertables_2" style="width:100%;"
| + | *'''COM TCP Link Mode''' |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x00000000 (Preamble)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Data Size
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec ID
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Command Quantity 1
| |
− | ! colspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Type (0x05)
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Command Size
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Command
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Command Quantity 2
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | |-
| |
− | |}
| |
| | | |
| + | All information is provided in “FMB6 FM6320 FM5300 and FM5500 TCP Link mode test instructions.pdf” document. |
| | | |
− | '''Response message structure:''' | + | == '''<big>Codec 16</big>''' == |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x00000000 (Preamble)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Data Size
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec ID
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response Quantity 1
| |
− | ! colspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Type (0x06)
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response Size
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response Quantity 2
| |
− | ! rowspan="1" style="width:14%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | |-
| |
− | |}
| |
| | | |
| | | |
− | '''Preamble''' - the packet starts with four zero bytes. <br> | + | *'''Description and example''' |
− | '''Data Size''' - size is calculated from Codec ID field to the second command or response quantity field. <br>
| |
− | '''Codec ID''' - in Codec12 it is always <code>0x0C</code>. <br>
| |
− | '''Command/Response Quantity 1''' - it is ignored when parsing the message. <br> | |
− | '''Type''' - it can be 0x05 to denote command or 0x06 to denote response. <br>
| |
− | '''Command/Response Size''' – command or response length. <br>
| |
− | '''Command/Response''' – command or response in HEX. <br>
| |
− | '''Command/Response Quantity 2''' - a byte which defines how many records (commands or responses) is in the packet. This byte will not be parsed but it’s recommended that it should contain same value as Command/Response Quantity 1. <br>
| |
− | '''CRC-16''' – calculated from Codec ID to the Command Quantity 2. CRC (Cyclic Redundancy Check) is an error-detecting code using for detect accidental changes to RAW data. For calculation we are using [[Codec#CRC-16|CRC-16/IBM]].<br> <br>
| |
− | Note that difference between commands and responses is message type field: <code>0x05</code> means command and <code>0x06</code> means response. <br>
| |
| | | |
− | *'''<big>Command coding table</big>'''
| + | Records to server will be sent as shown in table below. |
| + | The main difference between CODEC8 and CODEC16 is CODEC ID which will be 0x10 instead of 0x08, AVL ID‘s in AVL data is sent in 2 bytes, instead of 1 byte. |
| | | |
− | Command has to be converted from ASCII characters (char) to hexadecimal (HEX): <br>
| + | '''Also new parameter – Generation type is added.''' |
− | [[File:ASCII.png]] <br>
| |
| | | |
− | *'''<big>Command parsing example</big>'''
| + | By receiving 0x10 codec ID server must know that AVL data record will be parsed different. |
| | | |
− | Hexadecimal stream of command and answer in this example is given in hexadecimal form. The different fields of the message are separated into different table columns for better readability and understanding. <br>
| + | Codec16 is supported from firmware – 00.03.xx and newer. (FMB630/FM63XY) |
| + | ll AVL ID‘s which are higher than 255 will can be used only in CODEC16 protocol. |
| | | |
− | *'''<big>GPRS commands examples</big>'''
| |
| | | |
− | Hexadecimal stream of GPRS command and answer in these examples are given in hexadecimal form. The different fields of messages are separate into different table columns for better readability and some of them are converted to ASCII values for better understanding. <br> <br>
| + | <small>Generation type elements:</small> |
− | '''1'st example:''' Sending ''[[FMB getinfo|getinfo]]'' SMS command via GPRS Codec12 <br> <br>
| + | {| class="wikitable" |
− | Server request in hexadecimal stream: <br>
| |
− | <code>000000000000000F0C010500000007676574696E666F0100004312</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Server Command
| |
| |- | | |- |
− | ! rowspan="1" style="width:14%; vertical-align: middle; text-align: center;" |Server Command Part | + | !style="background: black; color: white;"| Value !!style="background: black; color: white;"| Record created |
− | ! rowspan="1" style="width:14%; vertical-align: middle; text-align: center;" |HEX Code Part | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes | + | | 0 || On exit |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Data Size | + | | 1 || On Entrance |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 0F | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Codec ID | + | | 2 || On Both |
− | | style="vertical-align: middle; text-align: center;" |0C | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Quantity 1 | + | | 3 || Reserved |
− | | style="vertical-align: middle; text-align: center;" |01 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Type | + | | 4 || Hysterisis |
− | | style="vertical-align: middle; text-align: center;" |05 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Size | + | | 5 || On Change |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 07 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command | + | | 6 || Eventual |
− | | style="vertical-align: middle; text-align: center;" |67 65 74 69 6E 66 6F | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Quantity 2 | + | | 7 || Periodical |
− | | style="vertical-align: middle; text-align: center;" |01 | + | |} |
| + | |
| + | |
| + | <small>Codec16 TCP packet frame:</small> |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| + | ! Header !! Data length !! Codec ID !! NOD1 !! AVL DATA !! NOD2 !! CRC16 |
− | | style="vertical-align: middle; text-align: center;" |00 00 43 12
| |
| |- | | |- |
− | |} | + | | 4 bytes || 4 bytes || 0x10 || 1 byte || Variable || 1 byte || 4 Bytes |
| + | |} |
| + | |
| + | NOD1, NOD2 – number of data (number of packed records) |
| + | |
| + | Codec ID – constant 0x10. |
| + | |
| + | Data length – the length of packet from CodecID to NOD2. |
| + | |
| + | NOD2 should be equal to NOD1. |
| + | |
| + | CRC16 is 4 bytes, but first two are zeroes and last two are CRC-16 calculated for CodecID to NOD2. |
| + | |
| | | |
| + | Received data: |
| | | |
− | Note that Server Command converted from HEX to ASCII means ''[[FMB getinfo|getinfo]]'' <br> <br>
| + | [[Image:123.png|123.png]] |
− | Device response in hexadecimal stream: <br>
| + | |
− | <code>00000000000000900C010600000088494E493A323031392F372F323220373A3232205254433A323031392F372F323220373A3533205253543A32204552523A</code>
| + | 00000000 4 zeros, 4 bytes |
− | <code>312053523A302042523A302043463A302046473A3020464C3A302054553A302F302055543A3020534D533A30204E4F4750533A303A3330204750533A312053</code>
| + | |
− | <code>41543A302052533A332052463A36352053463A31204D443A30010000C78F</code> <br> <br>
| + | 0000009D data length, 4 bytes |
− | Parsed:
| + | |
− | {| class="nd-othertables_2" style="width:100%;"
| + | 10 – Codec ID |
− | |+
| + | |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Device Answer
| + | 02- Number of Data (2 records) |
| + | |
| + | 1’st record data |
| + | |
| + | 0000013feb55ff74 – Timestamp in milliseconds (1374042849140) |
| + | |
| + | GMT: Wed, 17 Jul 2013 06:34:09 GMT |
| + | |
| + | 00 – Priority |
| + | |
| + | GPS Elements |
| + | |
| + | 0f0ea850 – Longitude 252618832 = 25,2618832º N |
| + | |
| + | 209a6900 – Latitude 546990336 = 54,6990336 º E |
| + | |
| + | 00AE – Altitude 174 meters |
| + | |
| + | 00B9 – Angle 185º |
| + | |
| + | 0B – 11 Visible satellites |
| + | |
| + | 0000 – 0 km/h speed |
| + | |
| + | IO Elements |
| + | |
| + | 0000 – IO element ID of Event generated (in this case when 0000 – data generated not on event) |
| + | |
| + | 07 - Generation type |
| + | |
| + | 0A – 10 IO elements in record (total) |
| + | |
| + | 05 – 5 IO elements, which length is 1 Byte |
| + | |
| + | 0001 – IO element ID = 01 |
| + | |
| + | 00 – IO element’s value = 0 |
| + | |
| + | 0002 – IO element ID = 02 |
| + | |
| + | 00 – IO element’s value = 0 |
| + | |
| + | 0003 – IO element ID = 03 |
| + | |
| + | 00 – IO element’s value = 0 |
| + | |
| + | 0004 – IO element ID = 04 |
| + | |
| + | 00 – IO element’s value = 0 |
| + | |
| + | 0120 – IO element ID = 288 (dec) |
| + | |
| + | 00 – IO element’s value = 0 |
| + | |
| + | 02 – 2 IO elements, which value length is 2 Bytes |
| + | |
| + | 0018 – IO element ID = 24 (dec) |
| + | |
| + | 0000 – IO element’s value |
| + | |
| + | 0046 – IO element ID = 70 (dec) |
| + | |
| + | 0129 – IO element’s value |
| + | |
| + | 02 – 2 IO elements, which value length is 4 Bytes |
| + | |
| + | 00C7 – IO element ID = 199 (dec) |
| + | |
| + | 00000000 – IO element’s value |
| + | |
| + | 0046 – IO element ID = 70 (dec) |
| + | |
| + | 00000000 – IO element’s value |
| + | |
| + | |
| + | 01 – 1 IO elements, which value length is 8 Bytes |
| + | |
| + | 003E – IO element ID = 62 (dec) |
| + | |
| + | 0000000000000000 – IO element’s value |
| + | |
| + | 2’st record data |
| + | |
| + | 0000015B198C7498000F0DBC502095872F00AE00B90B00000000070A0500010000020 |
| + | |
| + | 00003000004000120000200180000004601290200C700000000004C0000000001003E00000 |
| + | |
| + | 00000000000 |
| + | |
| + | 02 – Number of Data (2 records) |
| + | |
| + | 000009A5 - CRC-16, 4 Bytes (first 2 are always zeros) |
| + | |
| + | |
| + | *'''Communication with server''' |
| + | |
| + | 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 123456789012345 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" |
| |- | | |- |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |Device Answer Part | + | !style="background: black; color: white;"| Codec type !!style="background: black; color: white;"| AVL data packet header !!style="background: black; color: white;"| AVL data array !!style="background: black; color: white;"| CRC |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |HEX Code Part | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes | + | | || Four zero bytes, |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | + | ‘AVL data array’ length – 254 |
| + | || CodecId – 08 or codec 16, |
| + | NumberOfData – 2. |
| + | (Encoded using continuous bit stream. |
| + | |
| + | Last byte padded to align to byte boundary) |
| + | || CRC of ‘AVL data array’ |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Data Size | + | | Codec8 || 00000000000000FE || 0802...(data elements)...02 || 00008612 |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 90 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Codec ID | + | | Codec16 || 00000000000000FE || 1002...(data elements)...02 || 00008612 |
− | | style="vertical-align: middle; text-align: center;" |0C | + | |} |
| + | |
| + | Server acknowledges data reception (2 data elements): |
| + | |
| + | 00000002 |
| + | |
| + | |
| + | '''<big>Sending data over UDP/IP</big>''' |
| + | |
| + | |
| + | *'''UDP channel protocol''' |
| + | |
| + | UDP channel is a transport layer protocol above UDP/IP to add reliability to plain UDP/IP using acknowledgment packets. The packet structure is as follows: |
| + | |
| + | {| class="wikitable " |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Response Quantity 1
| + | ! colspan="4" align="center" style="background: black; color: white;"|UDP datagram |
− | | style="vertical-align: middle; text-align: center;" |01
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Response Type | + | | rowspan="4"| UDP channel packet x N |
− | | style="vertical-align: middle; text-align: center;" |06 | + | | Example || 2 bytes || Packet length (excluding this field) in big ending byte order |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Response Size | + | | Packet Id || 2 bytes || Packet id unique for this channel |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 88 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Response | + | | Not usable byte || 1 byte || Not usable byte |
− | | style="vertical-align: middle; text-align: center;" |49 4E 49 3A 32 30 31 39 2F 37 2F 32 32 20 37 3A 32 32 20 52 54 43 3A 32 30 31 39 2F 37 2F 32 32 20 37 3A 35 33 20 52 53 54 3A 32 20 45 52 52 3A 31 20 53 52 3A 30 20 42 52 3A 30 20 43 46 3A 30 20 46 47 3A 30 20 46 4C 3A 30 20 54 55 3A 30 2F 30 20 55 54 3A 30 20 53 4D 53 3A 30 20 4E 4F 47 50 53 3A 30 3A 33 30 20 47 50 53 3A 31 20 53 41 54 3A 30 20 52 53 3A 33 20 52 46 3A 36 35 20 53 46 3A 31 20 4D 44 3A 30 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Response Quantity 2 | + | | Packet payload || m bytes || Data payload |
− | | style="vertical-align: middle; text-align: center;" |01 | + | |} |
| + | |
| + | |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| + | ! colspan="3" align="center" style="background: black; color: white;"|Not usable byte |
− | | style="vertical-align: middle; text-align: center;" |00 00 C7 8F
| |
| |- | | |- |
− | |} <br> | + | | 1 ||Data packet requiring acknowledgment |
− | Note that Device Response converted from HEX to ASCII means: <br>
| + | |} |
− | ''INI:2019/7/22 7:22 RTC:2019/7/22 7:53 RST:2 ERR:1 SR:0 BR:0 CF:0 FG:0 FL:0 TU:0/0 UT:0 SMS:0 NOGPS:0:30 GPS:1 SAT:0 RS:3 RF:65 SF:1 MD:0'' <br>
| + | |
| + | Acknowledgment packet should have the same packet id as acknowledged data packet and empty data payload. |
| + | |
| + | Acknowledgement should be sent in binary format. |
| | | |
− | '''2'nd example:''' Sending ''[[FMB getio|getio]]'' SMS command via GPRS Codec12 <br><br>
| + | {| class="wikitable" |
− | Server request in hexadecimal stream: <br>
| |
− | <code>000000000000000D0C010500000005676574696F01000000CB</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Server Command
| |
| |- | | |- |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |Server Command Part | + | ! colspan="3" align="center" style="background: black; color: white;"|Acknowledgment packet |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes | + | | Packet length || 2 bytes || 0x0003 |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Data Size | + | | Packet id || 2 bytes || same as in acknowledged packet |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 0D | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Codec ID | + | | Not usable byte || 1 byte || 0x00 |
− | | style="vertical-align: middle; text-align: center;" |0C | + | |} |
| + | |
| + | |
| + | *'''Sending AVL data using UDP channel''' |
| + | |
| + | AVL data are sent encapsulated in UDP channel packets (Data payload field). |
| + | |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Quantity 1
| + | ! colspan="3" align="center" style="background: black; color: white;"|AVL data encapsulated in UDP channel packet |
− | | style="vertical-align: middle; text-align: center;" |01
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Type | + | | AVL packet id (1 byte) || Module IMEI || AVL data array |
− | | style="vertical-align: middle; text-align: center;" |05 | + | |} |
| + | |
| + | |
| + | AVL packet id (1 byte) – id identifying this AVL packet |
| + | |
| + | Module IMEI – IMEI of a sending module encoded the same as with TCP |
| + | |
| + | AVL data array – array of encoded AVL data |
| + | |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Size
| + | ! colspan="3" align="center" style="background: black; color: white;"|Server response to AVL data packet |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 05
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command | + | | AVL packet id (1 byte) ||Number of accepted AVL elements (1 byte) |
− | | style="vertical-align: middle; text-align: center;" |67 65 74 69 6F | + | |} |
| + | |
| + | AVL packet id (1 byte) – id of received AVL data packet |
| + | |
| + | Number of AVL data elements accepted (1 byte) – number of AVL data array entries from the beginning of array, which were accepted by the server |
| + | |
| + | |
| + | '''Scenario:''' |
| + | |
| + | Module sends UDP channel packet with encapsulated AVL data packet. |
| + | Server sends UDP channel packet with encapsulated response |
| + | Module validates AVL packet id and Number of accepted AVL elements. If server response with valid AVL packet id is not received within configured timeout, module can retry sending. |
| + | |
| + | |
| + | '''Example''' |
| + | |
| + | Module sends the data: |
| + | |
| + | {| class="wikitable" |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Quantity 2 | + | ! style="background: black; color: white;"|UDP channel header !!style="background: black; color: white;"| AVL packet header !!style="background: black; color: white;"| AVL data array |
− | | style="vertical-align: middle; text-align: center;" |01
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |CRC-16 | + | | Len – 253, |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 CB | + | Id – 0xCAFE, |
| + | |
| + | Not usable byte – 00 |
| + | |
| + | || AVL packet id – 0xDD, |
| + | IMEI – 1234567890123456 |
| + | || CodecId – 08, |
| + | NumberOfData – 2. |
| + | (Encoded using continuous bit stream) |
| + | |
| |- | | |- |
− | |} | + | | 00FDCAFE01 || DD000F3133343536373839303132333435 || 0802…(data elements)…02 |
| + | |} |
| | | |
| + | Server must respond with acknowledgment: |
| | | |
− | Note that Server Command converted from HEX to ASCII means ''[[FMB getio|getio]]'' <br> <br>
| + | {| class="wikitable" |
− | Device response in hexadecimal stream: <br>
| |
− | <code>00000000000000370C01060000002F4449313A31204449323A30204449333A302041494E313A302041494E323A313639323420444F313A3020444F323A3101000066E3</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Device Answer
| |
| |- | | |- |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |Device Answer Part | + | !style="background: black; color: white;"| UDP channel header !!style="background: black; color: white;"| AVL packet acknowledgment |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |HEX Code Part | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes | + | | Len – 5, |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | + | Id – 0xABCD, |
| + | |
| + | Not usable byte – 00 |
| + | || AVL packet id – 0xDD, |
| + | NumberOfAcceptedData – 2 |
| + | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Data Size | + | | 0005ABCD01 || DD02 |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 37 | + | |} |
− | |- | + | |
− | | style="vertical-align: middle; text-align: center;" |Codec ID
| + | |
− | | style="vertical-align: middle; text-align: center;" |0C
| + | *'''Another example, with all IO id’s enabled''' |
− | |-
| + | |
− | | style="vertical-align: middle; text-align: center;" |Response Quantity 1
| + | Server received data: |
− | | style="vertical-align: middle; text-align: center;" |01
| + | |
− | |-
| + | [[Image:aaz.png|aaz.png]] |
− | | style="vertical-align: middle; text-align: center;" |Response Type
| + | |
− | | style="vertical-align: middle; text-align: center;" |06
| + | Data length: 00a1 or 161 Bytes (not counting the first 2 data length bytes) |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response Size
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 2F
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response
| |
− | | style="vertical-align: middle; text-align: center;" |44 49 31 3A 31 20 44 49 32 3A 30 20 44 49 33 3A 30 20 41 49 4E 31 3A 30 20 41 49 4E 32 3A 31 36 39 32 34 20 44 4F 31 3A 30 20 44 4F 32 3A 31
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response Quantity 2
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 66 E3
| |
− | |-
| |
− | |}
| |
| | | |
| + | Packet identification: 0xCAFE 2 bytes |
| | | |
− | Note that Device Response converted from HEX to ASCII means: <br>
| + | Not usable byte : 00 |
− | ''DI1:1 DI2:0 DI3:0 AIN1:0 AIN2:16924 DO1:0 DO2:1'' <br>
| |
| | | |
− | *'''<big>Communication with server</big>'''
| + | Packet id: 1b |
| | | |
− | The GSM/GPRS commands can be sent from a terminal program. We recommend to use Hercules (in TCP server mode). Simply write command as explained below into Hercules Send field, check HEX box and click Send button. Note that the TCP server must be listening on specified port (see Port field and Listen button below).
| + | Imei length: 000f |
| | | |
− | [[File:Hercules.jpeg]]
| + | Actual imei: 333536333037303432343431303133 |
− | <br>
| |
| | | |
− | *'''<big>FMXX and Codec12 functionality</big>'''
| + | Codec id: 08 |
− | *'''Garmin'''
| |
| | | |
− | All information is provided in “FMXX and Garmin development.pdf” document. <br>
| + | Number of data: 01 |
| | | |
− | *'''COM TCP Link Mode'''
| + | Timestamp: 0000013febdd19c8 |
| | | |
− | All information is provided in “FMxx TCP Link mode test instructions.pdf” document.
| + | Priority: 00 |
| | | |
− | =='''<big>Codec 13</big>'''==
| + | GPS data: 0f0e9ff0209a718000690000120000 |
| | | |
− | *'''<big>About Codec13</big>'''
| + | UDP protocol is the same as TCP except message header is 7 bytes, which consist of: data length, packet identification, not usable byte and packet id. |
| | | |
− | Codec13 is original Teltonika protocol for device-server communication over GPRS messages. This protocol is necessary for using following FM features: COM TCP Link Mode (binary/ASCII/binary buffered/ASCII buffered) if message timestamp parameter is enabled in device configuration. Codec13 messages are one way only (Device → Server sending).<br>
| + | Then goes imei length and imei itself. |
| | | |
− | *'''<big>General Codec13 message structure</big>'''
| + | And after that goes AVL data. |
| | | |
− | The following diagram shows basic structure of Codec 13 messages:
| + | And at the very end number of data byte. There is no CRC in UDP. |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x00000000 (Preamble)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Data Size
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec ID
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response Quantity 1
| |
− | ! colspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Type
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response Size
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Timestamp
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response Quantity 2
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 byte
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | |-
| |
− | |}
| |
| | | |
| | | |
− | '''Preamble''' – the packet starts with preamble field (four zero bytes). <br> | + | *'''Sending data using SMS''' |
− | '''Data Size''' – size is calculated from Codec ID field to the second Response Quantity field. <br>
| |
− | '''Codec ID''' – in Codec13 it is always <code>0x0D</code>. <br>
| |
− | '''Response Quantity 1''' – <code>0x01</code>, it is ignored when parsing the message. <br>
| |
− | '''Response Type''' – it is always <code>0x06</code> since the packet is direction is FM->Server. <br>
| |
− | '''Response Size''' – response size field includes size of timestamp too, so it is equal to size of payload + size of timestamp. <br>
| |
− | '''Timestamp''' – a difference, in seconds, between the current time and midnight, January, 1970 UTC (UNIX time). <br>
| |
− | '''Response''' – actual received data. <br>
| |
− | '''Response Quantity 2''' – a byte which defines how many records (responses) is in the packet. This byte will not be parsed but it’s recommended that it should contain same value as Response Quantity 1. <br>
| |
− | '''CRC-16''' – calculated from Codec ID to the Second Number of Data. CRC (Cyclic Redundancy Check) is an error-detecting code using for detect accidental changes to RAW data. For calculation we are using [[Codec#CRC-16|CRC-16/IBM]].<br> <br>
| |
− | '''Note:''' Codec13 packets are used only when “Message Timestamp” parameter in RS232 settings is enabled. <br>
| |
| | | |
− | *'''<big>Command parsing example</big>'''
| + | AVL data or events can be sent encapsulated in binary SMS. TP-DCS field of these SMS should indicate that message contains 8-bit data (for example: TP-DCS can be 0x04). |
| | | |
− | Hexadecimal stream of GPRS command in this example is given in hexadecimal form. The different fields of message are separate into different table columns for better readability and some of them are converted to ASCII values for better understanding. <br> <br>
| + | {| class="wikitable" |
− | Receiving "hello lets test" SMS response via GPRS Codec13<br> <br>
| |
− | Hexadecimal stream: <br>
| |
− | <code>000000000000001D0D01060000001564E8328168656C6C6F206C65747320746573740D0A0100003548</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Device answer
| |
| |- | | |- |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |Device answer part | + | ! colspan="3" align="center" style="background: black; color: white;"|SM data (TP-UD) |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes | + | | AVL data array ||IMEI: 8 bytes |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| + | |} |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Data Size
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 1D
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID
| |
− | | style="vertical-align: middle; text-align: center;" |0D
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response Quantity 1
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response Type
| |
− | | style="vertical-align: middle; text-align: center;" |06
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response Size
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 15
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Timestamp
| |
− | | style="vertical-align: middle; text-align: center;" |64 E8 32 81
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response
| |
− | | style="vertical-align: middle; text-align: center;" |68 65 6C 6C 6F 20 6C 65 74 73 20 74 65 73 74 0D 0A
| |
− | |- | |
− | | style="vertical-align: middle; text-align: center;" |Response Quantity 2 | |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 35 48
| |
− | |-
| |
− | |} | |
− | | |
| | | |
− | Note that Server Response converted from HEX to ASCII means "hello lets test"
| + | AVL data array – array of encoded AVL data |
| | | |
− | =='''<big>Codec 14</big>'''==
| + | IMEI – IMEI of sending module encoded as a big endian 8-byte long number. |
| | | |
− | *'''<big>About Codec14</big>'''
| |
| | | |
− | Codec14 is original Teltonika protocol for device-server communication over GPRS messages and it is based on Codec12 protocol. <br>
| + | *'''24 position SMS data protocol''' |
− | Main difference of Codec14 is that, device will answer to GPRS command if device physical IMEI number matches specified IMEI number in GPRS command. <br>
| |
| | | |
− | Codec14 GPRS commands can be used for sending configuration, debug, digital outputs control commands or other (special purpose command on special firmware versions). <br>
| |
| | | |
− | *'''<big>FMB firmware requirements</big>'''
| + | 24-hour SMS is usually sent once every day and contains GPS data of last 24 hours. TP-DCS field of this SMS should indicate that message contains 8-bit data (i.e. TP-DCS can be 0x04). |
| | | |
− | Implemented in base firmware from FMB.Ver.03.25.04.Rev.00 and newer. <br>
| + | Note, that 24 position data protocol is used only with subscribed SMS. Event SMS use standard AVL data protocol. |
| | | |
− | *'''<big>General Codec14 message structure</big>'''
| |
| | | |
− | The following diagram shows basic structure of Codec14 messages. <br>
| + | '''Encoding''' |
| | | |
− | '''Command message structure'''
| + | To be able to compress 24 GPS data entries into one SMS (140 octets), the data is encoded extensively using bit fields. Data packet can be interpreted as a bit stream, where all bits are numbered as follows: |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x00000000 (preamble)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Data size
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x0E (Codec ID)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Command quantity
| |
− | ! colspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x05<br>(Message type)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Command size + IMEI size (8 bytes)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |IMEI (HEX)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Command
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Command quantity
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |8 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | |-
| |
− | |}
| |
| | | |
| | | |
− | '''Response message structure'''
| + | {| class="wikitable" |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x00000000 (preamble)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Data size
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x0E (Codec ID)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response quantity
| |
− | ! colspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |0x06 / 0x11 (Message type)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response size + IMEI size (8 bytes)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |IMEI (HEX)
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Response quantity
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| + | !style="background: black; color: white;"| Byte 1 !!style="background: black; color: white;"| Byte 2 !!style="background: black; color: white;"| Byte 3 !!style="background: black; color: white;"| Bytes 4-… |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |8 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |X bytes
| |
− | | style="vertical-align: middle; text-align: center;" |1 bytes
| |
− | | style="vertical-align: middle; text-align: center;" |4 bytes
| |
| |- | | |- |
| + | | Bits 0-7 || Bits 8-15 || Bits 16-24 || Bits 25-… |
| |} | | |} |
| | | |
| + | Bits in a byte are numbered starting from least significant bit. A field of 25 bits would consist of bits 0 to 24 where 0 is the least significant bit and bit 24 – most significant bit. |
| | | |
− | '''Preamble''' – the packet starts with four zero bytes. <br>
| |
− | '''Data Size''' – size is calculated from Codec ID field to the second command or response quantity field. <br>
| |
− | '''Codec ID''' – in Codec14 it is always <code>0x0E</code>. <br>
| |
− | '''Command/Response Quantity 1''' – it is ignored when parsing the message. <br>
| |
− | '''Type''' – if it is request command from server it has to contain 0x05. The response type field will contain <code>0x06</code> if it’s ACK or <code>0x11</code> if it’s nACK. <br>
| |
− | ''Explanation:'' If command message IMEI is equal to actual device IMEI, received command will be executed and response will be sent with ACK (<code>0x06</code>) message type field value. If command message IMEI doesn’t match actual device IMEI, received command won’t be executed and response to server will be sent with nACK (<code>0x11</code>) message type field value. <br>
| |
− | '''Command/Response Size''' – command or response length. <br>
| |
− | ''Note:'' make sure that size is IMEI size 8 + actual command size. Minimal value is 8 because Codec14 always contain IMEI and it’s 8 bytes. <br>
| |
− | '''IMEI (HEX)''' – it is send as HEX value. Example if device IMEI is 123456789123456 then IMEI data field will contain <code>0x0123456789123456</code> value. <br>
| |
− | '''Command/Response''' – command or response in HEX. <br>
| |
− | '''Command/Response Quantity 2''' - a byte which defines how many records (commands or responses) is in the packet. This byte will not be parsed but it’s recommended that it should contain same value as Command/Response Quantity 1. <br>'''CRC-16''' – calculated from Codec ID to the Second Number of Data. CRC (Cyclic Redundancy Check) is an error-detecting code using for detect accidental changes to RAW data. For calculation we are using [[Codec#CRC-16|CRC-16/IBM]].<br>
| |
| | | |
− | *'''<big>GPRS in Codec14 examples</big>'''
| + | '''Structure''' |
| | | |
− | Hexadecimal stream of GPRS command and answer in this example are given in hexadecimal form. The different fields of message are separate into different table columns for better readability and some of them are converted to ASCII values for better understanding. <br> <br>
| + | {| class="wikitable " |
− | Sending ''[[FMB getver|getver]]'' SMS command via GPRS Codec14: <br> <br>
| |
− | Server requests in Hexadecimal stream: <br>
| |
− | <code>00000000000000160E01050000000E0352093081452251676574766572010000D2C1</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Server Command
| |
| |- | | |- |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |Server Command Part | + | ! colspan="4" align="center" style="background: black; color: white;"|SMS Data Structure |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes | + | | || 8 || Codec ID || Codec ID = 4 |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Data Size | + | | || 35 || Timestamp || Time corresponding to the first (oldest) GPS data element, |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 16 | + | |
| + | represented in seconds elapsed from 2000.01.01 00:00 EET. |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Codec ID | + | | || 5 || ElementCount || Number of GPS data elements |
− | | style="vertical-align: middle; text-align: center;" |0E | + | |} |
| + | |
| + | |
| + | |
| + | {| class="wikitable " |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Quantity 1
| + | ! colspan="4" align="center" style="background: black; color: white;"|SMS Data Structure |
− | | style="vertical-align: middle; text-align: center;" |01
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Type | + | |ElementCount * || || GPSDataElement || GPS data elements. |
− | | style="vertical-align: middle; text-align: center;" |05 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Command Size | + | | || || Byte-align padding || Padding bits to align to 8-bits boundary |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 0E | + | |
| + | represented in seconds elapsed from 2000.01.01 00:00 EET. |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |IMEI | + | | || 64 || IMEI || IMEI of sending device as 8-byte long integer |
− | | style="vertical-align: middle; text-align: center;" |03 52 09 30 81 45 22 51
| + | |} |
− | |- | + | The time of only the first GPS data element is specified in Timestamp field. Time corresponding to each further element can be computed as elementTime = Timestamp + (1 hour * elementNumber). |
− | | style="vertical-align: middle; text-align: center;" |Command | |
− | | style="vertical-align: middle; text-align: center;" |67 65 74 76 65 72 | |
− | |- | |
− | | style="vertical-align: middle; text-align: center;" |Command Quantity 2
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 D2 C1
| |
− | |-
| |
− | |}
| |
| | | |
| | | |
− | Note that Server Command converted from HEX to ASCII means ''[[FMB getver|getver]]'' <br> <br>
| + | {| class="wikitable " |
− | Device ACK response in hexadecimal stream: <br>
| |
− | <code>00000000000000AB0E0106000000A303520930814522515665723A30332E31382E31345F3034204750533A41584E5F352E31305F333333332048773A464D42313230</code>
| |
− | <code>204D6F643A313520494D45493A33353230393330383134353232353120496E69743A323031382D31312D323220373A313320557074696D653A3137323334204D4143</code>
| |
− | <code>3A363042444430303136323631205350433A312830292041584C3A30204F42443A3020424C3A312E362042543A340100007AAE</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Device Answer
| |
| |- | | |- |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |Device Answer Part | + | ! colspan="5" align="center" style="background: black; color: white;"|GPS Data Element |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes | + | | || || Size (bits) || Field || Description |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Data Size | + | | || || 1 || ValidElement || ValidElement=1 – there is a valid Gps Data Element following, |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 37
| + | ValidElement=0 – no element at this position |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Codec ID | + | | rowspan="8"| ValidElement == 1 |
− | | style="vertical-align: middle; text-align: center;" |0E
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Response Quantity 1 | + | | || 1 || DifferentialCoords || Format of following data. |
− | | style="vertical-align: middle; text-align: center;" |01 | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Response Type | + | | rowspan="3"| DifferentialCoords == 1 |
− | | style="vertical-align: middle; text-align: center;" |06
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Response Size | + | | 14 || LongitudeDiff || Difference from previous element‘s longitude. |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 A3
| + | LongitudeDiff = prevLongitude – Longitude + 213 – 1 |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |IMEI | + | | 14 || LatitudeDiff || Difference from previous element‘s latitude |
− | | style="vertical-align: middle; text-align: center;" |03 52 09 30 81 45 22 51
| + | LatitudeDiff = prevLatitude – Latitude + 213 – 1 |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Response | + | | rowspan="3"| DifferentialCoords == 0 |
− | | style="vertical-align: middle; text-align: center;" |56 65 72 3A 30 33 2E 31 38 2E 31 34 5F 30 34 20 47 50 53 3A 41 58 4E 5F 35 2E 31 30 5F 33 33 33 33 20 48 77 3A 46 4D 42 31 32 30 20 4D 6F 64 3A 31 35 20 49 4D 45 49 3A 33 35 32 30 39 33 30 38 31 34 35 32 32 35 31 20 49 6E 69 74 3A 32 30 31 38 2D 31 31 2D 32 32 20 37 3A 31 33 20 55 70 74 69 6D 65 3A 31 37 32 33 34 20 4D 41 43 3A 36 30 42 44 44 30 30 31 36 32 36 31 20 53 50 43 3A 31 28 30 29 20 41 58 4C 3A 30 20 4F 42 44 3A 30 20 42 4C 3A 31 2E 36 20 42 54 3A 34
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Response Quantity 2 | + | | 21 || Longitude || Longitude= {(LongDegMult + 18 * 108) * (221 – |
− | | style="vertical-align: middle; text-align: center;" |01 | + | 1)} over {36*108} |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |CRC-16 | + | | 20 || Latitude || Latitude=(LatDegMult + 9*108) * (220 – 1) over |
− | | style="vertical-align: middle; text-align: center;" |00 00 7A AE
| + | {18*108} |
− | |-
| + | |- |
− | |}
| + | | || || 8 || Speed || Speed in km/h |
| + | |} |
| + | |
| + | |
| + | Longitude - longitude field value of GPSDataElement |
| + | |
| + | Latitude - latitude field value of GPSDataElement |
| + | |
| + | LongDegMult - longitude in degrees multiplied by 107 (integer part) |
| + | |
| + | LatDegMult latitude in degrees multiplied by 107 (integer part) |
| + | |
| + | prevLongitude longitude field value of previous GPSDataElemen |
| + | |
| + | prevLatitude latitude field value of previous GPSDataElement |
| + | |
| + | |
| + | |
| + | *'''Decoding GPS position''' |
| + | |
| + | |
| + | When decoding GPS data with DifferentialCoords=1, Latitude and Longitude values can be computed as follows: Longitude=prevLongitude – LongitudeDiff + 213 – 1, Latitude=prevLatitude – LatitudeDiff + 213 – 1. |
| + | |
| + | If there were no previous non-differential positions, differential coordinates should be computed assuming prevLongitude=prevLatitude=0. |
| + | |
| + | When Longitude and Latitude values are known, longitude and latitude representation in degrees can be computed as follows: |
| + | |
| + | [[Image:f11.png|f11.png]] |
| + | |
| + | |
| + | |
| + | *'''SMS Events''' |
| + | |
| + | When Configured to generate SMS event user will get this SMS upon event |
| + | |
| + | <Year/Month/Day> <Hour:Minute:Second> P:<profile_nr> <SMS Text> Val:<Event Value> Lon:<longitude> Lat:<latitude> Q:<HDOP> |
| | | |
| + | Example: |
| | | |
− | Note that Device Response converted from HEX to ASCII means: <br>
| + | 2016./04/11 12:00:00 P:3 Digital Input 1 Val:1 Lon:51.12258 Lat: 25.7461 Q:0.6 |
− | ''Ver:03.18.14_04 GPS:AXN_5.10_3333 Hw:FMB120 Mod:15 IMEI:352093081452251 Init:2018-11-22 7:13 Uptime:17234 MAC:60BDD0016261 SPC:1(0) AXL:0 OBD:0 BL:1.6 BT:4'' <br> <br>
| |
− | Device nACK response in hexadecimal stream: <br>
| |
− | <code>00000000000000100E011100000008035209308145246801000032AC</code> <br> <br>
| |
− | Parsed:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+
| |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Device Answer
| |
− | |-
| |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |Device Answer Part
| |
− | ! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |HEX Code Part
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Zero Bytes
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 00
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Data Size
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 10
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Codec ID
| |
− | | style="vertical-align: middle; text-align: center;" |0E
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response Quantity 1
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response Type
| |
− | | style="vertical-align: middle; text-align: center;" |11
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response Size
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 00 08
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |IMEI
| |
− | | style="vertical-align: middle; text-align: center;" |03 52 09 30 81 45 24 68
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |Response Quantity 2
| |
− | | style="vertical-align: middle; text-align: center;" |01
| |
− | |-
| |
− | | style="vertical-align: middle; text-align: center;" |CRC-16
| |
− | | style="vertical-align: middle; text-align: center;" |00 00 32 AC
| |
− | |-
| |
− | |} <br />
| |
| | | |
− | =='''<big>Differences between Codec 12, Codec 13 and Codec 14</big>'''==
| + | {| class="wikitable" |
− | In the table below you will see differences between Codec12, Codec13 and Codec14.
| |
− | {| class="nd-othertables_2" style="width:100%;" | |
− | |+
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec12
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec13
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Codec14
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Communication
| |
− | | style="vertical-align: middle; text-align: center;" |Server ⇄ Device Communication
| |
− | | style="vertical-align: middle; text-align: center;" |One-way (Device → Server communication)
| |
− | | style="vertical-align: middle; text-align: center;" |Server ⇄ Device Communication
| |
− | |-
| |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Codec ID
| |
− | | style="vertical-align: middle; text-align: center;" |0x0C
| |
− | | style="vertical-align: middle; text-align: center;" |0x0D
| |
− | | style="vertical-align: middle; text-align: center;" |0x0E
| |
| |- | | |- |
− | ! style="vertical-align: middle; text-align: center;" |command message type
| + | | No information available || 0 || Iceland || 1C |
− | | style="vertical-align: middle; text-align: center;" |0x05 | |
− | | style="vertical-align: middle; text-align: center;" |- | |
− | | style="vertical-align: middle; text-align: center;" |0x05 | |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Response Message Type
| + | | Austria || 1 || Kazakhstan || 1D |
− | | style="vertical-align: middle; text-align: center;" |0x06 | |
− | | style="vertical-align: middle; text-align: center;" | 0x06 | |
− | | style="vertical-align: middle; text-align: center;" |0x06 (if it is ACK) or 0x11 (if it is nACK) | |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Command / Response size
| + | | Albania || 2 || Luxembourg || 1E |
− | | style="vertical-align: middle; text-align: center;" |Command/Response | |
− | | style="vertical-align: middle; text-align: center;" |Only Response | |
− | | style="vertical-align: middle; text-align: center;" |Command/Response + IMEI | |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Timestamp
| + | | Andorra || 3 || Lithuania || 1F |
− | | style="vertical-align: middle; text-align: center;" |Not Using | |
− | | style="vertical-align: middle; text-align: center;" |Is Using | |
− | | style="vertical-align: middle; text-align: center;" |Not Using | |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |IMEI
| + | | Armenia || 4 || Latvia || 20 |
− | | style="vertical-align: middle; text-align: center;" |Not Using | |
− | | style="vertical-align: middle; text-align: center;" |Not Using | |
− | | style="vertical-align: middle; text-align: center;" |Is Using | |
| |- | | |- |
− | |} <br /> | + | | Azerbaijan || 5 || Malta || 21 |
− | | |
− | ='''<big>24 Position SMS Data Protocol</big>'''=
| |
− | | |
− | 24-hour SMS is usually sent once every day and contains GPS data of last 24 hours. TP-DCS field of this SMS should indicate that message contains 8-bit data (i.e. TP-DCS can be <code>0x04</code>). <br>
| |
− | Note, that 24 position data protocol is used only with subscribed SMS. Event SMS use standard AVL data protocol. <br>
| |
− | | |
− | *'''<big>Encoding</big>'''
| |
− | | |
− | To be able to compress 24 GPS data entries into one SMS (140 octets), the data is encoded extensively using bit fields. Data packet can be interpreted as a bit stream, where all bits are numbered as follows:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+ | |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Byte 1
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Byte 2
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Byte 3
| |
− | ! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Byte 4 ...
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |Bits 0 - 7 | + | | Belgium || 6 || Monaco || 22 |
− | | style="vertical-align: middle; text-align: center;" |Bits 8 - 15 | |
− | | style="vertical-align: middle; text-align: center;" |Bits 16 - 24 | |
− | | style="vertical-align: middle; text-align: center;" |Bits 25 - ... | |
| |- | | |- |
− | |} | + | | Bulgaria || 7 || Republic of Moldova || 23 |
− | | |
− | | |
− | Bits in a byte are numbered starting from least significant bit. A field of 25 bits would consist of bits 0 to 24 where 0 is the least significant bit and bit 24 – most significant bit. <br>
| |
− | | |
− | *'''<big>Structure</big>'''
| |
− | | |
− | Below in the tables you will see SMS Data Structure:
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+ | |
− | ! colspan="3" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |SMS Data Structure
| |
| |- | | |- |
− | | style="width:10%; vertical-align: middle; text-align: center;" |8 | + | | Bosnia and Herzegovina || 8 || Macedonia || 24 |
− | | style="width:10%; vertical-align: middle; text-align: center;" |Codec ID | |
− | | style="width:10%; vertical-align: middle; text-align: center;" |Codec ID = 4 (0x04) | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |35 | + | | Belarus || 9 || Norway || 25 |
− | | style="vertical-align: middle; text-align: center;" |Timestamp | |
− | | style="vertical-align: middle; text-align: center;" |Time corresponding to the first (oldest) GPS data element, represented in seconds elapsed from 2000.01.01 00:00 EET. | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |5 | + | | Switzerland || 0A || Netherlands || 26 |
− | | style="vertical-align: middle; text-align: center;" |ElementCount | |
− | | style="vertical-align: middle; text-align: center;" |Number of GPS data elements | |
| |- | | |- |
− | |} <br> | + | | Cyprus || 0B || Portugal || 27 |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+ | |
− | | |
− | ! colspan="4" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |SMS Data Structure
| |
| |- | | |- |
− | | rowspan="3" style="width:10%; vertical-align: middle; text-align: center;" |ElementCount * | + | | Czech Republic || 0C || Poland || 28 |
− | | style="width:10%; vertical-align: middle; text-align: center;" | | |
− | | style="width:10%; vertical-align: middle; text-align: center;" |GPSDataElement | |
− | | style="width:10%; vertical-align: middle; text-align: center;" |GPS data elements | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" | | + | | Germany || 0D || Romania || 29 |
− | | style="vertical-align: middle; text-align: center;" |Byte - align padding | |
− | | style="vertical-align: middle; text-align: center;" |Padding bits to align to 8 - bits boundary represented in seconds elapsed from 2000.01.01 00:00 EET. | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |64 | + | | Denmark || 0E || San Marino || 2A |
− | | style="vertical-align: middle; text-align: center;" |IMEI | |
− | | style="vertical-align: middle; text-align: center;" |IMEI of sending device as 8 byte long integer | |
| |- | | |- |
− | |} | + | | Spain || 0F || Russian Federation || 2B |
− | | |
− | | |
− | The time of only the first GPS data element is specified in Timestamp field. Time corresponding to each further element can be computed as elementTime = Timestamp + (1 hour * elementNumber). <br>
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+ | |
− | ! colspan="5" rowspan="1" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |GPS Data Element
| |
| |- | | |- |
− | ! rowspan="1" style="width:20%; vertical-align: middle; text-align: center;" |
| + | | Estonia || 10 || Sweden || 2C |
− | ! rowspan="1" style="width:20%; vertical-align: middle; text-align: center;" |
| |
− | ! rowspan="1" style="width:12%; vertical-align: middle; text-align: center;" |Size (bits)
| |
− | ! colspan="1" style="width:20%; vertical-align: middle; text-align: center;" |Field
| |
− | ! rowspan="1" style="width:28%; vertical-align: middle; text-align: center;" |Description
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" | | + | | France || 11 || Slovakia || 2D |
− | | style="vertical-align: middle; text-align: center;" | | |
− | | style="vertical-align: middle; text-align: center;" |1 | |
− | | style="vertical-align: middle; text-align: center;" |ValidElement | |
− | | style="vertical-align: middle; text-align: center;" |ValidElement = 1 – there is a valid Gps Data Element following,
| |
− | ValidElement = 0 – no element at this position
| |
| |- | | |- |
− | | rowspan="5" style="vertical-align: middle; text-align: center;" |ValidElement == 1 | + | | Finland || 12 || Slovenia || 2E |
− | | style="vertical-align: middle; text-align: center;" | | |
− | | style="vertical-align: middle; text-align: center;" |1 | |
− | | style="vertical-align: middle; text-align: center;" |DifferentialCoords | |
− | | style="vertical-align: middle; text-align: center;" |Format of following data
| |
| |- | | |- |
− | | rowspan="2" style="vertical-align: middle; text-align: center;" |DifferentialCoords == 1 | + | | Liechtenstein || 13 || Turkmenistan || 2F |
− | | style="vertical-align: middle; text-align: center;" |14 | |
− | | style="vertical-align: middle; text-align: center;" |LongitudeDiff | |
− | | style="vertical-align: middle; text-align: center;" |Difference from previous element‘s longitude. | |
− | LongitudeDiff = prevLongitude – Longitude + 213 – 1
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |14 | + | | Faeroe Islands|| 14 || Turkey || 30 |
− | | style="vertical-align: middle; text-align: center;" |LatitudeDiff | |
− | | style="vertical-align: middle; text-align: center;" |Difference from previous element‘s latitude | |
− | LatitudeDiff = prevLatitude – Latitude + 213 – 1
| |
| |- | | |- |
− | | rowspan="2" style="vertical-align: middle; text-align: center;" |DifferentialCoords == 0 | + | | United Kingdom || 15 || Ukraine || 31 |
− | | style="vertical-align: middle; text-align: center;" |21 | |
− | | style="vertical-align: middle; text-align: center;" |Longitude | |
− | | style="vertical-align: middle; text-align: center;" |Longitude = {(LongDegMult + 18 * 108) * (221 – 1)} over {36*108} | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |20 | + | | Georgia || 16 || Vatican City || 32 |
− | | style="vertical-align: middle; text-align: center;" |Latitude | |
− | | style="vertical-align: middle; text-align: center;" |Latitude = (LatDegMult + 9*108) * (220 – 1) over {18*108} | |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" | | + | | Greece || 17 || Yugoslavia || 33 |
− | | style="vertical-align: middle; text-align: center;" | | |
− | | style="vertical-align: middle; text-align: center;" |8 | |
− | | style="vertical-align: middle; text-align: center;" |Speed | |
− | | style="vertical-align: middle; text-align: center;" |Speed in km/h
| |
| |- | | |- |
− | |} | + | | Hungary || 18 || RFU || 34..FC |
− | | |
− | | |
− | '''Longitude''' - longitude field value of GPSDataElement <br>
| |
− | '''Latitude''' - latitude field value of GPSDataElement <br>
| |
− | '''LongDegMult''' - longitude in degrees multiplied by 107 (integer part) <br>
| |
− | '''LatDegMult''' - latitude in degrees multiplied by 107 (integer part) <br>
| |
− | '''prevLongitude''' - longitude field value of previous GPSDataElemen <br>
| |
− | '''prevLatitude''' - latitude field value of previous GPSDataElement <br>
| |
− | | |
− | *'''<big>Decoding GPS position</big>'''
| |
− | | |
− | When decoding GPS data with DifferentialCoords = 1, Latitude and Longitude values can be computed as follows: Longitude = prevLongitude – LongitudeDiff + 213 – 1, Latitude = prevLatitude – LatitudeDiff + 213 – 1. <br>
| |
− | If there were no previous non-differential positions, differential coordinates should be computed assuming prevLongitude = prevLatitude = 0. <br>
| |
− | When Longitude and Latitude values are known, longitude and latitude representation in degrees can be computed as follows:
| |
− | | |
− | [[File:24SMS.png]]
| |
− | | |
− | *'''<big>SMS Events</big>'''
| |
− | | |
− | When Configured to generate SMS event user will get this SMS upon event: <br>
| |
− | ''<Year/Month/Day> <Hour:Minute:Second> P:<profile_nr> <SMS Text> Val:<Event Value> Lon:<longitude> Lat:<latitude> Q:<HDOP>'' <br> <br>
| |
− | Example: <br>
| |
− | ''2016./04/11 12:00:00 P:3 Digital Input 1 Val:1 Lon:51.12258 Lat: 25.7461 Q:0.6'' <br>
| |
− | | |
− | ='''<big>Sending data using SMS</big>'''=
| |
− | This type data sending is using for FMBXXX devices which can be configured in [[FMB120 SMS/Call settings#SMS Data Sending|SMS Data Sending settings]].<br>
| |
− | | |
− | *'''<big>Data sending via SMS</big>'''
| |
− | | |
− | AVL data or events can be sent encapsulated in binary SMS. TP-DCS field of these SMS should indicate that message contains 8-bit data (for example: TP-DCS can be <code>0x04</code>).
| |
− | {| class="nd-othertables_2" style="width:100%;"
| |
− | |+ | |
− | ! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |SMS data (TP-UD)
| |
| |- | | |- |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |AVL data array
| + | | Croatia || 19 || European Community || FD |
− | ! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |IMEI
| |
| |- | | |- |
− | | style="vertical-align: middle; text-align: center;" |X bytes | + | | Italy || 1A || Example || FE |
− | | style="vertical-align: middle; text-align: center;" |8 bytes | |
| |- | | |- |
| + | | Ireland || 1B || Rest of the world || FF |
| |} | | |} |
− |
| |
− |
| |
− | '''AVL data array''' – array of encoded AVL data. <br>
| |
− | '''IMEI''' – IMEI of sending module encoded as a big endian 8 byte long number.
| |
− |
| |
− | ='''<big>CRC-16</big>'''=
| |
− | CRC (Cyclic Redundancy Check) is an error-detecting code using for detect accidental changes to RAW data. The algorithm how to calculate CRC-16 (also known as CRC-16/IBM) you will find below. <br>
| |
− | [[File:CRC16.png]]
| |
Introduction
A codec is a device or computer program for encoding or decoding a digital data stream or signal. Codec is a portmanteau of coder-decoder.
A codec encodes a data stream or a signal for transmission and storage, possibly in encrypted form, and the decoder function reverses the encoding for playback or editing.
Codec ID table
Codec 8
|
Codec 8 extended
|
Codec 12
|
Codec 13
|
Codec 16
|
0x08 |
0x8E |
0x0C |
0x0D |
0x10
|
Codec 8
Because the smallest information amount that can be written is one bit, there can be some bits left unused when result is byte array. Any unused bits should be left blank.
Below table represents AVL data packet structure.
4 zeros
|
Data field length
|
Codec ID
|
Number of Data 1
|
AVL Data
|
Number of Data 2
|
CRC-16
|
4 bytes |
4 bytes |
1 byte |
1 byte |
30-147 bytes |
1 byte |
4 bytes
|
Number of data – number of encoded data (number of records).
Codec ID is constant 08.
Data field length is the length of bytes [codec id, number of data 2].
Number of data 1 should always be equal to number of data 2 byte.
CRC-16 is 4 bytes, but first two are zeroes and last two are CRC-16 calculated for [codec id, number of data 2]
Minimum AVL packet size is 45 bytes (all IO elements disabled).
Maximum AVL packet size for one record is 783 bytes.
Timestamp
|
Priority
|
GPS Element
|
IO element
|
8 bytes |
1 byte |
15 bytes |
6-123
|
Timestamp – difference, in milliseconds, between the current time and midnight, January 1, 1970 UTC
Longitude
|
Latitude
|
Altitude
|
Angle
|
Satellites
|
Speed
|
4 bytes |
4 bytes |
2 bytes |
2 bytes |
1 bytes |
2 bytes
|
X Longitude
Y Latitude1
Altitude In meters above sea level1
Angle In degrees, 0 is north, increasing clock-wise 1
Satellites Number of visible satellites1
Speed in km/h. 0x0000 if GPS data is invalid1
Longitude and latitude are integer values built from degrees, minutes, seconds and milliseconds by formula
d - Degrees
m - Minutes
s - Seconds
ms - Milliseconds
p - Precision (10000000)
If longitude is in west or latitude in south, multiply result by –1. To determine if the coordinate is negative, convert it to binary format and check the very first bit. If it is 0, coordinate is positive, if it is 1, coordinate is negative.
Example:
Received value: 20 9c ca 80
Converted to BIN: 00100000 10011100 11001010 10000000 first bit is 0, which means coordinate is positive
Converted to DEC: 547146368
For more information see two‘s complement arithmetics.
Event IO ID |
1 byte
|
N of Total IO |
1 byte
|
N1 of One Byte IO |
1 byte
|
1’st IO ID |
1 byte
|
1’st IO Value |
1 byte
|
... |
|
N1’th IO ID |
1 byte
|
N1’th IO Value |
1 byte
|
N2 of Two Bytes |
1 byte
|
1’st IO ID |
1 byte
|
1’st IO Value |
2 bytes
|
... |
|
N2’th IO ID |
1 byte
|
N2’th IO Value |
2 bytes
|
N4 of Four Bytes |
1 byte
|
1’st IO ID |
1 byte
|
1’st IO Value |
4 byte
|
... |
|
N4’th IO ID |
1 byte
|
N4’th IO Value |
4 bytes
|
N8 of Eight Bytes |
1 byte
|
1’st IO ID |
1 byte
|
1’st IO Value |
8 bytes
|
... |
|
N8’th IO ID |
1 byte
|
N8’th IO Value |
8 bytes
|
Event IO ID – if data is acquired on event – this field defines which IO property has changed and generated an event. If data cause is not event – the value is 0.
N total number of properties coming with record (N=N1+N2+N4+N8)
N1 number of properties, which length is 1 byte
N2 number of properties, which length is 2 bytes
N4 number of properties, which length is 4 bytes
N8 number of properties, which length is 8 bytes
Example
Received data:
000000000000008c08010000013feb55ff74000f0ea850209a69000094000012000000
1e09010002000300040016014703f0001504c8000c0900730a00460b00501300464306
d7440000b5000bb60007422e9
f180000cd0386ce000107c700000000f10000601a4600
0001344800000bb84900000bb84a00000bb84c00000000024e0000000000000000cf00
000000000000000100003fca
In total 152 Bytes
00000000 4 zeroes, 4 bytes
0000008c data length, 4 bytes
08 – Codec ID
01 Number of Data (1 record) 1’st record data
010000013feb55ff74 – Timestamp in milliseconds (1374042849140)
GMT: Wed, 17 Jul 2013 06:34:09 GMT
00 – Priority
GPS Element
0f0ea850 – Longitude 252618832 = 25,2618832º N
209a6900 – Latitude 546990336 = 54,6990336 º E
0094 – Altitude 148 meters
0000 – Angle 0
12 – 18 Visible satellites
0000 – 0 km/h speed
IO Element
00 – IO element ID of Event generated (in this case when 00 – data generated not on event)
1e – 30 IO elements in record (total)
09 – 9 IO elements, which length is 1 Byte
0 – IO element ID = 01
0 – IO element’s value = 0
02 – IO element ID = 02
0 – IO element’s value = 0
03 – IO element ID = 03
0 – IO element’s value = 0
4 – IO element ID = 04
0 – IO element’s value = 0
16 – IO element ID = 22 (dec)
0 – IO element’s value = 1
47 – IO element ID = 71 (dec)
03 – IO element’s value = 3
F0 – IO element ID = 240 (dec)
0 – IO element’s value = 0
15 – IO element ID = 21 (dec)
04 – IO element’s value = 0
C8 – IO element ID = 200 (dec)
0 – IO element’s value = 0
0c – 12 IO elements, which value length is 2 Bytes
09 – IO element ID = 9 (dec)
0073 – IO element’s value
0a – IO element ID = 10 (dec)
0046 – IO element’s value
0b – IO element ID = 11 (dec)
0050 – IO element’s value
13 – IO element ID = 19 (dec)
0046 – IO element’s value
43 – IO element ID = 67 (dec)
06d7 – IO element’s value
1 – IO element ID = 68 (dec)
0 – IO element’s value
B5 – IO element ID = 181 (dec)
000b – IO element’s value
B6 – IO element ID = 182 (dec)
0007 – IO element’s value
42 – IO element ID = 66 (dec)
2e9f – IO element’s value
2 – IO element ID = 24 (dec)
0 – IO element’s value
cd – IO element ID = 205 (dec)
3 – IO element’s value
CE – IO element ID = 206 (dec)
0 – IO element’s value
07 – 7 IO elements, which value length is 4 Bytes
C7 – IO element ID = 199 (dec)
0 – IO element’s value
f1 – IO element ID = 241 (dec)
0000601a – IO element’s value
46 – IO element ID = 70 (dec)
00000134 – IO element’s value
48 – IO element ID = 72 (dec)
00000bb8 – IO element’s value
4 – IO element ID = 73 (dec)
00000bb8 – IO element’s value
4a – IO element ID = 74 (dec)
00000bb8 – IO element’s value
4c – IO element ID = 76 (dec)
1 – IO element’s value
02 – 2 IO elements, which value length is 8 Bytes
4e – IO element ID = 78 (dec)
0 – IO element’s value
cf – IO element ID = 207 (dec)
0 – IO element’s value
01 – Number of Data (1 record)
00003fca - CRC-16, 4 Bytes (first 2 are always zeros)
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:
AVL data packet header |
AVL data array |
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
UDP channel is a transport layer protocol above UDP/IP to add reliability to plain UDP/IP using acknowledgment packets. The packet structure is as follows:
UDP datagram
|
UDP channel packet x N
|
Example |
2 bytes |
Packet length (excluding this field) in big ending byte order
|
Packet Id |
2 bytes |
Packet id unique for this channel
|
Not usable byte |
1 byte |
Not usable byte
|
Packet payload |
m bytes |
Data payload
|
Not usable byte
|
1 |
Data packet requiring acknowledgment
|
Acknowledgment packet should have the same packet id as acknowledged data packet and empty data payload. Acknowledgement should be sent in binary format
Acknowledgment packet
|
Packet length |
2 bytes |
0x0003
|
Packet id |
2 bytes |
same as in acknowledged packet
|
Not usable byte |
1 byte |
0x00
|
- Sending AVL data using UDP channel
AVL data are sent encapsulated in UDP channel packets (Data payload field).
AVL data encapsulated in UDP channel packet
|
AVL packet id (1 byte) |
Module IMEI |
AVL data array
|
AVL packet id (1 byte) – id identifying this AVL packet
Module IMEI – IMEI of a sending module encoded the same as with TCP
AVL data array – array of encoded AVL data
Server response to AVL data packet
|
AVL packet id (1 byte) |
Number of accepted AVL elements (1 byte)
|
AVL packet id (1 byte) – id of received AVL data packet
AVL packet id (1 byte) – id of received AVL data packet
Number of AVL data elements accepted (1 byte) – number of AVL data array entries from the beginning of array, which were accepted by the server.
Scenario:
Module sends UDP channel packet with encapsulated AVL data packet.
Server sends UDP channel packet with encapsulated response
Module validates AVL packet id and Number of accepted AVL elements. If server response with valid AVL packet id is not received within configured timeout, module can retry sending.
Example:
Module sends the data:
UDP channel header |
AVL packet header |
AVL data array
|
Len – 253,
Id – 0xCAFE,
Not usable byte – 00
|
AVL packet id – 0xDD,
IMEI – 1234567890123456
|
CodecId – 08,
NumberOfData – 2.
(Encoded using continuous bit stream)
|
00FDCAFE01 |
DD000F3133343536373839303132333435 |
0802…(data elements)…02
|
Server must respond with acknowledgment:
UDP channel header |
AVL packet acknowledgment
|
Len – 5,
Id – 0xABCD,
Not usable byte – 00
|
AVL packet id – 0xDD,
NumberOfAcceptedData – 2
|
0005ABCD01 |
DD02
|
Codec 8 Extended
Difference between codec8 and codec8 extended
|
Codec 8 |
Codec 8 Extended
|
Codec ID |
0x08 |
0x8E
|
AVL Data IO element length |
1 Byte |
2 Bytes
|
AVL Data IO element total IO count length |
1 Byte |
2 Bytes
|
AVL Data IO element IO count length |
1 Byte |
2 Bytes
|
AVL Data IO element AVL ID length |
1 Byte |
2 Bytes
|
Variable size IO elements |
Does not include |
Includes variable size elements
|
Table 2. Codec 8 and 8 Extended differences
Main differences between are shown in above table. AVL data element sizes in codec 8 extended protocol were increased to 2 bytes length and new variable type added. For more detailed description look in codec 8
and codec 8 extended chapters.
- Codec 8 extended protocol sending over TCP
AVL data packet
Below table represents AVL data packet structure.
4 zeros |
Data field length |
Codec ID |
Number of
Data 1
|
AVL Data |
Number of
Data 2
|
CRC-16
|
4 Bytes |
4 Bytes |
1 Byte |
1 Byte |
38-768
Bytes
|
1 Byte |
4 Bytes
|
Table 3. AVL data packet structure
Number of data – number of encoded data (number of records). Codec ID is constant 0x8E.
Data field length is the length of bytes [codec id, number of data 2]. Number of data 1 should always be equal to number of data 2 byte.
CRC-16 is 4 bytes, but first two are zeroes and last two are CRC-16 calculated for [codec id, number of data
2]
Minimum AVL packet size is 53 bytes (all IO elements disabled).
Timestamp |
Timestamp Priority |
GPS Element |
IO Element
|
8 Bytes |
1 Byte |
15 Bytes |
14 - 744
|
Table 4. AVL data structure
Table 5. Priority element values
Longitude |
Latitude |
Altitude |
Angle |
Satellites |
Speed
|
4 Bytes |
4 Bytes |
2 Bytes |
2 Bytes |
1 Byte |
2 Bytes
|
Table 6. GPS element structure
Event IO ID |
2 bytes
|
N of Total IO |
2 bytes
|
N1 of One Byte IO |
2 bytes
|
1'st IO ID |
2 bytes
|
1'st IO Value |
1 bytes
|
|
|
N1'th IO ID |
2 bytes
|
N1'st IO Value |
1 bytes
|
N2 of Two Byte IO |
2 bytes
|
1'st IO ID |
2 bytes
|
1'st IO Value |
2 bytes
|
|
|
N2'th IO ID |
2 bytes
|
N2'st IO Value |
2 bytes
|
N4 of Four Byte IO |
2 bytes
|
1'st IO ID |
2 bytes
|
1'st IO Value |
4 bytes
|
|
|
N4'th IO ID |
2 bytes
|
N4'st IO Value |
4 bytes
|
N2 of Eight Byte IO |
2 bytes
|
1'st IO ID |
2 bytes
|
1'st IO Value |
8 bytes
|
|
|
N8'th IO ID |
2 bytes
|
N8'st IO Value |
8 bytes
|
NX of X Byte IO |
2 bytes
|
1'st IO ID |
2 bytes
|
1'st IO Length |
2 bytes
|
1'st IO Value |
defined by length
|
|
|
NX'st IO ID |
2 bytes
|
NX'st IO Length |
2 bytes
|
NX'st IO Value |
defined by length
|
Table 7. IO element structure
N - total number of properties coming with record (N=N1+N2+N4+N8+NX)
N1 - number of properties, which length is 1 byte
N2 - number of properties, which length is 2 bytes
N4 - number of properties, which length is 4 bytes
N8 - number of properties, which length is 8 bytes
NX - number of properties, which length is defined by length element
- Communication with server
Communication with server is the same as with codec 8 protocol, except in codec8 extended protocol codec id is 0x8E.
Example:
Module connects to server and sends IMEI:
000f333536333037303432343431303133
Server accepts the module:
01
Module sends data packet
AVL data packet header |
AVL data array |
CRC
|
Four zero bytes,
‘AVL data array’ length – 254
|
Codec Id – 8E, NumberOfData – 02.
(Encoded using continuous bit stream.
Last byte padded to align to byte boundary)
|
CRC of ‘AVL data array’
|
00000000000000FE |
8E02...(data elements)...02 |
00008612
|
Table 8. IO element structure
Server acknowledges data reception (2 data elements):
00000002
Received data:
000000000000005F8E010000015FBA40B620000F0DCDE420959D30008A000006000000000006000100EF0
000010011001E000100100000CBDF0002000B000000003544C875000E0000000029BFE4D1000101000011
0000000000000000000000000000000000010000D153
00000000 4 zeros, 4 bytes
0000005F data length, 4 bytes
8E – Codec ID
01- Number of Data (1 record)
1’st record data
0000015FBA40B620 – Timestamp in milliseconds (1510658324000)
GMT: Tuesday, November 14, 2017 11:18:44 AM
00 – Priority
GPS Element
0F0DCDE4 – Longitude 252562916 = 25, 2562916º N
20959D30 – Latitude 546676016 = 54,6676016 º E
008A – Altitude 138 meters
0000 – Angle 0º
06 – 6 Visible satellites
0000 – 0 km/h speed
IO Element
0000 – IO element ID of Event generated (in this case when 0000 – data generated not on event)
0006 – 6 IO elements in record (total)
0001 – 1 IO elements, which length is 1 Byte
00EF – IO element ID = 239 (dec)
00 – IO element’s value
0001 – 1 IO elements, which length is 2 Byte
0011 – IO element ID = 17 (dec )
001E – IO element’s value
0001 – 1 IO elements, which length is 4 Byte
0010 – IO element ID = 16 (dec )
0000CBDF – IO element’s value = 52191 (dec )
0002 – 2 IO elements, which length is 2 Byte
000B – IO element ID = 11 (dec )
000000003544C875 – IO element’s value
000E – IO element ID = 14 (dec )
0000000029BFE4D1 – IO element’s value
01 – Number of Data (1 record)
0000D153 – CRC-16, 4 Bytes (first 2 are always zeros
Codec 8 extended protocol sending over UDP
AVL data packet is the same as with codec 8, except codec ID is changed to 0x8E.
Example:
Module sends the data:
UDP channel header |
AVL packet header |
AVL data array
|
Len – 253,
Id – 0xCAFE,
Not usable byte – 00
|
AVL packet id – 0xDD,
IMEI – 1234567890123456
|
Codec Id – 8E, NumberOfData – 02.
(Encoded using continuous bit stream
|
00FDCAFE01 |
DD000F3133343536373839303132333435 |
8E02…(data elements)…02
|
Table 9. Example packet send to server
Server must respond with acknowledgment:
UDP channel header |
AVL packet acknowledgment
|
Len – 5,
Id – 0xCAFE,
Not usable byte – 00
|
AVL packet id -0xDD
Number of Accepted Data -2
|
0005CAFE01 |
DD02
|
Table 10. Example packet server response
Example
Server received data:
Data length: 00a1 or 161 Bytes (not counting the first 2 data length bytes)
Packet identification: 0xCAFE 2 bytes
Not usable byte: 00
Packet id: 1b
Imei length: 000f
Actual imei: 333536333037303432343431303133
Codec id: 8E
Number of data: 01
Timestamp: 0000013febdd19c8
Priority: 00
GPS data: 0f0e9ff0209a718000690000120000
Codec 12
Codec12 is original Teltonika protocol for device-server communication over GPRS messages.
Codec12 GPRS commands can be used for sending configuration, debug, digital outputs control commands or other (special purpose command on special firmware versions).
This protocol is also necessary for using FMB63/FM63/FM5300/FM5500/FM4200 features like: Garmin, LCD communication, COM TCP Link Mode.
Supported GPRS commands on each device depend on firmware version. For available GPRS commands on each device, please refer to Table1 FM firmware requirement “SMS over GPRS” means that all standard SMS commands text can be sent to device via GPRS in Codec12 format.
Device |
SMS over GPRS |
SMS over GPRS via UDP |
Special Codec12 GPRS commands
|
FM11YX |
Available since base firmware 01.11.XX |
Since base firmware
1.26.00
|
Available in FM1100 and FM1110 special firmware version 12.XX.XX*
|
FM12YX |
Available since base firmware 01.03.XX |
- |
Available in FM12YX special firmware 09.XX.XX*
|
FM10YX |
Available since base firmware 00.03.XX |
- |
Available since base firmware 00.06.XX and later versions**
|
FM3400 |
Available since base firmware 01.01.XX |
- |
-
|
FM36YX |
Available in base firmware |
Since base firmware 01.06.01 |
-
|
FM5300 |
Available in all firmware versions |
- |
Available in all firmware versions**
|
FM5500 |
Available in all firmware versions |
- |
Available in all firmware versions**
|
FM2200 |
Not available |
- |
Special firmware version 07.XX.XX*
|
FM4200 |
Not available |
- |
Special firmware version 42.XX.XX*
|
FM63YX |
Available in all firmware versions |
Since base firmware 00.02.19 |
Available in all firmware versions**
|
FMB9YX |
Available in base firmware |
Available in base firmware |
-
|
FMB0YX |
Available in base firmware |
Available in base firmware |
-
|
FMB1YX |
Available in base firmware |
Available in base firmware |
-
|
FMB6YX |
Available in all firmware versions |
Since base firmware 00.02.19 |
Available in all firmware versions**
|
FMA1YX |
Available in base firmware |
Since base firmware 1.26.00 |
Available in special firmware version 12.XX.XX*
|
FMA2YX |
Available in base firmware |
Available in base firmware |
-
|
Table 1. FM firmware requirement
'*' - supported special commands are listed on special firmware description. Please contact Your Teltonika sales manager for more details;
'**' - supported special commands are listed on device user manual, chapter “GPRS Commands”
Following figure shows how GRPS command session is started over TCP.
First FM opens GPRS session and sends AVL data to server (refer FM protocols). Once all records are sent and correct sent data array acknowledgment is received by FM then GPRS commands in Hex can be sent to FM.
The ACK (acknowledge of IMEI from server) is a one byte constant 0x01. The acknowledgement of each data array send from FMXXXX is four bytes integer – number of records received.
Note, that GPRS session should remain active between FM and server, while GPRS commands are sent. For this reason active datalink timeout (global parameters in FMXXXX configuration) is recommended to be set to 259200 (maximum value).
- General Codec12 message structure
The following diagram shows basic structure of Codec 12 messages.
Command message structure
0x00000000 |
Data size |
0x0C |
Command quantity |
0x05 |
Command size |
Command |
<CR><LF> |
Command quantity |
CRC
|
4 bytes |
4 bytes |
1 byte |
1 byte |
1 byte |
4 bytes |
X bytes |
0D0A |
1 byte |
4 bytes
|
Response message structure
0x00000000 |
Data size |
0x0C |
Command quantity |
0x06 |
Command size |
Command |
Command quantity |
CRC
|
4 bytes |
4 bytes |
1 byte |
1 byte |
1 byte |
4 bytes |
X bytes |
1 byte |
4 bytes
|
Structure explanation:
The message starts with preamble field - four zero bytes. Then goes four bytes data size field (size is calculated from 0x0C field to the second command or response quantity field). Then follows one byte Codec ID field (in Codec 12 it is always 0x0C). Then goes command or response quantity field (it is ignored when parsing the message). After that goes one byte message type field. It can be 0x05 to denote command or 0x06 to denote response. Then follows four bytes command or response size field. After it follows the command or response field itself. After that goes the second command or response quantity field. At the end there’s four bytes CRC field.
Note that difference between commands and responses is message type field: 0x05 means command and 0x06 means response.
The algorithm to calculate CRC is CRC-16 (also known as CRC-16-IBM). All the fields from codec ID to second command/response quantity field are used to calculate CRC. The algorithm of how to calculate
CRC is shown in Figure 3 CRC calculation algorithm.
Figure 3 CRC calculation algorithm
Command has to be convert from ASCII characters (char) to hexadecimal (Hex)
Table 2 ASCII conversion table
Hexadecimal stream of command and answer in this example are given in hexadecimal form. The different fields of message are highlighted in gray and yellow for better readability and command is converted in ASCII for better understanding.
Server command
Hexadecimal stream:
Parsed:
Preamble: 0x00000000
Packet Length: 0x00000018
Codec: 0x0C
Quantity of commands: 0x01
Command type: 0x05
Command size: 0x00000010
Command in ASCII after conversion: #GET DATAORDER<CR><LF>
Quantity of commands: 0x01
CRC: 0x00004990
Device answer
Hexadecimal stream:
Parsed:
Preamble: 0x00000000
Packet Length: 0x00000016
Codec: 0x0C
Quantity of commands: 0x01
Command type: 0x06
Command size: 0x0000000E
Command response is in ASCII after conversion: #DATAORDER=1<CR><LF>
Quantity of commands: 0x01
CRC: 0x00000095
- Codec12 GPRS commands examples
The example commands given in hexadecimal form separated by dollar signs are suitable to be sent from TCP server during data exchange session between FMXXXX device and server (for more details see Figure 1 Command session) The command can be sent from a terminal program such as Hercules (in TCP server mode). Simply write command as explained below into Hercules Send field and click Send button. The TCP server must be listening on specified port (see field Port and button Listen in Figure 4).
Figure 4 Hercules terminal GUI
- SMS over GPRS in Codec12 examples
In case of sending SMS commands over GPRS, do not use SMS logins set during configuration or do not leave empty spaces before command. Devices and firmware versions that support SMS over GPRS are listed in Table1.
Example 1: getinfo
Sending “getinfo” SMS command via GPRS Codec12:
Server requests:
Hexadecimal stream:
00000000000000110C010500000009676574696E666F0D0A010000DA7E
Parsed:
Zero: 0x00000000
Packet Length: 0x00000011
Codec: 0x0C
Quantity of commands: 0x01
Command type: 0x05
Command size: 0x00000009
Command: 0x676574696e666f (HEX of getinfo)
Command end symbol: 0x0D0A
Quantity of commands: 01
CRC: 0x0000DA7E
Device response:
Hexadecimal stream:
00000000000000820C01060000007A494E493A323031312F312F3120303A30205254433A323031312F312F3120373A3333205253543A33204552523A302053523A3134372042523A302043463A312046473A3020464C3A302055543A3020534D533A30204E4F4750533A303A3134204750533A32205341543A302052533A36204D443A302052463A30010000B8AA
Parsed:
Zero: 0x00000000
Packet Length: 0x00000082
Codec: 0C
Quantity of commands: 01
Command type: 06
Command size: 0x0000007A
Command response in ASCII after conversion: INI:2011/1/1 0:0 RTC:2011/1/1 7:33 RST:3 ERR:0 SR:147 BR:0 CF:1 FG:0 FL:0 UT:0 SMS:0 NOGPS:0:14 GPS:2 SAT:0
RS:6 MD:0 RF:0 (without <CR><LF>)
Quantity of commands: 01
CRC: 0x0000B8AA
Example 2: getio
Sending “getio” SMS command via GPRS Codec12:
Server request:
Hexadecimal stream:
000000000000000F0C010500000007676574696F0D0A0100003349
Parsed:
Zero: 0x00000000
Packet Length: 0x0000000F
Codec: 0x0C
Quantity of commands: 0x01
Command type: 0x05
Command size: 0x00000007
Command: 0x676574696f (HEX of getio)
Command end symbol: 0x0D0A
Quantity of commands: 01
CRC: 00003349
Device response:
Hexadecimal stream:
000000000000002C0C0106000000244449313A30204449323A30204449333A302041494E3A323420444F313A3020444F323A30010000F925
Parsed:
Zero: 0x00000000
Packet Length: 0x0000002C
Codec: 0C
Quantity of commands: 01
Command type: 06
Command size: 0x00000024
Command response in ASCII after conversion: DI1:0 DI2:0 DI3:0 AIN:24 DO1:0 DO2:0 (without <CR><LF>)
Quantity of commands: 01
CRC: 0x0000F925
- Special Codec12 commands:
Example 1: #GET VERSION
Server command - #GET VERSION<CR><LF>
Device response - #VERSION=XXXXXXXX<CR><LF>
XXXXXXXX – Device Firmware Version (up to 8 characters)
$00$00$00$00$00$00$00$16$0C$01$05$00$00$00$0E$23$47$45$54$20$56$45$52$53$49$4f$4e$0D$0A$01$00$00$D0$C8
Example 2: #GET NETWORK
Server command - #GET NETWORK<CR><LF>
Device response - #NETWORK=XXXXXX<CR><LF>
XXXXXX – GSM Operator Network [0 - 999999]
$00$00$00$00$00$00$00$16$0C$01$05$00$00$00$0E$23$47$45$54$20$4e$45$54$57$4f$52$4b$0D$0A$01$00$00$ED$61
Codec 13
Codec13 is original Teltonika protocol for device-server communication over GPRS messages. This protocol is necessary for using following FM features: COM TCP Link Mode (binary/ASCII/binary buffered/ASCII buffered) if message timestamp parameter is enabled in device configuration. Codec13 messages are one way only (Codec 13 is used for FM->Server sending).
Codec13 availability depends on device and firmware version.
Device |
Availability
|
FM11YX |
Available since base firmware 01.18.XX
|
FM12YX |
Not available
|
FM10YX |
Not available
|
FM3400 |
Not available
|
FM5300 |
Not available
|
FM5500 |
Not available
|
FM2200 |
Not available
|
FM4200 |
Not available
|
FM6320 |
Available in base
|
FMAXX |
Not available
|
FMBXX |
Available in base
|
FMB630 |
Available in base
|
Table 1. FM firmware requirements
Following figure shows how GRPS command session is started over TCP.
Figure 1. Command session
First FM opens GPRS session and sends AVL data to server (refer FM protocols).
After all records are sent and correct sent data array acknowledgment is received by FM, it will begin TCP link mode message sending.
TCP Link mode messages do not require ACK.
- General Codec13 message structure
The following diagram shows basic structure of Codec 13 messages.
0x00000000 |
Data size |
0x0D |
0x01 |
0x06 |
Command size |
Timestamp |
Payload |
0x01 |
CRC
|
4 bytes |
4 bytes |
1 byte |
1 byte |
1 byte |
4 bytes |
4 bytes |
X bytes |
1 byte |
1 byte
|
0x06 |
Message type filed - 0x06 = packet FM -> Server
|
Figure 2. Structure of Codec 13 messages
Structure explanation:
- Preamble field - four zero bytes.
- Data size field (size is calculated from:
CID(0x0D = 1 byte)
NOD(0x01 = 1 byte)
CMD_TYPE(0x06 = 1 byte)
CMD_SIZE(variable = 4 bytes, includes size of timestamp field too)
PAYLOAD(variable size, stored in CMD_SIZE field)
NOD(0x01 = 1 byte))
- Codec ID field (in Codec 13 it is always 0x0D).
- NOD field (0x01, it is ignored when parsing the message).
- Message type field. It is always 0x06 since the packet is direction is FM->Server.
- Command size field. Command size field includes size of timestamp too, so it is equal to size of payload + size of timestamp.
- Timestamp field – UNIX timestamp (since 1970/01/01 00:00:00 UTC)
- Payload field – actual received data
- NOD field (0x01, it is ignored when parsing the message)
The algorithm to calculate CRC is CRC-16 (also known as CRC-16-IBM). All the fields from codec ID to last NOD field are used to calculate CRC. The algorithm of how to calculate CRC is shown in figure 3.
NOTE – Codec13 packets are used only when “Message Timestamp” parameter in RS232 settings is enabled.
Figure 3. CRC calculation algorithm
The different fields of message are highlighted in gray and yellow for better readability.
Hexadecimal stream:
Parsed:
Preamble: 0x00000000
Packet Length: 0x0000001C
Codec: 0x0D
NOD: 0x01
Command type: 0x06
Command size: 0x00000014
Timestamp: 1458119714 – 03/16/2016 @ 9:15am UTC
Command: #GET DATAORDER<CR><LF>
NOD: 0x01
CRC: 0x00004990
- FMB630/FM6320/5300/FM5500 and Codec12 functionality
All information is provided in “FMB6 FM6320 FM5300 FM5500 and Garmin development.pdf” document.
All information is provided in “FMB6 FM6320 FM5300 and FM5500 TCP Link mode test instructions.pdf” document.
Codec 16
Records to server will be sent as shown in table below.
The main difference between CODEC8 and CODEC16 is CODEC ID which will be 0x10 instead of 0x08, AVL ID‘s in AVL data is sent in 2 bytes, instead of 1 byte.
Also new parameter – Generation type is added.
By receiving 0x10 codec ID server must know that AVL data record will be parsed different.
Codec16 is supported from firmware – 00.03.xx and newer. (FMB630/FM63XY)
ll AVL ID‘s which are higher than 255 will can be used only in CODEC16 protocol.
Generation type elements:
Value |
Record created
|
0 |
On exit
|
1 |
On Entrance
|
2 |
On Both
|
3 |
Reserved
|
4 |
Hysterisis
|
5 |
On Change
|
6 |
Eventual
|
7 |
Periodical
|
Codec16 TCP packet frame:
Header |
Data length |
Codec ID |
NOD1 |
AVL DATA |
NOD2 |
CRC16
|
4 bytes |
4 bytes |
0x10 |
1 byte |
Variable |
1 byte |
4 Bytes
|
NOD1, NOD2 – number of data (number of packed records)
Codec ID – constant 0x10.
Data length – the length of packet from CodecID to NOD2.
NOD2 should be equal to NOD1.
CRC16 is 4 bytes, but first two are zeroes and last two are CRC-16 calculated for CodecID to NOD2.
Received data:
00000000 4 zeros, 4 bytes
0000009D data length, 4 bytes
10 – Codec ID
02- Number of Data (2 records)
1’st record data
0000013feb55ff74 – Timestamp in milliseconds (1374042849140)
GMT: Wed, 17 Jul 2013 06:34:09 GMT
00 – Priority
GPS Elements
0f0ea850 – Longitude 252618832 = 25,2618832º N
209a6900 – Latitude 546990336 = 54,6990336 º E
00AE – Altitude 174 meters
00B9 – Angle 185º
0B – 11 Visible satellites
0000 – 0 km/h speed
IO Elements
0000 – IO element ID of Event generated (in this case when 0000 – data generated not on event)
07 - Generation type
0A – 10 IO elements in record (total)
05 – 5 IO elements, which length is 1 Byte
0001 – IO element ID = 01
00 – IO element’s value = 0
0002 – IO element ID = 02
00 – IO element’s value = 0
0003 – IO element ID = 03
00 – IO element’s value = 0
0004 – IO element ID = 04
00 – IO element’s value = 0
0120 – IO element ID = 288 (dec)
00 – IO element’s value = 0
02 – 2 IO elements, which value length is 2 Bytes
0018 – IO element ID = 24 (dec)
0000 – IO element’s value
0046 – IO element ID = 70 (dec)
0129 – IO element’s value
02 – 2 IO elements, which value length is 4 Bytes
00C7 – IO element ID = 199 (dec)
00000000 – IO element’s value
0046 – IO element ID = 70 (dec)
00000000 – IO element’s value
01 – 1 IO elements, which value length is 8 Bytes
003E – IO element ID = 62 (dec)
0000000000000000 – IO element’s value
2’st record data
0000015B198C7498000F0DBC502095872F00AE00B90B00000000070A0500010000020
00003000004000120000200180000004601290200C700000000004C0000000001003E00000
00000000000
02 – Number of Data (2 records)
000009A5 - CRC-16, 4 Bytes (first 2 are always zeros)
- Communication with server
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 123456789012345 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:
Codec type |
AVL data packet header |
AVL data array |
CRC
|
|
Four zero bytes,
‘AVL data array’ length – 254
|
CodecId – 08 or codec 16,
NumberOfData – 2.
(Encoded using continuous bit stream.
Last byte padded to align to byte boundary)
|
CRC of ‘AVL data array’
|
Codec8 |
00000000000000FE |
0802...(data elements)...02 |
00008612
|
Codec16 |
00000000000000FE |
1002...(data elements)...02 |
00008612
|
Server acknowledges data reception (2 data elements):
00000002
Sending data over UDP/IP
UDP channel is a transport layer protocol above UDP/IP to add reliability to plain UDP/IP using acknowledgment packets. The packet structure is as follows:
UDP datagram
|
UDP channel packet x N
|
Example |
2 bytes |
Packet length (excluding this field) in big ending byte order
|
Packet Id |
2 bytes |
Packet id unique for this channel
|
Not usable byte |
1 byte |
Not usable byte
|
Packet payload |
m bytes |
Data payload
|
Not usable byte
|
1 |
Data packet requiring acknowledgment
|
Acknowledgment packet should have the same packet id as acknowledged data packet and empty data payload.
Acknowledgement should be sent in binary format.
Acknowledgment packet
|
Packet length |
2 bytes |
0x0003
|
Packet id |
2 bytes |
same as in acknowledged packet
|
Not usable byte |
1 byte |
0x00
|
- Sending AVL data using UDP channel
AVL data are sent encapsulated in UDP channel packets (Data payload field).
AVL data encapsulated in UDP channel packet
|
AVL packet id (1 byte) |
Module IMEI |
AVL data array
|
AVL packet id (1 byte) – id identifying this AVL packet
Module IMEI – IMEI of a sending module encoded the same as with TCP
AVL data array – array of encoded AVL data
Server response to AVL data packet
|
AVL packet id (1 byte) |
Number of accepted AVL elements (1 byte)
|
AVL packet id (1 byte) – id of received AVL data packet
Number of AVL data elements accepted (1 byte) – number of AVL data array entries from the beginning of array, which were accepted by the server
Scenario:
Module sends UDP channel packet with encapsulated AVL data packet.
Server sends UDP channel packet with encapsulated response
Module validates AVL packet id and Number of accepted AVL elements. If server response with valid AVL packet id is not received within configured timeout, module can retry sending.
Example
Module sends the data:
UDP channel header |
AVL packet header |
AVL data array
|
Len – 253,
Id – 0xCAFE,
Not usable byte – 00
|
AVL packet id – 0xDD,
IMEI – 1234567890123456
|
CodecId – 08,
NumberOfData – 2.
(Encoded using continuous bit stream)
|
00FDCAFE01 |
DD000F3133343536373839303132333435 |
0802…(data elements)…02
|
Server must respond with acknowledgment:
UDP channel header |
AVL packet acknowledgment
|
Len – 5,
Id – 0xABCD,
Not usable byte – 00
|
AVL packet id – 0xDD,
NumberOfAcceptedData – 2
|
0005ABCD01 |
DD02
|
- Another example, with all IO id’s enabled
Server received data:
Data length: 00a1 or 161 Bytes (not counting the first 2 data length bytes)
Packet identification: 0xCAFE 2 bytes
Not usable byte : 00
Packet id: 1b
Imei length: 000f
Actual imei: 333536333037303432343431303133
Codec id: 08
Number of data: 01
Timestamp: 0000013febdd19c8
Priority: 00
GPS data: 0f0e9ff0209a718000690000120000
UDP protocol is the same as TCP except message header is 7 bytes, which consist of: data length, packet identification, not usable byte and packet id.
Then goes imei length and imei itself.
And after that goes AVL data.
And at the very end number of data byte. There is no CRC in UDP.
AVL data or events can be sent encapsulated in binary SMS. TP-DCS field of these SMS should indicate that message contains 8-bit data (for example: TP-DCS can be 0x04).
SM data (TP-UD)
|
AVL data array |
IMEI: 8 bytes
|
AVL data array – array of encoded AVL data
IMEI – IMEI of sending module encoded as a big endian 8-byte long number.
- 24 position SMS data protocol
24-hour SMS is usually sent once every day and contains GPS data of last 24 hours. TP-DCS field of this SMS should indicate that message contains 8-bit data (i.e. TP-DCS can be 0x04).
Note, that 24 position data protocol is used only with subscribed SMS. Event SMS use standard AVL data protocol.
Encoding
To be able to compress 24 GPS data entries into one SMS (140 octets), the data is encoded extensively using bit fields. Data packet can be interpreted as a bit stream, where all bits are numbered as follows:
Byte 1 |
Byte 2 |
Byte 3 |
Bytes 4-…
|
Bits 0-7 |
Bits 8-15 |
Bits 16-24 |
Bits 25-…
|
Bits in a byte are numbered starting from least significant bit. A field of 25 bits would consist of bits 0 to 24 where 0 is the least significant bit and bit 24 – most significant bit.
Structure
SMS Data Structure
|
|
8 |
Codec ID |
Codec ID = 4
|
|
35 |
Timestamp |
Time corresponding to the first (oldest) GPS data element,
represented in seconds elapsed from 2000.01.01 00:00 EET.
|
|
5 |
ElementCount |
Number of GPS data elements
|
SMS Data Structure
|
ElementCount * |
|
GPSDataElement |
GPS data elements.
|
|
|
Byte-align padding |
Padding bits to align to 8-bits boundary
represented in seconds elapsed from 2000.01.01 00:00 EET.
|
|
64 |
IMEI |
IMEI of sending device as 8-byte long integer
|
The time of only the first GPS data element is specified in Timestamp field. Time corresponding to each further element can be computed as elementTime = Timestamp + (1 hour * elementNumber).
GPS Data Element
|
|
|
Size (bits) |
Field |
Description
|
|
|
1 |
ValidElement |
ValidElement=1 – there is a valid Gps Data Element following,
ValidElement=0 – no element at this position
|
ValidElement == 1
|
|
1 |
DifferentialCoords |
Format of following data.
|
DifferentialCoords == 1
|
14 |
LongitudeDiff |
Difference from previous element‘s longitude.
LongitudeDiff = prevLongitude – Longitude + 213 – 1
|
14 |
LatitudeDiff |
Difference from previous element‘s latitude
LatitudeDiff = prevLatitude – Latitude + 213 – 1
|
DifferentialCoords == 0
|
21 |
Longitude |
Longitude= {(LongDegMult + 18 * 108) * (221 –
1)} over {36*108}
|
20 |
Latitude |
Latitude=(LatDegMult + 9*108) * (220 – 1) over
{18*108}
|
|
|
8 |
Speed |
Speed in km/h
|
Longitude - longitude field value of GPSDataElement
Latitude - latitude field value of GPSDataElement
LongDegMult - longitude in degrees multiplied by 107 (integer part)
LatDegMult latitude in degrees multiplied by 107 (integer part)
prevLongitude longitude field value of previous GPSDataElemen
prevLatitude latitude field value of previous GPSDataElement
When decoding GPS data with DifferentialCoords=1, Latitude and Longitude values can be computed as follows: Longitude=prevLongitude – LongitudeDiff + 213 – 1, Latitude=prevLatitude – LatitudeDiff + 213 – 1.
If there were no previous non-differential positions, differential coordinates should be computed assuming prevLongitude=prevLatitude=0.
When Longitude and Latitude values are known, longitude and latitude representation in degrees can be computed as follows:
When Configured to generate SMS event user will get this SMS upon event
<Year/Month/Day> <Hour:Minute:Second> P:<profile_nr> <SMS Text> Val:<Event Value> Lon:<longitude> Lat:<latitude> Q:<HDOP>
Example:
2016./04/11 12:00:00 P:3 Digital Input 1 Val:1 Lon:51.12258 Lat: 25.7461 Q:0.6
No information available |
0 |
Iceland |
1C
|
Austria |
1 |
Kazakhstan |
1D
|
Albania |
2 |
Luxembourg |
1E
|
Andorra |
3 |
Lithuania |
1F
|
Armenia |
4 |
Latvia |
20
|
Azerbaijan |
5 |
Malta |
21
|
Belgium |
6 |
Monaco |
22
|
Bulgaria |
7 |
Republic of Moldova |
23
|
Bosnia and Herzegovina |
8 |
Macedonia |
24
|
Belarus |
9 |
Norway |
25
|
Switzerland |
0A |
Netherlands |
26
|
Cyprus |
0B |
Portugal |
27
|
Czech Republic |
0C |
Poland |
28
|
Germany |
0D |
Romania |
29
|
Denmark |
0E |
San Marino |
2A
|
Spain |
0F |
Russian Federation |
2B
|
Estonia |
10 |
Sweden |
2C
|
France |
11 |
Slovakia |
2D
|
Finland |
12 |
Slovenia |
2E
|
Liechtenstein |
13 |
Turkmenistan |
2F
|
Faeroe Islands |
14 |
Turkey |
30
|
United Kingdom |
15 |
Ukraine |
31
|
Georgia |
16 |
Vatican City |
32
|
Greece |
17 |
Yugoslavia |
33
|
Hungary |
18 |
RFU |
34..FC
|
Croatia |
19 |
European Community |
FD
|
Italy |
1A |
Example |
FE
|
Ireland |
1B |
Rest of the world |
FF
|