Loading...
Searching...
No Matches
cbor.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 Silke Hofstra
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
23
24#include <stddef.h>
25#include <stdbool.h>
26#include <stdint.h>
27
28#include "senml.h"
29#include "nanocbor/nanocbor.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
40typedef enum {
41 SENML_LABEL_BASE_VERSION = -1,
42 SENML_LABEL_BASE_NAME = -2,
43 SENML_LABEL_BASE_TIME = -3,
44 SENML_LABEL_BASE_UNIT = -4,
45 SENML_LABEL_BASE_VALUE = -5,
46 SENML_LABEL_BASE_SUM = -6,
47 SENML_LABEL_NAME = 0,
48 SENML_LABEL_UNIT = 1,
49 SENML_LABEL_VALUE = 2,
50 SENML_LABEL_STRING_VALUE = 3,
51 SENML_LABEL_BOOLEAN_VALUE = 4,
52 SENML_LABEL_SUM = 5,
53 SENML_LABEL_TIME = 6,
54 SENML_LABEL_UPDATE_TIME = 7,
55 SENML_LABEL_DATA_VALUE = 8,
57
58#if IS_ACTIVE(CONFIG_SENML_ATTR_SUM) || defined(DOXYGEN)
69int senml_encode_sum_cbor(nanocbor_encoder_t *enc, const senml_attr_t *attr);
70#endif
71
80int senml_encode_bool_cbor(nanocbor_encoder_t *enc, const senml_bool_value_t *val);
81
90int senml_encode_value_cbor(nanocbor_encoder_t *enc, const senml_value_t *val);
91
100int senml_encode_string_cbor(nanocbor_encoder_t *enc, const senml_string_value_t *val);
101
110int senml_encode_data_cbor(nanocbor_encoder_t *enc, const senml_data_value_t *val);
111
112#ifdef __cplusplus
113}
114#endif
115
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_sum_cbor(nanocbor_encoder_t *enc, const senml_attr_t *attr)
Encode senml_attr_t containing sum 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_bool_cbor(nanocbor_encoder_t *enc, const senml_bool_value_t *val)
Encode senml_bool_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.
senml_cbor_label_t
SenML CBOR labels.
Definition cbor.h:40
Basic SenML types.
SenML common record attributes.
Definition senml.h:235
SenML boolean value.
Definition senml.h:277
SenML data value.
Definition senml.h:285
SenML string value.
Definition senml.h:268
SenML string value.
Definition senml.h:260