Functionality for reading [S]ensor [A]ctuator [U]ber [L]ayer sensors as SenML. More...
Functionality for reading [S]ensor [A]ctuator [U]ber [L]ayer sensors as SenML.
The senml_saul
module contains functions for reading sensors using [S]ensor [A]ctuator [U]ber [L]ayer and converting them to SenML CBOR.
Files | |
file | saul.h |
Functionality for reading [S]ensor [A]ctuator [U]ber [L]ayer sensors as SenML. | |
Macros | |
#define | CONFIG_SENML_SAUL_USE_FLOATS 0 |
Use floats instead of decimal types when encoding SAUL measurements. | |
Functions | |
int | senml_saul_reg_encode_cbor (nanocbor_encoder_t *enc, saul_reg_t *dev) |
Encode a single [S]ensor [A]ctuator [U]ber [L]ayer sensor as senml+cbor. | |
size_t | senml_saul_encode_cbor (uint8_t *buf, size_t len, saul_reg_t *reg) |
Encode all sensors from a [S]ensor [A]ctuator [U]ber [L]ayer registry as senml+cbor. | |
#define CONFIG_SENML_SAUL_USE_FLOATS 0 |
Use floats instead of decimal types when encoding SAUL measurements.
If this is set to 1
the phydat_t values from SAUL are converted to senml_numeric_t using phydat_to_senml_float. Values are converted using phydat_to_senml_decimal otherwise.
size_t senml_saul_encode_cbor | ( | uint8_t * | buf, |
size_t | len, | ||
saul_reg_t * | reg | ||
) |
Encode all sensors from a [S]ensor [A]ctuator [U]ber [L]ayer registry as senml+cbor.
This functions reads all [S]ensor [A]ctuator [U]ber [L]ayer sensors in a registry and encodes the values as SenML/CBOR.
buf | Buffer to store the CBOR in. |
len | Length of the buffer. |
reg | SAUL registry to encode. |
int senml_saul_reg_encode_cbor | ( | nanocbor_encoder_t * | enc, |
saul_reg_t * | dev | ||
) |
Encode a single [S]ensor [A]ctuator [U]ber [L]ayer sensor as senml+cbor.
enc | NanoCBOR encoder. |
dev | SAUL sensor to encode. |