Loading...
Searching...
No Matches
SenML SAUL

Functionality for reading [S]ensor [A]ctuator [U]ber [L]ayer sensors as SenML. More...

Detailed Description

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.
 

Macro Definition Documentation

◆ CONFIG_SENML_SAUL_USE_FLOATS

#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.

Definition at line 44 of file saul.h.

Function Documentation

◆ senml_saul_encode_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.

This functions reads all [S]ensor [A]ctuator [U]ber [L]ayer sensors in a registry and encodes the values as SenML/CBOR.

Parameters
bufBuffer to store the CBOR in.
lenLength of the buffer.
regSAUL registry to encode.
Returns
Size of the encoded data.

◆ senml_saul_reg_encode_cbor()

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.

Parameters
encNanoCBOR encoder.
devSAUL sensor to encode.
Returns
Number of dimensions encoded. Less or equal to 0 on error.