AWS IoT Device SDK C: Jobs
AWS IoT Jobs library
Return to main page ↑
AwsIotJobs_GetPendingAsync

Get the list of all pending jobs for a Thing and receive an asynchronous notification when the response arrives.

uint32_t flags,
const AwsIotJobsCallbackInfo_t * pCallbackInfo,
AwsIotJobsOperation_t * const pGetPendingOperation );

This function implements the GetPendingJobExecutions command of the Jobs API, which gets the list of all Jobs for a Thing that are not in a terminal state. The list of retrieved Jobs is returned as the pResponse member in AwsIotJobsCallbackParam_t, or through the AwsIotJobsResponse_t parameter of AwsIotJobs_Wait.

Parameters
[in]pRequestInfoJobs request parameters.
[in]flagsFlags which modify the behavior of the Jobs request. See Jobs Function Flags.
[in]pCallbackInfoAsynchronous notification of this function's completion.
[out]pGetPendingOperationSet to a handle by which this operation may be referenced after this function returns. This reference is invalidated once the Jobs operation completes.
Returns
This function will return AWS_IOT_JOBS_STATUS_PENDING upon successfully queuing the Jobs operation.
If this function fails before queuing the Jobs operation, it will return one of:
Upon successful completion of the Jobs operation (either through an AwsIotJobsCallbackInfo_t or AwsIotJobs_Wait), the status will be AWS_IOT_JOBS_SUCCESS.
Should the Jobs operation fail, the status will be one of:
See also
AwsIotJobs_GetPendingSync for a blocking variant of this function.

Example

#define THING_NAME "Test_device"
#define THING_NAME_LENGTH ( sizeof( THING_NAME ) - 1 )
// Signature of Jobs callback function.
void _jobsCallback( void * pCallbackContext, AwsIotJobsCallbackParam_t * pCallbackParam );
// Set the request info.
requestInfo.mqttConnection = _mqttConnection;
requestInfo.pThingName = THING_NAME;
requestInfo.thingNameLength = THING_NAME_LENGTH;
// Set the callback function to invoke.
callbackInfo.function = _jobsCallback;
// Queue Jobs GET PENDING.
AwsIotJobsError_t getPendingResult = AwsIotJobs_GetPendingAsync( &requestInfo,
0,
&callbackInfo,
&getPendingOperation );
// GET PENDING should have returned AWS_IOT_JOBS_STATUS_PENDING. The function
// _jobsCallback will be invoked once the Jobs response is received.