Jump to content

ADAS Communication Protocol: Difference between revisions

Created page with "'''General command structure''' General communication packet structure is as in table below. It consists of CMD_ID (2 bytes), Data length of command and payload. {| class="wik..."
 
No edit summary
 
(25 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''General command structure'''
__TOC__
 
==Server side configuration source code==
'''NOTE: This is a "test server" version, dedicated for initial functionality testing (which could also be done via cloudview platform) with 1-2 cameras. Multithreaded (and multiple device) handling on the server side is up to the client to do additional development and/or necessary optimizations and modifications, to support more than 1-2 cameras at the same server instance.'''
 
Optionally - platforms that already support camera integrations could be used.
Together with the communication protocol, this server side source code can be downloaded and implemented upon personal servers for the ease of use and configuration, please see index.js, debug.js and protocol.js which can be copied into the server.
 
Server files & source code can be downloaded here:
* [[Media:Camera Server files for Video Solutions.zip|Camera Server files]]
 
 
Please see index.js, debug.js and protocol.js files. These files contain required support for camera downloads and they can be inserted straight into server. The folder can also be run as server and will work with file downloads, so if personal server is not available, there is always a possibility to use this default server.
 
[[File:Server123.png|center]]
 
All that is required is an open Port on the computer and that port has to be written in run_server.bat file. Also by clicking on Readme file, you will be able to see the settings which you can enter into that run_server.bat file by right clicking the mouse button on it and choosing edit option. These settings include choices like DualCam download, ADAS file download or Auto mode, Metadata inclusion and etc.
 
[[File:Server edit.png|center]]
 
In this case, Notepad++ is chosen but you can choose any text editor in order to update the file.
 
==General command structure==
General communication packet structure is as in table below. It consists of CMD_ID (2 bytes), Data length of command and payload.
General communication packet structure is as in table below. It consists of CMD_ID (2 bytes), Data length of command and payload.
{| class="wikitable"
{| class="wikitable"
Line 11: Line 34:
|}
|}


'''Modified file transfer protocol'''
==Modified file transfer protocol==


'''Initialization packet'''
'''Initialization packet'''
Line 81: Line 104:
|}
|}


'''Request file path (CMD_ID 0x000C)'''
==Request file path (CMD_ID 0x000C)==
First after connecting to server and seeing bit set in init packet the server should send file path request command.
First after connecting to server and seeing bit set in init packet the server should send file path request command.
{| class="wikitable"
{| class="wikitable"
Line 93: Line 116:
|}
|}


'''File path response (CMD_ID 0x000D)'''
==File path response (CMD_ID 0x000D)==
This is a response to file path request (0x000C) command.
This is a response to file path request (0x000C) command.
{| class="wikitable"
{| class="wikitable"
Line 105: Line 128:
|}
|}


'''File request command (CMD_ID 0x0008)'''
==File request command (CMD_ID 0x0008)==
After device is connected for file upload server initiates file transfer by sending FILE REQ command.
After device is connected for file upload server initiates file transfer by sending FILE REQ command.
{| class="wikitable"
{| class="wikitable"
Line 118: Line 141:
Device should answer with START command described above indicating size and CRC of requested file.
Device should answer with START command described above indicating size and CRC of requested file.


'''Start file transfer command (CMD_ID 0x0001)'''
==Start file transfer command (CMD_ID 0x0001)==
After device received file request command from server (0x0008) device sends START command with file data (file size in bytes).
After device received file request command from server (0x0008) device sends START command with file data (file size in bytes).
{| class="wikitable"
{| class="wikitable"
Line 132: Line 155:
|}
|}


'''Resume file transfer command (CMD_ID 0x0002)'''
==Resume file transfer command (CMD_ID 0x0002)==
In a response to the START command a RESUME command must be sent from server.
In a response to the START command a RESUME command must be sent from server.
{| class="wikitable"
{| class="wikitable"
| colspan="11" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command ID
| colspan="11" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command ID
| colspan="7" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data length
| colspan="7" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data length
| colspan="12" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Packet offset (4 bytes)
| colspan="12" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Packet offset (in bytes) (4 bytes)
|-
|-
| colspan="11" |0x0002
| colspan="11" |0x0002
Line 143: Line 166:
| colspan="12" |0x00000000
| colspan="12" |0x00000000
|}
|}
To begin file transfer from the start, offset should be set to 0 (4 bytes value). In case when the file transfer was interrupted, to resume file transfer, offset can be set to the desired value (1 ≤ [offset] ≤ [file packets]).
To begin file transfer from the start, offset should be set to 0 (4 bytes value). In case when the file transfer was interrupted, to resume file transfer, offset can be set to the desired value (1 ≤ [offset (in bytes)] ≤ [file packets]).


'''Synchronize file transfer command (CMD_ID 0x0003)'''
==Synchronize file transfer command (CMD_ID 0x0003)==
In a response to the RESUME command SYNC command is sent from device.
In a response to the RESUME command SYNC command is sent from device.
{| class="wikitable"
{| class="wikitable"
Line 158: Line 181:
By sending SYNC command it is ensured that next data command will contain file data starting from the specified offset.
By sending SYNC command it is ensured that next data command will contain file data starting from the specified offset.


'''File data transfer command (CMD_ID 0x0004)'''
==File data transfer command (CMD_ID 0x0004)==
After sending SYNC command file data transfer is started by sending DATA commands.
After sending SYNC command file data transfer is started by sending DATA commands.
{| class="wikitable"
{| class="wikitable"
Line 179: Line 202:
''Initial value, when calculating CRC, is previously received packet (CMD ID 0x0004) CRC value.''
''Initial value, when calculating CRC, is previously received packet (CMD ID 0x0004) CRC value.''


'''File transfer status command (CMD_ID 0x0005)'''
==File transfer status command (CMD_ID 0x0005)==
After file transfer is completed and no more files are required from device, server should send COMPLETED command to the device (this command doesn’t work after executing repeat init command 0x0009 – in this case the server should send close session 0x0000 command mentioned before).
After file transfer is completed and no more files are required from device, server should send COMPLETED command to the device (this command doesn’t work after executing repeat init command 0x0009 – in this case the server should send close session 0x0000 command mentioned before).
{| class="wikitable"
{| class="wikitable"
Line 220: Line 243:
After COMPLETED command device should disconnect from the server.
After COMPLETED command device should disconnect from the server.


'''Initialization packet repeat command (CMD_ID 0x0009)'''
==Initialization packet repeat command (CMD_ID 0x0009)==
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 additional check is carried out for any additional files, that may have been captured during the download operation.


'''File transfer visual flow'''
==File transfer visual flow==
[[File:Flow.png|center|frameless|867x867px]]
[[File:Flow.png|center|frameless|867x867px]]
[[Category: Teltonika ADAS]]