|
AWS IoT Device SDK C:
Shadow
AWS IoT Device Shadow library
|
| Return to main page ↑ |
Implements functions for interacting with the Shadow library's subscription list. More...
#include "iot_config.h"#include <string.h>#include "private/aws_iot_shadow_internal.h"#include "platform/iot_threads.h"#include "iot_mqtt.h"Functions | |
| static bool | _shadowSubscription_match (const IotLink_t *pSubscriptionLink, void *pMatch) |
| Match two _shadowSubscription_t by Thing Name. More... | |
| _shadowSubscription_t * | _AwsIotShadow_FindSubscription (const char *pThingName, size_t thingNameLength, bool createIfNotFound) |
| Find a Shadow subscription object. May create a new subscription object and adds it to the subscription list if not found. More... | |
| void | _AwsIotShadow_RemoveSubscription (_shadowSubscription_t *pSubscription, _shadowSubscription_t **pRemovedSubscription) |
| Remove a Shadow subscription object from the subscription list if unreferenced. More... | |
| void | _AwsIotShadow_DestroySubscription (void *pData) |
| Free resources used for a Shadow subscription object. More... | |
| AwsIotShadowError_t | _AwsIotShadow_IncrementReferences (_shadowOperation_t *pOperation, char *pTopicBuffer, uint16_t operationTopicLength, AwsIotMqttCallbackFunction_t callback) |
| Increment the reference count of a Shadow subscriptions object. More... | |
| void | _AwsIotShadow_DecrementReferences (_shadowOperation_t *pOperation, char *pTopicBuffer, _shadowSubscription_t **pRemovedSubscription) |
| Decrement the reference count of a Shadow subscriptions object. More... | |
| AwsIotShadowError_t | AwsIotShadow_RemovePersistentSubscriptions (IotMqttConnection_t mqttConnection, const char *pThingName, size_t thingNameLength, uint32_t flags) |
| Remove persistent Thing Shadow operation topic subscriptions. More... | |
Variables | |
| IotListDouble_t | _AwsIotShadowSubscriptions = { 0 } |
| List of active Shadow subscriptions objects. | |
| IotMutex_t | _AwsIotShadowSubscriptionsMutex |
| Protects _AwsIotShadowSubscriptions from concurrent access. | |
Implements functions for interacting with the Shadow library's subscription list.
|
static |
Match two _shadowSubscription_t by Thing Name.
| [in] | pSubscriptionLink | Pointer to the link member of a _shadowSubscription_t containing the Thing Name to check. |
| [in] | pMatch | Pointer to an AwsIotThingName_t. |
true if the Thing Names match; false otherwise. | _shadowSubscription_t* _AwsIotShadow_FindSubscription | ( | const char * | pThingName, |
| size_t | thingNameLength, | ||
| bool | createIfNotFound | ||
| ) |
Find a Shadow subscription object. May create a new subscription object and adds it to the subscription list if not found.
| [in] | pThingName | Thing Name in the subscription object. |
| [in] | thingNameLength | Length of pThingName. |
| [in] | createIfNotFound | If true, attempt to create a new subscription object if no match is found. |
NULL if no subscription object is found and a new subscription object could not be allocated.| void _AwsIotShadow_RemoveSubscription | ( | _shadowSubscription_t * | pSubscription, |
| _shadowSubscription_t ** | pRemovedSubscription | ||
| ) |
Remove a Shadow subscription object from the subscription list if unreferenced.
| [in] | pSubscription | Subscription object to check. If this object has no active references, it is removed from the subscription list. |
| [out] | pRemovedSubscription | Removed subscription object, if any. Optional; pass NULL to ignore. If not NULL, this parameter will be set to the removed subscription and that subscription will not be destroyed. |
| void _AwsIotShadow_DestroySubscription | ( | void * | pData | ) |
Free resources used for a Shadow subscription object.
| [in] | pData | The subscription object to destroy. This parameter is of type void* to match the signature of free. |
| AwsIotShadowError_t _AwsIotShadow_IncrementReferences | ( | _shadowOperation_t * | pOperation, |
| char * | pTopicBuffer, | ||
| uint16_t | operationTopicLength, | ||
| AwsIotMqttCallbackFunction_t | callback | ||
| ) |
Increment the reference count of a Shadow subscriptions object.
Also adds MQTT subscriptions if necessary.
| [in] | pOperation | The operation for which the reference count should be incremented. |
| [in] | pTopicBuffer | Topic buffer containing the operation topic, used if subscriptions need to be added. |
| [in] | operationTopicLength | The length of the operation topic in pTopicBuffer. |
| [in] | callback | MQTT callback function for when this operation completes. |
pTopicBuffer! Any provided buffer must already contain the Shadow operation topic, plus enough space for the status suffix.| void _AwsIotShadow_DecrementReferences | ( | _shadowOperation_t * | pOperation, |
| char * | pTopicBuffer, | ||
| _shadowSubscription_t ** | pRemovedSubscription | ||
| ) |
Decrement the reference count of a Shadow subscriptions object.
Also removed MQTT subscriptions and deletes the subscription object if necessary.
| [in] | pOperation | The operation for which the reference count should be decremented. |
| [in] | pTopicBuffer | Topic buffer containing the operation topic, used if subscriptions need to be removed. |
| [out] | pRemovedSubscription | Set to point to a removed subscription. Optional; pass NULL to ignore. If not NULL, this function will not destroy a removed subscription. |
pTopicBuffer! Any provided buffer must be large enough to accommodate the full Shadow topic, plus SHADOW_LONGEST_SUFFIX_LENGTH.| AwsIotShadowError_t AwsIotShadow_RemovePersistentSubscriptions | ( | IotMqttConnection_t | mqttConnection, |
| const char * | pThingName, | ||
| size_t | thingNameLength, | ||
| uint32_t | flags | ||
| ) |
Remove persistent Thing Shadow operation topic subscriptions.
Passing the flag AWS_IOT_SHADOW_FLAG_KEEP_SUBSCRIPTIONS to AwsIotShadow_DeleteAsync, AwsIotShadow_GetAsync, AwsIotShadow_UpdateAsync, or their blocking versions. causes the Shadow operation topic subscriptions to be maintained for future calls to the same function. If a persistent subscription for a Shadow topic are no longer needed, this function may be used to remove it.
| [in] | mqttConnection | The MQTT connection associated with the persistent subscription. |
| [in] | pThingName | The Thing Name associated with the persistent subscription. |
| [in] | thingNameLength | The length of pThingName. |
| [in] | flags | Flags that determine which subscriptions to remove. Valid values are the bitwise OR of the following individual flags: |