The model of a BLE service.
More...
#include <BLEService.hpp>
The model of a BLE service.
◆ addCharacteristic()
Add a characteristic to the service.
- Parameters
-
[in] | pCharacteristic | A pointer to the characteristic to be added. |
120 _debug_print(TAG,
">> addCharacteristic()");
121 void *logCtx __attribute__((unused)) =
nullptr;
122 _debug_print_s(TAG,
"Adding characteristic: uuid", pCharacteristic->
getUUID().
toString().c_str(), &logCtx);
123 _debug_print_s(TAG,
" to service",
toString().c_str());
127 _debug_print(TAG,
"<< Adding a new characteristic with the same UUID as a previous one");
133 m_characteristicMap.setByUUID(pCharacteristic, pCharacteristic->
getUUID());
135 _debug_print(TAG,
"<< addCharacteristic()");
◆ createCharacteristic() [1/2]
Create a new BLE Characteristic associated with this service.
- Parameters
-
[in] | uuid | - The UUID of the characteristic. |
[in] | properties | - The properties of the characteristic. |
- Returns
- The new BLE characteristic.
159 return pCharacteristic;
◆ createCharacteristic() [2/2]
BLECharacteristic * BLEService::createCharacteristic |
( |
const char * |
uuid, |
|
|
uint32_t |
properties |
|
) |
| |
Create a new BLE Characteristic associated with this service.
- Parameters
-
[in] | uuid | - The UUID of the characteristic. |
[in] | properties | - The properties of the characteristic. |
- Returns
- The new BLE characteristic.
◆ dump()
void BLEService::dump |
( |
| ) |
|
Dump details of this BLE GATT service.
- Returns
- N/A.
68 void *logCtx __attribute__((unused)) =
nullptr;
69 _debug_print_s(TAG,
"Service: uuid", m_uuid.
toString().c_str(), &logCtx);
70 _debug_print_d(TAG,
", handle:", m_handle, &logCtx);
71 _debug_print_s(TAG,
", Characteristics", m_characteristicMap.
toString().c_str(), &logCtx);
◆ getHandle()
uint16_t BLEService::getHandle |
( |
| ) |
|
Get the handle associated with this service.
- Returns
- The handle associated with this service.
◆ getServer()
Get the BLE server associated with this service.
- Returns
- The BLEServer associated with this service.
◆ getUUID()
Get the UUID of the service.
- Returns
- the UUID of the service.
◆ toString()
std::string BLEService::toString |
( |
| ) |
|
Return a string representation of this service. A service is defined by:
- Its UUID
- Its handle
- Returns
- A string representation of this service.
181 std::stringstream stringStream;
183 ", handle: 0x" << std::hex << std::setfill(
'0') << std::setw(2) <<
getHandle();
184 return stringStream.str();
The documentation for this class was generated from the following files:
BLECharacteristic * createCharacteristic(const char *uuid, uint32_t properties)
Create a new BLE Characteristic associated with this service.
Definition: BLEService.cpp:145