AWS IoT Fleet Provisioning  v1.0.0
AWS IoT Fleet Provisioning Library
FleetProvisioning_GetRegisterThingTopic

Populate the topic string for a Fleet Provisioning RegisterThing topic.

uint16_t bufferLength,
const char * pTemplateName,
uint16_t templateNameLength,
uint16_t * pOutLength );
Parameters
[out]pTopicBufferThe buffer to write the topic string into.
[in]bufferLengthThe length of pTopicBuffer.
[in]formatThe desired RegisterThing format.
[in]topicThe desired RegisterThing topic.
[in]pTemplateNameThe name of the provisioning template configured with AWS IoT.
[in]templateNameLengthThe length of the provisioning template name.
[out]pOutLengthThe length of the topic string written to the buffer.
Returns
FleetProvisioningSuccess if the topic string is written to the buffer; FleetProvisioningBadParameter if invalid parameters, such as non-RegisterThing topics, are passed; FleetProvisioningBufferTooSmall if the buffer cannot hold the full topic string.

example

// The following example shows how to use the FleetProvisioning_GetRegisterThingTopic
// function to generate a topic string for getting an accepted response for
// a JSON RegisterThing request.
#define TOPIC_BUFFER_LENGTH ( 256u )
// In order to use the AWS IoT Fleet Provisioning service, there must be a
// provisioning template registered with AWS IoT Core.
// This example assumes that the template is named "template_name".
#define TEMPLATE_NAME "template_name"
#define TEMPLATE_NAME_LENGTH ( ( uint16_t ) ( sizeof( TEMPLATE_NAME ) - 1U )
char pTopicbuffer[ TOPIC_BUFFER_LENGTH ] = { 0 };
uint16_t topicLength = 0;
FleetProvisioningStatus_t status = FleetProvisioningError;
TOPIC_BUFFER_LENGTH,
FleetProvisioningJson,
FleetProvisioningAccepted,
TEMPLATE_NAME,
TEMPLATE_NAME_LENGTH,
&( topiclength ) );
if( status == FleetProvisioningSuccess )
{
// The buffer pTopicBuffer contains the topic string of length
// topicLength for getting a response for an accepted JSON RegisterThing
// request. Subscribe to this topic using an MQTT library of your choice.
}
FleetProvisioningStatus_t
FleetProvisioningStatus_t
Return codes for Fleet Provisioning APIs.
Definition: fleet_provisioning.h:56
FleetProvisioningApiTopics_t
FleetProvisioningApiTopics_t
Topics for each Fleet Provisioning APIs.
Definition: fleet_provisioning.h:96
FleetProvisioningFormat_t
FleetProvisioningFormat_t
Message format for Fleet Provisioning APIs.
Definition: fleet_provisioning.h:107
FleetProvisioning_GetRegisterThingTopic
FleetProvisioningStatus_t FleetProvisioning_GetRegisterThingTopic(char *pTopicBuffer, uint16_t bufferLength, FleetProvisioningFormat_t format, FleetProvisioningApiTopics_t topic, const char *pTemplateName, uint16_t templateNameLength, uint16_t *pOutLength)
Populate the topic string for a Fleet Provisioning RegisterThing topic.
Definition: fleet_provisioning.c:638