Changes

1,696 bytes added ,  10:12, 2 November 2018
Line 982: Line 982:     
*'''General Codec12 message structure'''
 
*'''General Codec12 message structure'''
 +
 +
The following diagram shows basic structure of Codec 12 messages.
 +
 +
 +
Command message structure
 +
{| class="wikitable"
 +
|-
 +
! 0x00000000 !! Data size !! 0x0C !! Command quantity !! 0x05 !! Command size !! Command !! Command quantity !! CRC
 +
|-
 +
| 4 bytes || 4 bytes || 1 byte || 1 byte || 1 byte || 4 bytes || X bytes || 1 byte || 4 bytes
 +
|}
 +
 +
 +
Response message structure
 +
{| class="wikitable"
 +
|-
 +
! 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.
 +
 +
[[Image:qqq.png|qqq.png]]
    
== <big>Codec 13 Nebaigta</big> ==
 
== <big>Codec 13 Nebaigta</big> ==

Navigation menu