Difference between revisions of "Codec14"

From Wiki Knowledge Base | Teltonika
Jump to: navigation, search
(Codec 14)
Line 76: Line 76:
 
The message starts with '''preamble field''' - four zero bytes.
 
The message starts with '''preamble field''' - four zero bytes.
  
Then goes four bytes data size field (size is calculated from 0x0E field to the second command or response quantity field). Then follows one byte Codec ID field (in Codec 14 it is always 0x0E).
+
Then goes four bytes data size field (size is calculated from 0x0E field to the second command or response quantity field).
  
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.
+
Then follows one byte '''Codec ID field (<span style="color:red">in Codec 14 it is always 0x0E</span>)'''.
  
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.
+
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.
 +
 
 +
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.
  
 
Explanation:  If received IMEI from server is equal to actual device IMEI received command will be executed and response will be send with ACK (0x06) message type field value.  If received IMEI doesn’t match actual device IMEI, received command won’t be executed and response to server will be send with nACK (0x11) message type field value.
 
Explanation:  If received IMEI from server is equal to actual device IMEI received command will be executed and response will be send with ACK (0x06) message type field value.  If received IMEI doesn’t match actual device IMEI, received command won’t be executed and response to server will be send with nACK (0x11) message type field value.
  
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.
+
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.
 +
 
 +
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.
  
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.
+
After it follows the '''command or response field''' itself. If message type field is nACK (0x11) this data field will be empty.
  
After it follows the command or response field itself.  If message type field is nACK (0x11) this data field will be empty.
+
After that goes the second '''command or response quantity field.'''
After that goes the second command or response quantity field.  
 
  
At the end there’s four bytes CRC field.
+
At the end there’s four bytes '''CRC field'''.
  
 
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.
 
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.

Revision as of 14:37, 14 June 2019

Codec 14

  • 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 FW from FMB.Ver.03.25.04.Rev.00+.

  • General Codec14 message structure

The following diagram shows basic structure of Codec14 messages.


Command message structure

0x00000000 Data size 0x0E Command quantity 0x05 Command size + IMEI size (8 bytes) IMEI (HEX) Command Command quantity CRC
4 bytes 4 bytes 1 bytes 1 bytes 1 bytes 4 bytes 8 bytes X bytes 1 bytes 4 bytes


Response message structure

0x00000000 Data size 0x0E Response quantity 0x06 / 0x11 Response size + IMEI size (8 bytes) IMEI (HEX) Response Response quantity CRC
4 bytes 4 bytes 1 bytes 1 bytes 1 bytes 4 bytes 8 bytes X bytes 1 bytes 4 bytes


  • Structure explanation:

The message starts with preamble field - four zero bytes.

Then goes four bytes data size field (size is calculated from 0x0E field to the second command or response quantity field).

Then follows one byte Codec ID field (in Codec 14 it is always 0x0E).

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.

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.

Explanation: If received IMEI from server is equal to actual device IMEI received command will be executed and response will be send with ACK (0x06) message type field value. If received IMEI doesn’t match actual device IMEI, received command won’t be executed and response to server will be send with nACK (0x11) message type field value.

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.

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.

After it follows the command or response field itself. If message type field is nACK (0x11) this data field will be empty.

After that goes the second command or response quantity field.

At the end there’s four bytes CRC field.

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.


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.