37 #ifndef SHADOW_DO_NOT_USE_CUSTOM_CONFIG
39 #include "shadow_config.h"
53 typedef enum ShadowMessageType
55 ShadowMessageTypeGetAccepted = 0,
56 ShadowMessageTypeGetRejected,
57 ShadowMessageTypeDeleteAccepted,
58 ShadowMessageTypeDeleteRejected,
59 ShadowMessageTypeUpdateAccepted,
60 ShadowMessageTypeUpdateRejected,
61 ShadowMessageTypeUpdateDocuments,
62 ShadowMessageTypeUpdateDelta,
63 ShadowMessageTypeMaxNum
73 typedef enum ShadowTopicStringType
75 ShadowTopicStringTypeGet = 0,
76 ShadowTopicStringTypeGetAccepted,
77 ShadowTopicStringTypeGetRejected,
78 ShadowTopicStringTypeDelete,
79 ShadowTopicStringTypeDeleteAccepted,
80 ShadowTopicStringTypeDeleteRejected,
81 ShadowTopicStringTypeUpdate,
82 ShadowTopicStringTypeUpdateAccepted,
83 ShadowTopicStringTypeUpdateRejected,
84 ShadowTopicStringTypeUpdateDocuments,
85 ShadowTopicStringTypeUpdateDelta,
86 ShadowTopicStringTypeMaxNum
93 typedef enum ShadowStatus
112 #define SHADOW_PREFIX "$aws/things/"
118 #define SHADOW_PREFIX_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_PREFIX ) - 1U ) )
125 #define SHADOW_CLASSIC_ROOT "/shadow"
131 #define SHADOW_CLASSIC_ROOT_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_CLASSIC_ROOT ) - 1U ) )
138 #define SHADOW_NAMED_ROOT "/shadow/name/"
144 #define SHADOW_NAMED_ROOT_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_NAMED_ROOT ) - 1U ) )
150 #define SHADOW_OP_DELETE "/delete"
156 #define SHADOW_OP_DELETE_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_OP_DELETE ) - 1U ) )
162 #define SHADOW_OP_GET "/get"
168 #define SHADOW_OP_GET_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_OP_GET ) - 1U ) )
174 #define SHADOW_OP_UPDATE "/update"
180 #define SHADOW_OP_UPDATE_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_OP_UPDATE ) - 1U ) )
186 #define SHADOW_SUFFIX_ACCEPTED "/accepted"
192 #define SHADOW_SUFFIX_ACCEPTED_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_ACCEPTED ) - 1U ) )
198 #define SHADOW_SUFFIX_REJECTED "/rejected"
204 #define SHADOW_SUFFIX_REJECTED_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_REJECTED ) - 1U ) )
210 #define SHADOW_SUFFIX_DELTA "/delta"
216 #define SHADOW_SUFFIX_DELTA_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_DELTA ) - 1U ) )
222 #define SHADOW_SUFFIX_DOCUMENTS "/documents"
228 #define SHADOW_SUFFIX_DOCUMENTS_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_DOCUMENTS ) - 1U ) )
234 #define SHADOW_SUFFIX_NULL
240 #define SHADOW_SUFFIX_NULL_LENGTH ( 0U )
246 #define SHADOW_THINGNAME_LENGTH_MAX ( 128U )
252 #define SHADOW_NAME_LENGTH_MAX ( 64U )
258 #define SHADOW_NAME_CLASSIC ""
264 #define SHADOW_NAME_CLASSIC_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_NAME_CLASSIC ) - 1U ) )
313 #define SHADOW_TOPIC_LEN( operationLength, suffixLength, thingNameLength, shadowNameLength ) \
314 ( operationLength + suffixLength + thingNameLength + shadowNameLength + \
315 SHADOW_PREFIX_LENGTH + \
316 ( ( shadowNameLength > 0 ) ? SHADOW_NAMED_ROOT_LENGTH : SHADOW_CLASSIC_ROOT_LENGTH ) )
328 #define SHADOW_TOPIC_LEN_UPDATE( thingNameLength, shadowNameLength ) \
329 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_NULL_LENGTH, thingNameLength, shadowNameLength )
341 #define SHADOW_TOPIC_LEN_UPDATE_ACC( thingNameLength, shadowNameLength ) \
342 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_ACCEPTED_LENGTH, thingNameLength, shadowNameLength )
354 #define SHADOW_TOPIC_LEN_UPDATE_REJ( thingNameLength, shadowNameLength ) \
355 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_REJECTED_LENGTH, thingNameLength, shadowNameLength )
367 #define SHADOW_TOPIC_LEN_UPDATE_DOCS( thingNameLength, shadowNameLength ) \
368 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DOCUMENTS_LENGTH, thingNameLength, shadowNameLength )
380 #define SHADOW_TOPIC_LEN_UPDATE_DELTA( thingNameLength, shadowNameLength ) \
381 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DELTA_LENGTH, thingNameLength, shadowNameLength )
393 #define SHADOW_TOPIC_LEN_GET( thingNameLength, shadowNameLength ) \
394 SHADOW_TOPIC_LEN( SHADOW_OP_GET_LENGTH, SHADOW_SUFFIX_NULL_LENGTH, thingNameLength, shadowNameLength )
406 #define SHADOW_TOPIC_LEN_GET_ACC( thingNameLength, shadowNameLength ) \
407 SHADOW_TOPIC_LEN( SHADOW_OP_GET_LENGTH, SHADOW_SUFFIX_ACCEPTED_LENGTH, thingNameLength, shadowNameLength )
419 #define SHADOW_TOPIC_LEN_GET_REJ( thingNameLength, shadowNameLength ) \
420 SHADOW_TOPIC_LEN( SHADOW_OP_GET_LENGTH, SHADOW_SUFFIX_REJECTED_LENGTH, thingNameLength, shadowNameLength )
432 #define SHADOW_TOPIC_LEN_DELETE( thingNameLength, shadowNameLength ) \
433 SHADOW_TOPIC_LEN( SHADOW_OP_DELETE_LENGTH, SHADOW_SUFFIX_NULL_LENGTH, thingNameLength, shadowNameLength )
445 #define SHADOW_TOPIC_LEN_DELETE_ACC( thingNameLength, shadowNameLength ) \
446 SHADOW_TOPIC_LEN( SHADOW_OP_DELETE_LENGTH, SHADOW_SUFFIX_ACCEPTED_LENGTH, thingNameLength, shadowNameLength )
458 #define SHADOW_TOPIC_LEN_DELETE_REJ( thingNameLength, shadowNameLength ) \
459 SHADOW_TOPIC_LEN( SHADOW_OP_DELETE_LENGTH, SHADOW_SUFFIX_REJECTED_LENGTH, thingNameLength, shadowNameLength )
470 #define SHADOW_TOPIC_LEN_MAX( thingNameLength, shadowNameLength ) \
471 SHADOW_TOPIC_LEN( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DOCUMENTS_LENGTH, thingNameLength, shadowNameLength )
500 #define SHADOW_TOPIC_STR( thingName, shadowName, operation, suffix ) \
501 ( ( sizeof( shadowName ) > 1 ) ? \
502 ( SHADOW_PREFIX thingName SHADOW_NAMED_ROOT shadowName operation suffix ) : \
503 ( SHADOW_PREFIX thingName SHADOW_CLASSIC_ROOT operation suffix ) )
515 #define SHADOW_TOPIC_STR_UPDATE( thingName, shadowName ) \
516 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_NULL )
528 #define SHADOW_TOPIC_STR_UPDATE_ACC( thingName, shadowName ) \
529 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_ACCEPTED )
541 #define SHADOW_TOPIC_STR_UPDATE_REJ( thingName, shadowName ) \
542 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_REJECTED )
554 #define SHADOW_TOPIC_STR_UPDATE_DOCS( thingName, shadowName ) \
555 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_DOCUMENTS )
567 #define SHADOW_TOPIC_STR_UPDATE_DELTA( thingName, shadowName ) \
568 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_DELTA )
580 #define SHADOW_TOPIC_STR_GET( thingName, shadowName ) \
581 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_GET, SHADOW_SUFFIX_NULL )
593 #define SHADOW_TOPIC_STR_GET_ACC( thingName, shadowName ) \
594 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_GET, SHADOW_SUFFIX_ACCEPTED )
606 #define SHADOW_TOPIC_STR_GET_REJ( thingName, shadowName ) \
607 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_GET, SHADOW_SUFFIX_REJECTED )
619 #define SHADOW_TOPIC_STR_DELETE( thingName, shadowName ) \
620 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_DELETE, SHADOW_SUFFIX_NULL )
632 #define SHADOW_TOPIC_STR_DELETE_ACC( thingName, shadowName ) \
633 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_DELETE, SHADOW_SUFFIX_ACCEPTED )
645 #define SHADOW_TOPIC_STR_DELETE_REJ( thingName, shadowName ) \
646 SHADOW_TOPIC_STR( thingName, shadowName, SHADOW_OP_DELETE, SHADOW_SUFFIX_REJECTED )
717 const char * pThingName,
718 uint8_t thingNameLength,
719 const char * pShadowName,
720 uint8_t shadowNameLength,
723 uint16_t * pOutLength );
789 uint16_t topicLength,
791 const char ** pThingName,
792 uint8_t * pThingNameLength,
793 const char ** pShadowName,
794 uint8_t * pShadowNameLength );
805 #define SHADOW_TOPIC_LENGTH( operationLength, suffixLength, thingNameLength ) \
806 SHADOW_TOPIC_LEN( operationLength, suffixLength, thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
814 #define SHADOW_TOPIC_LENGTH_UPDATE( thingNameLength ) \
815 SHADOW_TOPIC_LEN_UPDATE( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
823 #define SHADOW_TOPIC_LENGTH_UPDATE_ACCEPTED( thingNameLength ) \
824 SHADOW_TOPIC_LEN_UPDATE_ACC( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
832 #define SHADOW_TOPIC_LENGTH_UPDATE_REJECTED( thingNameLength ) \
833 SHADOW_TOPIC_LEN_UPDATE_REJ( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
841 #define SHADOW_TOPIC_LENGTH_UPDATE_DOCUMENTS( thingNameLength ) \
842 SHADOW_TOPIC_LEN_UPDATE_DOCS( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
850 #define SHADOW_TOPIC_LENGTH_UPDATE_DELTA( thingNameLength ) \
851 SHADOW_TOPIC_LEN_UPDATE_DELTA( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
859 #define SHADOW_TOPIC_LENGTH_GET( thingNameLength ) \
860 SHADOW_TOPIC_LEN_GET( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
868 #define SHADOW_TOPIC_LENGTH_GET_ACCEPTED( thingNameLength ) \
869 SHADOW_TOPIC_LEN_GET_ACC( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
877 #define SHADOW_TOPIC_LENGTH_GET_REJECTED( thingNameLength ) \
878 SHADOW_TOPIC_LEN_GET_REJ( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
886 #define SHADOW_TOPIC_LENGTH_DELETE( thingNameLength ) \
887 SHADOW_TOPIC_LEN_DELETE( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
895 #define SHADOW_TOPIC_LENGTH_DELETE_ACCEPTED( thingNameLength ) \
896 SHADOW_TOPIC_LEN_DELETE_ACC( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
904 #define SHADOW_TOPIC_LENGTH_DELETE_REJECTED( thingNameLength ) \
905 SHADOW_TOPIC_LEN_DELETE_REJ( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
913 #define SHADOW_TOPIC_LENGTH_MAX( thingNameLength ) \
914 SHADOW_TOPIC_LEN_MAX( thingNameLength, SHADOW_NAME_CLASSIC_LENGTH )
922 #define SHADOW_TOPIC_STRING( thingName, operation, suffix ) \
923 SHADOW_TOPIC_STR( thingName, SHADOW_NAME_CLASSIC, operation, suffix )
931 #define SHADOW_TOPIC_STRING_UPDATE( thingName ) \
932 SHADOW_TOPIC_STR_UPDATE( thingName, SHADOW_NAME_CLASSIC )
940 #define SHADOW_TOPIC_STRING_UPDATE_ACCEPTED( thingName ) \
941 SHADOW_TOPIC_STR_UPDATE_ACC( thingName, SHADOW_NAME_CLASSIC )
949 #define SHADOW_TOPIC_STRING_UPDATE_REJECTED( thingName ) \
950 SHADOW_TOPIC_STR_UPDATE_REJ( thingName, SHADOW_NAME_CLASSIC )
958 #define SHADOW_TOPIC_STRING_UPDATE_DOCUMENTS( thingName ) \
959 SHADOW_TOPIC_STR_UPDATE_DOCS( thingName, SHADOW_NAME_CLASSIC )
967 #define SHADOW_TOPIC_STRING_UPDATE_DELTA( thingName ) \
968 SHADOW_TOPIC_STR_UPDATE_DELTA( thingName, SHADOW_NAME_CLASSIC )
976 #define SHADOW_TOPIC_STRING_GET( thingName ) \
977 SHADOW_TOPIC_STR_GET( thingName, SHADOW_NAME_CLASSIC )
985 #define SHADOW_TOPIC_STRING_GET_ACCEPTED( thingName ) \
986 SHADOW_TOPIC_STR_GET_ACC( thingName, SHADOW_NAME_CLASSIC )
994 #define SHADOW_TOPIC_STRING_GET_REJECTED( thingName ) \
995 SHADOW_TOPIC_STR_GET_REJ( thingName, SHADOW_NAME_CLASSIC )
1003 #define SHADOW_TOPIC_STRING_DELETE( thingName ) \
1004 SHADOW_TOPIC_STR_DELETE( thingName, SHADOW_NAME_CLASSIC )
1012 #define SHADOW_TOPIC_STRING_DELETE_ACCEPTED( thingName ) \
1013 SHADOW_TOPIC_STR_DELETE_ACC( thingName, SHADOW_NAME_CLASSIC )
1021 #define SHADOW_TOPIC_STRING_DELETE_REJECTED( thingName ) \
1022 SHADOW_TOPIC_STR_DELETE_REJ( thingName, SHADOW_NAME_CLASSIC )
1034 #define Shadow_GetTopicString( topicType, pThingName, thingNameLength, pTopicBuffer, bufferSize, pOutLength ) \
1035 Shadow_AssembleTopicString( topicType, pThingName, thingNameLength, SHADOW_NAME_CLASSIC, 0, \
1036 pTopicBuffer, bufferSize, pOutLength )
1052 uint16_t topicLength,
1054 const char ** pThingName,
1055 uint16_t * pThingNameLength );