Astarte Device SDK ESP32
ESP32 device SDK for the Astarte platform
Loading...
Searching...
No Matches
astarte_bson_deserializer.h
Go to the documentation of this file.
1/*
2 * (C) Copyright 2018-2023, SECO Mind Srl
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later OR Apache-2.0
5 */
6
16#ifndef _ASTARTE_BSON_DESERIALIZER_H_
17#define _ASTARTE_BSON_DESERIALIZER_H_
18
19#include "astarte.h"
20#include <stdbool.h>
21#include <stddef.h>
22#include <stdint.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28typedef struct
29{
30 uint32_t size;
31 const void *list;
32 uint32_t list_size;
34
35typedef struct
36{
37 uint8_t type;
38 const char *name;
39 size_t name_len;
40 const void *value;
42
53bool astarte_bson_deserializer_check_validity(const void *buffer, int buffer_size);
54
62
72
82 astarte_bson_element_t curr_element, astarte_bson_element_t *next_element);
83
91
100 astarte_bson_element_t element, uint32_t *len);
101
109 astarte_bson_element_t element);
110
120
129 astarte_bson_element_t element, uint32_t *len);
130
140
150
158
166
177 astarte_bson_document_t document, const char *key, astarte_bson_element_t *element);
178
179#ifdef __cplusplus
180}
181#endif
182
183#endif // _ASTARTE_BSON_DESERIALIZER_H_
Astarte types and defines.
astarte_err_t
Astarte return codes.
Definition astarte.h:28
int64_t astarte_bson_deserializer_element_to_datetime(astarte_bson_element_t element)
Extract the value from the passed element.
astarte_err_t astarte_bson_deserializer_next_element(astarte_bson_document_t document, astarte_bson_element_t curr_element, astarte_bson_element_t *next_element)
Get the next element in a list.
int64_t astarte_bson_deserializer_element_to_int64(astarte_bson_element_t element)
Extract the value from the passed element.
astarte_bson_document_t astarte_bson_deserializer_init_doc(const void *buffer)
Initialize a document type from a BSON data buffer.
bool astarte_bson_deserializer_element_to_bool(astarte_bson_element_t element)
Extract the value from the passed element.
astarte_err_t astarte_bson_deserializer_first_element(astarte_bson_document_t document, astarte_bson_element_t *element)
Get the first element in a document's list.
astarte_bson_document_t astarte_bson_deserializer_element_to_array(astarte_bson_element_t element)
Extract the value from the passed element.
const uint8_t * astarte_bson_deserializer_element_to_binary(astarte_bson_element_t element, uint32_t *len)
Extract the value from the passed element.
int32_t astarte_bson_deserializer_element_to_int32(astarte_bson_element_t element)
Extract the value from the passed element.
double astarte_bson_deserializer_element_to_double(astarte_bson_element_t element)
Extract the value from the passed element.
const char * astarte_bson_deserializer_element_to_string(astarte_bson_element_t element, uint32_t *len)
Extract the value from the passed element.
astarte_bson_document_t astarte_bson_deserializer_element_to_document(astarte_bson_element_t element)
Extract the value from the passed element.
bool astarte_bson_deserializer_check_validity(const void *buffer, int buffer_size)
Perform some checks on the validity of the BSON.
astarte_err_t astarte_bson_deserializer_element_lookup(astarte_bson_document_t document, const char *key, astarte_bson_element_t *element)
Fetch the element with name corresponding to the specified key from the document.
Definition astarte_bson_deserializer.h:29
uint32_t list_size
Definition astarte_bson_deserializer.h:32
const void * list
Definition astarte_bson_deserializer.h:31
Definition astarte_bson_deserializer.h:36
const char * name
Definition astarte_bson_deserializer.h:38
const void * value
Definition astarte_bson_deserializer.h:40
size_t name_len
Definition astarte_bson_deserializer.h:39