Changes

no edit summary
Line 19: Line 19:  
|-
 
|-
 
|}
 
|}
Also, there are using two data transport protocols: TCP and UDP. But it is not important which one will be use in Codec.  
+
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 for device data sending</big>'''=
Line 65: Line 65:  
'''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>
 
'''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>
 
'''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>
+
'''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
Line 135: Line 135:  
'''Satellites''' – number of visible satellites. <br>
 
'''Satellites''' – number of visible satellites. <br>
 
'''Speed''' – speed calculated from satellites. <br> <br>
 
'''Speed''' – speed calculated from satellites. <br> <br>
'''Note:''' Speed will be <code>0x0000</code> if GPS data is invalid. <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>
 
Longitude and latitude are integer values built from degrees, minutes, seconds and milliseconds by formula: <br>
 
[[Image:GPS.png]]
 
[[Image:GPS.png]]
Line 305: Line 305:  
| rowspan="24" style="vertical-align: middle; text-align: center;" |AVL Data
 
| 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;" |Timestamp
| style="vertical-align: middle; text-align: center;" |00 00 00 01 6B 40 D8 EA 30 (GMT: Monday, June 10, 2019 10:04:46 AM)
+
| 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;" |Priority
Line 466: Line 466:  
|-
 
|-
 
| style="vertical-align: middle; text-align: center;" |1’st IO Value
 
| 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;" |5E 10
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N4 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N8 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
Line 556: Line 556:  
| style="vertical-align: middle; text-align: center;" |00
 
| style="vertical-align: middle; text-align: center;" |00
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N4 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N8 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
Line 606: Line 606:  
| style="vertical-align: middle; text-align: center;" |00
 
| style="vertical-align: middle; text-align: center;" |00
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N4 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N8 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
 
| rowspan="2" style="vertical-align: middle; text-align: center;" |
 
| 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;" |Number of Data 2 (Number of Total Records)
| style="vertical-align: middle; text-align: center;" |01
+
| style="vertical-align: middle; text-align: center;" |02
 
|-
 
|-
 
| style="vertical-align: middle; text-align: center;" |CRC-16
 
| style="vertical-align: middle; text-align: center;" |CRC-16
Line 626: Line 626:  
*'''<big>Codec8 protocol sending over UDP</big>'''
 
*'''<big>Codec8 protocol sending over UDP</big>'''
   −
UDP is a transport layer protocol above UDP/IP to add reliability to plain UDP/IP using acknowledgment packets. <br>
+
Codec8 protocol over UDP is a transport layer protocol above UDP/IP to add reliability to plain UDP/IP using acknowledgment packets. <br>
    
*'''AVL Data Packet'''
 
*'''AVL Data Packet'''
Line 857: Line 857:  
| style="vertical-align: middle; text-align: center;" |5D BC
 
| style="vertical-align: middle; text-align: center;" |5D BC
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N4 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N8 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
Line 1,038: Line 1,038:  
'''Satellites''' – number of visible satellites. <br>
 
'''Satellites''' – number of visible satellites. <br>
 
'''Speed''' – speed calculated from satellites. <br> <br>
 
'''Speed''' – speed calculated from satellites. <br> <br>
'''Note:''' Speed will be <code>0x0000</code> if GPS data is invalid. <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>
 
Longitude and latitude are integer values built from degrees, minutes, seconds and milliseconds by formula: <br>
 
[[Image:GPS.png]]
 
[[Image:GPS.png]]
Line 1,057: Line 1,057:  
| style="vertical-align: middle; text-align: center;" |2 bytes
 
| style="vertical-align: middle; text-align: center;" |2 bytes
 
| rowspan="33" style=" width:5%; vertical-align: middle; text-align: left;" |
 
| 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 0xEF (AVL ID: 239). If it’s not eventual record – the value is 0. <br>
+
| 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>
 
'''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>
 
'''N1''' – number of properties, which length is 1 byte. <br>
Line 1,273: Line 1,273:  
| style="vertical-align: middle; text-align: center;" |00 1D
 
| style="vertical-align: middle; text-align: center;" |00 1D
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N4 of Two Bytes IO
+
| 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;" |00 01
 
|-
 
|-
Line 1,282: Line 1,282:  
| style="vertical-align: middle; text-align: center;" |01 5E 2C 88
 
| style="vertical-align: middle; text-align: center;" |01 5E 2C 88
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N8 of Two Bytes IO
+
| 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;" |00 02
 
|-
 
|-
Line 1,316: Line 1,316:  
*'''UDP channel protocol'''
 
*'''UDP channel protocol'''
   −
AVL data packet is the same as with Codec8, except Codec ID is changed to <code>0x8E</code>. <br>  
+
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>  
    
*'''Communication with server'''
 
*'''Communication with server'''
Line 1,455: Line 1,455:  
| style="vertical-align: middle; text-align: center;" |00 1D
 
| style="vertical-align: middle; text-align: center;" |00 1D
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N4 of Two Bytes IO
+
| 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;" |00 01
 
|-
 
|-
Line 1,464: Line 1,464:  
| style="vertical-align: middle; text-align: center;" |01 5E 2C 88
 
| style="vertical-align: middle; text-align: center;" |01 5E 2C 88
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N8 of Two Bytes IO
+
| 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;" |00 02
 
|-
 
|-
Line 1,486: Line 1,486:     
Server response in hexadecimal stream:
 
Server response in hexadecimal stream:
<code>0005CAFE010700</code> <br> <br>
+
<code>0005CAFE010701</code> <br> <br>
 
Parsed:
 
Parsed:
 
{| class="nd-othertables_2" style="width:100%;"
 
{| class="nd-othertables_2" style="width:100%;"
Line 1,510: Line 1,510:  
|-
 
|-
 
| style="vertical-align: middle; text-align: center;" |Number of Accepted Data
 
| style="vertical-align: middle; text-align: center;" |Number of Accepted Data
| style="vertical-align: middle; text-align: center;" |00
+
| style="vertical-align: middle; text-align: center;" |01
 
|-
 
|-
 
|} <br>
 
|} <br>
Line 1,649: Line 1,649:  
'''Satellites''' – number of visible satellites. <br>
 
'''Satellites''' – number of visible satellites. <br>
 
'''Speed''' – speed calculated from satellites. <br> <br>
 
'''Speed''' – speed calculated from satellites. <br> <br>
'''Note:''' Speed will be <code>0x0000</code> if GPS data is invalid. <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>
 
Longitude and latitude are integer values built from degrees, minutes, seconds and milliseconds by formula: <br>
 
[[Image:GPS.png]]
 
[[Image:GPS.png]]
Line 1,912: Line 1,912:  
| style="vertical-align: middle; text-align: center;" |56 3A
 
| style="vertical-align: middle; text-align: center;" |56 3A
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N4 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N8 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
Line 1,983: Line 1,983:  
| style="vertical-align: middle; text-align: center;" |56 3A
 
| style="vertical-align: middle; text-align: center;" |56 3A
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N4 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N8 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
Line 2,001: Line 2,001:  
Server response: <code>00000002</code> <br>  
 
Server response: <code>00000002</code> <br>  
   −
*'''<big>Codec16 Extended protocol sending over UDP</big>'''
+
*'''<big>Codec16 protocol sending over UDP</big>'''
 
*'''UDP channel protocol'''
 
*'''UDP channel protocol'''
   −
AVL data packet is the same as with Codec8, except Codec ID is changed to <code>0x10</code>. <br>
+
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>
    
*'''Communication with server'''
 
*'''Communication with server'''
Line 2,164: Line 2,164:  
| style="vertical-align: middle; text-align: center;" |11 1A
 
| style="vertical-align: middle; text-align: center;" |11 1A
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N4 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |N8 of Two Bytes IO
+
| 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;" |00
 
|-
 
|-
Line 2,177: Line 2,177:     
Server response in hexadecimal stream:
 
Server response in hexadecimal stream:
<code>0005CAFE010700</code> <br> <br>
+
<code>0005CAFE010701</code> <br> <br>
 
Parsed:
 
Parsed:
 
{| class="nd-othertables_2" style="width:100%;"
 
{| class="nd-othertables_2" style="width:100%;"
Line 2,201: Line 2,201:  
|-
 
|-
 
| style="vertical-align: middle; text-align: center;" |Number of Accepted Data
 
| style="vertical-align: middle; text-align: center;" |Number of Accepted Data
| style="vertical-align: middle; text-align: center;" |00
+
| style="vertical-align: middle; text-align: center;" |01
 
|-
 
|-
 
|} <br />
 
|} <br />
Line 2,230: Line 2,230:  
|-
 
|-
 
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Generation Type
 
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Generation Type
| style="vertical-align: middle; text-align: center;" |Is Using
+
| 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;" |Not Using
 
| style="vertical-align: middle; text-align: center;" |Is Using
 
| style="vertical-align: middle; text-align: center;" |Is Using
Line 2,258: Line 2,258:  
*'''<big>About Codec12</big>'''
 
*'''<big>About Codec12</big>'''
   −
Codec12 is 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>  
+
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>  
 +
 
 +
*'''<big>FM firmware requirements</big>'''
 +
 
 +
Supported GPRS commands on each device depending on the firmware version. For available GPRS commands on each device, please refer to the table below.
 +
{| 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>'''
 
*'''<big>GPRS command session</big>'''
   −
Following figure shows how GRPS command session is started over TCP. <br>
+
The following figure shows how the GRPS command session is started over TCP. <br>
 
[[File:Codec12.png|1150px]]
 
[[File:Codec12.png|1150px]]
First, Teltonika device opens GPRS session and sends AVL data to 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 device. <br>
+
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 acknowledgement of each data array send from device is four bytes integer – number of records received. <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 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>  
+
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>'''
 
*'''<big>General Codec12 message structure</big>'''
Line 2,331: Line 2,364:  
'''Command/Response''' – command or response in HEX. <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>
 
'''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> <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>
 
Note that difference between commands and responses is message type field: <code>0x05</code> means command and <code>0x06</code> means response. <br>
   Line 2,341: Line 2,374:  
*'''<big>Command parsing example</big>'''
 
*'''<big>Command parsing example</big>'''
   −
Hexadecimal stream of 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 understanding. <br>  
+
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>  
    
*'''<big>GPRS commands examples</big>'''
 
*'''<big>GPRS commands examples</big>'''
Line 2,530: Line 2,563:  
*'''COM TCP Link Mode'''
 
*'''COM TCP Link Mode'''
   −
All information is provided in “FMxx TCP Link mode test instructions.pdf” document.  
+
All information is provided in “FMxx TCP Link mode test instructions.pdf” document.
    
=='''<big>Codec 13</big>'''==
 
=='''<big>Codec 13</big>'''==
Line 2,536: Line 2,569:  
*'''<big>About Codec13</big>'''
 
*'''<big>About Codec13</big>'''
   −
Codec13 is original Teltonika protocol for device-server communication over GPRS messages and it is based on Codec12 protocol. Main differences of Codec13 are that timestamp is using in messages and communication is one way only (Codec13 is used for Device -> Server sending). <br>
+
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>
    
*'''<big>General Codec13 message structure</big>'''
 
*'''<big>General Codec13 message structure</big>'''
Line 2,546: Line 2,579:  
! 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;" |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;" |Codec ID
! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Command Quantity 1
+
! 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
 
! 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;" |Command Size
+
! 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;" |Timestamp
! 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;" |Response
! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Command Quantity 2
+
! 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
 
! rowspan="1" style="width:10%; border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |CRC-16
 
|-
 
|-
Line 2,560: Line 2,593:  
| 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;" |8 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;" |X bytes
 
| style="vertical-align: middle; text-align: center;" |1 byte
 
| style="vertical-align: middle; text-align: center;" |1 byte
Line 2,569: Line 2,602:     
'''Preamble''' – the packet starts with preamble field (four zero bytes). <br>
 
'''Preamble''' – the packet starts with preamble field (four zero bytes). <br>
'''Data Size''' – size is calculated from Codec ID field to the second Command Quantity field. <br>
+
'''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>
 
'''Codec ID''' – in Codec13 it is always <code>0x0D</code>. <br>
'''Command Quantity 1''' – <code>0x01</code>, it is ignored when parsing the message. <br>
+
'''Response Quantity 1''' – <code>0x01</code>, it is ignored when parsing the message. <br>
'''Command Type''' – it is always <code>0x05</code> since the packet is direction is FM->Server. <br>
+
'''Response Type''' – it is always <code>0x06</code> since the packet is direction is FM->Server. <br>
'''Command Size''' – command size field includes size of timestamp too, so it is equal to size of payload + size of timestamp. <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 milliseconds, between the current time and midnight, January, 1970 UTC (UNIX time). <br>
+
'''Timestamp''' – a difference, in seconds, between the current time and midnight, January, 1970 UTC (UNIX time). <br>
'''Command''' – actual received data. <br>
+
'''Response''' – actual received data. <br>
'''Command Quantity 2''' – a byte which defines how many records (commands) 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>
+
'''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>
 
'''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>  
 
'''Note:''' Codec13 packets are used only when “Message Timestamp” parameter in RS232 settings is enabled. <br>  
Line 2,583: Line 2,616:     
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>
 
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>
Sending ''[[FMB getinfo|getinfo]]'' SMS command via GPRS Codec13. <br> <br>
+
Receiving "hello lets test" SMS response via GPRS Codec13<br> <br>
 
Hexadecimal stream: <br>
 
Hexadecimal stream: <br>
<code>00000000000000170D01050000000F0000016C0A81C320676574696E666F010000AAD2</code> <br> <br>
+
<code>000000000000001D0D01060000001564E8328168656C6C6F206C65747320746573740D0A0100003548</code> <br> <br>
 
Parsed:  
 
Parsed:  
 
{| class="nd-othertables_2" style="width:100%;"
 
{| class="nd-othertables_2" style="width:100%;"
 
|+
 
|+
! colspan="2" style="border-bottom: 2px solid #0054A6; vertical-align: middle; text-align: center;" |Server Command
+
! 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;" |Server Command Part
+
! 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
 
! rowspan="1" style="width:50%; vertical-align: middle; text-align: center;" |HEX Code Part
 
|-
 
|-
Line 2,598: Line 2,631:  
|-
 
|-
 
| style="vertical-align: middle; text-align: center;" |Data Size
 
| style="vertical-align: middle; text-align: center;" |Data Size
| style="vertical-align: middle; text-align: center;" |00 00 00 17
+
| 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;" |Codec ID
 
| style="vertical-align: middle; text-align: center;" |0D
 
| style="vertical-align: middle; text-align: center;" |0D
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |Command Quantity 1
+
| 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;" |01
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |Command Type
+
| style="vertical-align: middle; text-align: center;" |Response Type
| style="vertical-align: middle; text-align: center;" |05
+
| style="vertical-align: middle; text-align: center;" |06
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |Command Size
+
| style="vertical-align: middle; text-align: center;" |Response Size
| style="vertical-align: middle; text-align: center;" |00 00 00 07
+
| 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;" |Timestamp
| style="vertical-align: middle; text-align: center;" |00 00 01 6C 0A 81 C3 20
+
| style="vertical-align: middle; text-align: center;" |64 E8 32 81
 
|-
 
|-
| style="vertical-align: middle; text-align: center;" |Command
+
| style="vertical-align: middle; text-align: center;" |Response
| style="vertical-align: middle; text-align: center;" |67 65 74 69 6E 66 6F
+
| 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;" |Command Quantity 2
+
| 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;" |01
 
|-
 
|-
 
| style="vertical-align: middle; text-align: center;" |CRC-16
 
| style="vertical-align: middle; text-align: center;" |CRC-16
| style="vertical-align: middle; text-align: center;" |00 00 AA D2
+
| style="vertical-align: middle; text-align: center;" |00 00 35 48
 
|-
 
|-
 
|}  
 
|}  
      −
Note that Server Command converted from HEX to ASCII means ''[[FMB getinfo|getinfo]]''
+
Note that Server Response converted from HEX to ASCII means "hello lets test"
    
=='''<big>Codec 14</big>'''==
 
=='''<big>Codec 14</big>'''==
Line 2,747: Line 2,780:  
|-
 
|-
 
| style="vertical-align: middle; text-align: center;" |IMEI
 
| style="vertical-align: middle; text-align: center;" |IMEI
| style="vertical-align: middle; text-align: center;" |00 00 00 0E
+
| style="vertical-align: middle; text-align: center;" |03 52 09 30 81 45 22 51
 
|-
 
|-
 
| style="vertical-align: middle; text-align: center;" |Command
 
| style="vertical-align: middle; text-align: center;" |Command
| style="vertical-align: middle; text-align: center;" |03 52 09 30 81 45 22 51
+
| 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;" |Command Quantity 2
Line 2,858: Line 2,891:  
|-
 
|-
 
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Communication
 
! 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;" |Server Device Communication
| style="vertical-align: middle; text-align: center;" |One-way (Device -> Server communication)
+
| style="vertical-align: middle; text-align: center;" |One-way (Device Server communication)
| style="vertical-align: middle; text-align: center;" |Server - Device Communication
+
| style="vertical-align: middle; text-align: center;" |Server Device Communication
 
|-
 
|-
 
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Codec ID
 
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Codec ID
Line 2,866: Line 2,899:  
| style="vertical-align: middle; text-align: center;" |0x0D
 
| style="vertical-align: middle; text-align: center;" |0x0D
 
| style="vertical-align: middle; text-align: center;" |0x0E
 
| style="vertical-align: middle; text-align: center;" |0x0E
 +
|-
 +
! style="vertical-align: middle; text-align: center;" |command message type
 +
| 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
 
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Response Message Type
 
| style="vertical-align: middle; text-align: center;" |0x06
 
| style="vertical-align: middle; text-align: center;" |0x06
| style="vertical-align: middle; text-align: center;" | -
+
| 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)
 
| 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
 
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" |Command / Response size
| style="vertical-align: middle; text-align: center;" |Only Command/Response
+
| style="vertical-align: middle; text-align: center;" |Command/Response
| style="vertical-align: middle; text-align: center;" |Only Command
+
| style="vertical-align: middle; text-align: center;" |Only Response
 
| style="vertical-align: middle; text-align: center;" |Command/Response + IMEI
 
| style="vertical-align: middle; text-align: center;" |Command/Response + IMEI
 
|-
 
|-