Astarte Device SDK ESP32
ESP32 device SDK for the Astarte platform
|
Astarte BSON deserialization functions. More...
Go to the source code of this file.
Data Structures | |
struct | astarte_bson_document_t |
struct | astarte_bson_element_t |
Astarte BSON deserialization functions.
This library follows the v1.1 of the BSON standard, but does not provide support for the full specification, only for a smaller subset. For more information regarding the BSON format specifications see: https://bsonspec.org/spec.html.
bool astarte_bson_deserializer_check_validity | ( | const void * | buffer, |
int | buffer_size | ||
) |
Perform some checks on the validity of the BSON.
[in] | buffer | Buffer containing the document to check. |
[in] | buffer_size | Size of the allocated buffer containing the document. |
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.
[in] | document | Document to use for the search. |
[in] | key | Element name to use as key for the lookup. |
[out] | element | Used to return the found element, should be a pointer to an uninitialized element. |
astarte_bson_document_t astarte_bson_deserializer_element_to_array | ( | astarte_bson_element_t | element | ) |
Extract the value from the passed element.
[in] | element | Element to extract the value from. |
const uint8_t* astarte_bson_deserializer_element_to_binary | ( | astarte_bson_element_t | element, |
uint32_t * | len | ||
) |
Extract the value from the passed element.
[in] | element | Element to extract the value from. |
[out] | len | Returned bytes array length. Optional, pass NULL if not used. |
bool astarte_bson_deserializer_element_to_bool | ( | astarte_bson_element_t | element | ) |
Extract the value from the passed element.
[in] | element | Element to extract the value from. |
int64_t astarte_bson_deserializer_element_to_datetime | ( | astarte_bson_element_t | element | ) |
Extract the value from the passed element.
[in] | element | Element to extract the value from. |
astarte_bson_document_t astarte_bson_deserializer_element_to_document | ( | astarte_bson_element_t | element | ) |
Extract the value from the passed element.
[in] | element | Element to extract the value from. |
double astarte_bson_deserializer_element_to_double | ( | astarte_bson_element_t | element | ) |
Extract the value from the passed element.
[in] | element | Element to extract the value from. |
int32_t astarte_bson_deserializer_element_to_int32 | ( | astarte_bson_element_t | element | ) |
Extract the value from the passed element.
[in] | element | Element to extract the value from. |
int64_t astarte_bson_deserializer_element_to_int64 | ( | astarte_bson_element_t | element | ) |
Extract the value from the passed element.
[in] | element | Element to extract the value from. |
const char* astarte_bson_deserializer_element_to_string | ( | astarte_bson_element_t | element, |
uint32_t * | len | ||
) |
Extract the value from the passed element.
[in] | element | Element to extract the value from. |
[out] | len | Returned string length. Optional, pass NULL if not used. |
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.
[in] | document | Document from which to extract the element. |
[out] | element | Used to store the extracted element. |
astarte_bson_document_t astarte_bson_deserializer_init_doc | ( | const void * | buffer | ) |
Initialize a document type from a BSON data buffer.
[in] | buffer | Buffer containing the BSON data. |
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.
[in] | document | Document containing the list. |
[in] | curr_element | Pointer to the current element. |
[in] | next_element | Used to store the extracted element. |