5.9.4.2 File Get Callback
typedef void (*tpfFileGetCb)
(
uint8 u8Status,
uint8 u8Handler,
uint32 u32Size
);
The callback for the File Get receives three arguments; status of the File
Get request, file handler ID and the total size of the file. If the status is
OTA_STATUS_SUCCESS
, then the file handler and size can be used,
otherwise its values are not populated. From the Application’s point of view, they must
not be considered valid.
The file handler is auto-generated in the WINC and it identifies the file.
Only when a download finishes successfully, the corresponding file handler is generated.
The handler is required to both read from the file or erase the file. Similarly, if the
download is aborted or interrupted, then the handler is not generated, instead the
handler will have the value of HFD_INVALID_HANDLER
, which blocks any
further operation on the Flash through the APIs.
When the file download completes successfully, the total size of the download file is passed to the callback to notify the application. Using which the application tracks the total size of the downloaded data and the amount of data read.