size_t length,
const char * thingName,
uint16_t thingNameLength,
char ** outJobId,
uint16_t * outJobIdLength );
JobsTopic_t
Topic values for subscription requests.
Definition: jobs.h:301
JobsStatus_t
Return codes from jobs functions.
Definition: jobs.h:255
JobsStatus_t Jobs_MatchTopic(char *topic, size_t length, const char *thingName, uint16_t thingNameLength, JobsTopic_t *outApi, char **outJobId, uint16_t *outJobIdLength)
Output a topic value if a Jobs API topic string is present. Optionally, output a pointer to a jobID w...
Definition: jobs.c:597
Output a topic value if a Jobs API topic string is present. Optionally, output a pointer to a jobID within the topic and its length.
- Parameters
-
| [in] | topic | The topic string to check. |
| [in] | length | The length of the topic string. |
| [in] | thingName | The device's thingName as registered with AWS IoT. |
| [in] | thingNameLength | The length of the thingName. |
| [out] | outApi | The jobs topic API value if present, e.g., JobsUpdateSuccess. |
| [out] | outJobId | The beginning of the jobID in the topic string. |
| [out] | outJobIdLength | The length of the jobID in the topic string. |
- Returns
- JobsSuccess if a matching topic was found; JobsNoMatch if a matching topic was NOT found (parameter outApi gets JobsInvalidTopic ); JobsBadParameter if invalid parameters are passed.
- Note
- The topic and thingName parameters do not need a NUL terminator.
-
Not all Jobs APIs have jobIDs within the topic string. NULL and 0 are output when no jobID is present. The parameters jobId and jobIdLength may be NULL.
Example
char * pIncomingTopic;
size_t topicLength;
#define THING_NAME "11223445566"
#define THING_NAME_LENGTH ( sizeof( THING_NAME ) - 1U )
char * pJobId = NULL;
uint16_t jobIdLength;
topicLength,
THING_NAME,
THING_NAME_LENGTH,
&api,
&pJobId,
&jobIdLength );
{
if( api == JobsJobsChanged )
{
}
else if( api == JobsNextJobChanged )
{
}
else if( api == JobsGetPendingSuccess )
{
}
else if( api == JobsGetPendingFailed )
{
}
else if( api == JobsStartNextSuccess )
{
}
else if( api == JobsStartNextFailed )
{
}
else if( api == JobsDescribeSuccess )
{
}
else if( api == JobsDescribeFailed )
{
}
else if( api == JobsUpdateSuccess )
{
}
else if( api == JobsUpdateFailed )
{
}
else
{
}
}
@ JobsSuccess
The buffer was properly written or a match was found.
Definition: jobs.h:257
Output a topic value if a Jobs API topic string is present. Optionally, output a pointer to a jobID within the topic and its length.
See jobs.h for docs.