|
AWS IoT Device SDK C:
Shadow
AWS IoT Device Shadow library
|
| Return to main page ↑ |
Implements functions that process Shadow operations. More...
#include "iot_config.h"#include <string.h>#include "private/aws_iot_shadow_internal.h"#include "platform/iot_threads.h"#include "iot_mqtt.h"Data Structures | |
| struct | _operationMatchParams_t |
| First parameter to _shadowOperationMatch. More... | |
Functions | |
| static bool | _shadowOperationMatch (const IotLink_t *pOperationLink, void *pMatch) |
| Match a received Shadow response with a Shadow operation awaiting a response. More... | |
| static void | _commonOperationCallback (_shadowOperationType_t type, IotMqttCallbackParam_t *pMessage) |
| Common function for processing received Shadow responses. More... | |
| static void | _deleteCallback (void *pArgument, IotMqttCallbackParam_t *pMessage) |
| Invoked when a Shadow response is received for Shadow DELETE. More... | |
| static void | _getCallback (void *pArgument, IotMqttCallbackParam_t *pMessage) |
| Invoked when a Shadow response is received for a Shadow GET. More... | |
| static AwsIotShadowError_t | _processAcceptedGet (_shadowOperation_t *pOperation, const IotMqttPublishInfo_t *pPublishInfo) |
| Process an incoming Shadow document received when a Shadow GET is accepted. More... | |
| static void | _updateCallback (void *pArgument, IotMqttCallbackParam_t *pMessage) |
| Invoked when a Shadow response is received for a Shadow UPDATE. More... | |
| static void | _notifyCompletion (_shadowOperation_t *pOperation) |
| Notify of a completed Shadow operation. More... | |
| static AwsIotShadowError_t | _findSubscription (const char *pThingName, size_t thingNameLength, char *pTopicBuffer, uint16_t operationTopicLength, _shadowOperation_t *pOperation, bool *pFreeTopicBuffer) |
| Get a Shadow subscription to use with a Shadow operation. More... | |
| _shadowOperationType_t | _AwsIotShadow_IntToShadowOperationType (uint32_t n) |
| Convert an integer to the shadow operation type. More... | |
| AwsIotShadowCallbackType_t | _AwsIotShadow_IntToShadowCallbackType (uint32_t n) |
| Convert an integer to the shadow callback type. More... | |
| AwsIotShadowError_t | _AwsIotShadow_CreateOperation (_shadowOperation_t **pNewOperation, _shadowOperationType_t type, uint32_t flags, const AwsIotShadowCallbackInfo_t *pCallbackInfo) |
| Create a record for a new in-progress Shadow operation. More... | |
| void | _AwsIotShadow_DestroyOperation (void *pData) |
| Free resources used to record a Shadow operation. This is called when the operation completes. More... | |
| AwsIotShadowError_t | _AwsIotShadow_GenerateShadowTopic (_shadowOperationType_t type, const char *pThingName, size_t thingNameLength, char **pTopicBuffer, uint16_t *pOperationTopicLength) |
| Fill a buffer with a Shadow topic. More... | |
| AwsIotShadowError_t | _AwsIotShadow_ProcessOperation (IotMqttConnection_t mqttConnection, const char *pThingName, size_t thingNameLength, _shadowOperation_t *pOperation, const AwsIotShadowDocumentInfo_t *pDocumentInfo) |
| Process a Shadow operation by sending the necessary MQTT packets. More... | |
Variables | |
| IotListDouble_t | _AwsIotShadowPendingOperations = { 0 } |
| List of active Shadow operations awaiting a response from the Shadow service. | |
| IotMutex_t | _AwsIotShadowPendingOperationsMutex |
| Protects _AwsIotShadowPendingOperations from concurrent access. | |
Implements functions that process Shadow operations.
|
static |
Match a received Shadow response with a Shadow operation awaiting a response.
| [in] | pOperationLink | Pointer to the link member of the _shadowOperation_t to check. |
| [in] | pMatch | Pointer to an _operationMatchParams_t. |
true if pMatch matches the received response; false otherwise.
|
static |
Common function for processing received Shadow responses.
| [in] | type | DELETE, GET, or UPDATE. |
| [in] | pMessage | Received Shadow response (as an MQTT PUBLISH message). |
|
static |
Invoked when a Shadow response is received for Shadow DELETE.
| [in] | pArgument | Ignored. |
| [in] | pMessage | Received Shadow response (as an MQTT PUBLISH message). |
|
static |
Invoked when a Shadow response is received for a Shadow GET.
| [in] | pArgument | Ignored. |
| [in] | pMessage | Received Shadow response (as an MQTT PUBLISH message). |
|
static |
Process an incoming Shadow document received when a Shadow GET is accepted.
| [in] | pOperation | The GET operation associated with the incoming Shadow document. |
| [in] | pPublishInfo | The received Shadow document (as an MQTT PUBLISH message). |
pOperation.
|
static |
Invoked when a Shadow response is received for a Shadow UPDATE.
| [in] | pArgument | Ignored. |
| [in] | pMessage | Received Shadow response (as an MQTT PUBLISH message). |
|
static |
Notify of a completed Shadow operation.
| [in] | pOperation | The operation which completed. |
Depending on the parameters passed to a user-facing Shadow function, the notification will cause AwsIotShadow_Wait to return or invoke a user-provided callback.
|
static |
Get a Shadow subscription to use with a Shadow operation.
This function may use an existing Shadow subscription, or it may allocate a new one.
| [in] | pThingName | Thing Name associated with operation. |
| [in] | thingNameLength | Length of pThingName. |
| [in] | pTopicBuffer | Contains the topic to use for subscribing. |
| [in] | operationTopicLength | The length of the base topic in pTopicBuffer. |
| [in] | pOperation | Shadow operation that needs a subscription. |
| [out] | pFreeTopicBuffer | Whether the caller may free pTopicBuffer (which may be assigned to a subscription). |
| _shadowOperationType_t _AwsIotShadow_IntToShadowOperationType | ( | uint32_t | n | ) |
Convert an integer to the shadow operation type.
| [in] | n | The integer to convert. |
| AwsIotShadowCallbackType_t _AwsIotShadow_IntToShadowCallbackType | ( | uint32_t | n | ) |
Convert an integer to the shadow callback type.
| [in] | n | The integer to convert. |
| AwsIotShadowError_t _AwsIotShadow_CreateOperation | ( | _shadowOperation_t ** | pNewOperation, |
| _shadowOperationType_t | type, | ||
| uint32_t | flags, | ||
| const AwsIotShadowCallbackInfo_t * | pCallbackInfo | ||
| ) |
Create a record for a new in-progress Shadow operation.
| [out] | pNewOperation | Set to point to the new operation on success. |
| [in] | type | The type of Shadow operation. |
| [in] | flags | Flags variables passed to a user-facing Shadow function. |
| [in] | pCallbackInfo | User-provided callback function and parameter. |
| void _AwsIotShadow_DestroyOperation | ( | void * | pData | ) |
Free resources used to record a Shadow operation. This is called when the operation completes.
| [in] | pData | The operation which completed. This parameter is of type void* to match the signature of free. |
| AwsIotShadowError_t _AwsIotShadow_GenerateShadowTopic | ( | _shadowOperationType_t | type, |
| const char * | pThingName, | ||
| size_t | thingNameLength, | ||
| char ** | pTopicBuffer, | ||
| uint16_t * | pOperationTopicLength | ||
| ) |
Fill a buffer with a Shadow topic.
| [in] | type | One of: DELETE, GET, UPDATE. |
| [in] | pThingName | Thing Name to place in the topic. |
| [in] | thingNameLength | Length of pThingName. |
| [out] | pTopicBuffer | Address of the buffer for the Shadow topic. If the pointer at this address is NULL, this function will allocate a new buffer; otherwise, it will use the provided buffer. |
| [out] | pOperationTopicLength | Length of the Shadow operation topic (excluding any suffix) placed in pTopicBuffer. |
pTopicBuffer! Any provided buffer must be large enough to accommodate the full Shadow topic, plus SHADOW_LONGEST_SUFFIX_LENGTH.| AwsIotShadowError_t _AwsIotShadow_ProcessOperation | ( | IotMqttConnection_t | mqttConnection, |
| const char * | pThingName, | ||
| size_t | thingNameLength, | ||
| _shadowOperation_t * | pOperation, | ||
| const AwsIotShadowDocumentInfo_t * | pDocumentInfo | ||
| ) |
Process a Shadow operation by sending the necessary MQTT packets.
| [in] | mqttConnection | The MQTT connection to use. |
| [in] | pThingName | Thing Name for the Shadow operation. |
| [in] | thingNameLength | Length of pThingName. |
| [in] | pOperation | Operation data to process. |
| [in] | pDocumentInfo | Information on the Shadow document for GET or UPDATE operations. |