Azure IoT middleware for FreeRTOS
azure_iot_json_writer.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_WRITER_H
17 #define AZURE_IOT_JSON_WRITER_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 
31 typedef struct AzureIoTJSONWriter
32 {
33  struct
34  {
35  az_json_writer xCoreWriter;
38 
50  uint8_t * pucBuffer,
51  uint32_t ulBufferSize );
52 
66  const uint8_t * pucPropertyName,
67  uint32_t ulPropertyNameLength,
68  int32_t lValue );
69 
84  const uint8_t * pucPropertyName,
85  uint32_t ulPropertyNameLength,
86  double xValue,
87  uint16_t usFractionalDigits );
88 
102  const uint8_t * pucPropertyName,
103  uint32_t ulPropertyNameLength,
104  bool usValue );
105 
121  const uint8_t * pucPropertyName,
122  uint32_t ulPropertyNameLength,
123  const uint8_t * pucValue,
124  uint32_t ulValueLen );
125 
134 
147  const uint8_t * pucValue,
148  uint32_t ulValueLen );
149 
171  const uint8_t * pucJSON,
172  uint32_t ulJSONLen );
173 
187  const uint8_t * pusValue,
188  uint32_t ulValueLen );
189 
200  bool xValue );
201 
212  int32_t lValue );
213 
235  double xValue,
236  uint16_t usFractionalDigits );
237 
247 
257 
267 
277 
287 
288 #include "azure/core/_az_cfg_suffix.h"
289 
290 #endif /* AZURE_IOT_JSON_WRITER_H */
AzureIoTResult_t AzureIoTJSONWriter_Init(AzureIoTJSONWriter_t *pxWriter, uint8_t *pucBuffer, uint32_t ulBufferSize)
Initializes an AzureIoTJSONWriter_t which writes JSON text into a buffer passed.
AzureIoTResult_t AzureIoTJSONWriter_AppendPropertyName(AzureIoTJSONWriter_t *pxWriter, const uint8_t *pusValue, uint32_t ulValueLen)
Appends the UTF-8 property name (as a JSON string) which is the first part of a name/value pair of a ...
AzureIoTResult_t AzureIoTJSONWriter_AppendInt32(AzureIoTJSONWriter_t *pxWriter, int32_t lValue)
Appends an int32_t number value.
AzureIoTResult_t AzureIoTJSONWriter_AppendEndObject(AzureIoTJSONWriter_t *pxWriter)
Appends the end of the current JSON object (i.e. }).
AzureIoTResult_t AzureIoTJSONWriter_AppendPropertyWithDoubleValue(AzureIoTJSONWriter_t *pxWriter, const uint8_t *pucPropertyName, uint32_t ulPropertyNameLength, double xValue, uint16_t usFractionalDigits)
Appends the UTF-8 property name and value where value is double.
AzureIoTResult_t AzureIoTJSONWriter_AppendDouble(AzureIoTJSONWriter_t *pxWriter, double xValue, uint16_t usFractionalDigits)
Appends a double number value.
AzureIoTResult_t AzureIoTJSONWriter_AppendPropertyWithInt32Value(AzureIoTJSONWriter_t *pxWriter, const uint8_t *pucPropertyName, uint32_t ulPropertyNameLength, int32_t lValue)
Appends the UTF-8 property name and value where value is int32.
struct AzureIoTJSONWriter AzureIoTJSONWriter_t
The struct to use for Azure IoT JSON writer functionality.
int32_t AzureIoTJSONWriter_GetBytesUsed(AzureIoTJSONWriter_t *pxWriter)
Returns the length containing the JSON text written to the underlying buffer.
AzureIoTResult_t AzureIoTJSONWriter_AppendPropertyWithStringValue(AzureIoTJSONWriter_t *pxWriter, const uint8_t *pucPropertyName, uint32_t ulPropertyNameLength, const uint8_t *pucValue, uint32_t ulValueLen)
Appends the UTF-8 property name and value where value is string.
AzureIoTResult_t AzureIoTJSONWriter_AppendEndArray(AzureIoTJSONWriter_t *pxWriter)
Appends the end of the current JSON array (i.e. ]).
AzureIoTResult_t AzureIoTJSONWriter_AppendString(AzureIoTJSONWriter_t *pxWriter, const uint8_t *pucValue, uint32_t ulValueLen)
Appends the UTF-8 text value (as a JSON string) into the buffer.
AzureIoTResult_t AzureIoTJSONWriter_AppendPropertyWithBoolValue(AzureIoTJSONWriter_t *pxWriter, const uint8_t *pucPropertyName, uint32_t ulPropertyNameLength, bool usValue)
Appends the UTF-8 property name and value where value is boolean.
AzureIoTResult_t AzureIoTJSONWriter_AppendBeginObject(AzureIoTJSONWriter_t *pxWriter)
Appends the beginning of a JSON object (i.e. {).
AzureIoTResult_t AzureIoTJSONWriter_AppendNull(AzureIoTJSONWriter_t *pxWriter)
Appends the JSON literal null.
AzureIoTResult_t AzureIoTJSONWriter_AppendBool(AzureIoTJSONWriter_t *pxWriter, bool xValue)
Appends a boolean value (as a JSON literal true or false).
AzureIoTResult_t AzureIoTJSONWriter_AppendBeginArray(AzureIoTJSONWriter_t *pxWriter)
Appends the beginning of a JSON array (i.e. [).
AzureIoTResult_t AzureIoTJSONWriter_AppendJSONText(AzureIoTJSONWriter_t *pxWriter, const uint8_t *pucJSON, uint32_t ulJSONLen)
Appends an existing UTF-8 encoded JSON text into the buffer, useful for appending nested JSON.
Azure IoT FreeRTOS middleware result values.
enum AzureIoTResult AzureIoTResult_t
The results used by the middleware.
The struct to use for Azure IoT JSON writer functionality.
Definition: azure_iot_json_writer.h:32
struct AzureIoTJSONWriter::@6 _internal
Internal to the SDK.