in source/jobs.c [502:556]
static JobsStatus_t matchApi( char * topic,
size_t topicLength,
JobsTopic_t * outApi,
char ** outJobId,
uint16_t * outJobIdLength )
{
JobsStatus_t ret = JobsNoMatch;
assert( ( topic != NULL ) && ( outApi != NULL ) &&
( outJobId != NULL ) && ( outJobIdLength != NULL ) );
/* The first set of APIs do not have job IDs. */
if( JobsSuccess == strnnEq( topic, topicLength, apiTopic[ JobsJobsChanged ], apiTopicLength[ JobsJobsChanged ] ) )
{
ret = JobsSuccess;
*outApi = JobsJobsChanged;
}
else if( JobsSuccess == strnnEq( topic, topicLength, apiTopic[ JobsNextJobChanged ], apiTopicLength[ JobsNextJobChanged ] ) )
{
ret = JobsSuccess;
*outApi = JobsNextJobChanged;
}
else if( JobsSuccess == strnnEq( topic, topicLength, apiTopic[ JobsGetPendingSuccess ], apiTopicLength[ JobsGetPendingSuccess ] ) )
{
ret = JobsSuccess;
*outApi = JobsGetPendingSuccess;
}
else if( JobsSuccess == strnnEq( topic, topicLength, apiTopic[ JobsGetPendingFailed ], apiTopicLength[ JobsGetPendingFailed ] ) )
{
ret = JobsSuccess;
*outApi = JobsGetPendingFailed;
}
else if( JobsSuccess == strnnEq( topic, topicLength, apiTopic[ JobsStartNextSuccess ], apiTopicLength[ JobsStartNextSuccess ] ) )
{
ret = JobsSuccess;
*outApi = JobsStartNextSuccess;
}
else if( JobsSuccess == strnnEq( topic, topicLength, apiTopic[ JobsStartNextFailed ], apiTopicLength[ JobsStartNextFailed ] ) )
{
ret = JobsSuccess;
*outApi = JobsStartNextFailed;
}
else
{
/* MISRA Empty Body */
}
/* The remaining APIs must have a job ID. */
if( ret == JobsNoMatch )
{
ret = matchIdApi( topic, topicLength, outApi, outJobId, outJobIdLength );
}
return ret;
}