46#define JOBS_THINGNAME_MAX_LENGTH 128U
52#define JOBS_JOBID_MAX_LENGTH 64U
54#ifndef THINGNAME_MAX_LENGTH
61 #define THINGNAME_MAX_LENGTH JOBS_THINGNAME_MAX_LENGTH
64#ifndef JOBID_MAX_LENGTH
71 #define JOBID_MAX_LENGTH JOBS_JOBID_MAX_LENGTH
74#if ( THINGNAME_MAX_LENGTH > JOBS_THINGNAME_MAX_LENGTH )
75 #error "The value of THINGNAME_MAX_LENGTH exceeds the AWS IoT Jobs Service limit."
78#if ( JOBID_MAX_LENGTH > JOBS_JOBID_MAX_LENGTH )
79 #error "The value of JOBID_MAX_LENGTH exceeds the AWS IoT Jobs Service limit."
87#define JOBS_API_PREFIX "$aws/things/"
88#define JOBS_API_PREFIX_LENGTH ( sizeof( JOBS_API_PREFIX ) - 1U )
90#define JOBS_API_BRIDGE "/jobs/"
91#define JOBS_API_BRIDGE_LENGTH ( sizeof( JOBS_API_BRIDGE ) - 1U )
93#define JOBS_API_SUCCESS "/accepted"
94#define JOBS_API_SUCCESS_LENGTH ( sizeof( JOBS_API_SUCCESS ) - 1U )
96#define JOBS_API_FAILURE "/rejected"
97#define JOBS_API_FAILURE_LENGTH ( sizeof( JOBS_API_FAILURE ) - 1U )
99#define JOBS_API_JOBSCHANGED "notify"
100#define JOBS_API_JOBSCHANGED_LENGTH ( sizeof( JOBS_API_JOBSCHANGED ) - 1U )
102#define JOBS_API_NEXTJOBCHANGED "notify-next"
103#define JOBS_API_NEXTJOBCHANGED_LENGTH ( sizeof( JOBS_API_NEXTJOBCHANGED ) - 1U )
105#define JOBS_API_GETPENDING "get"
106#define JOBS_API_GETPENDING_LENGTH ( sizeof( JOBS_API_GETPENDING ) - 1U )
108#define JOBS_API_STARTNEXT "start-next"
109#define JOBS_API_STARTNEXT_LENGTH ( sizeof( JOBS_API_STARTNEXT ) - 1U )
111#define JOBS_API_DESCRIBE "get"
112#define JOBS_API_DESCRIBE_LENGTH ( sizeof( JOBS_API_DESCRIBE ) - 1U )
114#define JOBS_API_UPDATE "update"
115#define JOBS_API_UPDATE_LENGTH ( sizeof( JOBS_API_UPDATE ) - 1U )
117#define JOBS_API_JOBID_NEXT "$next"
118#define JOBS_API_JOBID_NEXT_LENGTH ( sizeof( JOBS_API_JOBID_NEXT ) - 1U )
120#define JOBS_API_JOBID_NULL ""
121#define JOBS_API_LEVEL_SEPARATOR "/"
123#define JOBS_API_COMMON_LENGTH( thingNameLength ) \
124 ( JOBS_API_PREFIX_LENGTH + ( thingNameLength ) + JOBS_API_BRIDGE_LENGTH )
135#define JOBS_TOPIC_COMMON( thingName, jobId, jobsApi ) \
153#define JOBS_API_SUBSCRIBE_NEXTJOBCHANGED( thingName ) \
154 JOBS_TOPIC_COMMON( thingName, JOBS_API_JOBID_NULL, JOBS_API_NEXTJOBCHANGED )
166#define JOBS_API_SUBSCRIBE_JOBSCHANGED( thingName ) \
167 JOBS_TOPIC_COMMON( thingName, JOBS_API_JOBID_NULL, JOBS_API_JOBSCHANGED )
179#define JOBS_API_PUBLISH_STARTNEXT( thingName ) \
180 JOBS_TOPIC_COMMON( thingName, JOBS_API_JOBID_NULL, JOBS_API_STARTNEXT )
192#define JOBS_API_PUBLISH_GETPENDING( thingName ) \
193 JOBS_TOPIC_COMMON( thingName, JOBS_API_JOBID_NULL, JOBS_API_GETPENDING )
207#define JOBS_API_PUBLISH_DESCRIBENEXTJOB( thingName ) \
208 JOBS_TOPIC_COMMON( thingName, JOBS_API_JOBID_NEXT JOBS_API_LEVEL_SEPARATOR, JOBS_API_DESCRIBE )
215#define JOBS_API_MAX_LENGTH( thingNameLength ) \
216 ( JOBS_API_COMMON_LENGTH( thingNameLength ) + \
217 JOBID_MAX_LENGTH + sizeof( '/' ) + JOBS_API_UPDATE_LENGTH + \
218 JOBS_API_SUCCESS_LENGTH + 1U )
251 JobsInvalidTopic = -1,
254 JobsGetPendingSuccess,
255 JobsGetPendingFailed,
256 JobsStartNextSuccess,
329 const char * thingName,
330 uint16_t thingNameLength,
332 size_t * outLength );
447 const char * thingName,
448 uint16_t thingNameLength,
451 uint16_t * outJobIdLength );
515 const char * thingName,
516 uint16_t thingNameLength,
517 size_t * outLength );
581 const char * thingName,
582 uint16_t thingNameLength,
583 size_t * outLength );
659 const char * thingName,
660 uint16_t thingNameLength,
662 uint16_t jobIdLength,
663 size_t * outLength );
736 const char * thingName,
737 uint16_t thingNameLength,
739 uint16_t jobIdLength,
740 size_t * outLength );
JobsTopic_t
Topic values for subscription requests.
Definition: jobs.h:250
JobsStatus_t
Return codes from jobs functions.
Definition: jobs.h:225
@ JobsNoMatch
The buffer does not contain a jobs topic.
Definition: jobs.h:228
@ JobsBufferTooSmall
The buffer write was truncated.
Definition: jobs.h:230
@ JobsSuccess
The buffer was properly written or a match was found.
Definition: jobs.h:227
@ JobsBadParameter
A function parameter was NULL or has an illegal value.
Definition: jobs.h:229
JobsStatus_t Jobs_Update(char *buffer, size_t length, const char *thingName, uint16_t thingNameLength, const char *jobId, uint16_t jobIdLength, size_t *outLength)
Populate a topic string for an UpdateJobExecution request.
Definition: jobs.c:677
JobsStatus_t Jobs_GetPending(char *buffer, size_t length, const char *thingName, uint16_t thingNameLength, size_t *outLength)
Populate a topic string for a GetPendingJobExecutions request.
Definition: jobs.c:569
JobsStatus_t Jobs_StartNext(char *buffer, size_t length, const char *thingName, uint16_t thingNameLength, size_t *outLength)
Populate a topic string for a StartNextPendingJobExecution request.
Definition: jobs.c:602
JobsStatus_t Jobs_Describe(char *buffer, size_t length, const char *thingName, uint16_t thingNameLength, const char *jobId, uint16_t jobIdLength, size_t *outLength)
Populate a topic string for a DescribeJobExecution request.
Definition: jobs.c:636
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:509
JobsStatus_t Jobs_GetTopic(char *buffer, size_t length, const char *thingName, uint16_t thingNameLength, JobsTopic_t api, size_t *outLength)
Populate a topic string for a subscription request.
Definition: jobs.c:264