An application can get callbacks from the OTA Agent.
OTA Agent callback to the application.
The application can use the callback to override default OTA functions.
- Parameters
-
[in,out] | cb_data | Current information that Application callback can use/modify. |
- Returns
- CY_OTA_CB_RSLT_OTA_CONTINUE CY_OTA_CB_RSLT_OTA_STOP CY_OTA_CB_RSLT_APP_SUCCESS CY_OTA_CB_RSLT_APP_FAILED
Creates and open new receive file for the data chunks as they come in.
- Note
- ota-update library expects user to implement this callback function.
-
Opens the file indicated in the OTA agent storage context in the MCU file system.
-
The previous image may be present in the designated image download partition or file, so the partition or file must be completely erased or overwritten in this routine.
- Parameters
-
- Returns
- CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_OPEN_STORAGE
Reads the flash data starting from the given offset.
- Note
- ota-update library expects user to implement this callback function.
- Parameters
-
[in] | storage_ptr | Pointer to the OTA Agent storage context cy_ota_storage_context_t |
[in] | chunk_info | Pointer to the chunk information which includes buffer, length, and offset. |
- Returns
- CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_READ_STORAGE
Write a data to the flash at the given offset.
- Note
- ota-update library expects user to implement this callback function.
- Parameters
-
[in] | storage_ptr | Pointer to the OTA Agent storage context cy_ota_storage_context_t |
[in] | chunk_info | Pointer to the chunk information which includes buffer, length, and offset. |
- Returns
- CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_WRITE_STORAGE
Close the underlying receive file in the specified OTA context.
- Note
- ota-update library expects user to implement this callback function.
- Parameters
-
- Returns
- CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_CLOSE_STORAGE
Authenticate received OTA update file specified in the OTA context.
- Note
- ota-update library expects user to implement this callback function.
-
Authentication method is user choice.
- Parameters
-
- Returns
- CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_VERIFY
typedef cy_rslt_t( * cy_ota_file_validate)(uint16_t app_id) |
The application has validated the new OTA image.
- Note
- This call must be after reboot and updated image is booted.
-
Calling this API makes currently executing image as boot image until next update.
- Parameters
-
[in] | app_id | Application ID. |
- Returns
- CY_RSLT_SUCCESS on success; error codes otherwise.
typedef cy_rslt_t( * cy_ota_file_get_app_info)(void *file_des, cy_ota_app_info_t *app_info) |
Get Application info like Application version and Application ID.
- Note
- ota-update library expects user to implement this callback function.
-
This API implementation is optional for MCUBootloader based OTA.
- Parameters
-
[in] | void* | Pointer to file descriptor. It can be cast as flash_area or FILE as needed. |
[in,out] | cy_ota_app_info_t* | Pointer to the OTA Application information context cy_ota_app_info_t |
- Returns
- CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_GENERAL