#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
◆ CBOR_7
| #define CBOR_7 0xE0 /* type 7 (float and other types) */ |
◆ CBOR_ARRAY
| #define CBOR_ARRAY 0x80 /* type 4 */ |
◆ CBOR_BREAK
| #define CBOR_BREAK (CBOR_7 | 31) |
◆ CBOR_BYTE_FOLLOWS
| #define CBOR_BYTE_FOLLOWS 24 /* indicator that the next byte is part of this item */ |
◆ CBOR_BYTES
| #define CBOR_BYTES 0x40 /* type 2 */ |
◆ CBOR_DATETIME_EPOCH_FOLLOWS
| #define CBOR_DATETIME_EPOCH_FOLLOWS 1 |
◆ CBOR_DATETIME_STRING_FOLLOWS
| #define CBOR_DATETIME_STRING_FOLLOWS 0 |
◆ CBOR_FALSE
| #define CBOR_FALSE (CBOR_7 | 20) |
◆ CBOR_FLOAT16
| #define CBOR_FLOAT16 (CBOR_7 | 25) |
◆ CBOR_FLOAT32
| #define CBOR_FLOAT32 (CBOR_7 | 26) |
◆ CBOR_FLOAT64
| #define CBOR_FLOAT64 (CBOR_7 | 27) |
◆ CBOR_INFO_MASK
| #define CBOR_INFO_MASK 0x1F /* low 5 bits */ |
◆ CBOR_MAP
| #define CBOR_MAP 0xA0 /* type 5 */ |
◆ CBOR_NEGINT
| #define CBOR_NEGINT 0x20 /* type 1 */ |
◆ CBOR_NULL
| #define CBOR_NULL (CBOR_7 | 22) |
◆ CBOR_TAG
| #define CBOR_TAG 0xC0 /* type 6 */ |
◆ CBOR_TEXT
| #define CBOR_TEXT 0x60 /* type 3 */ |
◆ CBOR_TRUE
| #define CBOR_TRUE (CBOR_7 | 21) |
◆ CBOR_TYPE
◆ CBOR_TYPE_MASK
| #define CBOR_TYPE_MASK 0xE0 /* top 3 bits */ |
◆ CBOR_UINT
| #define CBOR_UINT 0x00 /* type 0 */ |
◆ CBOR_UINT16_FOLLOWS
| #define CBOR_UINT16_FOLLOWS 25 /* 0x19 */ |
◆ CBOR_UINT32_FOLLOWS
| #define CBOR_UINT32_FOLLOWS 26 /* 0x1a */ |
◆ CBOR_UINT64_FOLLOWS
| #define CBOR_UINT64_FOLLOWS 27 /* 0x1b */ |
◆ CBOR_UINT8_FOLLOWS
| #define CBOR_UINT8_FOLLOWS 24 /* 0x18 */ |
◆ CBOR_UNDEFINED
| #define CBOR_UNDEFINED (CBOR_7 | 23) |
◆ CBOR_VAR_FOLLOWS
| #define CBOR_VAR_FOLLOWS 31 /* 0x1f */ |
◆ SENML_BVER_LABEL
| #define SENML_BVER_LABEL -1 |
◆ SENML_CBOR_BN_LABEL
| #define SENML_CBOR_BN_LABEL -2 |
◆ SENML_CBOR_BS_LABEL
| #define SENML_CBOR_BS_LABEL -16 |
◆ SENML_CBOR_BT_LABEL
| #define SENML_CBOR_BT_LABEL -3 |
◆ SENML_CBOR_BU_LABEL
| #define SENML_CBOR_BU_LABEL -4 |
◆ SENML_CBOR_BV_LABEL
| #define SENML_CBOR_BV_LABEL -5 |
◆ SENML_CBOR_N_LABEL
| #define SENML_CBOR_N_LABEL 0 |
◆ SENML_CBOR_S_LABEL
| #define SENML_CBOR_S_LABEL 5 |
◆ SENML_CBOR_T_LABEL
| #define SENML_CBOR_T_LABEL 6 |
◆ SENML_CBOR_U_LABEL
| #define SENML_CBOR_U_LABEL 1 |
◆ SENML_CBOR_UT_LABEL
| #define SENML_CBOR_UT_LABEL 7 |
◆ SENML_CBOR_V_LABEL
| #define SENML_CBOR_V_LABEL 2 |
◆ SENML_CBOR_VB_LABEL
| #define SENML_CBOR_VB_LABEL 4 |
◆ SENML_CBOR_VD_LABEL
| #define SENML_CBOR_VD_LABEL 8 |
◆ SENML_CBOR_VS_LABEL
| #define SENML_CBOR_VS_LABEL 3 |
◆ THINGSML_CBOR_I_LABEL
| #define THINGSML_CBOR_I_LABEL 23 |
◆ cbor_at_break()
check that the char at the current position is a break char
- Returns
- 1 if all ok, 0 if no break char was found.
◆ cbor_deserialize_double()
| size_t cbor_deserialize_double |
( |
double * |
val | ) |
|
◆ cbor_deserialize_float()
| size_t cbor_deserialize_float |
( |
float * |
val | ) |
|
◆ cbor_deserialize_float_half()
| size_t cbor_deserialize_float_half |
( |
float * |
val | ) |
|
◆ cbor_deserialize_int64_t()
| size_t cbor_deserialize_int64_t |
( |
int64_t * |
val | ) |
|
Deserialize signed 64 bit values from stream to val.
- Parameters
-
| [out] | val | Pointer to destination array |
- Returns
- Number of bytes read from
stream
◆ cbor_deserialize_uint64_t()
| size_t cbor_deserialize_uint64_t |
( |
uint64_t * |
val | ) |
|
Deserialize unsigned 64 bit values from stream to val.
- Parameters
-
| [out] | val | Pointer to destination array |
- Returns
- Number of bytes read from
stream
◆ cbor_serialize_array()
| size_t cbor_serialize_array |
( |
size_t |
array_length | ) |
|
Serialize array of length array_length.
Basic usage:
size_t cbor_serialize_int(int val)
Serializes an integer.
Definition: cbor.cpp:321
size_t cbor_serialize_array(size_t array_length)
Serialize array of length array_length.
Definition: cbor.cpp:309
- Note
- You have to make sure to serialize the correct amount of items. If you exceed the length
array_length, items will just be appened as normal
- Parameters
-
| [in] | array_length | Length of the array of items which follows |
- Returns
- Number of bytes written to stream
stream
◆ cbor_serialize_bool()
| size_t cbor_serialize_bool |
( |
bool |
val | ) |
|
Serializes a boolean value.
- Parameters
-
| [in] | val | The boolean value to serialize |
- Returns
- Number of bytes written to stream
stream
◆ cbor_serialize_byte_string()
| size_t cbor_serialize_byte_string |
( |
const char * |
val, |
|
|
int |
length |
|
) |
| |
Serializes a byte string.
- Parameters
-
| [in] | val | The byte string start pointer |
| [in] | length | The length of the string |
- Returns
- Number of bytes written to stream
stream
◆ cbor_serialize_double()
| size_t cbor_serialize_double |
( |
double |
val | ) |
|
Serializes a double precision floating point value.
- Parameters
-
| [in] | val | The double to serialize |
- Returns
- Number of bytes written to stream
stream
◆ cbor_serialize_float()
| size_t cbor_serialize_float |
( |
float |
val | ) |
|
Serializes a single precision floating point value.
- Parameters
-
| [in] | val | The float to serialize |
- Returns
- Number of bytes written to stream
stream
◆ cbor_serialize_half_float()
| size_t cbor_serialize_half_float |
( |
float |
val | ) |
|
Serializes a half precision floating point value.
- Parameters
-
| [in] | val | The float to serialize |
- Returns
- Number of bytes written to stream
stream
◆ cbor_serialize_int()
| size_t cbor_serialize_int |
( |
int |
val | ) |
|
Serializes an integer.
- Parameters
-
| [in] | val | The integer to serialize |
- Returns
- Number of bytes written to stream
stream
◆ cbor_serialize_map()
| size_t cbor_serialize_map |
( |
size_t |
map_length | ) |
|
Serialize map of length map_length.
Basic usage:
size_t cbor_serialize_byte_string(const char *val, int length)
Serializes a byte string.
Definition: cbor.cpp:457
size_t cbor_serialize_map(size_t map_length)
Serialize map of length map_length.
Definition: cbor.cpp:315
- Parameters
-
| map_length | Length of the map of items which follows |
- Returns
- Number of bytes written to stream
stream
◆ cbor_serialize_unicode_string()
| size_t cbor_serialize_unicode_string |
( |
const char * |
val | ) |
|
Serializes a unicode string.
string
- Parameters
-
| [out] | val | The zero-terminated unicode string to serialize. |
- Returns
- Number of bytes written to stream
stream
◆ decode_int()
| size_t decode_int |
( |
uint64_t * |
val | ) |
|
◆ is_lossless_to_float()
| bool is_lossless_to_float |
( |
double |
value | ) |
|
◆ is_lossless_to_half_float()
| bool is_lossless_to_half_float |
( |
double |
value | ) |
|