|
26 | 26 |
|
27 | 27 | static const char* LOG_TAG = "BLEService"; // Tag for logging.
|
28 | 28 |
|
| 29 | +/** |
| 30 | + * @brief Construct an instance of the BLEService |
| 31 | + * @param [in] uuid The UUID of the service. |
| 32 | + */ |
| 33 | +BLEService::BLEService(const char* uuid) { |
| 34 | + BLEService(BLEUUID(uuid)); |
| 35 | +} |
| 36 | + |
| 37 | + |
29 | 38 | /**
|
30 | 39 | * @brief Construct an instance of the BLEService
|
31 | 40 | * @param [in] uuid The UUID of the service.
|
@@ -200,9 +209,17 @@ void BLEService::addCharacteristic(BLECharacteristic* pCharacteristic) {
|
200 | 209 | * @param [in] properties - The properties of the characteristic.
|
201 | 210 | * @return The new BLE characteristic.
|
202 | 211 | */
|
203 |
| -BLECharacteristic* BLEService::createCharacteristic( |
204 |
| - BLEUUID uuid, |
205 |
| - uint32_t properties) { |
| 212 | +BLECharacteristic* BLEService::createCharacteristic(const char* uuid, uint32_t properties) { |
| 213 | + return createCharacteristic(BLEUUID(uuid), properties); |
| 214 | +} |
| 215 | + |
| 216 | +/** |
| 217 | + * @brief Create a new BLE Characteristic associated with this service. |
| 218 | + * @param [in] uuid - The UUID of the characteristic. |
| 219 | + * @param [in] properties - The properties of the characteristic. |
| 220 | + * @return The new BLE characteristic. |
| 221 | + */ |
| 222 | +BLECharacteristic* BLEService::createCharacteristic(BLEUUID uuid, uint32_t properties) { |
206 | 223 | BLECharacteristic *pCharacteristic = new BLECharacteristic(uuid, properties);
|
207 | 224 | addCharacteristic(pCharacteristic);
|
208 | 225 | return pCharacteristic;
|
@@ -289,6 +306,11 @@ void BLEService::handleGATTServerEvent(
|
289 | 306 | } // handleGATTServerEvent
|
290 | 307 |
|
291 | 308 |
|
| 309 | +BLECharacteristic* BLEService::getCharacteristic(const char* uuid) { |
| 310 | + return getCharacteristic(BLEUUID(uuid)); |
| 311 | +} |
| 312 | + |
| 313 | + |
292 | 314 | BLECharacteristic* BLEService::getCharacteristic(BLEUUID uuid) {
|
293 | 315 | return m_characteristicMap.getByUUID(uuid);
|
294 | 316 | }
|
|
0 commit comments