nRF Connect SDK API 2.8.0
Loading...
Searching...
No Matches
aws_jobs.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
10#ifndef AWS_JOBS_H__
11#define AWS_JOBS_H__
12
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <zephyr/kernel.h>
24#include <zephyr/types.h>
25#include <zephyr/net/mqtt.h>
26
38
42#define SUBSCRIBE_ID_BASE (2110)
43#define SUBSCRIBE_NOTIFY (SUBSCRIBE_ID_BASE + 1)
44#define SUBSCRIBE_NOTIFY_NEXT (SUBSCRIBE_ID_BASE + 2)
45#define SUBSCRIBE_GET (SUBSCRIBE_ID_BASE + 3)
46#define SUBSCRIBE_JOB_ID_GET (SUBSCRIBE_ID_BASE + 4)
47#define SUBSCRIBE_JOB_ID_UPDATE (SUBSCRIBE_ID_BASE + 5)
48#define SUBSCRIBE_EXPECTED (SUBSCRIBE_ID_BASE + 10)
55#define AWS "$aws/things/"
56#define AWS_LEN (sizeof(AWS) - 1)
57#define AWS_JOBS_JOB_ID_MAX_LEN (64 + 1)
58#define AWS_JOBS_TOPIC_STATIC_LEN 20 /* '$aws/token' etc... */
59#define AWS_JOBS_TOPIC_MAX_LEN (CONFIG_CLIENT_ID_MAX_LEN + \
60 AWS_JOBS_TOPIC_STATIC_LEN + AWS_JOBS_JOB_ID_MAX_LEN)
61
74int aws_jobs_create_topic_notify_next(struct mqtt_client *const client,
75 uint8_t *topic_buf);
76
89int aws_jobs_subscribe_topic_notify_next(struct mqtt_client *const client,
90 uint8_t *topic_buf);
91
104int aws_jobs_unsubscribe_topic_notify_next(struct mqtt_client *const client,
105 uint8_t *topic_buf);
106
118int aws_jobs_create_topic_notify(struct mqtt_client *const client,
119 uint8_t *topic_buf);
120
132int aws_jobs_subscribe_topic_notify(struct mqtt_client *const client,
133 uint8_t *topic_buf);
134
147int aws_jobs_unsubscribe_topic_notify(struct mqtt_client *const client,
148 uint8_t *topic_buf);
149
162int aws_jobs_create_topic_get(struct mqtt_client *const client,
163 const uint8_t *job_id, uint8_t *topic_buf);
164
177int aws_jobs_subscribe_topic_get(struct mqtt_client *const client,
178 const uint8_t *job_id, uint8_t *topic_buf);
179
193int aws_jobs_unsubscribe_topic_get(struct mqtt_client *const client,
194 const uint8_t *job_id, uint8_t *topic_buf);
195
208int aws_jobs_subscribe_topic_update(struct mqtt_client *const client,
209 const uint8_t *job_id, uint8_t *topic_buf);
210
224int aws_jobs_unsubscribe_topic_update(struct mqtt_client *const client,
225 const uint8_t *job_id, uint8_t *topic_buf);
226
250int aws_jobs_update_job_execution(struct mqtt_client *const client,
251 const uint8_t *job_id,
252 enum execution_status status,
253 const uint8_t *status_details,
254 int expected_version,
255 const uint8_t *client_token,
256 uint8_t *topic_buf);
257
272int aws_jobs_get_job_execution(struct mqtt_client *const client,
273 const char *job_id, uint8_t *topic_buf);
274
288bool aws_jobs_cmp(const char *sub, const char *pub, size_t pub_len,
289 const uint8_t *suffix);
290
291#ifdef __cplusplus
292}
293#endif
294
299#endif /* AWS_JOBS_H__ */
int aws_jobs_create_topic_notify_next(struct mqtt_client *const client, uint8_t *topic_buf)
Construct the notify-next topic for receiving AWS IoT jobs.
int aws_jobs_update_job_execution(struct mqtt_client *const client, const uint8_t *job_id, enum execution_status status, const uint8_t *status_details, int expected_version, const uint8_t *client_token, uint8_t *topic_buf)
AWS Jobs update job execution status function.
int aws_jobs_subscribe_topic_notify_next(struct mqtt_client *const client, uint8_t *topic_buf)
Construct the notify-next topic and subscribe to it for receiving AWS IoT jobs.
int aws_jobs_unsubscribe_topic_notify_next(struct mqtt_client *const client, uint8_t *topic_buf)
Construct the notify-next topic and unsubscribe from it to stop receiving AWS IoT jobs.
int aws_jobs_subscribe_topic_notify(struct mqtt_client *const client, uint8_t *topic_buf)
Construct the notify topic and subscribe to it for receiving AWS IoT jobs lists.
int aws_jobs_subscribe_topic_update(struct mqtt_client *const client, const uint8_t *job_id, uint8_t *topic_buf)
Construct the update topic for a job ID and subscribe to rejected and accepted to receive feedback wh...
int aws_jobs_create_topic_get(struct mqtt_client *const client, const uint8_t *job_id, uint8_t *topic_buf)
Construct the get topic for a job ID.
int aws_jobs_unsubscribe_topic_notify(struct mqtt_client *const client, uint8_t *topic_buf)
Construct the notify topic and unsubscribe to stop receiving AWS IoT jobs lists.
int aws_jobs_get_job_execution(struct mqtt_client *const client, const char *job_id, uint8_t *topic_buf)
AWS Jobs get job execution.
execution_status
Job Execution Status.
Definition aws_jobs.h:28
@ AWS_JOBS_SUCCEEDED
Definition aws_jobs.h:31
@ AWS_JOBS_IN_PROGRESS
Definition aws_jobs.h:30
@ AWS_JOBS_REJECTED
Definition aws_jobs.h:34
@ AWS_JOBS_REMOVED
Definition aws_jobs.h:35
@ AWS_JOBS_TIMED_OUT
Definition aws_jobs.h:33
@ AWS_JOBS_QUEUED
Definition aws_jobs.h:29
@ AWS_JOBS_CANCELED
Definition aws_jobs.h:36
@ AWS_JOBS_FAILED
Definition aws_jobs.h:32
int aws_jobs_unsubscribe_topic_update(struct mqtt_client *const client, const uint8_t *job_id, uint8_t *topic_buf)
Construct the update topic for a job ID and unsubscribe from rejected and accepted to stop receiving ...
int aws_jobs_unsubscribe_topic_get(struct mqtt_client *const client, const uint8_t *job_id, uint8_t *topic_buf)
Construct the get topic for a job ID and unsubscribe from it for both accepted and rejected.
int aws_jobs_create_topic_notify(struct mqtt_client *const client, uint8_t *topic_buf)
Construct the notify topic for receiving AWS IoT jobs.
bool aws_jobs_cmp(const char *sub, const char *pub, size_t pub_len, const uint8_t *suffix)
Compare topics.
int aws_jobs_subscribe_topic_get(struct mqtt_client *const client, const uint8_t *job_id, uint8_t *topic_buf)
Construct the get topic for a job ID and subscribe to it for both accepted and rejected.