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

Signal event to the OTA Agent task.

bool OTA_SignalEvent( const OtaEventMsg_t * const pEventMsg );

This function adds the event to the back of event queue and used by internal OTA modules to signal agent task.

Parameters
[in]pEventMsgEvent to be added to the queue
Returns
true If operation is successful, false If the event can not be added

Example Signal OTA agent that a new file block has been received over the http connection.

OtaHttpStatus_t handleDataFromHTTPService( const HTTPResponse_t * pResponse )
{
// Assume otaEventBufferGet is a user defined, thread-safe function
// that gets an available buffer from the pool of OTA buffers.
OtaEventData_t * pData = otaEventBufferGet();
bool result = false;
// Validate pResponse for correct data.
if( pData != NULL )
{
memcpy( pData->data, pResponse->pBody, pResponse->bodyLen );
pData->dataLength = pResponse->bodyLen;
// Send job document received event.
eventMsg.pEventData = pData;
result = OTA_SignalEvent( &eventMsg );
if( result )
{
returnValue = OtaHttpSuccess;
}
}
return returnValue;
}
OtaEventData_t::dataLength
uint32_t dataLength
Definition: ota_private.h:424
OtaEventData_t::data
uint8_t data[OTA_DATA_BLOCK_SIZE]
Definition: ota_private.h:423
OtaEventData_t
The OTA Agent event and data structures.
Definition: ota_private.h:422
OTA_SignalEvent
bool OTA_SignalEvent(const OtaEventMsg_t *const pEventMsg)
Signal event to the OTA Agent task.
Definition: ota.c:2921
OtaAgentEventReceivedFileBlock
@ OtaAgentEventReceivedFileBlock
Event to trigger when file block is received.
Definition: ota_private.h:352
OtaEventMsg_t::eventId
OtaEvent_t eventId
Definition: ota_private.h:436
OtaEventMsg_t
Stores information about the event message.
Definition: ota_private.h:434
OtaHttpSuccess
@ OtaHttpSuccess
OTA HTTP interface success.
Definition: ota_http_interface.h:87
OtaHttpRequestFailed
@ OtaHttpRequestFailed
Error sending the HTTP request.
Definition: ota_http_interface.h:90
OtaEventMsg_t::pEventData
OtaEventData_t * pEventData
Definition: ota_private.h:435
OtaHttpStatus_t
OtaHttpStatus_t
The OTA HTTP interface return status.
Definition: ota_http_interface.h:86