AWS IoT Jobs v2.0.0
Client library for AWS IoT Jobs
 
Loading...
Searching...
No Matches
otaParser_parseJobDocFile
int8_t otaParser_parseJobDocFile( const char * jobDoc,
const size_t jobDocLength,
const uint8_t fileIndex,
struct containing the fields of an AFR OTA Job Document
Definition: job_parser.h:23

Signals if the job document provided is an AWS IoT Core OTA update document.

Parameters
jobDocThe job document contained in the AWS IoT Job
jobDocLengthThe length of the job document
fieldsA pointer to an job document fields structure populated by call
Returns
int8_t The next file index in the job. Returns 0 if no additional files are available. Returns -1 if error.

Example

// The following example shows how to use the otaParser_parseJobDocFile API
// to parse out the fields of a received Job Document and populate the fields
// of the AfrOtaJobDocumentFields_t stucture.
const char * jobDoc; // Populated by call to Jobs_GetJobDocument
size_t jobDocLength; // Return value of Jobs_GetJobDocument
int8_t fileIndex = 0;
AfrOtaJobDocumentFields_t fields = {0}; // populated by API
do
{
fileIndex = otaParser_parseJobDocFile(jobDoc,
jobDocLength,
fileIndex,
&fields);
} while(fileIndex > 0)
// File index will be -1 if an error occurred, and 0 if all files were
// processed