AWS IoT Device SDK C:
Jobs
AWS IoT Jobs library
|
Return to main page ↑ |
Implements functions that process Jobs operations. More...
#include "iot_config.h"
#include <string.h>
#include "private/aws_iot_jobs_internal.h"
#include "platform/iot_threads.h"
#include "iot_error.h"
#include "iot_mqtt.h"
Data Structures | |
struct | _operationMatchParams_t |
First parameter to _jobsOperation_match. More... | |
Functions | |
static bool | _jobsOperation_match (const IotLink_t *pOperationLink, void *pMatch) |
Match a received Jobs response with a Jobs operation awaiting a response. More... | |
static void | _getPendingCallback (void *pArgument, IotMqttCallbackParam_t *pMessage) |
Invoked when a Jobs response is received for Jobs GET PENDING. More... | |
static void | _startNextCallback (void *pArgument, IotMqttCallbackParam_t *pMessage) |
Invoked when a Jobs response is received for a Jobs START NEXT. More... | |
static void | _describeCallback (void *pArgument, IotMqttCallbackParam_t *pMessage) |
Invoked when a Jobs response is received for Jobs DESCRIBE. More... | |
static void | _updateCallback (void *pArgument, IotMqttCallbackParam_t *pMessage) |
Invoked when a Jobs response is received for a Jobs UPDATE. More... | |
static void | _commonOperationCallback (_jobsOperationType_t type, IotMqttCallbackParam_t *pMessage) |
Common function for processing received Jobs responses. More... | |
static void | _notifyCompletion (_jobsOperation_t *pOperation) |
Notify of a completed Jobs operation. More... | |
static AwsIotJobsError_t | _findSubscription (const AwsIotJobsRequestInfo_t *pRequestInfo, char *pTopicBuffer, uint16_t operationTopicLength, _jobsOperation_t *pOperation, bool *pFreeTopicBuffer) |
Get a Jobs subscription to use with a Jobs operation. More... | |
AwsIotJobsError_t | _AwsIotJobs_CreateOperation (_jobsOperationType_t type, const AwsIotJobsRequestInfo_t *pRequestInfo, const _jsonRequestContents_t *pRequestContents, uint32_t flags, const AwsIotJobsCallbackInfo_t *pCallbackInfo, _jobsOperation_t **pNewOperation) |
Create a record for a new in-progress Jobs operation. More... | |
void | _AwsIotJobs_DestroyOperation (void *pData) |
Free resources used to record a Jobs operation. This is called when the operation completes. More... | |
AwsIotJobsError_t | _AwsIotJobs_GenerateJobsTopic (_jobsOperationType_t type, const AwsIotJobsRequestInfo_t *pRequestInfo, char **pTopicBuffer, uint16_t *pOperationTopicLength) |
Fill a buffer with a Jobs topic. More... | |
AwsIotJobsError_t | _AwsIotJobs_ProcessOperation (const AwsIotJobsRequestInfo_t *pRequestInfo, _jobsOperation_t *pOperation) |
Process a Jobs operation by sending the necessary MQTT packets. More... | |
Variables | |
IotListDouble_t | _AwsIotJobsPendingOperations = { 0 } |
List of active Jobs operations awaiting a response from the Jobs service. | |
IotMutex_t | _AwsIotJobsPendingOperationsMutex |
Protects _AwsIotJobsPendingOperations from concurrent access. | |
Implements functions that process Jobs operations.
|
static |
Match a received Jobs response with a Jobs operation awaiting a response.
[in] | pOperationLink | Pointer to the link member of the _jobsOperation_t to check. |
[in] | pMatch | Pointer to an _operationMatchParams_t. |
true
if pMatch
matches the received response; false
otherwise.
|
static |
Invoked when a Jobs response is received for Jobs GET PENDING.
[in] | pArgument | Ignored. |
[in] | pMessage | Received Jobs response (as an MQTT PUBLISH message). |
|
static |
Invoked when a Jobs response is received for a Jobs START NEXT.
[in] | pArgument | Ignored. |
[in] | pMessage | Received Jobs response (as an MQTT PUBLISH message). |
|
static |
Invoked when a Jobs response is received for Jobs DESCRIBE.
[in] | pArgument | Ignored. |
[in] | pMessage | Received Jobs response (as an MQTT PUBLISH message). |
|
static |
Invoked when a Jobs response is received for a Jobs UPDATE.
[in] | pArgument | Ignored. |
[in] | pMessage | Received Jobs response (as an MQTT PUBLISH message). |
|
static |
Common function for processing received Jobs responses.
[in] | type | GET PENDING, START NEXT, DESCRIBE, or UPDATE. |
[in] | pMessage | Received Jobs response (as an MQTT PUBLISH message). |
|
static |
Notify of a completed Jobs operation.
[in] | pOperation | The operation which completed. |
Depending on the parameters passed to a user-facing Jobs function, the notification will cause AwsIotJobs_Wait to return or invoke a user-provided callback.
|
static |
Get a Jobs subscription to use with a Jobs operation.
This function may use an existing Jobs subscription, or it may allocate a new one.
[in] | pRequestInfo | Common Jobs request parameters. |
[in] | pTopicBuffer | Contains the topic to use for subscribing. |
[in] | operationTopicLength | The length of the base topic in pTopicBuffer . |
[in] | pOperation | Jobs operation that needs a subscription. |
[out] | pFreeTopicBuffer | Whether the caller may free pTopicBuffer (which may be assigned to a subscription). |
AwsIotJobsError_t _AwsIotJobs_CreateOperation | ( | _jobsOperationType_t | type, |
const AwsIotJobsRequestInfo_t * | pRequestInfo, | ||
const _jsonRequestContents_t * | pRequestContents, | ||
uint32_t | flags, | ||
const AwsIotJobsCallbackInfo_t * | pCallbackInfo, | ||
_jobsOperation_t ** | pNewOperation | ||
) |
Create a record for a new in-progress Jobs operation.
[in] | type | The type of Jobs operation for the request. |
[in] | pRequestInfo | Common Jobs request parameters. |
[in] | pRequestContents | Additional values to place in the JSON document, depending on type . |
[in] | flags | Flags variables passed to a user-facing Jobs function. |
[in] | pCallbackInfo | User-provided callback function and parameter. |
[out] | pNewOperation | Set to point to the new operation on success. |
void _AwsIotJobs_DestroyOperation | ( | void * | pData | ) |
Free resources used to record a Jobs operation. This is called when the operation completes.
[in] | pData | The operation which completed. This parameter is of type void* to match the signature of free. |
AwsIotJobsError_t _AwsIotJobs_GenerateJobsTopic | ( | _jobsOperationType_t | type, |
const AwsIotJobsRequestInfo_t * | pRequestInfo, | ||
char ** | pTopicBuffer, | ||
uint16_t * | pOperationTopicLength | ||
) |
Fill a buffer with a Jobs topic.
[in] | type | One of: GET PENDING, START NEXT, DESCRIBE, or UPDATE. |
[in] | pRequestInfo | Common Jobs request parameters. |
[out] | pTopicBuffer | Address of the buffer for the Jobs topic. If the pointer at this address is NULL , this function will allocate a new buffer; otherwise, it will use the provided buffer. |
[out] | pOperationTopicLength | Length of the Jobs operation topic (excluding any suffix) placed in pTopicBuffer . |
pTopicBuffer
! Any provided buffer must be large enough to accommodate the full Jobs topic, plus JOBS_LONGEST_SUFFIX_LENGTH.AwsIotJobsError_t _AwsIotJobs_ProcessOperation | ( | const AwsIotJobsRequestInfo_t * | pRequestInfo, |
_jobsOperation_t * | pOperation | ||
) |
Process a Jobs operation by sending the necessary MQTT packets.
[in] | pRequestInfo | Common Jobs request parameters. |
[in] | pOperation | Operation data to process. |