Changes to enabled on-line compiler

Committer:
JMF
Date:
Wed May 30 20:59:51 2018 +0000
Revision:
0:082731ede69f
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JMF 0:082731ede69f 1 /*
JMF 0:082731ede69f 2 * Copyright 2015-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
JMF 0:082731ede69f 3 *
JMF 0:082731ede69f 4 * Licensed under the Apache License, Version 2.0 (the "License").
JMF 0:082731ede69f 5 * You may not use this file except in compliance with the License.
JMF 0:082731ede69f 6 * A copy of the License is located at
JMF 0:082731ede69f 7 *
JMF 0:082731ede69f 8 * http://aws.amazon.com/apache2.0
JMF 0:082731ede69f 9 *
JMF 0:082731ede69f 10 * or in the "license" file accompanying this file. This file is distributed
JMF 0:082731ede69f 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
JMF 0:082731ede69f 12 * express or implied. See the License for the specific language governing
JMF 0:082731ede69f 13 * permissions and limitations under the License.
JMF 0:082731ede69f 14 */
JMF 0:082731ede69f 15
JMF 0:082731ede69f 16 /**
JMF 0:082731ede69f 17 * @file aws_iot_job_topics.h
JMF 0:082731ede69f 18 * @brief Functions for parsing and creating MQTT topics used by the AWS IoT Jobs system.
JMF 0:082731ede69f 19 */
JMF 0:082731ede69f 20
JMF 0:082731ede69f 21 #ifdef DISABLE_IOT_JOBS
JMF 0:082731ede69f 22 #error "Jobs API is disabled"
JMF 0:082731ede69f 23 #endif
JMF 0:082731ede69f 24
JMF 0:082731ede69f 25 #ifndef AWS_IOT_JOBS_TOPICS_H_
JMF 0:082731ede69f 26 #define AWS_IOT_JOBS_TOPICS_H_
JMF 0:082731ede69f 27
JMF 0:082731ede69f 28 #include <stdint.h>
JMF 0:082731ede69f 29 #include <stdbool.h>
JMF 0:082731ede69f 30 #include <stddef.h>
JMF 0:082731ede69f 31
JMF 0:082731ede69f 32 #ifdef __cplusplus
JMF 0:082731ede69f 33 extern "C" {
JMF 0:082731ede69f 34 #endif
JMF 0:082731ede69f 35
JMF 0:082731ede69f 36 #define JOB_ID_NEXT "$next"
JMF 0:082731ede69f 37 #define JOB_ID_WILDCARD "+"
JMF 0:082731ede69f 38
JMF 0:082731ede69f 39 /**
JMF 0:082731ede69f 40 * The type of job topic.
JMF 0:082731ede69f 41 */
JMF 0:082731ede69f 42 typedef enum {
JMF 0:082731ede69f 43 JOB_UNRECOGNIZED_TOPIC = 0,
JMF 0:082731ede69f 44 JOB_GET_PENDING_TOPIC,
JMF 0:082731ede69f 45 JOB_START_NEXT_TOPIC,
JMF 0:082731ede69f 46 JOB_DESCRIBE_TOPIC,
JMF 0:082731ede69f 47 JOB_UPDATE_TOPIC,
JMF 0:082731ede69f 48 JOB_NOTIFY_TOPIC,
JMF 0:082731ede69f 49 JOB_NOTIFY_NEXT_TOPIC,
JMF 0:082731ede69f 50 JOB_WILDCARD_TOPIC
JMF 0:082731ede69f 51 } AwsIotJobExecutionTopicType;
JMF 0:082731ede69f 52
JMF 0:082731ede69f 53 /**
JMF 0:082731ede69f 54 * The type of reply topic, or #JOB_REQUEST_TYPE for
JMF 0:082731ede69f 55 * topics that are not replies.
JMF 0:082731ede69f 56 */
JMF 0:082731ede69f 57 typedef enum {
JMF 0:082731ede69f 58 JOB_UNRECOGNIZED_TOPIC_TYPE = 0,
JMF 0:082731ede69f 59 JOB_REQUEST_TYPE,
JMF 0:082731ede69f 60 JOB_ACCEPTED_REPLY_TYPE,
JMF 0:082731ede69f 61 JOB_REJECTED_REPLY_TYPE,
JMF 0:082731ede69f 62 JOB_WILDCARD_REPLY_TYPE
JMF 0:082731ede69f 63 } AwsIotJobExecutionTopicReplyType;
JMF 0:082731ede69f 64
JMF 0:082731ede69f 65 /**
JMF 0:082731ede69f 66 * @brief Get the topic matching the provided details and put into the provided buffer.
JMF 0:082731ede69f 67 *
JMF 0:082731ede69f 68 * If the buffer is not large enough to store the full topic the topic will be truncated
JMF 0:082731ede69f 69 * to fit, with the last character always being a null terminator.
JMF 0:082731ede69f 70 *
JMF 0:082731ede69f 71 * \param buffer the buffer to put the results into
JMF 0:082731ede69f 72 * \param bufferSize the size of the buffer
JMF 0:082731ede69f 73 * \param topicType the type of the topic
JMF 0:082731ede69f 74 * \param replyType the reply type of the topic
JMF 0:082731ede69f 75 * \param thingName the name of the thing in the topic
JMF 0:082731ede69f 76 * \param jobId the name of the job id in the topic
JMF 0:082731ede69f 77 * \return the number of characters in the topic excluding the null terminator. A return
JMF 0:082731ede69f 78 * value of bufferSize or more means that the topic string was truncated.
JMF 0:082731ede69f 79 */
JMF 0:082731ede69f 80 int aws_iot_jobs_get_api_topic(char *buffer, size_t bufferSize,
JMF 0:082731ede69f 81 AwsIotJobExecutionTopicType topicType, AwsIotJobExecutionTopicReplyType replyType,
JMF 0:082731ede69f 82 const char* thingName, const char* jobId);
JMF 0:082731ede69f 83
JMF 0:082731ede69f 84 #ifdef __cplusplus
JMF 0:082731ede69f 85 }
JMF 0:082731ede69f 86 #endif
JMF 0:082731ede69f 87
JMF 0:082731ede69f 88 #endif /* AWS_IOT_JOBS_TOPICS_H_ */