Azure IoT middleware for FreeRTOS
azure_iot_json_reader.h
Go to the documentation of this file.
1 /* Copyright (c) Microsoft Corporation.
2  * Licensed under the MIT License. */
3 
16 #ifndef AZURE_IOT_JSON_READER_H
17 #define AZURE_IOT_JSON_READER_H
18 
19 #include <stdbool.h>
20 #include <stdint.h>
21 
22 #include "azure_iot_result.h"
23 
24 /* Azure SDK for Embedded C includes */
25 #include "azure/core/az_json.h"
26 #include "azure/core/_az_cfg_prefix.h"
27 
32 {
33  eAzureIoTJSONTokenNONE = AZ_JSON_TOKEN_NONE,
34  eAzureIoTJSONTokenBEGIN_OBJECT = AZ_JSON_TOKEN_BEGIN_OBJECT,
35  eAzureIoTJSONTokenEND_OBJECT = AZ_JSON_TOKEN_END_OBJECT,
36  eAzureIoTJSONTokenBEGIN_ARRAY = AZ_JSON_TOKEN_BEGIN_ARRAY,
37  eAzureIoTJSONTokenEND_ARRAY = AZ_JSON_TOKEN_END_ARRAY,
38  eAzureIoTJSONTokenPROPERTY_NAME = AZ_JSON_TOKEN_PROPERTY_NAME,
39  eAzureIoTJSONTokenSTRING = AZ_JSON_TOKEN_STRING,
40  eAzureIoTJSONTokenNUMBER = AZ_JSON_TOKEN_NUMBER,
41  eAzureIoTJSONTokenTRUE = AZ_JSON_TOKEN_TRUE,
42  eAzureIoTJSONTokenFALSE = AZ_JSON_TOKEN_FALSE,
43  eAzureIoTJSONTokenNULL = AZ_JSON_TOKEN_NULL
45 
49 typedef struct AzureIoTJSONReader
50 {
51  struct
52  {
53  az_json_reader xCoreReader;
56 
71  const uint8_t * pucBuffer,
72  uint32_t ulBufferSize );
73 
84 
99 
110  bool * pxValue );
111 
122  int32_t * plValue );
123 
134  double * pxValue );
135 
149  uint8_t * pucBuffer,
150  uint32_t ulBufferSize,
151  uint32_t * pusBytesCopied );
152 
168  const uint8_t * pucExpectedText,
169  uint32_t ulExpectedTextLength );
170 
180  AzureIoTJSONTokenType_t * pxTokenType );
181 
182 #include "azure/core/_az_cfg_suffix.h"
183 
184 #endif /* AZURE_IOT_JSON_READER_H */
struct AzureIoTJSONReader AzureIoTJSONReader_t
The struct to use for Azure IoT JSON reader functionality.
enum AzureIoTJSONTokenType AzureIoTJSONTokenType_t
Defines symbols for the various kinds of JSON tokens that make up any JSON text.
AzureIoTJSONTokenType
Defines symbols for the various kinds of JSON tokens that make up any JSON text.
Definition: azure_iot_json_reader.h:32
AzureIoTResult_t AzureIoTJSONReader_SkipChildren(AzureIoTJSONReader_t *pxReader)
Reads and skips over any nested JSON elements.
AzureIoTResult_t AzureIoTJSONReader_NextToken(AzureIoTJSONReader_t *pxReader)
Reads the next token in the JSON text and updates the reader state.
AzureIoTResult_t AzureIoTJSONReader_TokenType(AzureIoTJSONReader_t *pxReader, AzureIoTJSONTokenType_t *pxTokenType)
Determines type of token currently AzureIoTJSONReader_t points to.
AzureIoTResult_t AzureIoTJSONReader_GetTokenDouble(AzureIoTJSONReader_t *pxReader, double *pxValue)
Gets the JSON token's number as a double.
AzureIoTResult_t AzureIoTJSONReader_Init(AzureIoTJSONReader_t *pxReader, const uint8_t *pucBuffer, uint32_t ulBufferSize)
Initializes an AzureIoTJSONReader_t to read the JSON payload contained within the provided buffer.
AzureIoTResult_t AzureIoTJSONReader_GetTokenInt32(AzureIoTJSONReader_t *pxReader, int32_t *plValue)
Gets the JSON token's number as a 32-bit signed integer.
bool AzureIoTJSONReader_TokenIsTextEqual(AzureIoTJSONReader_t *pxReader, const uint8_t *pucExpectedText, uint32_t ulExpectedTextLength)
Determines whether the unescaped JSON token value that the AzureIoTJSONReader_t points to is equal to...
AzureIoTResult_t AzureIoTJSONReader_GetTokenBool(AzureIoTJSONReader_t *pxReader, bool *pxValue)
Gets the JSON token's boolean value.
AzureIoTResult_t AzureIoTJSONReader_GetTokenString(AzureIoTJSONReader_t *pxReader, uint8_t *pucBuffer, uint32_t ulBufferSize, uint32_t *pusBytesCopied)
Gets the JSON token's string after unescaping it, if required.
Azure IoT FreeRTOS middleware result values.
enum AzureIoTResult AzureIoTResult_t
The results used by the middleware.
The struct to use for Azure IoT JSON reader functionality.
Definition: azure_iot_json_reader.h:50
struct AzureIoTJSONReader::@5 _internal
Internal to the SDK.