37#ifndef SHADOW_DO_NOT_USE_CUSTOM_CONFIG
39 #include "shadow_config.h"
53typedef enum ShadowMessageType
55 ShadowMessageTypeGetAccepted = 0,
56 ShadowMessageTypeGetRejected,
57 ShadowMessageTypeDeleteAccepted,
58 ShadowMessageTypeDeleteRejected,
59 ShadowMessageTypeUpdateAccepted,
60 ShadowMessageTypeUpdateRejected,
61 ShadowMessageTypeUpdateDocuments,
62 ShadowMessageTypeUpdateDelta,
63 ShadowMessageTypeMaxNum
73typedef 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
93typedef enum ShadowStatus
110#define SHADOW_PREFIX "$aws/things/"
116#define SHADOW_PREFIX_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_PREFIX ) - 1U ) )
122#define SHADOW_OP_DELETE "/shadow/delete"
128#define SHADOW_OP_DELETE_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_OP_DELETE ) - 1U ) )
134#define SHADOW_OP_GET "/shadow/get"
140#define SHADOW_OP_GET_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_OP_GET ) - 1U ) )
146#define SHADOW_OP_UPDATE "/shadow/update"
152#define SHADOW_OP_UPDATE_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_OP_UPDATE ) - 1U ) )
158#define SHADOW_SUFFIX_ACCEPTED "/accepted"
164#define SHADOW_SUFFIX_ACCEPTED_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_ACCEPTED ) - 1U ) )
170#define SHADOW_SUFFIX_REJECTED "/rejected"
176#define SHADOW_SUFFIX_REJECTED_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_REJECTED ) - 1U ) )
182#define SHADOW_SUFFIX_DELTA "/delta"
188#define SHADOW_SUFFIX_DELTA_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_DELTA ) - 1U ) )
194#define SHADOW_SUFFIX_DOCUMENTS "/documents"
200#define SHADOW_SUFFIX_DOCUMENTS_LENGTH ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_DOCUMENTS ) - 1U ) )
206#define SHADOW_SUFFIX_NULL
212#define SHADOW_SUFFIX_NULL_LENGTH ( 0U )
218#define SHADOW_THINGNAME_LENGTH_MAX ( 128U )
258#define SHADOW_TOPIC_LENGTH( operationLength, suffixLength, thingNameLength ) \
259 ( operationLength + suffixLength + thingNameLength + SHADOW_PREFIX_LENGTH )
264#define SHADOW_TOPIC_LENGTH_UPDATE( thingNameLength ) \
265 SHADOW_TOPIC_LENGTH( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_NULL_LENGTH, thingNameLength )
270#define SHADOW_TOPIC_LENGTH_UPDATE_ACCEPTED( thingNameLength ) \
271 SHADOW_TOPIC_LENGTH( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_ACCEPTED_LENGTH, thingNameLength )
276#define SHADOW_TOPIC_LENGTH_UPDATE_REJECTED( thingNameLength ) \
277 SHADOW_TOPIC_LENGTH( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_REJECTED_LENGTH, thingNameLength )
282#define SHADOW_TOPIC_LENGTH_UPDATE_DOCUMENTS( thingNameLength ) \
283 SHADOW_TOPIC_LENGTH( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DOCUMENTS_LENGTH, thingNameLength )
288#define SHADOW_TOPIC_LENGTH_UPDATE_DELTA( thingNameLength ) \
289 SHADOW_TOPIC_LENGTH( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DELTA_LENGTH, thingNameLength )
294#define SHADOW_TOPIC_LENGTH_GET( thingNameLength ) \
295 SHADOW_TOPIC_LENGTH( SHADOW_OP_GET_LENGTH, SHADOW_SUFFIX_NULL_LENGTH, thingNameLength )
300#define SHADOW_TOPIC_LENGTH_GET_ACCEPTED( thingNameLength ) \
301 SHADOW_TOPIC_LENGTH( SHADOW_OP_GET_LENGTH, SHADOW_SUFFIX_ACCEPTED_LENGTH, thingNameLength )
306#define SHADOW_TOPIC_LENGTH_GET_REJECTED( thingNameLength ) \
307 SHADOW_TOPIC_LENGTH( SHADOW_OP_GET_LENGTH, SHADOW_SUFFIX_REJECTED_LENGTH, thingNameLength )
312#define SHADOW_TOPIC_LENGTH_DELETE( thingNameLength ) \
313 SHADOW_TOPIC_LENGTH( SHADOW_OP_DELETE_LENGTH, SHADOW_SUFFIX_NULL_LENGTH, thingNameLength )
318#define SHADOW_TOPIC_LENGTH_DELETE_ACCEPTED( thingNameLength ) \
319 SHADOW_TOPIC_LENGTH( SHADOW_OP_DELETE_LENGTH, SHADOW_SUFFIX_ACCEPTED_LENGTH, thingNameLength )
324#define SHADOW_TOPIC_LENGTH_DELETE_REJECTED( thingNameLength ) \
325 SHADOW_TOPIC_LENGTH( SHADOW_OP_DELETE_LENGTH, SHADOW_SUFFIX_REJECTED_LENGTH, thingNameLength )
331#define SHADOW_TOPIC_LENGTH_MAX( thingNameLength ) \
332 SHADOW_TOPIC_LENGTH( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DOCUMENTS_LENGTH, thingNameLength )
360#define SHADOW_TOPIC_STRING( thingName, operation, suffix ) \
361 ( SHADOW_PREFIX thingName operation suffix )
366#define SHADOW_TOPIC_STRING_UPDATE( thingName ) \
367 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_NULL )
372#define SHADOW_TOPIC_STRING_UPDATE_ACCEPTED( thingName ) \
373 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_ACCEPTED )
378#define SHADOW_TOPIC_STRING_UPDATE_REJECTED( thingName ) \
379 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_REJECTED )
384#define SHADOW_TOPIC_STRING_UPDATE_DOCUMENTS( thingName ) \
385 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_DOCUMENTS )
390#define SHADOW_TOPIC_STRING_UPDATE_DELTA( thingName ) \
391 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_UPDATE, SHADOW_SUFFIX_DELTA )
396#define SHADOW_TOPIC_STRING_GET( thingName ) \
397 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_GET, SHADOW_SUFFIX_NULL )
402#define SHADOW_TOPIC_STRING_GET_ACCEPTED( thingName ) \
403 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_GET, SHADOW_SUFFIX_ACCEPTED )
408#define SHADOW_TOPIC_STRING_GET_REJECTED( thingName ) \
409 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_GET, SHADOW_SUFFIX_REJECTED )
414#define SHADOW_TOPIC_STRING_DELETE( thingName ) \
415 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_DELETE, SHADOW_SUFFIX_NULL )
420#define SHADOW_TOPIC_STRING_DELETE_ACCEPTED( thingName ) \
421 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_DELETE, SHADOW_SUFFIX_ACCEPTED )
426#define SHADOW_TOPIC_STRING_DELETE_REJECTED( thingName ) \
427 SHADOW_TOPIC_STRING( thingName, SHADOW_OP_DELETE, SHADOW_SUFFIX_REJECTED )
490 const char * pThingName,
491 uint8_t thingNameLength,
494 uint16_t * pOutLength );
550 uint16_t topicLength,
552 const char ** pThingName,
553 uint16_t * pThingNameLength );
ShadowTopicStringType_t
Each of these values describes the type of a shadow topic string.
Definition: shadow.h:74
ShadowStatus_t
Return codes from Shadow functions.
Definition: shadow.h:94
ShadowMessageType_t
Each of these values describes the type of a shadow message. https://docs.aws.amazon....
Definition: shadow.h:54
@ SHADOW_BAD_PARAMETER
Input parameter is invalid.
Definition: shadow.h:97
@ SHADOW_SUCCESS
Shadow function success.
Definition: shadow.h:95
@ SHADOW_BUFFER_TOO_SMALL
The provided buffer is too small.
Definition: shadow.h:98
@ SHADOW_FAIL
Shadow function encountered error.
Definition: shadow.h:96
@ SHADOW_SHADOW_MESSAGE_TYPE_PARSE_FAILED
Could not parse the shadow type.
Definition: shadow.h:100
@ SHADOW_THINGNAME_PARSE_FAILED
Could not parse the thing name.
Definition: shadow.h:99
ShadowStatus_t Shadow_MatchTopic(const char *pTopic, uint16_t topicLength, ShadowMessageType_t *pMessageType, const char **pThingName, uint16_t *pThingNameLength)
Given the topic string of an incoming message, determine whether it is related to a device shadow; if...
Definition: shadow.c:430
ShadowStatus_t Shadow_GetTopicString(ShadowTopicStringType_t topicType, const char *pThingName, uint8_t thingNameLength, char *pTopicBuffer, uint16_t bufferSize, uint16_t *pOutLength)
Assemble shadow topic string when Thing Name is only known at run time. If the Thing Name is known at...
Definition: shadow.c:536
This represents the default values for the configuration macros for the Shadow library.