Line 1,324: |
Line 1,324: |
| !style="background: yellow; color: red;"| 0x01||Ignored bytes | | !style="background: yellow; color: red;"| 0x01||Ignored bytes |
| |} | | |} |
| + | |
| + | |
| + | <small>Figure 2. Structure of Codec 13 messages</small> |
| + | |
| + | Structure explanation: |
| + | |
| + | *'''Preamble field''' - four zero bytes. |
| + | |
| + | *'''Data size field''' (size is calculated from: |
| + | |
| + | <small>CID(0x0D = 1 byte) |
| + | |
| + | NOD(0x01 = 1 byte) |
| + | |
| + | CMD_TYPE(0x06 = 1 byte) |
| + | |
| + | CMD_SIZE(variable = 4 bytes, includes size of timestamp field too) |
| + | |
| + | PAYLOAD(variable size, stored in CMD_SIZE field) |
| + | |
| + | NOD(0x01 = 1 byte)) |
| + | </small> |
| + | *'''Codec ID field''' (in Codec 13 it is always 0x0D). |
| + | |
| + | *'''NOD field''' (0x01, it is ignored when parsing the message). |
| + | |
| + | *'''Message type field'''. It is always 0x06 since the packet is direction is FM->Server. |
| + | |
| + | *'''Command size field'''. Command size field includes size of timestamp too, so it is equal to size of payload + size of timestamp. |
| + | |
| + | *'''Timestamp field''' – UNIX timestamp (since 1970/01/01 00:00:00 UTC) |
| + | |
| + | *'''Payload field''' – actual received data |
| + | |
| + | *'''NOD field''' (0x01, it is ignored when parsing the message) |
| + | |
| + | *'''CRC field''' – CRC-16-IBM |
| + | |
| + | |
| + | The algorithm to calculate CRC is CRC-16 (also known as CRC-16-IBM). All the fields from codec ID to last NOD field are used to calculate CRC. The algorithm of how to calculate CRC is shown in figure 3. |
| + | |
| + | '''NOTE''' – Codec13 packets are used only when “Message Timestamp” parameter in RS232 settings is enabled. |
| + | |
| + | [[Image:111.png|111.png]] |
| + | |
| + | <small>Figure 3. CRC calculation algorithm</small> |
| + | |
| + | |
| + | *'''Command parsing example''' |
| + | |
| + | The different fields of message are highlighted in gray and yellow for better readability. |
| + | |
| + | Hexadecimal stream: |
| | | |
| == '''<big>Codec 16 Nebaigta</big>''' == | | == '''<big>Codec 16 Nebaigta</big>''' == |