Implementation of the APIs from jobs.h. More...
#include <assert.h>#include <string.h>#include <stdbool.h>#include "jobs.h"#include "core_json.h"Functions | |
| JobsStatus_t | Jobs_GetTopic (char *buffer, size_t length, const char *thingName, uint16_t thingNameLength, JobsTopic_t api, size_t *outLength) |
| Populate a topic string for a subscription request. | |
| JobsStatus_t | Jobs_MatchTopic (char *topic, size_t length, const char *thingName, uint16_t thingNameLength, JobsTopic_t *outApi, char **outJobId, uint16_t *outJobIdLength) |
| Output a topic value if a Jobs API topic string is present. | |
| JobsStatus_t | Jobs_GetPending (char *buffer, size_t length, const char *thingName, uint16_t thingNameLength, size_t *outLength) |
| Populate a topic string for a GetPendingJobExecutions request. | |
| JobsStatus_t | Jobs_StartNext (char *buffer, size_t length, const char *thingName, uint16_t thingNameLength, size_t *outLength) |
| Populate a topic string for a StartNextPendingJobExecution request. | |
| size_t | Jobs_StartNextMsg (const char *clientToken, size_t clientTokenLength, char *buffer, size_t bufferSize) |
| Populate a message string for a StartNextPendingJobExecution request. | |
| JobsStatus_t | Jobs_Describe (char *buffer, size_t length, const char *thingName, uint16_t thingNameLength, const char *jobId, uint16_t jobIdLength, size_t *outLength) |
| Populate a topic string for a DescribeJobExecution request. | |
| JobsStatus_t | Jobs_Update (char *buffer, size_t length, const char *thingName, uint16_t thingNameLength, const char *jobId, uint16_t jobIdLength, size_t *outLength) |
| Populate a topic string for an UpdateJobExecution request. | |
| size_t | Jobs_UpdateMsg (JobCurrentStatus_t status, const char *expectedVersion, size_t expectedVersionLength, char *buffer, size_t bufferSize) |
| Populate a message string for an UpdateJobExecution request. | |
| bool | Jobs_IsStartNextAccepted (const char *topic, const size_t topicLength, const char *thingName, const size_t thingNameLength) |
| Checks if a message comes from the start-next/accepted reserved topic. | |
| bool | Jobs_IsJobUpdateStatus (const char *topic, const size_t topicLength, const char *jobId, const size_t jobIdLength, const char *thingName, const size_t thingNameLength, JobUpdateStatus_t expectedStatus) |
| Checks if a message comes from the update/accepted reserved topic. | |
| size_t | Jobs_GetJobId (const char *message, size_t messageLength, const char **jobId) |
| Retrieves the job ID from a given message (if applicable) | |
| size_t | Jobs_GetJobDocument (const char *message, size_t messageLength, const char **jobDoc) |
| Retrieves the job document from a given message (if applicable) | |
Implementation of the APIs from jobs.h.
| JobsStatus_t Jobs_GetTopic | ( | char * | buffer, |
| size_t | length, | ||
| const char * | thingName, | ||
| uint16_t | thingNameLength, | ||
| JobsTopic_t | api, | ||
| size_t * | outLength | ||
| ) |
Populate a topic string for a subscription request.
See jobs.h for docs.
| JobsStatus_t Jobs_MatchTopic | ( | char * | topic, |
| size_t | length, | ||
| const char * | thingName, | ||
| uint16_t | thingNameLength, | ||
| JobsTopic_t * | outApi, | ||
| char ** | outJobId, | ||
| uint16_t * | outJobIdLength | ||
| ) |
Output a topic value if a Jobs API topic string is present.
Output a topic value if a Jobs API topic string is present. Optionally, output a pointer to a jobID within the topic and its length.
See jobs.h for docs.
| JobsStatus_t Jobs_GetPending | ( | char * | buffer, |
| size_t | length, | ||
| const char * | thingName, | ||
| uint16_t | thingNameLength, | ||
| size_t * | outLength | ||
| ) |
Populate a topic string for a GetPendingJobExecutions request.
See jobs.h for docs.
| JobsStatus_t Jobs_StartNext | ( | char * | buffer, |
| size_t | length, | ||
| const char * | thingName, | ||
| uint16_t | thingNameLength, | ||
| size_t * | outLength | ||
| ) |
Populate a topic string for a StartNextPendingJobExecution request.
See jobs.h for docs.
| size_t Jobs_StartNextMsg | ( | const char * | clientToken, |
| size_t | clientTokenLength, | ||
| char * | buffer, | ||
| size_t | bufferSize | ||
| ) |
Populate a message string for a StartNextPendingJobExecution request.
| clientToken | The device's token |
| clientTokenLength | The expected length of the clientToken |
| buffer | The buffer to be written to |
| bufferSize | The size of the buffer |
Example
| JobsStatus_t Jobs_Describe | ( | char * | buffer, |
| size_t | length, | ||
| const char * | thingName, | ||
| uint16_t | thingNameLength, | ||
| const char * | jobId, | ||
| uint16_t | jobIdLength, | ||
| size_t * | outLength | ||
| ) |
Populate a topic string for a DescribeJobExecution request.
See jobs.h for docs.
| JobsStatus_t Jobs_Update | ( | char * | buffer, |
| size_t | length, | ||
| const char * | thingName, | ||
| uint16_t | thingNameLength, | ||
| const char * | jobId, | ||
| uint16_t | jobIdLength, | ||
| size_t * | outLength | ||
| ) |
Populate a topic string for an UpdateJobExecution request.
See jobs.h for docs.
| size_t Jobs_UpdateMsg | ( | JobCurrentStatus_t | status, |
| const char * | expectedVersion, | ||
| size_t | expectedVersionLength, | ||
| char * | buffer, | ||
| size_t | bufferSize | ||
| ) |
Populate a message string for an UpdateJobExecution request.
| status | Current status of the job |
| expectedVersion | The version that is expected |
| expectedVersionLength | The length of the expectedVersion string |
| buffer | The buffer to be written to |
| bufferSize | the size of the buffer |
Example
| bool Jobs_IsStartNextAccepted | ( | const char * | topic, |
| const size_t | topicLength, | ||
| const char * | thingName, | ||
| const size_t | thingNameLength | ||
| ) |
Checks if a message comes from the start-next/accepted reserved topic.
| topic | The topic to check against |
| topicLength | The expected topic length |
| thingName | The device's thingName as registered with AWS IoT. |
| thingNameLength | The length of the thingName. |
| bool Jobs_IsJobUpdateStatus | ( | const char * | topic, |
| const size_t | topicLength, | ||
| const char * | jobId, | ||
| const size_t | jobIdLength, | ||
| const char * | thingName, | ||
| const size_t | thingNameLength, | ||
| JobUpdateStatus_t | expectedStatus | ||
| ) |
Checks if a message comes from the update/accepted reserved topic.
| topic | The topic to check against |
| topicLength | The expected topic length |
| jobId | Corresponding Job ID which the update was accepted for |
| jobIdLength | The Job ID length |
| thingName | The device's thingName as registered with AWS IoT. |
| thingNameLength | The length of the thingName. |
| expectedStatus | The job update status reported by AWS IoT Jobs |
| size_t Jobs_GetJobId | ( | const char * | message, |
| size_t | messageLength, | ||
| const char ** | jobId | ||
| ) |
Retrieves the job ID from a given message (if applicable)
| message | [In] A JSON formatted message |
| messageLength | [In] The length of the message |
| jobId | [Out] The job ID |
Example
| size_t Jobs_GetJobDocument | ( | const char * | message, |
| size_t | messageLength, | ||
| const char ** | jobDoc | ||
| ) |
Retrieves the job document from a given message (if applicable)
| message | [In] A JSON formatted message which |
| messageLength | [In] The length of the message |
| jobDoc | [Out] The job document |
Example