AWS IoT Embedded C Device SDK
aws_iot_json_utils.h
1 /*
2  * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
25 #ifndef AWS_IOT_SDK_SRC_JSON_UTILS_H_
26 #define AWS_IOT_SDK_SRC_JSON_UTILS_H_
27 
28 #include <stdbool.h>
29 #include <stdint.h>
30 
31 #include "aws_iot_error.h"
32 #include "jsmn.h"
33 
34 // utility functions
47 int8_t jsoneq(const char *json, jsmntok_t *tok, const char *s);
48 
61 IoT_Error_t parseInteger32Value(int32_t *i, const char *jsonString, jsmntok_t *token);
62 
75 IoT_Error_t parseInteger16Value(int16_t *i, const char *jsonString, jsmntok_t *token);
76 
89 IoT_Error_t parseInteger8Value(int8_t *i, const char *jsonString, jsmntok_t *token);
90 
103 IoT_Error_t parseUnsignedInteger32Value(uint32_t *i, const char *jsonString, jsmntok_t *token);
104 
117 IoT_Error_t parseUnsignedInteger16Value(uint16_t *i, const char *jsonString, jsmntok_t *token);
118 
131 IoT_Error_t parseUnsignedInteger8Value(uint8_t *i, const char *jsonString, jsmntok_t *token);
132 
145 IoT_Error_t parseFloatValue(float *f, const char *jsonString, jsmntok_t *token);
146 
159 IoT_Error_t parseDoubleValue(double *d, const char *jsonString, jsmntok_t *token);
160 
173 IoT_Error_t parseBooleanValue(bool *b, const char *jsonString, jsmntok_t *token);
174 
187 IoT_Error_t parseStringValue(char *buf, const char *jsonString, jsmntok_t *token);
188 
189 #endif /* AWS_IOT_SDK_SRC_JSON_UTILS_H_ */
Definition: jsmn.h:65
Definition of error types for the SDK.
Definition of the JSMN (Jasmine) JSON parser.
IoT_Error_t
IoT Error enum.
Definition: aws_iot_error.h:36