18#ifndef NIMBLE_CPP_SERVICE_H_
19#define NIMBLE_CPP_SERVICE_H_
22#if CONFIG_BT_ENABLED && 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:41
A base class for local BLE attributes.
Definition NimBLELocalAttribute.h:29
The model of a BLE server.
Definition NimBLEServer.h:62
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:194
NimBLECharacteristic * getCharacteristicByHandle(uint16_t handle) const
Get a pointer to the characteristic object with the specified handle.
Definition NimBLEService.cpp:308
std::string toString() const
Return a string representation of this service. A service is defined by:
Definition NimBLEService.cpp:353
const std::vector< NimBLECharacteristic * > & getCharacteristics() const
Definition NimBLEService.cpp:321
~NimBLEService()
Destructor, make sure we release the resources allocated for the service.
Definition NimBLEService.cpp:50
void dump() const
Dump details of this BLE GATT service.
Definition NimBLEService.cpp:66
bool isStarted() const
Checks if the service has been started.
Definition NimBLEService.cpp:374
NimBLEServer * getServer() const
Get the BLE server associated with this service.
Definition NimBLEService.cpp:366
bool start()
Builds the database of characteristics/descriptors for the service and registers it with the NimBLE s...
Definition NimBLEService.cpp:91
NimBLECharacteristic * getCharacteristic(const char *uuid, uint16_t instanceId=0) const
Get a pointer to the characteristic object with the specified UUID.
Definition NimBLEService.cpp:279
void addCharacteristic(NimBLECharacteristic *pCharacteristic)
Add a characteristic to the service.
Definition NimBLEService.cpp:219
void removeCharacteristic(NimBLECharacteristic *pCharacteristic, bool deleteChr=false)
Remove a characteristic from the service.
Definition NimBLEService.cpp:251
A model of a BLE UUID.
Definition NimBLEUUID.h:41