18#ifndef NIMBLE_CPP_SERVICE_H_
19#define NIMBLE_CPP_SERVICE_H_
22#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
26# include "NimBLEAttribute.h"
27# include "NimBLEServer.h"
28# include "NimBLECharacteristic.h"
46 uint32_t properties = NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::WRITE,
47 uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
50 uint32_t properties = NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::WRITE,
51 uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
65 std::vector<NimBLECharacteristic*> m_vChars{};
69 ble_gatt_svc_def m_pSvcDef[2]{};
The model of a BLE Characteristic.
Definition NimBLECharacteristic.h:40
A base class for local BLE attributes.
Definition NimBLELocalAttribute.h:29
The model of a BLE server.
Definition NimBLEServer.h:60
The model of a BLE service.
Definition NimBLEService.h:34
NimBLECharacteristic * createCharacteristic(const char *uuid, uint32_t properties=NIMBLE_PROPERTY::READ|NIMBLE_PROPERTY::WRITE, uint16_t max_len=BLE_ATT_ATTR_MAX_LEN)
Create a new BLE Characteristic associated with this service.
Definition NimBLEService.cpp:188
NimBLECharacteristic * getCharacteristicByHandle(uint16_t handle) const
Get a pointer to the characteristic object with the specified handle.
Definition NimBLEService.cpp:302
std::string toString() const
Return a string representation of this service. A service is defined by:
Definition NimBLEService.cpp:347
const std::vector< NimBLECharacteristic * > & getCharacteristics() const
Definition NimBLEService.cpp:315
~NimBLEService()
Destructor, make sure we release the resources allocated for the service.
Definition NimBLEService.cpp:51
void dump() const
Dump details of this BLE GATT service.
Definition NimBLEService.cpp:67
bool isStarted() const
Checks if the service has been started.
Definition NimBLEService.cpp:368
NimBLEServer * getServer() const
Get the BLE server associated with this service.
Definition NimBLEService.cpp:360
bool start()
Builds the database of characteristics/descriptors for the service and registers it with the NimBLE s...
Definition NimBLEService.cpp:92
NimBLECharacteristic * getCharacteristic(const char *uuid, uint16_t instanceId=0) const
Get a pointer to the characteristic object with the specified UUID.
Definition NimBLEService.cpp:273
void addCharacteristic(NimBLECharacteristic *pCharacteristic)
Add a characteristic to the service.
Definition NimBLEService.cpp:213
void removeCharacteristic(NimBLECharacteristic *pCharacteristic, bool deleteChr=false)
Remove a characteristic from the service.
Definition NimBLEService.cpp:245
A model of a BLE UUID.
Definition NimBLEUUID.h:41