Changes

no edit summary
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 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 Four Bytes IO
 
| style="vertical-align: middle; text-align: center;" |N4 of Four Bytes IO
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,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 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,290: Line 2,290:  
|-
 
|-
 
|} <br />
 
|} <br />
'''Note:''' “SMS over GPRS” means that all standard SMS commands text can be sent to the device via GPRS in Codec12 format.   
+
'''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>'''
Line 2,568: 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,578: 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,601: 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 seconds, 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>  
    +
*'''<big>Command parsing example</big>'''
    +
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>
 +
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
 +
! 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 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"
    
=='''<big>Codec 14</big>'''==
 
=='''<big>Codec 14</big>'''==
Line 2,843: 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,851: 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
 
|-
 
|-