NimBLE-Arduino 1.4.2
|
The model of a BLE service. More...
#include <NimBLEService.h>
Public Member Functions | |
NimBLEService (const char *uuid) | |
Construct an instance of the NimBLEService. More... | |
NimBLEService (const NimBLEUUID &uuid) | |
Construct an instance of the BLEService. More... | |
NimBLEServer * | getServer () |
Get the BLE server associated with this service. More... | |
NimBLEUUID | getUUID () |
Get the UUID of the service. More... | |
uint16_t | getHandle () |
Get the handle associated with this service. More... | |
std::string | toString () |
Return a string representation of this service. A service is defined by: More... | |
void | dump () |
Dump details of this BLE GATT service. | |
bool | start () |
Builds the database of characteristics/descriptors for the service and registers it with the NimBLE stack. More... | |
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. More... | |
NimBLECharacteristic * | createCharacteristic (const NimBLEUUID &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. More... | |
void | addCharacteristic (NimBLECharacteristic *pCharacteristic) |
Add a characteristic to the service. More... | |
void | removeCharacteristic (NimBLECharacteristic *pCharacteristic, bool deleteChr=false) |
Remove a characteristic from the service. More... | |
NimBLECharacteristic * | getCharacteristic (const char *uuid, uint16_t instanceId=0) |
Get a pointer to the characteristic object with the specified UUID. More... | |
NimBLECharacteristic * | getCharacteristic (const NimBLEUUID &uuid, uint16_t instanceId=0) |
Get a pointer to the characteristic object with the specified UUID. More... | |
NimBLECharacteristic * | getCharacteristicByHandle (uint16_t handle) |
Get a pointer to the characteristic object with the specified handle. More... | |
std::vector< NimBLECharacteristic * > | getCharacteristics () |
std::vector< NimBLECharacteristic * > | getCharacteristics (const char *uuid) |
std::vector< NimBLECharacteristic * > | getCharacteristics (const NimBLEUUID &uuid) |
The model of a BLE service.
NimBLEService::NimBLEService | ( | const char * | uuid | ) |
Construct an instance of the NimBLEService.
[in] | uuid | The UUID of the service. |
NimBLEService::NimBLEService | ( | const NimBLEUUID & | uuid | ) |
Construct an instance of the BLEService.
[in] | uuid | The UUID of the service. |
void NimBLEService::addCharacteristic | ( | NimBLECharacteristic * | pCharacteristic | ) |
Add a characteristic to the service.
[in] | pCharacteristic | A pointer to the characteristic instance to add to the service. |
NimBLECharacteristic * NimBLEService::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.
[in] | uuid | - The UUID of the characteristic. |
[in] | properties | - The properties of the characteristic. |
[in] | max_len | - The maximum length in bytes that the characteristic value can hold. |
NimBLECharacteristic * NimBLEService::createCharacteristic | ( | const NimBLEUUID & | 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.
[in] | uuid | - The UUID of the characteristic. |
[in] | properties | - The properties of the characteristic. |
[in] | max_len | - The maximum length in bytes that the characteristic value can hold. |
NimBLECharacteristic * NimBLEService::getCharacteristic | ( | const char * | uuid, |
uint16_t | instanceId = 0 |
||
) |
Get a pointer to the characteristic object with the specified UUID.
[in] | uuid | The UUID of the characteristic. |
instanceId | The index of the characteristic to return (used when multiple characteristics have the same UUID). |
NimBLECharacteristic * NimBLEService::getCharacteristic | ( | const NimBLEUUID & | uuid, |
uint16_t | instanceId = 0 |
||
) |
Get a pointer to the characteristic object with the specified UUID.
[in] | uuid | The UUID of the characteristic. |
instanceId | The index of the characteristic to return (used when multiple characteristics have the same UUID). |
NimBLECharacteristic * NimBLEService::getCharacteristicByHandle | ( | uint16_t | handle | ) |
Get a pointer to the characteristic object with the specified handle.
handle | The handle of the characteristic. |
std::vector< NimBLECharacteristic * > NimBLEService::getCharacteristics | ( | ) |
std::vector< NimBLECharacteristic * > NimBLEService::getCharacteristics | ( | const char * | uuid | ) |
std::vector< NimBLECharacteristic * > NimBLEService::getCharacteristics | ( | const NimBLEUUID & | uuid | ) |
uint16_t NimBLEService::getHandle | ( | ) |
Get the handle associated with this service.
NimBLEServer * NimBLEService::getServer | ( | ) |
Get the BLE server associated with this service.
NimBLEUUID NimBLEService::getUUID | ( | ) |
Get the UUID of the service.
void NimBLEService::removeCharacteristic | ( | NimBLECharacteristic * | pCharacteristic, |
bool | deleteChr = false |
||
) |
Remove a characteristic from the service.
[in] | pCharacteristic | A pointer to the characteristic instance to remove from the service. |
[in] | deleteChr | If true it will delete the characteristic instance and free it's resources. |
bool NimBLEService::start | ( | ) |
Builds the database of characteristics/descriptors for the service and registers it with the NimBLE stack.
std::string NimBLEService::toString | ( | ) |
Return a string representation of this service. A service is defined by: