Changes

no edit summary
Line 1,719: Line 1,719:  
6 – Downloading video
 
6 – Downloading video
 
|}
 
|}
  −
'''Camera SMS/GPRS commands'''
  −
  −
'''File transfer'''
  −
A new camera request was added, which allows server to request files from camera. The format is as provided below:
  −
{| class="wikitable"
  −
! colspan="12" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command
  −
| colspan="16" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Arguments
  −
| colspan="27" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Explanation
  −
|-
  −
| colspan="12" |mdas_camreq:
  −
| colspan="16" |<file_type>,
  −
<file_source>,
  −
<timestamp>,
  −
<duration>,
  −
<domain>,<port><sup>1</sup>
  −
| colspan="27" |Captures   appropriate   file    with   the   provided    details.   If   the connection  to  server  is  opened,  then  files  immediately  become available for download. If not, then the connection is tried to  be made.
  −
If <domain> and <port> parameters  are included, the device will send footage of the command to that address.
  −
|}
  −
The arguments are as follows:
  −
  −
* <file_type>
  −
** 0 – Video
  −
** 1 – Snapshot
  −
  −
* <file_source>
  −
** 0 – hardcoded MDAS. 1, 2 and 3 are reserved for DualCam project.
  −
  −
* <timestamp>
  −
** Unix timestamp in decimal
  −
  −
* <duration>
  −
** Video duration in seconds from provided timestamp (not required for photo download) (up to 30 s)
  −
  −
* <domain>
  −
** Optional – domain to where file has to be sent
  −
* <port>
  −
** Only required if domain is used
  −
  −
<nowiki>*</nowiki>'''<domain>''' and '''<port>''' variables are optional and command can be used without them. Only available since 03.27.06.Rev.360. These parameters DO NOT work for SpecID160.
  −
  −
'''Camera firmware version'''
  −
This command can be used to retrieve the current camera FW version via SMS/GPRS.
  −
{| class="wikitable"
  −
| colspan="12" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command
  −
| colspan="16" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Arguments
  −
| colspan="27" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Explanation
  −
|-
  −
| colspan="12" |mdas_fwreq
  −
| colspan="16" |None
  −
| colspan="27" |Used to check camera’s  firmware version
  −
|}
  −
  −
'''General camera information'''
  −
This command sends these values, retrieved from the camera: date/time, error code, recording state, SD card status, camera state.
  −
{| class="wikitable"
  −
| colspan="12" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command
  −
| colspan="16" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Arguments
  −
| colspan="27" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Explanation
  −
|-
  −
| colspan="12" |mdas_getinfo
  −
| colspan="16" |None
  −
| colspan="27" |Used to get general camera  information
  −
|}
  −
  −
'''File upload procedure'''
  −
When video/snapshot file is requested via SMS/GPRS command firstly the device checks if it has SD card inserted and if it has the requested video/snapshot in the SD card. The file is present, file upload is immediately triggered, otherwise the device checks if MDAS9 camera is connected to FMB640 and tries to download the file – file upload to the server starts only after the file was saved to FMBs SD card.
  −
  −
'''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="wikitable"
  −
| colspan="18" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command ID
  −
| colspan="14" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data length
  −
| colspan="17" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data
  −
|-
  −
| colspan="18" |2 bytes
  −
| colspan="14" |2 bytes
  −
| colspan="17" |[data length] bytes
  −
|}
  −
  −
'''Modified file transfer protocol'''
  −
  −
'''Initialization packet'''
  −
On connection, the device sends an initialization packet.
  −
{| class="wikitable"
  −
| colspan="15" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Header (0x0000)
  −
| colspan="18" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Protocol ID
  −
| colspan="10" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |IMEI
  −
| colspan="13" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Settings
  −
|-
  −
| colspan="15" |2 bytes
  −
| colspan="18" |2 bytes
  −
| colspan="10" |8 bytes
  −
| colspan="13" |4 bytes
  −
|}
  −
Protocol ID – just a reference for the protocol version that is running on device (for server cross compatibility with older versions).
  −
  −
Settings flag contains information on what is available for download. Structure provided:
  −
{| class="wikitable"
  −
| colspan="57" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Settings, 4 B
  −
|-
  −
| colspan="18" |Byte 3
  −
| colspan="16" |Byte 2
  −
| colspan="10" |Byte 1
  −
| colspan="13" |Byte 0
  −
|-
  −
| colspan="2" |
  −
| colspan="2" |
  −
| colspan="3" |
  −
| colspan="2" |
  −
| colspan="3" |
  −
| colspan="2" |
  −
| colspan="2" |*
  −
| colspan="2" |
  −
| colspan="3" |
  −
| colspan="3" |
  −
| colspan="2" |
  −
| colspan="2" |
  −
|
  −
|
  −
| colspan="2" |
  −
| colspan="2" |
  −
|
  −
| colspan="2" |
  −
|
  −
|
  −
|
  −
|
  −
| colspan="2" |
  −
|
  −
| colspan="2" |
  −
|
  −
| colspan="3" |
  −
|
  −
|
  −
| colspan="2" |
  −
| colspan="2" |
  −
|
  −
|}
  −
  −
'''Close session command (CMD_ID 0x0000)'''
  −
In case when device connects to the server, but server does not expect it to connect, server will respond by sending CLOSE command after which connection will be terminated. This command is also used then device connect to server for custom file sending and server finishes to send all custom files to device.
  −
{| class="wikitable"
  −
| colspan="20" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command ID
  −
| colspan="13" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data length
  −
|-
  −
| colspan="20" |0x0000
  −
| colspan="13" |0x0000
  −
|}
  −
  −
'''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.
  −
{| class="wikitable"
  −
!rowspan="1" style="width: 350px; background: #0054A6; color: white;"|Command ID
  −
!rowspan="1" style="width: 350px; background: #0054A6; color: white;"|Data length
  −
!rowspan="1" style="width: 350px; background: #0054A6; color: white;"|Blank field (2 bytes)
  −
|-
  −
|0x000C
  −
|0x0002
  −
|0x0000 (always same value)
  −
|}
  −
  −
'''File path response (CMD_ID 0x000D)'''
  −
This is a response to file path request (0x000C) command.
  −
{| class="wikitable"
  −
| colspan="14" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command ID
  −
| colspan="11" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data length
  −
| colspan="13" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Blank field (Variable)
  −
|-
  −
| colspan="14" |0x000D
  −
| colspan="11" |1-512
  −
| colspan="13" |<file path, or \0>
  −
|}
  −
  −
'''File request command (CMD_ID 0x0008)'''
  −
After device is connected for file upload server initiates file transfer by sending FILE REQ command.
  −
{| class="wikitable"
  −
| colspan="9" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command ID
  −
| colspan="10" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data length
  −
| colspan="19" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |File Identifier
  −
|-
  −
| colspan="9" |0x0008
  −
| colspan="10" |2 bytes
  −
| colspan="19" |File path has to be  requested first via 0x000C command.
  −
|}
  −
Device should answer with START command described above indicating size and CRC of requested file.
  −
  −
'''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).
  −
{| class="wikitable"
  −
| colspan="12" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command ID
  −
| colspan="12" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data length
  −
| colspan="12" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |File Size (4 bytes)
  −
| colspan="17" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Blank field (2 bytes)
  −
|-
  −
| colspan="12" |0x0001
  −
| colspan="12" |0x0006
  −
| colspan="12" |0x12345678
  −
| colspan="17" |0x0000 (always same value)
  −
|}
  −
  −
'''Resume file transfer command (CMD_ID 0x0002)'''
  −
In a response to the START command a RESUME command must be sent from server.
  −
{| class="wikitable"
  −
| 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="12" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Packet offset (4 bytes)
  −
|-
  −
| colspan="11" |0x0002
  −
| colspan="7" |0x0004
  −
| 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]).
  −
  −
'''Synchronize file transfer command (CMD_ID 0x0003)'''
  −
In a response to the RESUME command SYNC command is sent from device.
  −
{| class="wikitable"
  −
| colspan="11" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command ID
  −
| colspan="8" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data length
  −
| colspan="9" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |File offset (4 bytes)
  −
|-
  −
| colspan="11" |0x0003
  −
| colspan="8" |0x0004
  −
| colspan="9" |0x00000000
  −
|}
  −
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)'''
  −
After sending SYNC command file data transfer is started by sending DATA commands.
  −
{| class="wikitable"
  −
| colspan="9" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command ID
  −
| colspan="11" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data length
  −
| colspan="14" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |File data (up to 1024  bytes)
  −
| colspan="11" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data CRC (2 bytes)
  −
|-
  −
| colspan="9" |0x0004
  −
| colspan="11" |0x0402
  −
| colspan="14" |...
  −
| colspan="11" |…
  −
|}
  −
File data is split into 1024-byte parts, each part wrapped into DATA command and sent.
  −
  −
''Note: if command with a bad CRC is received, RESUME command should be sent with last valid file offset, after receiving RESUME command, server will stop sending DATA commands and continue communication from “Resume file transfer command (CMD_ID 0x0002)” step.''
  −
  −
''CRC polynomial expression: '''0x8408'''''
  −
  −
''Initial value, when calculating CRC, is previously received packet (CMD ID 0x0004) CRC value.''
  −
  −
'''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).
  −
{| class="wikitable"
  −
| colspan="17" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Command ID
  −
| colspan="14" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Data length
  −
| colspan="12" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Status (4 bytes)
  −
|-
  −
| colspan="17" |0x0005
  −
| colspan="14" |0x0004
  −
| colspan="12" |0x00000000
  −
|}
  −
In case of server using invalid arguments, commands or not following the file request flow, the device will send this command with Status field set to one of the few possible error codes. List of possible ones provided below.
  −
{| class="wikitable"
  −
| colspan="11" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Status value (hexadecimal)
  −
| colspan="20" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Description
  −
| colspan="22" rowspan="1" style="width: 350px; background: #0054A6; color: white;" |Notes
  −
|-
  −
| colspan="11" |0x00000000
  −
| colspan="20" |File transfer process  completed
  −
| colspan="22" |Sent from server
  −
|-
  −
| colspan="11" |0x00000002
  −
| colspan="20" |Failed to close GPRS
  −
| colspan="22" |Sent from device
  −
|-
  −
| colspan="11" |0x00000003
  −
| colspan="20" |Failed to close socket
  −
| colspan="22" |Sent from device
  −
|-
  −
| colspan="11" |0x00000005
  −
| colspan="20" |Invalid response from  server to init packet
  −
| colspan="22" |Sent from device
  −
|-
  −
| colspan="11" |0x00000011
  −
| colspan="20" |This error code forces the  device to disconnect from server
  −
| colspan="22" |Sent from device. Possible  causes:
  −
· „MDAS-9“ special ID (1039) is not active
  −
· The requested file is not available by camera
  −
|}
  −
After COMPLETED command device should disconnect from the server.
  −
  −
'''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.
  −
  −
'''File transfer visual flow'''
  −
[[File:Flow.png|center|frameless|867x867px]]
 
0

edits