AWS IoT Over-the-air Update v3.4.0
Client library for AWS IoT OTA
 
Loading...
Searching...
No Matches
OTA_Suspend
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_Suspend(void)
Suspend OTA agent operations .
Definition: ota.c:3558

Suspend OTA agent operations .

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

Example Suspend the OTA agent when a network error occurs.

void handleNetworkErrors()
{
OtaErr_t otaErr = OtaErrNone;
int16_t suspendTimeout = 5000U;
// Handle disconnects and other network reset operations
// Suspend OTA operations.
otaErr = OTA_Suspend();
if( otaErr != OtaErrNone )
{
// Suspend may fail due to Event queue failure,
// or if the agent has shut down, handle the failure by
// sending logs or retrying OTA_Suspend().
}
else
{
while( ( ( OTA_GetState() != OtaAgentStateSuspended )
&& ( suspendTimeout > 0 ) )
{
// Wait for OTA Library state to suspend
portSleep( 1000U );
suspendTimeout -= 1000U;
}
if( OTA_GetState() != OtaAgentStateSuspended )
{
// Handle Suspend failure or Retry OTA_Suspend().
}
}
}
@ OtaErrNone
No error occurred during the operation.
Definition: ota.h:81
OtaState_t OTA_GetState(void)
Get the current state of the OTA agent.
Definition: ota.c:3408