43 #ifndef SHADOW_DO_NOT_USE_CUSTOM_CONFIG
45 #include "shadow_config.h"
59 typedef enum ShadowMessageType
61 ShadowMessageTypeGetAccepted = 0,
62 ShadowMessageTypeGetRejected,
63 ShadowMessageTypeDeleteAccepted,
64 ShadowMessageTypeDeleteRejected,
65 ShadowMessageTypeUpdateAccepted,
66 ShadowMessageTypeUpdateRejected,
67 ShadowMessageTypeUpdateDocuments,
68 ShadowMessageTypeUpdateDelta,
69 ShadowMessageTypeMaxNum
79 typedef enum ShadowTopicStringType
81 ShadowTopicStringTypeGet = 0,
82 ShadowTopicStringTypeGetAccepted,
83 ShadowTopicStringTypeGetRejected,
84 ShadowTopicStringTypeDelete,
85 ShadowTopicStringTypeDeleteAccepted,
86 ShadowTopicStringTypeDeleteRejected,
87 ShadowTopicStringTypeUpdate,
88 ShadowTopicStringTypeUpdateAccepted,
89 ShadowTopicStringTypeUpdateRejected,
90 ShadowTopicStringTypeUpdateDocuments,
91 ShadowTopicStringTypeUpdateDelta,
92 ShadowTopicStringTypeMaxNum
99 typedef enum ShadowStatus
118 #define SHADOW_PREFIX "$aws/things/"
124 #define SHADOW_PREFIX_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_PREFIX ) - 1U ) )
131 #define SHADOW_CLASSIC_ROOT "/shadow"
137 #define SHADOW_CLASSIC_ROOT_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_CLASSIC_ROOT ) - 1U ) )
144 #define SHADOW_NAMED_ROOT "/shadow/name/"
150 #define SHADOW_NAMED_ROOT_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_NAMED_ROOT ) - 1U ) )
156 #define SHADOW_OP_DELETE "/delete"
162 #define SHADOW_OP_DELETE_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_OP_DELETE ) - 1U ) )
168 #define SHADOW_OP_GET "/get"
174 #define SHADOW_OP_GET_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_OP_GET ) - 1U ) )
180 #define SHADOW_OP_UPDATE "/update"
186 #define SHADOW_OP_UPDATE_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_OP_UPDATE ) - 1U ) )
192 #define SHADOW_SUFFIX_ACCEPTED "/accepted"
198 #define SHADOW_SUFFIX_ACCEPTED_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_ACCEPTED ) - 1U ) )
204 #define SHADOW_SUFFIX_REJECTED "/rejected"
210 #define SHADOW_SUFFIX_REJECTED_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_REJECTED ) - 1U ) )
216 #define SHADOW_SUFFIX_DELTA "/delta"
222 #define SHADOW_SUFFIX_DELTA_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_DELTA ) - 1U ) )
228 #define SHADOW_SUFFIX_DOCUMENTS "/documents"
234 #define SHADOW_SUFFIX_DOCUMENTS_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_DOCUMENTS ) - 1U ) )
240 #define SHADOW_SUFFIX_NULL
246 #define SHADOW_SUFFIX_NULL_LENGTH ( 0U )
252 #define SHADOW_THINGNAME_LENGTH_MAX ( 128U )
258 #define SHADOW_NAME_LENGTH_MAX ( 64U )
264 #define SHADOW_NAME_CLASSIC ""
270 #define SHADOW_NAME_CLASSIC_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_NAME_CLASSIC ) - 1U ) )
319 #define SHADOW_TOPIC_LEN( operationLength, suffixLength, thingNameLength, shadowNameLength ) \
320 ( operationLength + suffixLength + thingNameLength + shadowNameLength + \
321 SHADOW_PREFIX_LENGTH + \
322 ( ( shadowNameLength > 0 ) ? SHADOW_NAMED_ROOT_LENGTH : SHADOW_CLASSIC_ROOT_LENGTH ) )
334 #define SHADOW_TOPIC_LEN_UPDATE( thingNameLength, shadowNameLength ) \
335 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_NULL_LENGTH, thingNameLength, shadowNameLength )
347 #define SHADOW_TOPIC_LEN_UPDATE_ACC( thingNameLength, shadowNameLength ) \
348 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_ACCEPTED_LENGTH, thingNameLength, shadowNameLength )
360 #define SHADOW_TOPIC_LEN_UPDATE_REJ( thingNameLength, shadowNameLength ) \
361 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_REJECTED_LENGTH, thingNameLength, shadowNameLength )
373 #define SHADOW_TOPIC_LEN_UPDATE_DOCS( thingNameLength, shadowNameLength ) \
374 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DOCUMENTS_LENGTH, thingNameLength, shadowNameLength )
386 #define SHADOW_TOPIC_LEN_UPDATE_DELTA( thingNameLength, shadowNameLength ) \
387 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DELTA_LENGTH, thingNameLength, shadowNameLength )
399 #define SHADOW_TOPIC_LEN_GET( thingNameLength, shadowNameLength ) \
400 SHADOW_TOPIC_LEN( SHADOW_OP_GET_LENGTH, SHADOW_SUFFIX_NULL_LENGTH, thingNameLength, shadowNameLength )
412 #define SHADOW_TOPIC_LEN_GET_ACC( thingNameLength, shadowNameLength ) \
413 SHADOW_TOPIC_LEN( SHADOW_OP_GET_LENGTH, SHADOW_SUFFIX_ACCEPTED_LENGTH, thingNameLength, shadowNameLength )
425 #define SHADOW_TOPIC_LEN_GET_REJ( thingNameLength, shadowNameLength ) \
426 SHADOW_TOPIC_LEN( SHADOW_OP_GET_LENGTH, SHADOW_SUFFIX_REJECTED_LENGTH, thingNameLength, shadowNameLength )
438 #define SHADOW_TOPIC_LEN_DELETE( thingNameLength, shadowNameLength ) \
439 SHADOW_TOPIC_LEN( SHADOW_OP_DELETE_LENGTH, SHADOW_SUFFIX_NULL_LENGTH, thingNameLength, shadowNameLength )
451 #define SHADOW_TOPIC_LEN_DELETE_ACC( thingNameLength, shadowNameLength ) \
452 SHADOW_TOPIC_LEN( SHADOW_OP_DELETE_LENGTH, SHADOW_SUFFIX_ACCEPTED_LENGTH, thingNameLength, shadowNameLength )
464 #define SHADOW_TOPIC_LEN_DELETE_REJ( thingNameLength, shadowNameLength ) \
465 SHADOW_TOPIC_LEN( SHADOW_OP_DELETE_LENGTH, SHADOW_SUFFIX_REJECTED_LENGTH, thingNameLength, shadowNameLength )
476 #define SHADOW_TOPIC_LEN_MAX( thingNameLength, shadowNameLength ) \
477 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DOCUMENTS_LENGTH, thingNameLength, shadowNameLength )
506 #define SHADOW_TOPIC_STR( thingName, shadowName, operation, suffix ) \
507 ( ( sizeof( shadowName ) > 1 ) ? \
508 ( SHADOW_PREFIX thingName SHADOW_NAMED_ROOT shadowName operation suffix ) : \
509 ( SHADOW_PREFIX thingName SHADOW_CLASSIC_ROOT operation suffix ) )
521 #define SHADOW_TOPIC_STR_UPDATE( thingName, shadowName ) \
522 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_NULL )
534 #define SHADOW_TOPIC_STR_UPDATE_ACC( thingName, shadowName ) \
535 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_ACCEPTED )
547 #define SHADOW_TOPIC_STR_UPDATE_REJ( thingName, shadowName ) \
548 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_REJECTED )
560 #define SHADOW_TOPIC_STR_UPDATE_DOCS( thingName, shadowName ) \
561 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_DOCUMENTS )
573 #define SHADOW_TOPIC_STR_UPDATE_DELTA( thingName, shadowName ) \
574 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_DELTA )
586 #define SHADOW_TOPIC_STR_GET( thingName, shadowName ) \
587 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_GET, SHADOW_SUFFIX_NULL )
599 #define SHADOW_TOPIC_STR_GET_ACC( thingName, shadowName ) \
600 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_GET, SHADOW_SUFFIX_ACCEPTED )
612 #define SHADOW_TOPIC_STR_GET_REJ( thingName, shadowName ) \
613 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_GET, SHADOW_SUFFIX_REJECTED )
625 #define SHADOW_TOPIC_STR_DELETE( thingName, shadowName ) \
626 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_DELETE, SHADOW_SUFFIX_NULL )
638 #define SHADOW_TOPIC_STR_DELETE_ACC( thingName, shadowName ) \
639 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_DELETE, SHADOW_SUFFIX_ACCEPTED )
651 #define SHADOW_TOPIC_STR_DELETE_REJ( thingName, shadowName ) \
652 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_DELETE, SHADOW_SUFFIX_REJECTED )
723 const char * pThingName,
724 uint8_t thingNameLength,
725 const char * pShadowName,
726 uint8_t shadowNameLength,
729 uint16_t * pOutLength );
795 uint16_t topicLength,
797 const char ** pThingName,
798 uint8_t * pThingNameLength,
799 const char ** pShadowName,
800 uint8_t * pShadowNameLength );
811 #define SHADOW_TOPIC_LENGTH( operationLength, suffixLength, thingNameLength ) \
812 SHADOW_TOPIC_LEN( operationLength, suffixLength, thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
820 #define SHADOW_TOPIC_LENGTH_UPDATE( thingNameLength ) \
821 SHADOW_TOPIC_LEN_UPDATE( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
829 #define SHADOW_TOPIC_LENGTH_UPDATE_ACCEPTED( thingNameLength ) \
830 SHADOW_TOPIC_LEN_UPDATE_ACC( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
838 #define SHADOW_TOPIC_LENGTH_UPDATE_REJECTED( thingNameLength ) \
839 SHADOW_TOPIC_LEN_UPDATE_REJ( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
847 #define SHADOW_TOPIC_LENGTH_UPDATE_DOCUMENTS( thingNameLength ) \
848 SHADOW_TOPIC_LEN_UPDATE_DOCS( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
856 #define SHADOW_TOPIC_LENGTH_UPDATE_DELTA( thingNameLength ) \
857 SHADOW_TOPIC_LEN_UPDATE_DELTA( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
865 #define SHADOW_TOPIC_LENGTH_GET( thingNameLength ) \
866 SHADOW_TOPIC_LEN_GET( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
874 #define SHADOW_TOPIC_LENGTH_GET_ACCEPTED( thingNameLength ) \
875 SHADOW_TOPIC_LEN_GET_ACC( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
883 #define SHADOW_TOPIC_LENGTH_GET_REJECTED( thingNameLength ) \
884 SHADOW_TOPIC_LEN_GET_REJ( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
892 #define SHADOW_TOPIC_LENGTH_DELETE( thingNameLength ) \
893 SHADOW_TOPIC_LEN_DELETE( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
901 #define SHADOW_TOPIC_LENGTH_DELETE_ACCEPTED( thingNameLength ) \
902 SHADOW_TOPIC_LEN_DELETE_ACC( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
910 #define SHADOW_TOPIC_LENGTH_DELETE_REJECTED( thingNameLength ) \
911 SHADOW_TOPIC_LEN_DELETE_REJ( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
919 #define SHADOW_TOPIC_LENGTH_MAX( thingNameLength ) \
920 SHADOW_TOPIC_LEN_MAX( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
928 #define SHADOW_TOPIC_STRING( thingName, operation, suffix ) \
929 SHADOW_TOPIC_STR( thingName, SHADOW_NAME_CLASSIC, operation, suffix )
937 #define SHADOW_TOPIC_STRING_UPDATE( thingName ) \
938 SHADOW_TOPIC_STR_UPDATE( thingName, SHADOW_NAME_CLASSIC )
946 #define SHADOW_TOPIC_STRING_UPDATE_ACCEPTED( thingName ) \
947 SHADOW_TOPIC_STR_UPDATE_ACC( thingName, SHADOW_NAME_CLASSIC )
955 #define SHADOW_TOPIC_STRING_UPDATE_REJECTED( thingName ) \
956 SHADOW_TOPIC_STR_UPDATE_REJ( thingName, SHADOW_NAME_CLASSIC )
964 #define SHADOW_TOPIC_STRING_UPDATE_DOCUMENTS( thingName ) \
965 SHADOW_TOPIC_STR_UPDATE_DOCS( thingName, SHADOW_NAME_CLASSIC )
973 #define SHADOW_TOPIC_STRING_UPDATE_DELTA( thingName ) \
974 SHADOW_TOPIC_STR_UPDATE_DELTA( thingName, SHADOW_NAME_CLASSIC )
982 #define SHADOW_TOPIC_STRING_GET( thingName ) \
983 SHADOW_TOPIC_STR_GET( thingName, SHADOW_NAME_CLASSIC )
991 #define SHADOW_TOPIC_STRING_GET_ACCEPTED( thingName ) \
992 SHADOW_TOPIC_STR_GET_ACC( thingName, SHADOW_NAME_CLASSIC )
1000 #define SHADOW_TOPIC_STRING_GET_REJECTED( thingName ) \
1001 SHADOW_TOPIC_STR_GET_REJ( thingName, SHADOW_NAME_CLASSIC )
1009 #define SHADOW_TOPIC_STRING_DELETE( thingName ) \
1010 SHADOW_TOPIC_STR_DELETE( thingName, SHADOW_NAME_CLASSIC )
1018 #define SHADOW_TOPIC_STRING_DELETE_ACCEPTED( thingName ) \
1019 SHADOW_TOPIC_STR_DELETE_ACC( thingName, SHADOW_NAME_CLASSIC )
1027 #define SHADOW_TOPIC_STRING_DELETE_REJECTED( thingName ) \
1028 SHADOW_TOPIC_STR_DELETE_REJ( thingName, SHADOW_NAME_CLASSIC )
1040 #define Shadow_GetTopicString( topicType, pThingName, thingNameLength, pTopicBuffer, bufferSize, pOutLength ) \
1041 Shadow_AssembleTopicString( topicType, pThingName, thingNameLength, SHADOW_NAME_CLASSIC, 0, \
1042 pTopicBuffer, bufferSize, pOutLength )
1058 uint16_t topicLength,
1060 const char ** pThingName,
1061 uint16_t * pThingNameLength );