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

Update the status of a job execution and receive an asynchronous notification when the Job update completes.

const AwsIotJobsUpdateInfo_t * pUpdateInfo,
uint32_t flags,
const AwsIotJobsCallbackInfo_t * pCallbackInfo,
AwsIotJobsOperation_t * const pUpdateOperation );

This function implements the UpdateJobExecution command of the Jobs API, which updates the status of a Job execution.

Parameters
[in]pRequestInfoJobs request parameters.
[in]pUpdateInfoJobs update parameters.
[in]flagsFlags which modify the behavior of the Jobs request. See Jobs Function Flags.
[in]pCallbackInfoAsynchronous notification of this function's completion.
[out]pUpdateOperationSet 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_UpdateSync 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;
// A Job ID must be set. AWS_IOT_JOBS_NEXT_JOB is not valid for UPDATE.
requestInfo.pJobId = "job-id";
requestInfo.jobIdLength = 6;
// Set the update info.
// Set the callback function to invoke.
callbackInfo.function = _jobsCallback;
// Queue Jobs UPDATE.
AwsIotJobsError_t updateResult = AwsIotJobs_UpdateAsync( &requestInfo,
&updateInfo,
0,
&callbackInfo,
&updateOperation );
// UPDATE should have returned AWS_IOT_JOBS_STATUS_PENDING. The function
// _jobsCallback will be invoked once the Jobs response is received.