Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
UUID Class Reference
[Common]
Representation of a Universally Unique Identifier (UUID). More...
#include <UUID.h>
Public Types | |
enum | UUID_Type_t { UUID_TYPE_SHORT = 0, UUID_TYPE_LONG = 1 } |
Enumeration of the types of UUIDs. More... | |
enum | ByteOrder_t { MSB, LSB } |
Enumeration of byte ordering. More... | |
typedef uint16_t | ShortUUIDBytes_t |
Type for a 16-bit UUID. | |
typedef uint8_t | LongUUIDBytes_t [LENGTH_OF_LONG_UUID] |
Type for a 128-bit UUID. | |
Public Member Functions | |
UUID (const char *stringUUID) | |
Construct a 128-bit UUID from a string. | |
UUID (const LongUUIDBytes_t longUUID, ByteOrder_t order=UUID::MSB) | |
Construct a new UUID from a 128-bit representation. | |
UUID (ShortUUIDBytes_t _shortUUID) | |
Creates a new 16-bit UUID. | |
UUID (const UUID &source) | |
UUID copy constructor. | |
UUID (void) | |
Default constructor. | |
void | setupLong (const LongUUIDBytes_t longUUID, ByteOrder_t order=UUID::MSB) |
Replace existing value with a 128-bit UUID. | |
UUID_Type_t | shortOrLong (void) const |
Return the internal type of the UUID. | |
const uint8_t * | getBaseUUID (void) const |
Get a pointer to the UUID value based on the current UUID type. | |
ShortUUIDBytes_t | getShortUUID (void) const |
Get the uint16_t value of the UUID. | |
uint8_t | getLen (void) const |
Get the length (in bytes) of the internal UUID representation. | |
bool | operator== (const UUID &other) const |
Equal to operator between UUIDs. | |
bool | operator!= (const UUID &other) const |
Not equal to operator. | |
Static Public Attributes | |
static const unsigned | LENGTH_OF_LONG_UUID = 16 |
Length in bytes of a long UUID. | |
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. |
Detailed Description
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:
- 16-bit UUIDs: Shortened representation of the 128 bit UUID 0000xxxx-0000-1000-8000-00805F9B34FB where xxxx is the 16 bit UUID. Values of those UUIDs are defined by the Bluetooth body. The short representation saves bandwidth during protocol transactions.
- 128-bit UUIDs: Complete representation of a UUID. They are commonly used for user defined UUID.
This class acts as an adapter over these two kinds of UUIDs to allow indiscriminate use of both forms in Mbed BLE APIs.
- Note:
- 32-bit UUID representation is not supported currently.
Definition at line 74 of file UUID.h.
Member Typedef Documentation
typedef uint8_t LongUUIDBytes_t[LENGTH_OF_LONG_UUID] |
typedef uint16_t ShortUUIDBytes_t |
Member Enumeration Documentation
enum ByteOrder_t |
enum UUID_Type_t |
Constructor & Destructor Documentation
UUID | ( | const char * | stringUUID ) |
Construct a 128-bit UUID from a string.
- Parameters:
-
[in] stringUUID Human readable representation of the UUID following the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
- Note:
- Upper and lower case are supported.
- Hyphens are optional. The string must include at most four hyphens.
- Internally, the UUID is stored in the little endian order as a 16-byte array.
UUID | ( | const LongUUIDBytes_t | longUUID, |
ByteOrder_t | order = UUID::MSB |
||
) |
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.
- Attention:
- 16-bit UUIDs are not used in user defined data type or user defined element ID.
- Note:
- User defined UUIDs are commonly named vendor-specific UUIDs across the Bluetooth literature.
UUID | ( | void | ) |
Default constructor.
Construct an invalid UUID.
- Postcondition:
- shortOrLong() returns the value UUID_TYPE_SHORT.
- getShortUUID() returns the value BLE_UUID_UNKNOWN.
Member Function Documentation
const uint8_t* getBaseUUID | ( | void | ) | const |
uint8_t getLen | ( | void | ) | const |
ShortUUIDBytes_t getShortUUID | ( | void | ) | const |
bool operator!= | ( | const UUID & | other ) | const |
bool operator== | ( | const UUID & | other ) | const |
void setupLong | ( | const LongUUIDBytes_t | longUUID, |
ByteOrder_t | order = UUID::MSB |
||
) |
UUID_Type_t shortOrLong | ( | void | ) | const |
Field Documentation
const unsigned LENGTH_OF_LONG_UUID = 16 [static] |
const unsigned MAX_UUID_STRING_LENGTH = LENGTH_OF_LONG_UUID * 2 + 4 [static] |
Generated on Tue Jul 12 2022 14:26:54 by
