AWS IoT Device Shadow  v1.0.0
AWS IoT Device Shadow client library
Constants

Constants defined in the Shadow library. More...

Macros

#define SHADOW_PREFIX   "$aws/things/"
 The common prefix of all Shadow MQTT topics from here https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-mqtt.html.
 
#define SHADOW_PREFIX_LENGTH   ( ( uint16_t ) ( sizeof( SHADOW_PREFIX ) - 1U ) )
 The length of SHADOW_PREFIX.
 
#define SHADOW_OP_DELETE   "/shadow/delete"
 The string representing a Shadow "DELETE" operation in a Shadow MQTT topic.
 
#define SHADOW_OP_DELETE_LENGTH   ( ( uint16_t ) ( sizeof( SHADOW_OP_DELETE ) - 1U ) )
 The length of SHADOW_OP_DELETE.
 
#define SHADOW_OP_GET   "/shadow/get"
 The string representing a Shadow "GET" operation in a Shadow MQTT topic.
 
#define SHADOW_OP_GET_LENGTH   ( ( uint16_t ) ( sizeof( SHADOW_OP_GET ) - 1U ) )
 The length of SHADOW_OP_GET.
 
#define SHADOW_OP_UPDATE   "/shadow/update"
 The string representing a Shadow "UPDATE" operation in a Shadow MQTT topic.
 
#define SHADOW_OP_UPDATE_LENGTH   ( ( uint16_t ) ( sizeof( SHADOW_OP_UPDATE ) - 1U ) )
 The length of SHADOW_OP_UPDATE.
 
#define SHADOW_SUFFIX_ACCEPTED   "/accepted"
 The suffix for a Shadow operation "accepted" topic.
 
#define SHADOW_SUFFIX_ACCEPTED_LENGTH   ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_ACCEPTED ) - 1U ) )
 The length of SHADOW_SUFFIX_ACCEPTED.
 
#define SHADOW_SUFFIX_REJECTED   "/rejected"
 The suffix for a Shadow operation "rejected" topic.
 
#define SHADOW_SUFFIX_REJECTED_LENGTH   ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_REJECTED ) - 1U ) )
 The length of SHADOW_SUFFIX_REJECTED.
 
#define SHADOW_SUFFIX_DELTA   "/delta"
 The suffix for a Shadow "delta" topic.
 
#define SHADOW_SUFFIX_DELTA_LENGTH   ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_DELTA ) - 1U ) )
 The length of SHADOW_SUFFIX_DELTA.
 
#define SHADOW_SUFFIX_DOCUMENTS   "/documents"
 The suffix for a Shadow "documents" topic.
 
#define SHADOW_SUFFIX_DOCUMENTS_LENGTH   ( ( uint16_t ) ( sizeof( SHADOW_SUFFIX_DOCUMENTS ) - 1U ) )
 The length of SHADOW_SUFFIX_DOCUMENTS.
 
#define SHADOW_SUFFIX_NULL
 The suffix for a "null" suffix.
 
#define SHADOW_SUFFIX_NULL_LENGTH   ( 0U )
 The length of null suffix.
 
#define SHADOW_THINGNAME_LENGTH_MAX   ( 128U )
 The maximum length of Thing Name.
 
#define SHADOW_TOPIC_LENGTH(operationLength, suffixLength, thingNameLength)    ( operationLength + suffixLength + thingNameLength + SHADOW_PREFIX_LENGTH )
 Compute shadow topic length. More...
 
#define SHADOW_TOPIC_LENGTH_MAX(thingNameLength)    SHADOW_TOPIC_LENGTH( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DOCUMENTS_LENGTH, thingNameLength )
 Compute the length of the longest shadow topic.
 
#define SHADOW_TOPIC_STRING(thingName, operation, suffix)    ( SHADOW_PREFIX thingName operation suffix )
 Assemble constant shadow topic strings when Thing Name is known at compile time. More...
 

Detailed Description

Constants defined in the Shadow library.

Macro Definition Documentation

◆ SHADOW_TOPIC_LENGTH

#define SHADOW_TOPIC_LENGTH (   operationLength,
  suffixLength,
  thingNameLength 
)     ( operationLength + suffixLength + thingNameLength + SHADOW_PREFIX_LENGTH )

Compute shadow topic length.

The format of shadow topic strings is defined at https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-mqtt.html

A shadow topic string takes one of the two forms: $aws/things/<thingName>/shadow/<operation> $aws/things/<thingName>/shadow/<operation>/<suffix>

The <thingName>, <operation> and <suffix> segments correspond to the three input parameters of this macro. The <suffix> part can be null.

When thingName is known to be "myThing" at compile time, invoke the macro like this: (In this case, the length is a constant at compile time.)

SHADOW_TOPIC_LENGTH( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DELTA_LENGTH, 7 )

When thingName is only known at run time and held in a variable myThingName, invoke the macro like this:

SHADOW_TOPIC_LENGTH( SHADOW_OP_UPDATE_LENGTH, SHADOW_SUFFIX_DELTA_LENGTH,
                  strlen( ( const char * ) myThingName ) )
Parameters
[operationLength]Can be one of:
[suffixLength]Can be one of:
[thingNameLength]Length of the thingName excluding the ending NULL.
Returns
Length of the shadow topic in bytes.

◆ SHADOW_TOPIC_STRING

#define SHADOW_TOPIC_STRING (   thingName,
  operation,
  suffix 
)     ( SHADOW_PREFIX thingName operation suffix )

Assemble constant shadow topic strings when Thing Name is known at compile time.

When thingName is known to be "myThing" at compile time, invoke the macro like this:

SHADOW_TOPIC_STRING( SHADOW_OP_UPDATE, SHADOW_SUFFIX_DELTA, "myThing" )

When thingName is only known at run time, do not use this macro. Use the Shadow_GetTopicString() function instead.

Parameters
[operation]Can be one of:
[suffix]Can be one of:
[thingName]Thing Name.
Returns
Topic string.