1. Overview
This article describes the content related to device file management. The device supports uploading and downloading files, videos, configuration files, fonts, etc.
GetFiles. Get a list of files in the current device.
DeleteFiles. Delete Files from device.
1.1 The process of uploading a file
1. After the upper computer and the lower computer establish a connection and negotiate the transmission protocol version, the file can be uploaded.
2. The upper computer sends the kFileStartAsk command to the lower computer, and the lower computer will respond to the kFileStartAnswer command to the upper computer. If there is an error, the upper computer should check the error code and stop to upload file.
3. The upper computer continuously sends the file contents to the lower computer through the kFileContentAsk command. (Each packet size should not exceed 9*1024 bytes, and the lower computer will not respond to the kFileContentAsk command.)
4. When the file content is uploaded, the upper computer
should send the kFileEndAsk command to the lower
computer, and the lower computer will respond to the kFileEndAnswer
command to the upper computer (If the file is large, there may be a delay.).
If there is an error, the upper computer should check the error code and stop to
upload file.
2.1 Upload file
Field |
packet length |
command |
md5 |
file size |
file type |
file name |
byte |
2 |
2 |
33 |
8 |
2 |
2~256 |
value |
Len |
kFileStartAsk |
md5 |
size |
type |
|
/**
* 1. Len = 2 + 2 + 33 + 8 + 2
+ the length of file name
* 2. md5represents the md5 value of the file,
and the a-f character in the md5 value uses lowercase letters, for example::
"239a1b2d06d959aca2676bd0103e60e0"
* 3.file type : Value
range {0 (picture), 1 (video), 2 (font), 3 (firmware), 4 (basic configuration
parameters), 5 (FPG configuration parameters).
* 4."file name" indicates the file name, which is used to locate the
file, so the user needs to ensure the uniqueness of the file name. You need to
add '\0' at the end of the file name.’.
*/
Respond
Field |
packet length |
command |
ErrorCode |
existSize |
byte |
2 |
2 |
2 |
8 |
value |
8 |
kFileStartAnswer |
|
|
/**
* 1. (The error code refers to
ErrorCode
* 2. If the ErrorCode is not kSuccess, check the error code and
interrupt the transfer.
* 3. If the status is kSuccess, then the existSize value is
valid.
* 4. existSize indicates the size of the file
stored in the lower computer. If the file does not exist, the value is 0.
*/
A request to start transferring file content.
Field |
packet length |
command |
file content |
byte |
2 |
2 |
1-(9*1024-4) |
value |
|
kFileContentAsk |
data |
Field |
packet length |
command |
btye |
2 |
2 |
value |
4 |
kFileEndAsk |
The response of end to transfer
file.
Field |
packet length |
command |
Error code |
byte |
2 |
2 |
2 |
value |
6 |
kFileEndAnswer |
|