SimpleLink CC32xx OTA Library
Simplifies the implementation of Internet connectivity
|
Functions | |
int16_t | OTA_init (OTA_runningMode runningMode, OTA_memBlock *pMemBlock, OTA_eventHandler eventHandler) |
Initialize the OTA application. More... | |
int16_t | OTA_run () |
Run the OTA App state machine. More... | |
int16_t | OTA_set (OTA_option option, int32_t optionLen, uint8_t *pOptionVal, int32_t flags) |
Set OTA command/parameter. More... | |
int16_t | OTA_get (OTA_option option, int32_t *pOptionLen, uint8_t *pOptionVal) |
Get the current OTA status. More... | |
int16_t OTA_get | ( | OTA_option | option, |
int32_t * | pOptionLen, | ||
uint8_t * | pOptionVal | ||
) |
Get the current OTA status.
[in] | pOtaLib | OTA control block pointer |
[in] | Option | Selects the option |
[in] | OptionLen | option structure length |
[in] | pOptionVal | pointer to the option structure |
This function gets the current OTA of active or Idle. The parameter option, could be one of the following:
EXTLIB_OTA_GET_OPT_IS_ACTIVE - Check if OTA process is active or idle
EXTLIB_OTA_GET_OPT_VERSIONS - return the current OTA version and the new update version for the user to compare
EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT - Check if the new image is in the state BUNDLE_STATE_WAITING_FOR_COMMIT
Value at pOptionVal will be set to 1 if OTA process is active, 0 if Idle
Definition at line 176 of file OtaLib.c.
int16_t OTA_init | ( | OTA_runningMode | runningMode, |
OTA_memBlock * | pMemBlock, | ||
OTA_eventHandler | eventHandler | ||
) |
Initialize the OTA application.
[in] | runningMode | Supported only OTA_RUN_NON_BLOCKING |
[in] | pMemBlock | Is the OTA library control block allocated by the application |
[in] | eventHandler | Callback to the app, currently not supported, need to be NULL |
This function initializes the OTA application and modules. The size of the control block parameter should be enough for OTA init (currently 7800 bytes) otherwize the init will failed
-OTA_INIT_ERROR - when the size of the OTA control block OtaCB_t is not enough for the OTA lib
Definition at line 45 of file OtaLib.c.
int16_t OTA_run | ( | ) |
Run the OTA App state machine.
[in] | pOtaLib | Pointer to OTA application pointer |
Run one step from the OTA application state machine. Host should repeat calling this function and examine the return value in order to check if OTA completed or got error or just need to be continued. This pattern is useful in host with NON-OS. In host with OS, host should start OTA task and continuously calling this function till OTA completed.
-OTA_RUN_STATUS_CONTINUE - Host should continue calling sl_OtaRun
-OTA_RUN_STATUS_CONTINUE_WARNING_... - group of OTA WARNINGS, actually those are errors but the OTA will retry the process 5 times so user should continue run the OTA
-OTA_RUN_STATUS_NO_UPDATES - No updates for now, host can retry after another period of time
-OTA_RUN_STATUS_CHECK_NEWER_VERSION - OTA found newer update version, user can accept the new version by calling sl_OtaSet with option _ ACCEPT_UPDATE , or just continue running, or do another check before continue
-OTA_RUN_STATUS_CHECK_OLDER_VERSION - OTA found older update version, user can stop the OTA by calling sl_OtaSet with option _DECLINE_UPDATE , or continue running, or do another check before continue
-OTA_RUN_STATUS_DOWNLOAD_DONE - Current OTA update completed, host should move the image to BUNDLE_STATE_TESTING by calling sl_Stop and then ro reset the MCU
-OTA_RUN_ERROR_... - group of OTA ERRORS, user should stop the OTA process -OTA_RUN_ERROR_CONSECUTIVE_OTA_ERRORS - OTA process failed 5 consecutive times -OTA_RUN_ERROR_NO_SERVER_NO_VENDOR - user didn't call sl_OtaSet with EXTLIB_OTA_OPT_VENDOR_ID and EXTLIB_OTA_OPT_SERVER_INFO before running the OTA -OTA_RUN_ERROR_SECURITY_ALERT - security alert from file system, user must stop trying downloading current OTA update -OTA_RUN_ERROR_UNEXPECTED_STATE - OTA state error, must init the OTA before continue
Definition at line 249 of file OtaLib.c.
int16_t OTA_set | ( | OTA_option | option, |
int32_t | optionLen, | ||
uint8_t * | pOptionVal, | ||
int32_t | flags | ||
) |
Set OTA command/parameter.
[in] | pOtaLib | OTA control block pointer |
[in] | Option | Select the option |
[in] | OptionLen | Option structure length |
[in] | pOptionVal | pointer to the option structure |
This function sets OTA command/parameter. The parameter Option can be one of the following:
EXTLIB_OTA_SET_OPT_SERVER_INFO - Set the Server information
EXTLIB_OTA_SET_OPT_VENDOR_ID - Set the Vendor DIR string
EXTLIB_OTA_SET_OPT_ACCEPT_UPDATE - Accept the new image
EXTLIB_OTA_SET_OPT_DECLINE_UPDATE - Decline the new image
EXTLIB_OTA_SET_OPT_IMAGE_COMMIT - Commit the currnet image in testing mode
EXTLIB_OTA_SET_OPT_IMAGE_ROLLBACK - decline the currnet image in testing mode and rollback to the previous image
Definition at line 99 of file OtaLib.c.