Code: |
AS + 101 |
Symbolic: |
bccFlashFileSave |
This command will save a generic file from a flash folder of the connected device to the local disk. Request parameters are the following:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U32 |
FLAGS |
Operating flags: 0x00000001 Overwrite target file 0x00000002 Recover save, if needed 0x00000004 No BIF16 handling |
4 |
U32 |
OFFSET |
Staring required offset |
8 |
U16 |
CRC16 |
Calculated CRC16 (from 0 to OFFSET-1), if OFFSET greater than zero. |
10 |
STRZ |
FILENAME |
Filename |
On failure, a bccNack is received with following errors:
NACK code |
Description |
Extra data |
---|---|---|
nackFileNotExist (nackNotFound) |
Flash file not exist |
|
nackOpenError |
Error opening the flash file |
|
nackReadError |
Error reading tjhe flash file |
|
nackMemoryFull |
Out of memory (or general memory problem) |
|
nackIllegalArgs
|
Illegal argument
|
U16 What illegal: 1=Folder 2=Filename 3=Flags 4=Offset 5=Crc16 |
On success, a bccAck is received with following data:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U32 |
OFFSET |
Applied starting load offset |
4 |
U32 |
FILESIZE |
Effective file size [bytes] |
8 |
U32 |
ALLOCADDR |
Allocation address (only BIF16) |
12 |
U32 |
STARTADDR |
Start address (only BIF16) |
16 |
U8 |
HH |
Time (hour) of the file |
17 |
U8 |
MM |
Time (minute) of the file |
18 |
U8 |
SS |
Time (second) of the file |
19 |
U8 |
DD |
Date (day) of the file |
20 |
U8 |
MO |
Date (month) of the file |
21 |
U8 |
YY |
Data (year - 2000) of the file |
22 |
U32 |
ATTR |
Attributes: 0x00000002 Reserved file 0x00000004 System file 0x00000020 Hidden file 0x00000040 Read-only file 0xF0000000 File type mask: - 0x0 Generic - 0x2 OS standard - 0x3 OS test - 0x4 OS standard flat - 0x5 Old language (without OS) - 0x6 FIFO (queue) |
If required starting offset cannot be applied (or CRC16 does not match), returned applied offset is zero.
NOTE: the SCH value of this bccAck will be the DCH for all subsequent commands/message for this data transfer.
In order to receive data from the device, you should send periodically a bccIBlock message, indicating how many data packet the device can send you. After you received required number of packet (or less if receiving a bccEndData), you can transmit a new bccIBlock.
The bccIBlock has the following data:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U8 |
COUNT |
N. of binary packet to send |
Notes:
•If you send correcly bccIBlock but, after an amount of time, you don't receive any data, you can decide to abort the transfer, using the bccAbort command.
•On slower communication lines use 1 as COUNT value; on standard RS232 use 3 as COUNT value.
File raw content (data) will be trasmitte by the device with the bccData message (for last packet use bccEndData to indicate end of data), with the following format:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U32 |
OFFSET |
Data offset |
4 |
B[] |
DATA |
Binary data to send |
Notes:
•bccData (or bccEndData) messages will begin with pid = 0 and will be incremented by 1 at each message.
•DATA size is in range 1-251 for each bccData message but could be less for bccEndData message.
•The data transfer could be aborted at any time with a bccAbort command.
•If required file is empty, you will receive directly bccNoData message.
After you receive bccEndData (or bccNoData) message you should send a bccCompleted message (if all things are right) to report that the file transfer has been completed: if you need more time before sending this message, please periodically send a bccWait message to inform the connected device about the delay. The bccCompleted data are:
Offset |
Type |
Label |
Description |
---|---|---|---|
0 |
U32 |
SIZE |
Total file size [bytes] |
4 |
U32 |
COUNT |
No. of total binary packet received |
Notes:
•Some BCC/31 implementation have limit on the total delay time for bccWait messages: when the limit is reached, the operation will expire.
At any time the device can decide to abort the transfer. In this case you will receive the notification via the bccAborted message.