AWS IoT Over-the-air Update v3.4.0
Client library for AWS IoT OTA
 
Loading...
Searching...
No Matches
ota_mqtt_private.h File Reference

Contains function definitions of routines for OTA download and control using MQTT data plane. More...

#include "ota.h"
#include "ota_private.h"
Include dependency graph for ota_mqtt_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

OtaErr_t requestJob_Mqtt (const OtaAgentContext_t *pAgentCtx)
 Check for available OTA job over MQTT.
 
OtaErr_t initFileTransfer_Mqtt (const OtaAgentContext_t *pAgentCtx)
 Initialize file transfer over MQTT.
 
OtaErr_t requestFileBlock_Mqtt (OtaAgentContext_t *pAgentCtx)
 Request File block over MQTT.
 
OtaErr_t decodeFileBlock_Mqtt (const uint8_t *pMessageBuffer, size_t messageSize, int32_t *pFileId, int32_t *pBlockId, int32_t *pBlockSize, uint8_t *const *pPayload, size_t *pPayloadSize)
 Decode a cbor encoded fileblock.
 
OtaErr_t cleanupControl_Mqtt (const OtaAgentContext_t *pAgentCtx)
 Cleanup related to OTA control plane over MQTT.
 
OtaErr_t cleanupData_Mqtt (const OtaAgentContext_t *pAgentCtx)
 Cleanup related to OTA data plane over MQTT.
 
OtaErr_t updateJobStatus_Mqtt (const OtaAgentContext_t *pAgentCtx, OtaJobStatus_t status, int32_t reason, int32_t subReason)
 Update job status over MQTT.
 
const char * OTA_MQTT_strerror (OtaMqttStatus_t status)
 Status to string conversion for OTA MQTT interface status.
 

Detailed Description

Contains function definitions of routines for OTA download and control using MQTT data plane.

Function Documentation

◆ requestJob_Mqtt()

OtaErr_t requestJob_Mqtt ( const OtaAgentContext_t pAgentCtx)

Check for available OTA job over MQTT.

This function Request for the next available OTA job from the job service by publishing a "get next job" message to the job service.

Parameters
[in]pAgentCtxThe OTA agent context.
Returns
The OTA error code. See OTA Agent error codes information in ota.h.

◆ initFileTransfer_Mqtt()

OtaErr_t initFileTransfer_Mqtt ( const OtaAgentContext_t pAgentCtx)

Initialize file transfer over MQTT.

This function initializes the file transfer after the OTA job is parsed and accepted by subscribing to the data streaming topics.

Parameters
[in]pAgentCtxThe OTA agent context.
Returns
The OTA error code. See OTA Agent error codes information in ota.h.

< Buffer to store the topic generated for requesting data stream.

◆ requestFileBlock_Mqtt()

OtaErr_t requestFileBlock_Mqtt ( OtaAgentContext_t pAgentCtx)

Request File block over MQTT.

This function is used for requesting a file block over MQTT using the file context.

Parameters
[in]pAgentCtxThe OTA agent context.
Returns
The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent error codes information in ota.h.

◆ decodeFileBlock_Mqtt()

OtaErr_t decodeFileBlock_Mqtt ( const uint8_t *  pMessageBuffer,
size_t  messageSize,
int32_t *  pFileId,
int32_t *  pBlockId,
int32_t *  pBlockSize,
uint8_t *const *  pPayload,
size_t *  pPayloadSize 
)

Decode a cbor encoded fileblock.

This function is used for decoding a file block received over MQTT & encoded in cbor.

Parameters
[in]pMessageBufferThe message to be decoded.
[in]messageSizeThe size of the message in bytes.
[out]pFileIdThe server file ID.
[out]pBlockIdThe file block ID.
[out]pBlockSizeThe file block size.
[out]pPayloadThe payload.
[out]pPayloadSizeThe payload size.
Returns
The OTA PAL layer error code combined with the MCU specific error code. See OTA Agent error codes information in ota.h.

◆ cleanupControl_Mqtt()

OtaErr_t cleanupControl_Mqtt ( const OtaAgentContext_t pAgentCtx)

Cleanup related to OTA control plane over MQTT.

This function cleanup by unsubscribing from any topics that were subscribed for performing OTA over MQTT.

Parameters
[in]pAgentCtxThe OTA agent context.
Returns
The OTA error code. See OTA Agent error codes information in ota.h.

◆ cleanupData_Mqtt()

OtaErr_t cleanupData_Mqtt ( const OtaAgentContext_t pAgentCtx)

Cleanup related to OTA data plane over MQTT.

This function performs cleanup by unsubscribing from any topics that were subscribed for performing OTA data over MQTT.

Parameters
[in]pAgentCtxThe OTA agent context.
Returns
The OTA error code. See OTA Agent error codes information in ota.h.

◆ updateJobStatus_Mqtt()

OtaErr_t updateJobStatus_Mqtt ( const OtaAgentContext_t pAgentCtx,
OtaJobStatus_t  status,
int32_t  reason,
int32_t  subReason 
)

Update job status over MQTT.

This function updates the OTA job status over MQTT with information like in progress, completion or failure.

Parameters
[in]pAgentCtxThe OTA agent context.
[in]statusThe OTA job status which should be updated.
See also
OtaJobStatus_t.
Parameters
[in]reasonThe major reason for the status update.
[in]subReasonThe platform specific reason.
Returns
The OTA error code. See OTA Agent error codes information in ota.h.

◆ OTA_MQTT_strerror()

const char * OTA_MQTT_strerror ( OtaMqttStatus_t  status)

Status to string conversion for OTA MQTT interface status.

Parameters
[in]statusThe status to convert to a string.
Returns
The string representation of the status.