48#define JOBS_THINGNAME_MAX_LENGTH 128U
54#define JOBS_JOBID_MAX_LENGTH 64U
56#ifndef THINGNAME_MAX_LENGTH
63 #define THINGNAME_MAX_LENGTH JOBS_THINGNAME_MAX_LENGTH
66#ifndef JOBID_MAX_LENGTH
73 #define JOBID_MAX_LENGTH JOBS_JOBID_MAX_LENGTH
76#if ( THINGNAME_MAX_LENGTH > JOBS_THINGNAME_MAX_LENGTH )
77 #error "The value of THINGNAME_MAX_LENGTH exceeds the AWS IoT Jobs Service limit."
80#if ( JOBID_MAX_LENGTH > JOBS_JOBID_MAX_LENGTH )
81 #error "The value of JOBID_MAX_LENGTH exceeds the AWS IoT Jobs Service limit."
89#define JOBS_API_PREFIX "$aws/things/"
90#define JOBS_API_PREFIX_LENGTH ( sizeof( JOBS_API_PREFIX ) - 1U )
92#define JOBS_API_BRIDGE "/jobs/"
93#define JOBS_API_BRIDGE_LENGTH ( sizeof( JOBS_API_BRIDGE ) - 1U )
95#define JOBS_API_SUCCESS "/accepted"
96#define JOBS_API_SUCCESS_LENGTH ( sizeof( JOBS_API_SUCCESS ) - 1U )
98#define JOBS_API_FAILURE "/rejected"
99#define JOBS_API_FAILURE_LENGTH ( sizeof( JOBS_API_FAILURE ) - 1U )
101#define JOBS_API_JOBSCHANGED "notify"
102#define JOBS_API_JOBSCHANGED_LENGTH ( sizeof( JOBS_API_JOBSCHANGED ) - 1U )
104#define JOBS_API_NEXTJOBCHANGED "notify-next"
105#define JOBS_API_NEXTJOBCHANGED_LENGTH ( sizeof( JOBS_API_NEXTJOBCHANGED ) - 1U )
107#define JOBS_API_GETPENDING "get"
108#define JOBS_API_GETPENDING_LENGTH ( sizeof( JOBS_API_GETPENDING ) - 1U )
110#define JOBS_API_STARTNEXT "start-next"
111#define JOBS_API_STARTNEXT_LENGTH ( sizeof( JOBS_API_STARTNEXT ) - 1U )
113#define JOBS_API_DESCRIBE "get"
114#define JOBS_API_DESCRIBE_LENGTH ( sizeof( JOBS_API_DESCRIBE ) - 1U )
116#define JOBS_API_UPDATE "update"
117#define JOBS_API_UPDATE_LENGTH ( sizeof( JOBS_API_UPDATE ) - 1U )
119#define JOBS_API_JOBID_NEXT "$next"
120#define JOBS_API_JOBID_NEXT_LENGTH ( sizeof( JOBS_API_JOBID_NEXT ) - 1U )
122#define JOBS_API_JOBID_NULL ""
123#define JOBS_API_LEVEL_SEPARATOR "/"
125#define JOBS_API_COMMON_LENGTH( thingNameLength ) \
126 ( JOBS_API_PREFIX_LENGTH + ( thingNameLength ) + JOBS_API_BRIDGE_LENGTH )
137#define JOBS_TOPIC_COMMON( thingName, jobId, jobsApi ) \
155#define JOBS_API_SUBSCRIBE_NEXTJOBCHANGED( thingName ) \
156 JOBS_TOPIC_COMMON( thingName, JOBS_API_JOBID_NULL, JOBS_API_NEXTJOBCHANGED )
168#define JOBS_API_SUBSCRIBE_JOBSCHANGED( thingName ) \
169 JOBS_TOPIC_COMMON( thingName, JOBS_API_JOBID_NULL, JOBS_API_JOBSCHANGED )
181#define JOBS_API_PUBLISH_STARTNEXT( thingName ) \
182 JOBS_TOPIC_COMMON( thingName, JOBS_API_JOBID_NULL, JOBS_API_STARTNEXT )
194#define JOBS_API_PUBLISH_GETPENDING( thingName ) \
195 JOBS_TOPIC_COMMON( thingName, JOBS_API_JOBID_NULL, JOBS_API_GETPENDING )
209#define JOBS_API_PUBLISH_DESCRIBENEXTJOB( thingName ) \
210 JOBS_TOPIC_COMMON( thingName, JOBS_API_JOBID_NEXT JOBS_API_LEVEL_SEPARATOR, JOBS_API_DESCRIBE )
217#define JOBS_API_MAX_LENGTH( thingNameLength ) \
218 ( JOBS_API_COMMON_LENGTH( thingNameLength ) + \
219 JOBID_MAX_LENGTH + sizeof( '/' ) + JOBS_API_UPDATE_LENGTH + \
220 JOBS_API_SUCCESS_LENGTH + 1U )
253 JobsInvalidTopic = -1,
256 JobsGetPendingSuccess,
257 JobsGetPendingFailed,
258 JobsStartNextSuccess,
331 const char * thingName,
332 uint16_t thingNameLength,
334 size_t * outLength );
449 const char * thingName,
450 uint16_t thingNameLength,
453 uint16_t * outJobIdLength );
517 const char * thingName,
518 uint16_t thingNameLength,
519 size_t * outLength );
583 const char * thingName,
584 uint16_t thingNameLength,
585 size_t * outLength );
661 const char * thingName,
662 uint16_t thingNameLength,
664 uint16_t jobIdLength,
665 size_t * outLength );
738 const char * thingName,
739 uint16_t thingNameLength,
741 uint16_t jobIdLength,
742 size_t * outLength );
JobsTopic_t
Topic values for subscription requests.
Definition: jobs.h:252
JobsStatus_t
Return codes from jobs functions.
Definition: jobs.h:227
@ JobsNoMatch
The buffer does not contain a jobs topic.
Definition: jobs.h:230
@ JobsBufferTooSmall
The buffer write was truncated.
Definition: jobs.h:232
@ JobsSuccess
The buffer was properly written or a match was found.
Definition: jobs.h:229
@ JobsBadParameter
A function parameter was NULL or has an illegal value.
Definition: jobs.h:231
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:714
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:606
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:639
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:673
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:546
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:266