Jim Flynn / Mbed OS aws-iot-device-sdk-mbed-c
Embed: (wiki syntax)

« Back to documentation index

aws_iot_jobs_interface.h File Reference

aws_iot_jobs_interface.h File Reference

An interface for interacting with the AWS IoT Jobs system. More...

Go to the source code of this file.

Functions

IoT_Error_t aws_iot_jobs_subscribe_to_job_messages (AWS_IoT_Client *pClient, QoS qos, const char *thingName, const char *jobId, AwsIotJobExecutionTopicType topicType, AwsIotJobExecutionTopicReplyType replyType, pApplicationHandler_t pApplicationHandler, void *pApplicationHandlerData, char *topicBuffer, uint16_t topicBufferSize)
 Subscribe to jobs messages for the given thing and/or jobs.
IoT_Error_t aws_iot_jobs_subscribe_to_all_job_messages (AWS_IoT_Client *pClient, QoS qos, const char *thingName, pApplicationHandler_t pApplicationHandler, void *pApplicationHandlerData, char *topicBuffer, uint16_t topicBufferSize)
 Subscribe to all job messages.
IoT_Error_t aws_iot_jobs_unsubscribe_from_job_messages (AWS_IoT_Client *pClient, char *topicBuffer)
 Unsubscribe from a job subscription.
IoT_Error_t aws_iot_jobs_send_query (AWS_IoT_Client *pClient, QoS qos, const char *thingName, const char *jobId, const char *clientToken, char *topicBuffer, uint16_t topicBufferSize, char *messageBuffer, size_t messageBufferSize, AwsIotJobExecutionTopicType topicType)
 Send a query to one of the job query APIs.
IoT_Error_t aws_iot_jobs_start_next (AWS_IoT_Client *pClient, QoS qos, const char *thingName, const AwsIotStartNextPendingJobExecutionRequest *startNextRequest, char *topicBuffer, uint16_t topicBufferSize, char *messageBuffer, size_t messageBufferSize)
 Send a start next command to the job start-next API.
IoT_Error_t aws_iot_jobs_describe (AWS_IoT_Client *pClient, QoS qos, const char *thingName, const char *jobId, const AwsIotDescribeJobExecutionRequest *describeRequest, char *topicBuffer, uint16_t topicBufferSize, char *messageBuffer, size_t messageBufferSize)
 Send a describe job query to the job query API.
IoT_Error_t aws_iot_jobs_send_update (AWS_IoT_Client *pClient, QoS qos, const char *thingName, const char *jobId, const AwsIotJobExecutionUpdateRequest *updateRequest, char *topicBuffer, uint16_t topicBufferSize, char *messageBuffer, size_t messageBufferSize)
 Send an update about a job execution.

Detailed Description

An interface for interacting with the AWS IoT Jobs system.

Functions for interacting with the AWS IoT Jobs system.

This file defines utility functions for interacting with the AWS IoT jobs APIs over MQTT. It provides functions for managing subscriptions to job related topics and for sending queries and updates requests for jobs. Callers are responsible for managing the subscriptions and associating responses with the queries and update messages.

Definition in file aws_iot_jobs_interface.h.


Function Documentation

IoT_Error_t aws_iot_jobs_describe ( AWS_IoT_Client pClient,
QoS  qos,
const char *  thingName,
const char *  jobId,
const AwsIotDescribeJobExecutionRequest describeRequest,
char *  topicBuffer,
uint16_t  topicBufferSize,
char *  messageBuffer,
size_t  messageBufferSize 
)

Send a describe job query to the job query API.

Send a describe job query to the job query API. If jobId is null this requests a list of pending jobs for the thing. If jobId is not null then it sends a query for the details of that job.

Parameters:
pClientthe client to use
qosthe qos to use
thingNamethe thing name to query for
jobIdthe id of the job to query for. If null a list of all pending jobs for the thing is requested.
describeRequestthe describe request to send
topicBufferthe topic buffer to use. This may be discarded as soon as this function returns
topicBufferSizethe size of topicBuffer
messageBufferthe message buffer to use. May be NULL if clientToken is NULL
messageBufferSizethe size of messageBuffer
Returns:
LIMIT_EXCEEDED_ERROR if the topic buffer or message buffer is too small, NULL_VALUE_ERROR if the any of the required inputs are NULL, otherwise the result of the mqtt publish

Definition at line 141 of file aws_iot_jobs_interface.c.

IoT_Error_t aws_iot_jobs_send_query ( AWS_IoT_Client pClient,
QoS  qos,
const char *  thingName,
const char *  jobId,
const char *  clientToken,
char *  topicBuffer,
uint16_t  topicBufferSize,
char *  messageBuffer,
size_t  messageBufferSize,
AwsIotJobExecutionTopicType  topicType 
)

Send a query to one of the job query APIs.

Send a query to one of the job query APIs. If jobId is null this requests a list of pending jobs for the thing. If jobId is not null then it sends a query for the details of that job. If jobId is $next then it sends a query for the details for the next pending job.

Parameters:
pClientthe client to use
qosthe qos to use
thingNamethe thing name to query for
jobIdthe id of the job to query for. If null a list of all pending jobs for the thing is requested.
clientTokenthe client token to use for the query. If null no clientToken is sent resulting in an empty message.
topicBufferthe topic buffer to use. This may be discarded as soon as this function returns
topicBufferSizethe size of topicBuffer
messageBufferthe message buffer to use. May be NULL if clientToken is NULL
messageBufferSizethe size of messageBuffer
topicTypethe topic type to publish query to
Returns:
LIMIT_EXCEEDED_ERROR if the topic buffer or message buffer is too small, NULL_VALUE_ERROR if the any of the required inputs are NULL, otherwise the result of the mqtt publish

Definition at line 69 of file aws_iot_jobs_interface.c.

IoT_Error_t aws_iot_jobs_send_update ( AWS_IoT_Client pClient,
QoS  qos,
const char *  thingName,
const char *  jobId,
const AwsIotJobExecutionUpdateRequest updateRequest,
char *  topicBuffer,
uint16_t  topicBufferSize,
char *  messageBuffer,
size_t  messageBufferSize 
)

Send an update about a job execution.

Send an update about a job execution.

Parameters:
pClientthe client to use
qosthe qos to use
thingNamethe thing name to send the update for
jobIdthe id of the job to send the update for
updateRequestthe update request to send
topicBufferthe topic buffer to use. This may be discarded as soon as this function returns
topicBufferSizethe size of topicBuffer
messageBufferthe message buffer to use.
messageBufferSizethe size of messageBuffer
Returns:
LIMIT_EXCEEDED_ERROR if the topic buffer or message buffer is too small, NULL_VALUE_ERROR if the any of the required inputs are NULL, otherwise the result of the mqtt publish

Definition at line 181 of file aws_iot_jobs_interface.c.

IoT_Error_t aws_iot_jobs_start_next ( AWS_IoT_Client pClient,
QoS  qos,
const char *  thingName,
const AwsIotStartNextPendingJobExecutionRequest startNextRequest,
char *  topicBuffer,
uint16_t  topicBufferSize,
char *  messageBuffer,
size_t  messageBufferSize 
)

Send a start next command to the job start-next API.

Send a start next command to the job start-next API.

Parameters:
pClientthe client to use
qosthe qos to use
thingNamethe thing name to query for
startNextRequestthe start-next request to send
topicBufferthe topic buffer to use. This may be discarded as soon as this function returns
topicBufferSizethe size of topicBuffer
messageBufferthe message buffer to use. May be NULL if clientToken is NULL
messageBufferSizethe size of messageBuffer
Returns:
LIMIT_EXCEEDED_ERROR if the topic buffer or message buffer is too small, NULL_VALUE_ERROR if the any of the required inputs are NULL, otherwise the result of the mqtt publish

Definition at line 110 of file aws_iot_jobs_interface.c.

IoT_Error_t aws_iot_jobs_subscribe_to_all_job_messages ( AWS_IoT_Client pClient,
QoS  qos,
const char *  thingName,
pApplicationHandler_t  pApplicationHandler,
void *  pApplicationHandlerData,
char *  topicBuffer,
uint16_t  topicBufferSize 
)

Subscribe to all job messages.

Subscribe to all job messages for the given thing.

Note:
Subscribing with the same thing more than once is undefined.
Parameters:
pClientthe client to use
qosthe qos to use
thingNamethe name of the thing to subscribe to
pApplicationHandlerthe callback handler
pApplicationHandlerDatathe callback context data. This must remain valid at least until aws_iot_jobs_unsubscribe_from_job_messages is called.
topicBuffer.A buffer to use to hold the topic name for the subscription. This buffer must remain valid at least until aws_iot_jobs_unsubscribe_from_job_messages is called.
topicBufferSizethe size of the topic buffer. The function will fail with LIMIT_EXCEEDED_ERROR if this is too small.
Returns:
the result of subscribing to the topic (see aws_iot_mqtt_subscribe)

Definition at line 50 of file aws_iot_jobs_interface.c.

IoT_Error_t aws_iot_jobs_subscribe_to_job_messages ( AWS_IoT_Client pClient,
QoS  qos,
const char *  thingName,
const char *  jobId,
AwsIotJobExecutionTopicType  topicType,
AwsIotJobExecutionTopicReplyType  replyType,
pApplicationHandler_t  pApplicationHandler,
void *  pApplicationHandlerData,
char *  topicBuffer,
uint16_t  topicBufferSize 
)

Subscribe to jobs messages for the given thing and/or jobs.

The function can be used to subscribe to all job related messages. To subscribe to messages not related to a job the jobId passed should be null. The jobId can also be "+" to subscribe to messages related to any job, or "$next" to indicate the next pending job.

See also aws_iot_jobs_subscribe_to_all_job_messages to subscribe to all possible messages in one operation.

Note:
Subscribing with the same thing, job and topic type more than once is undefined.
Parameters:
pClientthe client to use
qosthe qos to use
thingNamethe name of the thing to subscribe to
jobIdthe job id to subscribe to. To subscribe to messages not related to a job the jobId passed should be null. The jobId can also be "+" to subscribe to messages related to any job, or "$next" to indicate the next pending job.
topicTypethe topic type to subscribe to
replyTypethe reply topic type to subscribe to
pApplicationHandlerthe callback handler
pApplicationHandlerDatathe callback context data. This must remain valid at least until aws_iot_jobs_unsubscribe_from_job_messages is called.
topicBuffer.A buffer to use to hold the topic name for the subscription. This buffer must remain valid at least until aws_iot_jobs_unsubscribe_from_job_messages is called.
topicBufferSizethe size of the topic buffer. The function will fail with LIMIT_EXCEEDED_ERROR if this is too small.
Returns:
the result of subscribing to the topic (see aws_iot_mqtt_subscribe)

Definition at line 33 of file aws_iot_jobs_interface.c.

IoT_Error_t aws_iot_jobs_unsubscribe_from_job_messages ( AWS_IoT_Client pClient,
char *  topicBuffer 
)

Unsubscribe from a job subscription.

Remove the subscription created using aws_iot_jobs_subscribe_to_job_messages or aws_iot_jobs_subscribe_to_all_job_messages.

Parameters:
pClientthe client to use
topicBufferthe topic buffer passed to aws_iot_jobs_subscribe_to_job_messages or aws_iot_jobs_subscribe_to_all_job_messages when the subscription was created.
Returns:
AWS_SUCCESS or the first error encountered.

Definition at line 62 of file aws_iot_jobs_interface.c.