AWS IoT Jobs v1.5.1
Client library for AWS IoT Jobs
 
Loading...
Searching...
No Matches
Jobs_GetJobDocument
size_t Jobs_GetJobDocument( const char * message,
size_t messageLength,
const char ** jobDoc );
size_t Jobs_GetJobDocument(const char *message, size_t messageLength, const char **jobDoc)
Retrieves the job document from a given message (if applicable)
Definition: jobs.c:923

Retrieves the job document from a given message (if applicable)

Parameters
message[In] A JSON formatted message which
messageLength[In] The length of the message
jobDoc[Out] The job document
Returns
size_t The length of the job document

Example

// The following example shows the usage of the Jobs_GetJobId API to
// extract the jobId and its length from a message, if present.
const char * message; // A JSON formatted message from the IoT core
size_t messageLength; // Length of the JSON formatted message
const char * jobDoc; // variable to hold the job doc
size_t jobDocLength = 0U; // Holds length of the job doc
jobDocLength = Jobs_GetJobDocument( message,
messageLength,
&jobDoc);
if ( jobDocLength > 0 )
{
// JobDoc was successfully extracted from the message.
// Pass JobDoc as input to otaParser_parseJobDocFile to
// extract the fields from the job document and store them
// in a AfrOtaJobDocumentFields_t stuct.
}