pabigot
0.1.1
C++ support classes
|
Basic holder for 128-bit UUIDs stored as a little-endian byte sequence. More...
#include </mnt/devel/pabigot-cxx/include/pabigot/ble.hpp>
Public Member Functions | |
std::string | as_string () const noexcept |
Convert the UUID to its standard text representation. More... | |
bool | base_match (const uuid128_type &other) const noexcept |
Indicate whether the two UUIDs have the same base UUID. More... | |
uuid128_type | from_uuid16 (const uuid16_type &uuid16) const noexcept |
Construct a derived 128-bit UUID from a 16-bit UUID. More... | |
uuid128_type | from_uuid16 (uint16_t uuid16) const noexcept |
Construct a derived 128-bit UUID from a 16-bit UUID integral value. More... | |
uuid16_type::integer_type | uuid16 () const noexcept |
Extract the 16-bit UUID as a host byte order integer. | |
uuid128_type | swap_endian () const noexcept |
Byte-reverse the UUID, converting between big- and little-endian representations. More... | |
Public Member Functions inherited from pabigot::ble::details::uuid_type< 16 > | |
constexpr | uuid_type (const super_type &arr) |
constexpr | uuid_type (super_type &arr) |
constexpr | uuid_type (const uint8_t(&arr)[byte_length]) |
constexpr | uuid_type (uint8_t(&arr)[byte_length]) |
Static Public Attributes | |
static const uuid128_type | BLUETOOTH_BASE |
The Bluetooth Base UUID. More... | |
Static Public Attributes inherited from pabigot::ble::details::uuid_type< 16 > | |
static constexpr std::size_t | byte_length |
The length of the UUID in bytes. | |
static constexpr std::size_t | bit_length |
The length of the UUID in bits. | |
Additional Inherited Members | |
Public Types inherited from pabigot::ble::details::uuid_type< 16 > | |
using | super_type = std::array< uint8_t, nb > |
Basic holder for 128-bit UUIDs stored as a little-endian byte sequence.
To generate an initializer for a 128-bit UUID use:
UUID=${UUID:-$(uuidgen)} # Optionally clear bits [96, 112) to set as base for 16-bit UUIDs # UUID=$(echo ${UUID} | sed -r -e 's@^(....)....@\10000@') echo "// UUID: ${UUID}" echo ${UUID} \ | sed -r \ -e 's@-@@g' \ -e 's@(..)@0x&,\n@g' \ | sed -e '/^$/d' \ | tac \ | paste -d' ' - - - - unset UUID
|
noexcept |
Convert the UUID to its standard text representation.
|
noexcept |
Indicate whether the two UUIDs have the same base UUID.
Base UUIDs are assumed to be for 16-bit UUIDs, meaning this succeeds if the UUIDs are equal in all but bits [96, 112).
|
noexcept |
Construct a derived 128-bit UUID from a 16-bit UUID.
This returns a new 128-bit UUID equal to this UUID but with bits [96, 112) replaced by the contents of uuid16
.
|
inlinenoexcept |
Construct a derived 128-bit UUID from a 16-bit UUID integral value.
This returns a new 128-bit UUID equal to this UUID but with bits [96, 112) replaced by the contents of uuid16
in little-endian byte order.
|
noexcept |
Byte-reverse the UUID, converting between big- and little-endian representations.
|
static |
The Bluetooth Base UUID.
I.e.: 00000000-0000-1000-8000-00805F9B34FB