Line 716: |
Line 716: |
| ==Communication protocol== | | ==Communication protocol== |
| '''Close a session command (CMD ID 0x0000)'''<br> | | '''Close a session command (CMD ID 0x0000)'''<br> |
− | In case when a device connects to a server, but the server does not expect it to connect, server will respond by sending a CLOSE command after which the connection will be terminated. This command is also used when device connects to a server for a custom file sending and server finishes to send all custom files to the device. | + | In case when a device connects to a server, but the server does not expect it to connect, the server will respond by sending a CLOSE command after which the connection will be terminated. This command is also used when the device connects to a server for a custom file sending and the server finishes to send all custom files to the device. |
| {| class="wikitable" | | {| class="wikitable" |
| |+ | | |+ |
Line 742: |
Line 742: |
| <br> | | <br> |
| '''File request command (CMD ID 0x0008)'''<br> | | '''File request command (CMD ID 0x0008)'''<br> |
− | After device is connected for a file upload, server initiates file transfer by sending a FILE REQ command. | + | After the device is connected for a file upload, the server initiates file transfer by sending a FILE REQ command. |
| {| class="wikitable" | | {| class="wikitable" |
| |+ | | |+ |
Line 753: |
Line 753: |
| | rowspan="1" style="text-align: center; style=" width: 150px; background: white; color: black;" |''See the table below'' | | | rowspan="1" style="text-align: center; style=" width: 150px; background: white; color: black;" |''See the table below'' |
| |} | | |} |
− | Device should answer with a START command described above indicating a size and CRC of the requested file.
| + | The device should answer with a START command described above indicating the size and CRC of the requested file. |
| {| class="wikitable" | | {| class="wikitable" |
| |+ | | |+ |
Line 799: |
Line 799: |
| | rowspan="1" style="text-align: center; style=" width: 150px; background: white; color: black;" |0x00000001 | | | rowspan="1" style="text-align: center; style=" width: 150px; background: white; color: black;" |0x00000001 |
| |} | | |} |
− | By sending SYNC command it is ensured that next data command will contain file data starting from the specified offset. | + | By sending the SYNC command it is ensured that the next data command will contain file data starting from the specified offset. |
| <br> | | <br> |
| <br> | | <br> |
Line 817: |
Line 817: |
| |} | | |} |
| A File data is split into 1024 byte parts, each part wrapped into a DATA command and is sent. <br> | | A File data is split into 1024 byte parts, each part wrapped into a DATA command and is sent. <br> |
− | Note: ''if a command with a bad CRC is received, RESUME command should be sent with the last valid file offset, after receiving a RESUME command, server will stop sending DATA commands and continue communication from'' '''“Resume file transfer”''' ''step.''<br> | + | Note: ''if a command with a bad CRC is received, RESUME command should be sent with the last valid file offset, after receiving a RESUME command, the server will stop sending DATA commands and continue communication from'' '''“Resume file transfer”''' ''step.''<br> |
| CRC polynomial expression: 0x8408 | | CRC polynomial expression: 0x8408 |
− | Initial value, when calculating CRC, is previously received packet (CMD ID 0x0004) CRC value.
| + | The initial value, when calculating CRC, is the previously received packet (CMD ID 0x0004) CRC value. |
| <br> | | <br> |
| <br> | | <br> |
| '''File transfer status command (CMD ID 0x0005)'''<br> | | '''File transfer status command (CMD ID 0x0005)'''<br> |
− | After a file transfer is completed and no more files are required from the device, a server should send a COMPLETED command to the device (this command does not work after executing repeat init command0 x0009 – in this case the server should send a CLOSE SESSION 0x0000 command mentioned before). | + | After a file transfer is completed and no more files are required from the device, a server should send a COMPLETED command to the device (this command does not work after executing repeat init command0 x0009 – in this case, the server should send a CLOSE SESSION 0x0000 command mentioned before). |
| {| class="wikitable" | | {| class="wikitable" |
| |+ | | |+ |
Line 834: |
Line 834: |
| | rowspan="1" style="text-align: center; style=" width: 150px; background: white; color: black;" |0x00000000 | | | rowspan="1" style="text-align: center; style=" width: 150px; background: white; color: black;" |0x00000000 |
| |} | | |} |
− | In case of the server using invalid arguments, commands or not following the file request flow, the device will send this command with a Status field set to one of the few possible error codes. List of possible ones is provided below. | + | In case of the server using invalid arguments, commands or not following the file request flow, the device will send this command with a Status field set to one of the few possible error codes. A list of possible ones is provided below. |
| {| class="wikitable" | | {| class="wikitable" |
| |+ | | |+ |
Line 868: |
Line 868: |
| <br> | | <br> |
| '''Initialization packet repeat command (CMD ID 0x0009)'''<br> | | '''Initialization packet repeat command (CMD ID 0x0009)'''<br> |
− | When sent, the initialization packet is repeated. This is used, when all of the files are downloaded and additional check is carried out for any additional files, that may have been captured during the download operation. | + | When sent, the initialization packet is repeated. This is used, when all of the files are downloaded and an additional check is carried out for any additional files, that may have been captured during the download operation. |
| + | <br> |
| + | '''Query file metadata request (CMD ID 0x000A)'''<br> |
| + | This command is used for retrieving extra information about a selected file. A file identifier is used to determine which file’s information will be received. File identifiers are identical and used in the same way as in the File Request Command (0x0008). |
| <br> | | <br> |
| | | |