A model of a BLE UUID.
More...
|
| NimBLEUUID (const std::string &uuid) |
| Create a UUID from a string. More...
|
|
| NimBLEUUID (uint16_t uuid) |
| Create a UUID from the 16bit value. More...
|
|
| NimBLEUUID (uint32_t uuid) |
| Create a UUID from the 32bit value. More...
|
|
| NimBLEUUID (const ble_uuid128_t *uuid) |
| Create a UUID from the native UUID. More...
|
|
| NimBLEUUID (const uint8_t *pData, size_t size, bool msbFirst) |
| Create a UUID from 2, 4, 16 bytes of memory. More...
|
|
| NimBLEUUID (uint32_t first, uint16_t second, uint16_t third, uint64_t fourth) |
| Create a UUID from the 128bit value using hex parts instead of string, instead of NimBLEUUID("ebe0ccb0-7a0a-4b0c-8a1a-6ff2997da3a6"), it becomes NimBLEUUID(0xebe0ccb0, 0x7a0a, 0x4b0c, 0x8a1a6ff2997da3a6) More...
|
|
| NimBLEUUID () |
| Creates an empty UUID.
|
|
uint8_t | bitSize () const |
| Get the number of bits in this uuid. More...
|
|
bool | equals (const NimBLEUUID &uuid) const |
| Compare a UUID against this UUID. More...
|
|
const ble_uuid_any_t * | getNative () const |
| Get the native UUID value. More...
|
|
const NimBLEUUID & | to128 () |
| Convert a UUID to its 128 bit representation. More...
|
|
std::string | toString () const |
| Get a string representation of the UUID. More...
|
|
bool | operator== (const NimBLEUUID &rhs) const |
| Convienience operator to check if this UUID is equal to another.
|
|
bool | operator!= (const NimBLEUUID &rhs) const |
| Convienience operator to check if this UUID is not equal to another.
|
|
| operator std::string () const |
| Convienience operator to convert this UUID to string representation. More...
|
|
◆ NimBLEUUID() [1/6]
NimBLEUUID::NimBLEUUID |
( |
const std::string & |
value | ) |
|
Create a UUID from a string.
Create a UUID from a string. There will be two possible stories here. Either the string represents a binary data field or the string represents a hex encoding of a UUID. For the hex encoding, here is an example:
"beb5483e-36e1-4688-b7f5-ea07361b26a8"
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
12345678-90ab-cdef-1234-567890abcdef
This has a length of 36 characters. We need to parse this into 16 bytes.
- Parameters
-
[in] | value | The string to build a UUID from. |
◆ NimBLEUUID() [2/6]
NimBLEUUID::NimBLEUUID |
( |
uint16_t |
uuid | ) |
|
Create a UUID from the 16bit value.
- Parameters
-
[in] | uuid | The 16bit short form UUID. |
◆ NimBLEUUID() [3/6]
NimBLEUUID::NimBLEUUID |
( |
uint32_t |
uuid | ) |
|
Create a UUID from the 32bit value.
- Parameters
-
[in] | uuid | The 32bit short form UUID. |
◆ NimBLEUUID() [4/6]
NimBLEUUID::NimBLEUUID |
( |
const ble_uuid128_t * |
uuid | ) |
|
Create a UUID from the native UUID.
- Parameters
-
◆ NimBLEUUID() [5/6]
NimBLEUUID::NimBLEUUID |
( |
const uint8_t * |
pData, |
|
|
size_t |
size, |
|
|
bool |
msbFirst |
|
) |
| |
Create a UUID from 2, 4, 16 bytes of memory.
- Parameters
-
[in] | pData | The pointer to the start of the UUID. |
[in] | size | The size of the data. |
[in] | msbFirst | Is the MSB first in pData memory? |
◆ NimBLEUUID() [6/6]
NimBLEUUID::NimBLEUUID |
( |
uint32_t |
first, |
|
|
uint16_t |
second, |
|
|
uint16_t |
third, |
|
|
uint64_t |
fourth |
|
) |
| |
Create a UUID from the 128bit value using hex parts instead of string, instead of NimBLEUUID("ebe0ccb0-7a0a-4b0c-8a1a-6ff2997da3a6"), it becomes NimBLEUUID(0xebe0ccb0, 0x7a0a, 0x4b0c, 0x8a1a6ff2997da3a6)
- Parameters
-
[in] | first | The first 32bit of the UUID. |
[in] | second | The next 16bit of the UUID. |
[in] | third | The next 16bit of the UUID. |
[in] | fourth | The last 64bit of the UUID, combining the last 2 parts of the string equivalent |
◆ bitSize()
uint8_t NimBLEUUID::bitSize |
( |
| ) |
const |
Get the number of bits in this uuid.
- Returns
- The number of bits in the UUID. One of 16, 32 or 128.
◆ equals()
bool NimBLEUUID::equals |
( |
const NimBLEUUID & |
uuid | ) |
const |
Compare a UUID against this UUID.
- Parameters
-
[in] | uuid | The UUID to compare against. |
- Returns
- True if the UUIDs are equal and false otherwise.
◆ fromString()
NimBLEUUID NimBLEUUID::fromString |
( |
const std::string & |
uuid | ) |
|
|
static |
Create a NimBLEUUID from a string of the form: 0xNNNN 0xNNNNNNNN 0x<UUID> NNNN NNNNNNNN <UUID>
- Parameters
-
[in] | uuid | The string to create the UUID from. |
◆ getNative()
const ble_uuid_any_t * NimBLEUUID::getNative |
( |
| ) |
const |
Get the native UUID value.
- Returns
- The native UUID value or nullptr if not set.
◆ operator std::string()
NimBLEUUID::operator std::string |
( |
| ) |
const |
Convienience operator to convert this UUID to string representation.
This allows passing NimBLEUUID to functions that accept std::string and/or or it's methods as a parameter.
◆ to128()
Convert a UUID to its 128 bit representation.
A UUID can be internally represented as 16bit, 32bit or the full 128bit. This method will convert 16 or 32 bit representations to the full 128bit.
- Returns
- The NimBLEUUID converted to 128bit.
◆ toString()
std::string NimBLEUUID::toString |
( |
void |
| ) |
const |
Get a string representation of the UUID.
The format of a string is: 01234567 8901 2345 6789 012345678901 0000180d-0000-1000-8000-00805f9b34fb 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
- Returns
- A string representation of the UUID.
- Deprecated:
- Use std::string() operator instead.