Loading...
Searching...
No Matches
SenML CBOR

Functionality for encoding SenML values as CBOR. More...

Detailed Description

Functionality for encoding SenML values as CBOR.

The senml_cbor module contains functionality for encoding SenML values to CBOR using NanoCBOR library.

Files

file  cbor.h
 Functionality for encoding SenML values as CBOR.
 

Enumerations

enum  senml_cbor_label_t {
  SENML_LABEL_BASE_VERSION = -1 , SENML_LABEL_BASE_NAME = -2 , SENML_LABEL_BASE_TIME = -3 , SENML_LABEL_BASE_UNIT = -4 ,
  SENML_LABEL_BASE_VALUE = -5 , SENML_LABEL_BASE_SUM = -6 , SENML_LABEL_NAME = 0 , SENML_LABEL_UNIT = 1 ,
  SENML_LABEL_VALUE = 2 , SENML_LABEL_STRING_VALUE = 3 , SENML_LABEL_BOOLEAN_VALUE = 4 , SENML_LABEL_SUM = 5 ,
  SENML_LABEL_TIME = 6 , SENML_LABEL_UPDATE_TIME = 7 , SENML_LABEL_DATA_VALUE = 8
}
 SenML CBOR labels. More...
 

Functions

int senml_encode_sum_cbor (nanocbor_encoder_t *enc, const senml_attr_t *attr)
 Encode senml_attr_t containing sum as CBOR.
 
int senml_encode_bool_cbor (nanocbor_encoder_t *enc, const senml_bool_value_t *val)
 Encode senml_bool_value_t as CBOR.
 
int senml_encode_value_cbor (nanocbor_encoder_t *enc, const senml_value_t *val)
 Encode senml_value_t as CBOR.
 
int senml_encode_string_cbor (nanocbor_encoder_t *enc, const senml_string_value_t *val)
 Encode senml_string_value_t as CBOR.
 
int senml_encode_data_cbor (nanocbor_encoder_t *enc, const senml_data_value_t *val)
 Encode senml_data_value_t as CBOR.
 

Enumeration Type Documentation

◆ senml_cbor_label_t

SenML CBOR labels.

This list contains the SenML CBOR labels as assigned by IANA.

Definition at line 44 of file cbor.h.

Function Documentation

◆ senml_encode_bool_cbor()

int senml_encode_bool_cbor ( nanocbor_encoder_t *  enc,
const senml_bool_value_t val 
)

Encode senml_bool_value_t as CBOR.

Parameters
encNanoCBOR encoder.
valvalue to encode.
Returns
Size of the encoded data.

◆ senml_encode_data_cbor()

int senml_encode_data_cbor ( nanocbor_encoder_t *  enc,
const senml_data_value_t val 
)

Encode senml_data_value_t as CBOR.

Parameters
encNanoCBOR encoder.
valvalue to encode.
Returns
Size of the encoded data.

◆ senml_encode_string_cbor()

int senml_encode_string_cbor ( nanocbor_encoder_t *  enc,
const senml_string_value_t val 
)

Encode senml_string_value_t as CBOR.

Parameters
encNanoCBOR encoder.
valvalue to encode.
Returns
Size of the encoded data.

◆ senml_encode_sum_cbor()

int senml_encode_sum_cbor ( nanocbor_encoder_t *  enc,
const senml_attr_t attr 
)

Encode senml_attr_t containing sum as CBOR.

Requires the sum attribute to be enabled by setting CONFIG_SENML_ATTR_SUM to 1.

Parameters
encNanoCBOR encoder.
attrAttributes (including sum) to encode.
Returns
Size of the encoded data.

◆ senml_encode_value_cbor()

int senml_encode_value_cbor ( nanocbor_encoder_t *  enc,
const senml_value_t val 
)

Encode senml_value_t as CBOR.

Parameters
encNanoCBOR encoder.
valvalue to encode.
Returns
Size of the encoded data.