Implementation of the AWS IoT Fleet Provisioning Library. More...
Enumerations | |
enum | TopicSuffix_t { TopicPublish, TopicAccepted, TopicRejected, TopicInvalidSuffix } |
Identifier for which of the topic suffixes for a given format and Fleet Provisioning MQTT API. | |
enum | TopicFormatSuffix_t { TopicJsonPublish, TopicJsonAccepted, TopicJsonRejected, TopicCborPublish, TopicCborAccepted, TopicCborRejected, TopicInvalidFormatSuffix } |
Identifier for which of the topics in each Fleet Provisioning MQTT API. | |
Functions | |
static uint16_t | getRegisterThingTopicLength (uint16_t templateNameLength, FleetProvisioningFormat_t format, FleetProvisioningApiTopics_t topic) |
Get the topic length for a given RegisterThing topic. More... | |
static void | writeTopicFragmentAndAdvance (char **pBufferCursor, const char *fragment, uint16_t length) |
Write the given piece of the topic to the remaining buffer and advance the remaining buffer pointer. More... | |
static FleetProvisioningStatus_t | GetRegisterThingTopicCheckParams (const char *pTopicBuffer, FleetProvisioningFormat_t format, FleetProvisioningApiTopics_t topic, const char *pTemplateName, uint16_t templateNameLength, const uint16_t *pOutLength) |
Check the parameters for FleetProvisioning_GetRegisterThingTopic(). More... | |
static TopicSuffix_t | parseTopicSuffix (const char *pRemainingTopic, uint16_t remainingLength) |
Match the suffix from the remaining topic string and return the corresponding suffix. More... | |
static TopicFormatSuffix_t | parseTopicFormatSuffix (const char *pRemainingTopic, uint16_t remainingLength) |
Match the format and suffix from the remaining topic string and return the corresponding format and suffix. More... | |
static FleetProvisioningTopic_t | parseCreateCertificateFromCsrTopic (const char *pTopic, uint16_t topicLength) |
Match a topic string with the CreateCertificateFromCsr topics. More... | |
static FleetProvisioningTopic_t | parseCreateKeysAndCertificateTopic (const char *pTopic, uint16_t topicLength) |
Match a topic string with the CreateKeysAndCertificate topics. More... | |
static FleetProvisioningTopic_t | parseRegisterThingTopic (const char *pTopic, uint16_t topicLength) |
Match a topic string with the RegisterThing topics. More... | |
static FleetProvisioningStatus_t | consumeIfMatch (const char **pBufferCursor, uint16_t *pRemainingLength, const char *matchString, uint16_t matchLength) |
Check if the remaining buffer starts with a specified string. If so, moves the remaining buffer pointer past the matched section and updates the remaining length. More... | |
static FleetProvisioningStatus_t | consumeTemplateName (const char **pTopicCursor, uint16_t *pRemainingLength) |
Move the remaining topic pointer past the template name in the unparsed topic so far, and update the remaining topic length. More... | |
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. More... | |
FleetProvisioningStatus_t | FleetProvisioning_MatchTopic (const char *pTopic, uint16_t topicLength, FleetProvisioningTopic_t *pOutApi) |
Check if the given topic is one of the Fleet Provisioning topics. More... | |
Implementation of the AWS IoT Fleet Provisioning Library.
|
static |
Get the topic length for a given RegisterThing topic.
[in] | templateNameLength | the length of the template name registered with AWS IoT. |
[in] | format | The RegisterThing API format to use. |
[in] | topic | The RegisterThing API format to use. |
|
static |
Write the given piece of the topic to the remaining buffer and advance the remaining buffer pointer.
The caller is responsible for assuring that there is enough space remaining in the buffer to write the given string.
[in,out] | pBufferCursor | Pointer to the remaining buffer. |
[in] | fragment | The piece of the topic string to write. |
[in] | length | The length of fragment . |
|
static |
Check the parameters for FleetProvisioning_GetRegisterThingTopic().
[in] | pTopicBuffer | The buffer to write the topic string into. |
[in] | format | The desired RegisterThing format. |
[in] | topic | The desired RegisterThing topic. |
[in] | pTemplateName | The name of the provisioning template configured with AWS IoT. |
[in] | templateNameLength | The length of pTemplateName . |
[in] | pOutLength | The length of the topic string written to the buffer. |
|
static |
Match the suffix from the remaining topic string and return the corresponding suffix.
Suffix: empty, /accepted, or /rejected.
[in] | pRemainingTopic | The remaining portion of the topic. |
[in] | remainingLength | The remaining length of the topic. |
|
static |
Match the format and suffix from the remaining topic string and return the corresponding format and suffix.
Format: json or cbor. Suffix: empty, /accepted, or /rejected.
[in] | pRemainingTopic | The remaining portion of the topic. |
[in] | remainingLength | The remaining length of the topic. |
|
static |
Match a topic string with the CreateCertificateFromCsr topics.
[in] | pTopic | The topic string to match. |
[in] | topicLength | The length of the topic string. |
|
static |
Match a topic string with the CreateKeysAndCertificate topics.
[in] | pTopic | The topic string to match. |
[in] | topicLength | The length of the topic string. |
|
static |
Match a topic string with the RegisterThing topics.
[in] | pTopic | The topic string to match. |
[in] | topicLength | The length of the topic string. |
|
static |
Check if the remaining buffer starts with a specified string. If so, moves the remaining buffer pointer past the matched section and updates the remaining length.
[in,out] | pBufferCursor | Pointer to the remaining portion of the buffer. |
[in,out] | pRemainingLength | The remaining length of the buffer. |
[in] | matchString | The string to match against. |
[in] | matchLength | The length of matchString . |
|
static |
Move the remaining topic pointer past the template name in the unparsed topic so far, and update the remaining topic length.
The end of thing name is marked by a forward slash. A zero length thing name is not valid.
This function extracts the same template name from the following topic strings:
[in,out] | pTopicCursor | Pointer to the remaining topic string. |
[in,out] | pRemainingLength | Pointer to the length of the remaining topic string. |
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.
[out] | pTopicBuffer | The buffer to write the topic string into. |
[in] | bufferLength | The length of pTopicBuffer . |
[in] | format | The desired RegisterThing format. |
[in] | topic | The desired RegisterThing topic. |
[in] | pTemplateName | The name of the provisioning template configured with AWS IoT. |
[in] | templateNameLength | The length of the provisioning template name. |
[out] | pOutLength | The length of the topic string written to the buffer. |
example
FleetProvisioningStatus_t FleetProvisioning_MatchTopic | ( | const char * | pTopic, |
uint16_t | topicLength, | ||
FleetProvisioningTopic_t * | pOutApi | ||
) |
Check if the given topic is one of the Fleet Provisioning topics.
The function outputs which API the topic is for.
[in] | pTopic | The topic string to check. |
[in] | topicLength | The length of the topic string. |
[out] | pOutApi | The Fleet Provisioning topic API value. |
Example