NimBLE-Arduino 1.4.2
|
A model of a BLE UUID. More...
#include <NimBLEUUID.h>
Public Member Functions | |
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... | |
const NimBLEUUID & | to16 () |
Convert 128 bit UUID to its 16 bit representation. More... | |
std::string | toString () const |
Get a string representation of the UUID. More... | |
bool | operator== (const NimBLEUUID &rhs) const |
Convenience operator to check if this UUID is equal to another. | |
bool | operator!= (const NimBLEUUID &rhs) const |
Convenience operator to check if this UUID is not equal to another. | |
operator std::string () const | |
Convenience operator to convert this UUID to string representation. More... | |
Static Public Member Functions | |
static NimBLEUUID | fromString (const std::string &uuid) |
A model of a BLE UUID.
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:
This has a length of 36 characters. We need to parse this into 16 bytes.
[in] | value | The string to build a UUID from. |
NimBLEUUID::NimBLEUUID | ( | uint16_t | uuid | ) |
Create a UUID from the 16bit value.
[in] | uuid | The 16bit short form UUID. |
NimBLEUUID::NimBLEUUID | ( | uint32_t | uuid | ) |
Create a UUID from the 32bit value.
[in] | uuid | The 32bit short form UUID. |
NimBLEUUID::NimBLEUUID | ( | const ble_uuid128_t * | uuid | ) |
Create a UUID from the native UUID.
[in] | uuid | The native UUID. |
NimBLEUUID::NimBLEUUID | ( | const uint8_t * | pData, |
size_t | size, | ||
bool | msbFirst | ||
) |
Create a UUID from 2, 4, 16 bytes of memory.
[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::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)
[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 |
uint8_t NimBLEUUID::bitSize | ( | ) | const |
Get the number of bits in this uuid.
bool NimBLEUUID::equals | ( | const NimBLEUUID & | uuid | ) | const |
Compare a UUID against this UUID.
[in] | uuid | The UUID to compare against. |
|
static |
Create a NimBLEUUID from a string of the form: 0xNNNN 0xNNNNNNNN 0x<UUID> NNNN NNNNNNNN <UUID>
[in] | uuid | The string to create the UUID from. |
const ble_uuid_any_t * NimBLEUUID::getNative | ( | ) | const |
Get the native UUID value.
NimBLEUUID::operator std::string | ( | ) | const |
Convenience 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.
const NimBLEUUID & NimBLEUUID::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 32bit representations to the full 128bit.
const NimBLEUUID & NimBLEUUID::to16 | ( | ) |
Convert 128 bit UUID to its 16 bit representation.
A UUID can be internally represented as 16bit, 32bit or the full 128bit. This method will convert a 128bit uuid to 16bit if it contains the ble base uuid.
std::string NimBLEUUID::toString | ( | ) | 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