AWS IoT Over-the-air Update  v3.1.0
Client library for AWS IoT OTA
OTA_Shutdown

Signal to the OTA Agent to shut down.

OtaState_t OTA_Shutdown( uint32_t ticksToWait,
uint8_t unsubscribeFlag );

Signals the OTA agent task to shut down. The OTA agent will unsubscribe from all MQTT job notification topics, stop in progress OTA jobs, if any, and clear all resources.

Parameters
[in]ticksToWaitThe number of ticks to wait for the OTA Agent to complete the shutdown process. If this is set to zero, the function will return immediately without waiting. The actual state is returned to the caller. The agent does not sleep for this while but used for busy looping.
[in]unsubscribeFlagFlag to indicate if unsubscribe operations should be performed from the job topics when shutdown is called. If the flag is 0 then unsubscribe operations are not called for job topics If application requires it to be unsubscribed from the job topics then flag must be set to 1 when calling OTA_Shutdown.
Returns
One of the OTA agent states from the OtaState_t enum. A normal shutdown will return OtaAgentStateNotReady. Otherwise, refer to the OtaState_t enum for details.

Example

// ticksToWait used for busy looping until shutdown. Actual delay may depend on the agent priority,
// and platform.
uint32_t ticksToWait = 100;
// If it is required that the unsubscribe operations are not
//performed while shutting down set this to 0.
uint8_t unsubscribe = 1;
OTA_Shutdown(ticksToWait, unsubscribe);
...
if( OTA_GetState() != OtaAgentStateStopped )
{
// Optional: Disconnect MQTT and HTTP connections
// required by the OTA agent and other tasks.
}
OtaState_t
OtaState_t
OTA Agent states.
Definition: ota.h:114
OTA_Shutdown
OtaState_t OTA_Shutdown(uint32_t ticksToWait, uint8_t unsubscribeFlag)
Signal to the OTA Agent to shut down.
Definition: ota.c:3156
OTA_GetState
OtaState_t OTA_GetState(void)
Get the current state of the OTA agent.
Definition: ota.c:3215