Loading...
Searching...
No Matches
cbor.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Silke Hofstra
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
9#pragma once
10
26
27#include <stddef.h>
28#include <stdbool.h>
29#include <stdint.h>
30
31#include "senml.h"
32#include "nanocbor/nanocbor.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
43typedef enum {
44 SENML_LABEL_BASE_VERSION = -1,
45 SENML_LABEL_BASE_NAME = -2,
46 SENML_LABEL_BASE_TIME = -3,
47 SENML_LABEL_BASE_UNIT = -4,
48 SENML_LABEL_BASE_VALUE = -5,
49 SENML_LABEL_BASE_SUM = -6,
50 SENML_LABEL_NAME = 0,
51 SENML_LABEL_UNIT = 1,
52 SENML_LABEL_VALUE = 2,
53 SENML_LABEL_STRING_VALUE = 3,
54 SENML_LABEL_BOOLEAN_VALUE = 4,
55 SENML_LABEL_SUM = 5,
56 SENML_LABEL_TIME = 6,
57 SENML_LABEL_UPDATE_TIME = 7,
58 SENML_LABEL_DATA_VALUE = 8,
60
61#if IS_ACTIVE(CONFIG_SENML_ATTR_SUM) || defined(DOXYGEN)
72int senml_encode_sum_cbor(nanocbor_encoder_t *enc, const senml_attr_t *attr);
73#endif
74
83int senml_encode_bool_cbor(nanocbor_encoder_t *enc, const senml_bool_value_t *val);
84
93int senml_encode_value_cbor(nanocbor_encoder_t *enc, const senml_value_t *val);
94
103int senml_encode_string_cbor(nanocbor_encoder_t *enc, const senml_string_value_t *val);
104
113int senml_encode_data_cbor(nanocbor_encoder_t *enc, const senml_data_value_t *val);
114
115#ifdef __cplusplus
116}
117#endif
118
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:43
Basic SenML types.
SenML common record attributes.
Definition senml.h:238
SenML boolean value.
Definition senml.h:280
SenML data value.
Definition senml.h:288
SenML string value.
Definition senml.h:271
SenML string value.
Definition senml.h:263