Representation of a Universally Unique Identifier (UUID). More...
#include <UUID.h>
Public Types | |
typedef uint16_t | ShortUUIDBytes_t |
Type for a 16-bit UUID. More... | |
typedef uint8_t | LongUUIDBytes_t[LENGTH_OF_LONG_UUID] |
Type for a 128-bit UUID. More... | |
Public Member Functions | |
UUID (const char *stringUUID) | |
Construct a 128-bit UUID from a string. More... | |
UUID (const LongUUIDBytes_t longUUID, ByteOrder_t order=UUID::MSB) | |
Construct a new UUID from a 128-bit representation. More... | |
UUID (ShortUUIDBytes_t _shortUUID) | |
Creates a new 16-bit UUID. More... | |
UUID (const UUID &source) | |
UUID copy constructor. More... | |
UUID & | operator= (const UUID &source)=default |
UUID copy assignment. More... | |
UUID () | |
Default constructor. More... | |
void | setupLong (const LongUUIDBytes_t longUUID, ByteOrder_t order=UUID::MSB) |
Replace existing value with a 128-bit UUID. More... | |
UUID_Type_t | shortOrLong () const |
Return the internal type of the UUID. More... | |
const uint8_t * | getBaseUUID () const |
Get a pointer to the UUID value based on the current UUID type. More... | |
ShortUUIDBytes_t | getShortUUID () const |
Get the uint16_t value of the UUID. More... | |
uint8_t | getLen () const |
Get the length (in bytes) of the internal UUID representation. More... | |
bool | operator== (const UUID &other) const |
Equal to operator between UUIDs. More... | |
bool | operator!= (const UUID &other) const |
Not equal to operator. More... | |
Static Public Attributes | |
static const unsigned | LENGTH_OF_LONG_UUID = 16 |
Length in bytes of a long UUID. More... | |
static const unsigned | MAX_UUID_STRING_LENGTH = LENGTH_OF_LONG_UUID * 2 + 4 |
Maximum length for the string representation of a UUID excluding the null terminator. More... | |
Representation of a Universally Unique Identifier (UUID).
UUIDs are 128-bit wide numbers used to identify data type and elements in many layers of the Bluetooth specification.
Two representations of UUIDS exist:
This class acts as an adapter over these two kinds of UUIDs to allow indiscriminate use of both forms in Mbed BLE APIs.
Definition at line 76 of file common/UUID.h.
typedef uint8_t LongUUIDBytes_t[LENGTH_OF_LONG_UUID] |
Type for a 128-bit UUID.
Definition at line 124 of file common/UUID.h.
typedef uint16_t ShortUUIDBytes_t |
Type for a 16-bit UUID.
Definition at line 114 of file common/UUID.h.
enum ByteOrder_t |
Enumeration of byte ordering.
It is used to construct 128-byte UUIDs.
Enumerator | |
---|---|
MSB |
Most significant byte first (at the smallest address). |
LSB |
Least significant byte first (at the smallest address). |
Definition at line 99 of file common/UUID.h.
enum UUID_Type_t |
Enumeration of the types of UUIDs.
Enumerator | |
---|---|
UUID_TYPE_SHORT |
16-bit wide UUID representation. |
UUID_TYPE_LONG |
128-bit wide UUID representation. |
Definition at line 82 of file common/UUID.h.
UUID | ( | const char * | stringUUID | ) |
Construct a 128-bit UUID from a string.
[in] | stringUUID | Human readable representation of the UUID following the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. |
Definition at line 149 of file common/UUID.h.
UUID | ( | const LongUUIDBytes_t | longUUID, |
ByteOrder_t | order = UUID::MSB |
||
) |
Construct a new UUID from a 128-bit representation.
[in] | longUUID | The 128-bit (16-byte) of the UUID value. |
[in] | order | Bytes order of longUUID . |
Definition at line 200 of file common/UUID.h.
UUID | ( | ShortUUIDBytes_t | _shortUUID | ) |
Creates a new 16-bit UUID.
The Bluetooth standard body defines 16-bit wide UUIDs. They are the shortened version of the UUID 0000xxxx-0000-1000-8000-00805F9B34FB, where xxxx is the value of the 16-bit UUID.
Definition at line 220 of file common/UUID.h.
UUID copy constructor.
[in] | source | The UUID to copy. |
Definition at line 231 of file common/UUID.h.
UUID | ( | ) |
Default constructor.
Construct an invalid UUID.
Definition at line 253 of file common/UUID.h.
const uint8_t* getBaseUUID | ( | ) | const |
uint8_t getLen | ( | ) | const |
Get the length (in bytes) of the internal UUID representation.
Definition at line 324 of file common/UUID.h.
ShortUUIDBytes_t getShortUUID | ( | ) | const |
Get the uint16_t value of the UUID.
Definition at line 313 of file common/UUID.h.
bool operator!= | ( | const UUID & | other | ) | const |
Not equal to operator.
[in] | other | The UUID compared to this. |
Definition at line 360 of file common/UUID.h.
bool operator== | ( | const UUID & | other | ) | const |
Equal to operator between UUIDs.
[in] | other | The UUID to compare to this. |
Definition at line 338 of file common/UUID.h.
void setupLong | ( | const LongUUIDBytes_t | longUUID, |
ByteOrder_t | order = UUID::MSB |
||
) |
Replace existing value with a 128-bit UUID.
[in] | longUUID | New 16-byte wide UUID value. |
[in] | order | Byte ordering of longUUID . |
Definition at line 264 of file common/UUID.h.
UUID_Type_t shortOrLong | ( | ) | const |
Return the internal type of the UUID.
Definition at line 286 of file common/UUID.h.
|
static |
Length in bytes of a long UUID.
Definition at line 119 of file common/UUID.h.
|
static |
Maximum length for the string representation of a UUID excluding the null terminator.
The string is composed of two characters per byte plus four '-' characters.
Definition at line 133 of file common/UUID.h.