in source/shadow.c [705:760]
static void createShadowTopicString( ShadowTopicStringType_t topicType,
const char * pThingName,
uint8_t thingNameLength,
const char * pShadowName,
uint8_t shadowNameLength,
char * pTopicBuffer )
{
uint16_t offset = 0U, operationStringLength = 0U;
const char * pShadowPrefix = SHADOW_PREFIX;
const char * pOperationString = NULL;
const char * pClassicShadowRoot = SHADOW_CLASSIC_ROOT;
const char * pNamedShadowRoot = SHADOW_NAMED_ROOT;
/* Copy the Shadow topic prefix into the topic buffer. */
( void ) memcpy( ( void * ) pTopicBuffer,
( const void * ) pShadowPrefix,
( size_t ) SHADOW_PREFIX_LENGTH );
offset = ( uint16_t ) ( offset + SHADOW_PREFIX_LENGTH );
/* Copy the Thing Name into the topic buffer. */
( void ) memcpy( ( void * ) &( pTopicBuffer[ offset ] ),
( const void * ) pThingName,
( size_t ) thingNameLength );
offset = ( uint16_t ) ( offset + thingNameLength );
/* Are we assembling a named shadow? */
if( shadowNameLength > 0U )
{
/* Copy the named Shadow topic root into the topic buffer. */
( void ) memcpy( ( void * ) &( pTopicBuffer[ offset ] ),
( const void * ) pNamedShadowRoot,
( size_t ) SHADOW_NAMED_ROOT_LENGTH );
offset = ( uint16_t ) ( offset + SHADOW_NAMED_ROOT_LENGTH );
/* Copy the Shadow Name into the topic buffer. */
( void ) memcpy( ( void * ) &( pTopicBuffer[ offset ] ),
( const void * ) pShadowName,
( size_t ) shadowNameLength );
offset = ( uint16_t ) ( offset + shadowNameLength );
}
else
{
/* Copy the Classic Shadow topic root into the topic buffer. */
( void ) memcpy( ( void * ) &( pTopicBuffer[ offset ] ),
( const void * ) pClassicShadowRoot,
( size_t ) SHADOW_CLASSIC_ROOT_LENGTH );
offset = ( uint16_t ) ( offset + SHADOW_CLASSIC_ROOT_LENGTH );
}
pOperationString = getShadowOperationString( topicType );
operationStringLength = getShadowOperationLength( topicType );
/* Copy the Shadow operation string into the topic buffer. */
( void ) memcpy( ( void * ) &( pTopicBuffer[ offset ] ),
( const void * ) pOperationString,
( size_t ) operationStringLength );
}