Over The Air (OTA) Update Library
All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

General Description

An application can get callbacks from the OTA Agent.

Typedefs

typedef cy_ota_callback_results_t(* cy_ota_callback_t )(cy_ota_cb_struct_t *cb_data)
 OTA Agent callback to the application. More...
 
typedef cy_rslt_t(* cy_ota_file_open )(cy_ota_storage_context_t *storage_ptr)
 Creates and open new receive file for the data chunks as they come in. More...
 
typedef cy_rslt_t(* cy_ota_file_read )(cy_ota_storage_context_t *storage_ptr, cy_ota_storage_read_info_t *chunk_info)
 Reads the flash data starting from the given offset. More...
 
typedef cy_rslt_t(* cy_ota_file_write )(cy_ota_storage_context_t *storage_ptr, cy_ota_storage_write_info_t *chunk_info)
 Write a data to the flash at the given offset. More...
 
typedef cy_rslt_t(* cy_ota_file_close )(cy_ota_storage_context_t *storage_ptr)
 Close the underlying receive file in the specified OTA context. More...
 
typedef cy_rslt_t(* cy_ota_file_verify )(cy_ota_storage_context_t *storage_ptr)
 Authenticate received OTA update file specified in the OTA context. More...
 
typedef cy_rslt_t(* cy_ota_file_validate )(uint16_t app_id)
 The application has validated the new OTA image. More...
 
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. More...
 

Typedef Documentation

typedef cy_ota_callback_results_t( * cy_ota_callback_t)(cy_ota_cb_struct_t *cb_data)

OTA Agent callback to the application.

The application can use the callback to override default OTA functions.

Parameters
[in,out]cb_dataCurrent 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
typedef cy_rslt_t( * cy_ota_file_open)(cy_ota_storage_context_t *storage_ptr)

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
[in]storage_ptrPointer to the OTA Agent storage context cy_ota_storage_context_t
Returns
CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_OPEN_STORAGE
typedef cy_rslt_t( * cy_ota_file_read)(cy_ota_storage_context_t *storage_ptr, cy_ota_storage_read_info_t *chunk_info)

Reads the flash data starting from the given offset.

Note
ota-update library expects user to implement this callback function.
Parameters
[in]storage_ptrPointer to the OTA Agent storage context cy_ota_storage_context_t
[in]chunk_infoPointer to the chunk information which includes buffer, length, and offset.
Returns
CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_READ_STORAGE
typedef cy_rslt_t( * cy_ota_file_write)(cy_ota_storage_context_t *storage_ptr, cy_ota_storage_write_info_t *chunk_info)

Write a data to the flash at the given offset.

Note
ota-update library expects user to implement this callback function.
Parameters
[in]storage_ptrPointer to the OTA Agent storage context cy_ota_storage_context_t
[in]chunk_infoPointer to the chunk information which includes buffer, length, and offset.
Returns
CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_WRITE_STORAGE
typedef cy_rslt_t( * cy_ota_file_close)(cy_ota_storage_context_t *storage_ptr)

Close the underlying receive file in the specified OTA context.

Note
ota-update library expects user to implement this callback function.
Parameters
[in]storage_ptrPointer to the OTA Agent storage context cy_ota_storage_context_t
Returns
CY_RSLT_SUCCESS CY_RSLT_OTA_ERROR_CLOSE_STORAGE
typedef cy_rslt_t( * cy_ota_file_verify)(cy_ota_storage_context_t *storage_ptr)

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
[in]storage_ptrPointer to the OTA Agent storage context cy_ota_storage_context_t
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_idApplication 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