AWS IoT Over-the-air Update v3.4.0
Client library for AWS IoT OTA
OTA_ActivateNewImage

Activate the newest MCU image received via OTA.

OtaErr_t
The OTA API return status. OTA agent error codes are in the upper 8 bits of the 32 bit OTA error word...
Definition: ota.h:80
OtaErr_t OTA_ActivateNewImage(void)
Activate the newest MCU image received via OTA.
Definition: ota.c:3441

This function should reset the MCU and cause a reboot of the system to execute the newly updated firmware. It should be called by the user code sometime after the OtaJobEventActivate event is passed to the users application via the OTA Job Complete Callback mechanism. Refer to the OTA_Init function for more information about configuring the callback.

Returns
OtaErrNone if successful, otherwise an error code prefixed with 'OtaErr' from the list above.

Example

static void otaAppCallback( OtaJobEvent_t event,
const void * pData )
{
OtaErr_t otaErr = OtaErrNone;
if( event == OtaJobEventActivate )
{
// Activate the new firmware image.
// This calls the platform specific code required to
// activate the received OTA update firmware.
if( otaErr == OtaErrActivateFailed )
{
// Handle Image activation failure by requesting manual response, sending
// error logs or retrying activation.
}
}
// Handle other events
}
OtaJobEvent_t
OTA Job callback events.
Definition: ota.h:167
@ OtaErrNone
No error occurred during the operation.
Definition: ota.h:81
@ OtaErrActivateFailed
Failed to activate the new image.
Definition: ota.h:103
@ OtaJobEventActivate
OTA receive is authenticated and ready to activate.
Definition: ota.h:168