AWS IoT Device SDK C: Shadow
AWS IoT Device Shadow library
Return to main page ↑
aws_iot_shadow.h
Go to the documentation of this file.
1 /*
2  * AWS IoT Shadow V2.1.0
3  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
28 #ifndef AWS_IOT_SHADOW_H_
29 #define AWS_IOT_SHADOW_H_
30 
31 /* The config header is always included first. */
32 #include "iot_config.h"
33 
34 /* Shadow types include. */
36 
37 /*------------------------ Shadow library functions -------------------------*/
38 
92 /* @[declare_shadow_init] */
93 AwsIotShadowError_t AwsIotShadow_Init( uint32_t mqttTimeoutMs );
94 /* @[declare_shadow_init] */
95 
109 /* @[declare_shadow_cleanup] */
110 void AwsIotShadow_Cleanup( void );
111 /* @[declare_shadow_cleanup] */
112 
176 /* @[declare_shadow_deleteasync] */
178  const char * pThingName,
179  size_t thingNameLength,
180  uint32_t flags,
181  const AwsIotShadowCallbackInfo_t * pCallbackInfo,
182  AwsIotShadowOperation_t * const pDeleteOperation );
183 /* @[declare_shadow_deleteasync] */
184 
210 /* @[declare_shadow_deletesync] */
212  const char * pThingName,
213  size_t thingNameLength,
214  uint32_t flags,
215  uint32_t timeoutMs );
216 /* @[declare_shadow_deletesync] */
217 
300 /* @[declare_shadow_getasync] */
302  const AwsIotShadowDocumentInfo_t * pGetInfo,
303  uint32_t flags,
304  const AwsIotShadowCallbackInfo_t * pCallbackInfo,
305  AwsIotShadowOperation_t * const pGetOperation );
306 /* @[declare_shadow_getasync] */
307 
339 /* @[declare_shadow_getsync] */
341  const AwsIotShadowDocumentInfo_t * pGetInfo,
342  uint32_t flags,
343  uint32_t timeoutMs,
344  const char ** const pShadowDocument,
345  size_t * const pShadowDocumentLength );
346 /* @[declare_shadow_getsync] */
347 
437 /* @[declare_shadow_updateasync] */
439  const AwsIotShadowDocumentInfo_t * pUpdateInfo,
440  uint32_t flags,
441  const AwsIotShadowCallbackInfo_t * pCallbackInfo,
442  AwsIotShadowOperation_t * const pUpdateOperation );
443 /* @[declare_shadow_updateasync] */
444 
469 /* @[declare_shadow_updatesync] */
471  const AwsIotShadowDocumentInfo_t * pUpdateInfo,
472  uint32_t flags,
473  uint32_t timeoutMs );
474 /* @[declare_shadow_updatesync] */
475 
591 /* @[declare_shadow_wait] */
593  uint32_t timeoutMs,
594  const char ** const pShadowDocument,
595  size_t * const pShadowDocumentLength );
596 /* @[declare_shadow_wait] */
597 
716 /* @[declare_shadow_setdeltacallback] */
718  const char * pThingName,
719  size_t thingNameLength,
720  uint32_t flags,
721  const AwsIotShadowCallbackInfo_t * pDeltaCallback );
722 /* @[declare_shadow_setdeltacallback] */
723 
826 /* @[declare_shadow_setupdatedcallback] */
828  const char * pThingName,
829  size_t thingNameLength,
830  uint32_t flags,
831  const AwsIotShadowCallbackInfo_t * pUpdatedCallback );
832 /* @[declare_shadow_setupdatedcallback] */
833 
866 /* @[declare_shadow_removepersistentsubscriptions] */
868  const char * pThingName,
869  size_t thingNameLength,
870  uint32_t flags );
871 /* @[declare_shadow_removepersistentsubscriptions] */
872 
873 /*------------------------- Shadow helper functions -------------------------*/
874 
891 /* @[declare_shadow_strerror] */
892 const char * AwsIotShadow_strerror( AwsIotShadowError_t status );
893 /* @[declare_shadow_strerror] */
894 
901 #define AwsIotShadow_Delete AwsIotShadow_DeleteAsync
902 #define AwsIotShadow_TimedDelete AwsIotShadow_DeleteSync
903 #define AwsIotShadow_Get AwsIotShadow_GetAsync
904 #define AwsIotShadow_TimedGet AwsIotShadow_GetSync
905 #define AwsIotShadow_Update AwsIotShadow_UpdateAsync
906 #define AwsIotShadow_TimedUpdate AwsIotShadow_UpdateSync
907 
909 #endif /* ifndef AWS_IOT_SHADOW_H_ */
AwsIotShadowError_t AwsIotShadow_GetAsync(IotMqttConnection_t mqttConnection, const AwsIotShadowDocumentInfo_t *pGetInfo, uint32_t flags, const AwsIotShadowCallbackInfo_t *pCallbackInfo, AwsIotShadowOperation_t *const pGetOperation)
Retrieve a Thing Shadow and receive an asynchronous notification when the Shadow document is received...
Definition: aws_iot_shadow_api.c:840
AwsIotShadowError_t AwsIotShadow_GetSync(IotMqttConnection_t mqttConnection, const AwsIotShadowDocumentInfo_t *pGetInfo, uint32_t flags, uint32_t timeoutMs, const char **const pShadowDocument, size_t *const pShadowDocumentLength)
Retrieve a Thing Shadow with a timeout.
Definition: aws_iot_shadow_api.c:921
AwsIotShadowError_t AwsIotShadow_Init(uint32_t mqttTimeoutMs)
One-time initialization function for the Shadow library.
Definition: aws_iot_shadow_api.c:656
AwsIotShadowError_t
Return codes of Shadow functions.
Definition: aws_iot_shadow_types.h:88
AwsIotShadowError_t AwsIotShadow_UpdateAsync(IotMqttConnection_t mqttConnection, const AwsIotShadowDocumentInfo_t *pUpdateInfo, uint32_t flags, const AwsIotShadowCallbackInfo_t *pCallbackInfo, AwsIotShadowOperation_t *const pUpdateOperation)
Send a Thing Shadow update and receive an asynchronous notification when the Shadow Update completes...
Definition: aws_iot_shadow_api.c:958
struct _mqttConnection * IotMqttConnection_t
Information on a user-provided Shadow callback function.
Definition: aws_iot_shadow_types.h:436
const char * AwsIotShadow_strerror(AwsIotShadowError_t status)
Returns a string that describes an AwsIotShadowError_t.
Definition: aws_iot_shadow_api.c:1217
AwsIotShadowError_t AwsIotShadow_DeleteSync(IotMqttConnection_t mqttConnection, const char *pThingName, size_t thingNameLength, uint32_t flags, uint32_t timeoutMs)
Delete a Thing Shadow with a timeout.
Definition: aws_iot_shadow_api.c:806
AwsIotShadowError_t AwsIotShadow_SetUpdatedCallback(IotMqttConnection_t mqttConnection, const char *pThingName, size_t thingNameLength, uint32_t flags, const AwsIotShadowCallbackInfo_t *pUpdatedCallback)
Set a callback to be invoked when a Thing Shadow changes.
Definition: aws_iot_shadow_api.c:1199
AwsIotShadowError_t AwsIotShadow_RemovePersistentSubscriptions(IotMqttConnection_t mqttConnection, const char *pThingName, size_t thingNameLength, uint32_t flags)
Remove persistent Thing Shadow operation topic subscriptions.
Definition: aws_iot_shadow_subscription.c:407
struct _shadowOperation * AwsIotShadowOperation_t
Opaque handle that references an in-progress Shadow operation.
Definition: aws_iot_shadow_types.h:66
Information on a Shadow document for AwsIotShadow_GetAsync or AwsIotShadow_UpdateAsync.
Definition: aws_iot_shadow_types.h:469
AwsIotShadowError_t AwsIotShadow_UpdateSync(IotMqttConnection_t mqttConnection, const AwsIotShadowDocumentInfo_t *pUpdateInfo, uint32_t flags, uint32_t timeoutMs)
Send a Thing Shadow update with a timeout.
Definition: aws_iot_shadow_api.c:1073
AwsIotShadowError_t AwsIotShadow_Wait(AwsIotShadowOperation_t operation, uint32_t timeoutMs, const char **const pShadowDocument, size_t *const pShadowDocumentLength)
Wait for a Shadow operation to complete.
Definition: aws_iot_shadow_api.c:1105
AwsIotShadowError_t AwsIotShadow_SetDeltaCallback(IotMqttConnection_t mqttConnection, const char *pThingName, size_t thingNameLength, uint32_t flags, const AwsIotShadowCallbackInfo_t *pDeltaCallback)
Set a callback to be invoked when the Thing Shadow desired and reported states differ.
Definition: aws_iot_shadow_api.c:1181
AwsIotShadowError_t AwsIotShadow_DeleteAsync(IotMqttConnection_t mqttConnection, const char *pThingName, size_t thingNameLength, uint32_t flags, const AwsIotShadowCallbackInfo_t *pCallbackInfo, AwsIotShadowOperation_t *const pDeleteOperation)
Delete a Thing Shadow and receive an asynchronous notification when the Delete completes.
Definition: aws_iot_shadow_api.c:736
void AwsIotShadow_Cleanup(void)
One-time deinitialization function for the Shadow library.
Definition: aws_iot_shadow_api.c:699
Types of the Thing Shadow library.