Populate the topic string for a Device Defender operation.
uint16_t bufferLength,
const char * pThingName,
uint16_t thingNameLength,
uint16_t * pOutLength );
- Parameters
-
[in] | pBuffer | The buffer to write the topic string into. |
[in] | bufferLength | The length of the buffer. |
[in] | pThingName | The device's thingName as registered with AWS IoT. |
[in] | thingNameLength | The length of the thing name. |
[in] | api | The desired Device Defender API. |
[out] | pOutLength | The length of the topic string written to the buffer. |
- Returns
- DefenderSuccess if the topic string is written to the buffer; DefenderBadParameter if invalid parameters are passed; DefenderBufferTooSmall if the buffer cannot hold the full topic string.
Example
#define TOPIC_BUFFER_LENGTH ( 256U )
const char * pThingName = GetDeviceSerialNumber();
uint16_t thingNameLength = ( uint16_t )strlen( pThingname );
char topicBuffer[ TOPIC_BUFFER_LENGTH ] = { 0 };
uint16_t topicLength = 0;
TOPIC_BUFFER_LENGTH,
pThingName,
thingNameLength,
&( topicLength ) );
{
}