Last Updated on : 2024-05-11 03:56:26download
This topic describes the file transfer service that supports file upload and download. This service enables you to transfer various file types and large files. See Appendix 3: File type for the supported file types.
The file transfer service interacts with the MCU through the command 0x37
and its subcommands.
The commands used in the file download process.
Command | Description |
---|---|
Subcommand: 0x01 | Initiate file download |
Subcommand: 0x02 | Sync file information |
Subcommand: 0x03 | Download file |
The commands used in the file upload process.
Command | Description |
---|---|
Subcommand: 0x06 | Initiate file upload |
Subcommand: 0x07 | Upload file |
The commands used to control the file transfer process.
Command | Description |
---|---|
Subcommand: 0x04 | The MCU initiates or terminates file transfer. |
Subcommand: 0x05 | Report the result of executing the file transfer command. |
Subcommand: 0x08 | Send the result of the file transfer. |
The module sends this command to notify the MCU of a file download task. The MCU returns whether to execute the download task based on the current operation.
This command does not apply to download tasks for robot vacuum voice files.
The module sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x37 |
Data length | 2 | 0x0002 |
Data | 1 | Subcommand: 0x01 |
1 | 0x01 : Fixed to 0x01 . |
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 37 00 02 01 01 3a
The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x37 |
Data length | 2 | 0x0003 |
Data | 1 | Subcommand: 0x01 |
1 | Ret : Whether to execute file download.
|
|
1 |
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 37 00 03 01 00 07 41
The module sends this command to notify the MCU of the information of the download file.
This command does not apply to download tasks for robot vacuum voice files.
The module sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x37 |
Data length | 2 | 0x0001 + N |
Data | 1 | Subcommand: 0x02 |
N | The payload. See the example of N below. |
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Field description:
name
: The file name, which can be user-defined.id
: The file ID. This field is deprecated.no
: The file identifier.len
: The file length.type
: The file type, such as TXT and JPG. See Appendix 3: File type for the supported file types.file_info
: The user-defined information for each file. The module sends the raw data of this field to the MCU, with the data format being defined by the MCU.ext_info
: The user-defined information for the file to download. The module sends the raw data of this field to the MCU, with the data format being defined by the MCU.act
: The action to the download task, such as print and audio play. The following table lists the definition.Name | Text display | Audio play | Video play | Storage | |
---|---|---|---|---|---|
Type value | 1 | 2 | 3 | 4 | 5 |
no
is the unique identifier for a file, used to match and delete files.
The example of N
in a file download request:
{
"num": n, // The number of files to be downloaded.
"name": ["xx", "xx", "xx",..], // The file name.
"id": [n,n,n,……], // The file ID, compatible with legacy projects.
"no": ["xx","xx",...], // The file identifier.
"len": [n,n,n,…], // The file length.
"type": [n,n,n,…], // The type of each file.
"file_info": ["xx", "xx",…], // The user-defined data for each file.
"ext_info": "xxxx", // The user-defined additional data for the file to be downloaded.
"act": xx // The action to the file to be downloaded.
}
The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x37 |
Data length | 2 | 0x0002 |
Data | 1 | Subcommand: 0x02 |
1 | Ret : The result of command execution.
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 03 37 00 02 02 00 3d
Data format: packet offset (unsigned short) + payload data.
When the MCU receives a frame with a length of five bytes and the packet offset is equal to or greater than the file size, the transfer is completed.
The module sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x37 |
Data length | 2 | 0x02 + 0x0004 + packet length |
Data | 1 | Subcommand: 0x03 |
1 | The sequence number of the file being transferred. The first file is 1 , the second file is 2 , and so on. |
|
4 | The packet offset. | |
N | The payload. | |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: The sequence number of the file is 1
and the packet offset is 0
.
55 aa 00 37 xx xx 03 01 00 00 00 00 00 xx xx xx xx xx
The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x37 |
Data length | 2 | 0x0002 |
Data | 1 | Subcommand: 0x03 |
1 | Ret : The result of command execution.
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 03 37 00 02 03 00 3e
The module sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x37 |
Data length | 2 | 0x0001 + packet length |
Data | 1 | Subcommand: 0x20 |
Packet length | The payload.
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x37 |
Data length | 2 | 0x0001 |
Data | 1 | Subcommand: 0x20 |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
The module sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x37 |
Data length | 2 | 0x0001 + packet length |
Data | 1 | Subcommand: 0x06 |
1 | The sequence number of the file being transferred. The first file is 1 , the second file is 2 , and so on. |
|
4 | The packet offset. | |
N | The payload. | |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
The MCU sends this command to the module to request uploading files.
The MCU sends the following data.
Field | Length (byte) | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x37 |
Data length | 2 | 0x0001 + N |
Data | 1 | Subcommand: 0x06 |
N | The payload. See the example of N below. |
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
The example of N
in a file upload request:
{
"num": n, // The number of files to be downloaded.
"files":
[
{
"name": "xx", // The file name.
"id": n, // The file ID, compatible with legacy projects.
"len": n, // The file length.
"type": n, // The type of each file.
"file_info": "xx" // The user-defined data for each file.
},
{
"name": "xx", // The file name.
"id": n, // The file ID
"len": n, // The file length.
"type": n, // The type of each file.
"file_info": "xx" // The user-defined data for each file.
},
...
],
"ext_info": "xxxx" // The additional information.
}
The module returns the following data.
Field | Length (byte) | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x37 |
Data length | 2 | 0x0002 |
Data | 1 | Subcommand: 0x06 |
1 | Ret : The result of command execution.
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
The MCU sends the following data.
Field | Length (byte) | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x37 |
Data length | 2 | 0x00020x0004 + packet length |
Data | 1 | Subcommand: 0x07 |
2 | The ID of the file being transferred. | |
4 | The packet offset. | |
N | The payload. | |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
The module sends the following data.
Field | Length (byte) | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x37 |
Data length | 2 | 0x0003 |
Data | 1 | Subcommand: 0x07 |
1 | Ret : The result of operation.
|
|
1 |
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
The MCU can use this command to request the transfer status or terminate a file transfer.
The MCU sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x37 |
Data length | 2 | 0x0003 |
Data | 1 | Subcommand: 0x04 |
1 | Ret :
|
|
1 |
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 03 37 00 03 04 02 00 42
The module returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x37 |
Data length | 2 | 0x0003 |
Data | 1 | Subcommand: 0x04 |
1 | Ret :
|
|
1 |
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 37 00 03 04 02 00 3f
The MCU can use this command to send the execution status of the file transfer to the module. This command is optional. You can implement it to present the execution status. Data of Act
is also optional, depending on your product features.
The file ID is the file sequence number specified with the command 0x3702
. Make sure they match.
The MCU sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x37 |
Data length | 2 | 0x01 + l + L + 2 |
Data | 1 | Subcommand: 0x05 |
1 | The length of ID. | |
L | The ID of the file, corresponding to the id field specified with the command 0x3702 . |
|
1 | Act :
|
|
1 |
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: A printer is printing a file of ID 10 and the task progress is at 20%.
55 aa 03 37 05 05 01 0a 01 14 63
The module returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x37 |
Data length | 2 | 0x0002 |
Data | 1 | Subcommand: 0x05 |
1 | Ret :
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 37 00 02 05 00 3d
The module can use this command to notify the MCU of the result of file download or upload.
The module sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x37 |
Data length | 2 | 0x0004 |
Data | 1 | Subcommand: 0x08 |
1 |
|
|
1 | Ret : The result of command execution.
|
|
1 |
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 37 00 04 08 01 00 00 43
The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x37 |
Data length | 2 | 0x0001 |
Data | 1 | Subcommand: 0x08 |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 03 37 00 01 08 42
Description | Status value |
---|---|
Device is shut down. | 0x00 |
File transfer times out. | 0x01 |
Battery level is low. | 0x02 |
Device is overheating. | 0x03 |
File is large. | 0x04 |
Memory is not enough. | 0x05 |
Operation anomaly occurs. For example, out of paper, paper jam, and cover open. | 0x06 |
Status | Description | Status value |
---|---|---|
Status 1 | No file transfer task. | 0x00 |
Status 2 | File transfer is starting. | 0x01 |
Status 3 | File transfer is in progress. | 0x02 |
Status 4 | File transfer/download is completed. | 0x03 |
Status 5 | File is uploaded to the server. | 0x04 |
Status 6 | File transfer with the MCU times out. | 0x05 |
Status 7 | Failed to get the URL for file upload. | 0x06 |
Status 8 | Failed to upload the file to the server. | 0x07 |
Status 9 | Failed to get the file from the server. | 0x08 |
Status 10 | The MCU fails to respond to file transfer. | 0x09 |
Description | Value |
---|---|
TXT | 1 |
doc | 2 |
3 | |
EXCEL | 4 |
PNG | 5 |
JPG | 6 |
BMP | 7 |
TIF | 8 |
GIF | 9 |
PCX | 10 |
TGA | 11 |
Exif | 12 |
FPX | 13 |
SVG | 14 |
PSD | 15 |
CDR | 16 |
PCD | 17 |
DXF | 18 |
UFO | 19 |
EPS | 20 |
AI | 21 |
Raw | 22 |
WMF | 23 |
WebP | 24 |
AVIF | 25 |
WAV | 26 |
FLAC | 27 |
APE | 28 |
ALAC | 29 |
WavPack (WV) | 30 |
MP3 | 31 |
AAC | 32 |
Ogg Vorbis | 33 |
Opus | 34 |
MP4 | 35 |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback