Changes

9,041 bytes added ,  16:37, 28 June 2019
no edit summary
Line 1,438: Line 1,438:     
All information is provided in “FMB6 FM6320 FM5300 and FM5500 TCP Link mode test instructions.pdf” document.
 
All information is provided in “FMB6 FM6320 FM5300 and FM5500 TCP Link mode test instructions.pdf” document.
 +
 +
== '''<big>Codec 14</big>''' ==
 +
 +
*'''About Codec14'''
 +
 +
Codec14 is original Teltonika protocol for device-server communication over GPRS messages and it is based on Codec12 protocol
 +
 +
Codec14 GPRS commands can be used for sending configuration, debug, digital outputs control commands or other (special purpose command on special firmware versions).
 +
 +
*'''FMB firmware requirements'''
 +
 +
Implemented in base firmware from FMB.Ver.03.25.04.Rev.00 and newer.
 +
 +
*'''General Codec14 message structure'''
 +
 +
The following diagram shows basic structure of Codec14 messages.
 +
 +
 +
*'''Command message structure'''
 +
{| class="nd-othertables_2" style="width:100%;
 +
|+
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | 0x00000000 (preamble)
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | Data size
 +
! rowspan="1" style="width:6%; vertical-align: middle; text-align: center;" | 0x0E (Codec ID)
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | Command quantity
 +
! colspan="1" style="width:10%; vertical-align: middle; text-align: center;"| 0x05<br>(Message type)
 +
! rowspan="1" style="width:14%; vertical-align: middle; text-align: center;" | Command size + IMEI size (8 bytes)
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | IMEI (HEX)
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | Command
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | Command quantity
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | CRC
 +
|-
 +
| 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="nd-othertables_2" style="width:100%;
 +
|+
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | 0x00000000 (preamble)
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | Data size
 +
! rowspan="1" style="width:6%; vertical-align: middle; text-align: center;" | 0x0E (Codec ID)
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | Response quantity
 +
! colspan="1" style="width:10%; vertical-align: middle; text-align: center;"| 0x06 / 0x11 (Message type)
 +
! rowspan="1" style="width:14%; vertical-align: middle; text-align: center;" | Response size + IMEI size (8 bytes)
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | IMEI (HEX)
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | Response
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | Response quantity
 +
! rowspan="1" style="width:10%; vertical-align: middle; text-align: center;" | CRC
 +
|-
 +
| 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
 +
|-
 +
|}
 +
 +
 +
*'''Structure explanation:'''
 +
 +
: 1. The message starts with '''preamble field''' - four zero bytes. <br>
 +
: 2. Then goes four bytes '''data size''' field (size is calculated from 0x0E field to the second command or response quantity field). <br>
 +
: 3. Then follows one byte '''Codec ID field (<span style="color:red">in Codec 14 it is always 0x0E</span>)'''. <br>
 +
: 4. Then goes '''command or response quantity field.''' Response message will contain same quantity field value as request command quantity 1st byte (quantity byte that’s located before message field type byte). 2nd byte (quantity byte that’s located at the end before CRC) will not be parsed but it’s recommended that it should contain same value as 1st byte. <br>
 +
: 5. After that goes one byte '''message type field.''' If it’s request command from server it has to contain 0x05. The response type field will contain 0x06 if it’s ACK or 0x11 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 (0x06) 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 (0x11) message type field value. <br>
 +
: 6. Then follows four bytes '''command or response size field.''' (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>
 +
: 7. After it follows the '''IMEI'''. IMEI is send as HEX value. Example if device IMEI is 123456789123456 then IMEI data field will contain 0x0123456789123456 value. <br>
 +
: 8. After it follows the '''command or response field''' itself.  If message type field is nACK (0x11) this data field will be empty. <br>
 +
: 9. After that goes the second '''command or response quantity field.''' <br>
 +
: 10. At the end there’s four bytes '''CRC field'''. <br>
 +
 +
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.
 +
 +
CRC is shown in Figure 3 CRC calculation algorithm.
 +
 +
 +
*'''GPRS in Codec14 examples'''
 +
 +
Sending "''getver''" SMS command via GPRS Codec14:<br>
 +
'''Server requests:'''<br>
 +
Hexadecimal stream:<br>
 +
0000000000000016<span style="color:red">'''0E'''</span>01<span style="background-color: lightblue">05</span>0000000E<span style="background-color: lightgreen">0352093081452251</span><span style="background-color: yellow">676574766572</span>010000D2C1<br>
 +
'''Parsed:'''<br>
 +
Zero:  0x00000000<br>
 +
Packet Length:  0x00000016<br>
 +
Codec:  <span style="color:red">'''0E'''</span><br>
 +
Quantity of commands:  0x01<br>
 +
Command type:  0x<span style="background-color: lightblue">05</span><br>
 +
Command size:  0x0000000E<br>
 +
IMEI:  0x<span style="background-color: lightgreen">0352093081452251</span> (HEX string)<br>
 +
Command:  0x<span style="background-color: yellow">676574766572</span> (HEX of '''getver''')<br>
 +
Quantity of commands:  01<br>
 +
CRC:  0x0000D2C1<br>
 +
 +
 +
'''Device ACK response:'''<br>
 +
Hexadecimal stream: <br>
 +
00000000000000AB<span style="color:red">'''0E'''</span>01<span style="background-color: lightblue">06</span>000000A3<span style="background-color: lightgreen">0352093081452251</span><span style="background-color: yellow">5665723A30332E31382E3<br>
 +
1345F3034204750533A41584E5F352E31305F333333332048773A464D4231323020<br>
 +
4D6F643A313520494D45493A33353230393330383134353232353120496E69743A3<br>
 +
23031382D31312D323220373A313320557074696D653A3137323334204D41433A3<br>
 +
63042444430303136323631205350433A312830292041584C3A30204F42443A3020<br>
 +
424C3A312E362042543A34</span>0100007AAE<br>
 +
'''Parsed:'''<br>
 +
Zero:  0x00000000  <br>
 +
Packet Length: 0x000000AB <br>
 +
Codec:  0x<span style="color:red">'''0E'''</span><br>
 +
Quantity of commands:  01  <br>
 +
Command type:  0x<span style="background-color: lightblue">06</span><br>
 +
Command size:  0x000000A3 <br>
 +
IMEI:  0x<span style="background-color: lightgreen">0352093081452251</span> <br>
 +
Command response in ASCII after conversion:<br>
 +
<span style="background-color: yellow">Ver:03.18.14_04 GPS:AXN_5.10_3333 Hw:FMB120 Mod:15 IMEI:352093081452251 <br>
 +
Init:2018-11-22 7:13 Uptime:17234 MAC:60BDD0016261 SPC:1(0) AXL:0 OBD:0 BL:1.6 BT:4</span><br>
 +
Quantity of commands:  01  <br>
 +
CRC:  0x00007AAE <br>
 +
 +
 +
'''Device nACK response:'''<br>
 +
Hexadecimal stream: <br>
 +
0000000000000010<span style="color:red">'''0E'''</span>01<span style="background-color: lightblue">11</span>00000008<span style="background-color: lightgreen">0352093081452468</span>01000032AC <br>
 +
'''Parsed:''' 
 +
Zero:  0x00000000  <br>
 +
Packet Length: 0x00000010 <br>
 +
Codec:  0x<span style="color:red">'''0E'''</span><br>
 +
Quantity of commands:  01  <br>
 +
Command type:  0x<span style="background-color: lightblue">11</span><br>
 +
Command size:  0x00000008 <br>
 +
IMEI:  0x<span style="background-color: lightgreen">0352093081452468</span> <br>
 +
Quantity of commands:  01  <br>
 +
CRC:  0x000032AC <br>
    
== '''<big>Codec 16</big>''' ==
 
== '''<big>Codec 16</big>''' ==

Navigation menu