|
KPN Things Device SDK
|
Macros | |
| #define | htons(x) ( ((x)<<8 & 0xFF00) | ((x)>>8 & 0x00FF) ) |
| #define | htonl(x) |
| #define | htonll(x) ((((uint64_t)htonl(x)) << 32) + htonl((x) >> 32)) |
| #define | ntohl(x) |
Functions | |
| float | binary_to_float (uint32_t x) |
| uint32_t | float_to_binary (float x) |
| double | binary_to_double (uint64_t x) |
| uint16_t | half_float_to_binary (float val) |
| float | binary_to_half_float (uint16_t val) |
| float | ntohd_avr (uint64_t x) |
| bool | is_lossless_to_half_float (double value) |
| bool | is_lossless_to_float (double value) |
| double | decode_float_half (unsigned char *halfp) |
| size_t | decode_int (uint64_t *val) |
| size_t | cbor_serialize_array (size_t array_length) |
Serialize array of length array_length. More... | |
| size_t | cbor_serialize_map (size_t map_length) |
Serialize map of length map_length. More... | |
| size_t | cbor_serialize_int (int val) |
| Serializes an integer. More... | |
| size_t | cbor_serialize_unicode_string (const char *const val) |
| Serializes a unicode string. More... | |
| size_t | cbor_serialize_half_float (float val) |
| Serializes a half precision floating point value. More... | |
| size_t | cbor_serialize_float (float val) |
| Serializes a single precision floating point value. More... | |
| size_t | cbor_serialize_double (double val) |
| Serializes a double precision floating point value. More... | |
| size_t | cbor_deserialize_float_half (float *val) |
| size_t | cbor_deserialize_float (float *val) |
| size_t | cbor_deserialize_double (double *val) |
| size_t | cbor_deserialize_int64_t (int64_t *val) |
Deserialize signed 64 bit values from stream to val. More... | |
| size_t | cbor_deserialize_uint64_t (uint64_t *val) |
Deserialize unsigned 64 bit values from stream to val. More... | |
| size_t | cbor_serialize_bool (bool val) |
| Serializes a boolean value. More... | |
| size_t | cbor_serialize_byte_string (const char *val, int length) |
| Serializes a byte string. More... | |
| #define htonl | ( | x | ) |
| #define htons | ( | x | ) | ( ((x)<<8 & 0xFF00) | ((x)>>8 & 0x00FF) ) |
| #define ntohl | ( | x | ) |
|
inline |
Convert double x to host format
|
inline |
Convert float x to host format
|
inline |
| size_t cbor_deserialize_double | ( | double * | val | ) |
| size_t cbor_deserialize_float | ( | float * | val | ) |
| size_t cbor_deserialize_float_half | ( | float * | val | ) |
| size_t cbor_deserialize_int64_t | ( | int64_t * | val | ) |
Deserialize signed 64 bit values from stream to val.
| [out] | val | Pointer to destination array |
stream | size_t cbor_deserialize_uint64_t | ( | uint64_t * | val | ) |
Deserialize unsigned 64 bit values from stream to val.
| [out] | val | Pointer to destination array |
stream | size_t cbor_serialize_array | ( | size_t | array_length | ) |
Serialize array of length array_length.
Basic usage:
array_length, items will just be appened as normal| [in] | array_length | Length of the array of items which follows |
stream | size_t cbor_serialize_bool | ( | bool | val | ) |
Serializes a boolean value.
| [in] | val | The boolean value to serialize |
stream | size_t cbor_serialize_byte_string | ( | const char * | val, |
| int | length | ||
| ) |
Serializes a byte string.
| [in] | val | The byte string start pointer |
| [in] | length | The length of the string |
stream | size_t cbor_serialize_double | ( | double | val | ) |
Serializes a double precision floating point value.
| [in] | val | The double to serialize |
stream | size_t cbor_serialize_float | ( | float | val | ) |
Serializes a single precision floating point value.
| [in] | val | The float to serialize |
stream | size_t cbor_serialize_half_float | ( | float | val | ) |
Serializes a half precision floating point value.
| [in] | val | The float to serialize |
stream | size_t cbor_serialize_int | ( | int | val | ) |
Serializes an integer.
| [in] | val | The integer to serialize |
stream | size_t cbor_serialize_map | ( | size_t | map_length | ) |
Serialize map of length map_length.
Basic usage:
| map_length | Length of the map of items which follows |
stream | size_t cbor_serialize_unicode_string | ( | const char * | val | ) |
Serializes a unicode string.
string
| [out] | val | The zero-terminated unicode string to serialize. |
stream | double decode_float_half | ( | unsigned char * | halfp | ) |
Source: CBOR RFC reference implementation
| size_t decode_int | ( | uint64_t * | val | ) |
|
inline |
|
inline |
| bool is_lossless_to_float | ( | double | value | ) |
| bool is_lossless_to_half_float | ( | double | value | ) |
|
inline |