Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
|
Base class for a BLE service. More...
#include <cs_Service.h>
Public Types | |
enum | condition_t { C_SERVICE_INITIALIZED } |
Public Member Functions | |
Service () | |
virtual | ~Service () |
Default empty destructor. More... | |
void | init (Stack *stack) |
Initialize the service: register it at the softdevice. More... | |
void | setUUID (const UUID &uuid) |
Set the UUID. More... | |
Stack * | getStack () |
const UUID & | getUUID () const |
uint16_t | getHandle () |
tuple< CharacteristicBase * > | getCharacteristics () |
virtual void | createCharacteristics ()=0 |
void | onBleEvent (const ble_evt_t *event) |
void | onConnect (uint16_t connectionHandle, const ble_gap_evt_connected_t &event) |
void | onDisconnect (uint16_t connectionHandle, const ble_gap_evt_disconnected_t &event) |
bool | onWrite (const ble_gatts_evt_write_t &event, uint16_t gattHandle) |
void | onTxComplete (const ble_common_evt_t *event) |
void | addCharacteristic (CharacteristicBase *characteristic) |
Add a single characteristic to the list @characteristic Characteristic to add. More... | |
void | updatedCharacteristics () |
![]() | |
BaseClass () | |
bool | isInitialized (uint8_t i=0) |
void | setInitialized (uint8_t i=0) |
void | setUninitialized (uint8_t i=0) |
Private Attributes | |
Stack * | _stack = nullptr |
Back reference to the stack. More... | |
UUID | _uuid |
uint16_t | _handle = BLE_CONN_HANDLE_INVALID |
Service handle will be obtained from SoftDevice. More... | |
tuple< CharacteristicBase * > | _characteristics |
List of characteristics. More... | |
Base class for a BLE service.
enum Service::condition_t |
Service::Service | ( | ) |
|
inlinevirtual |
Default empty destructor.
We don't currently delete our characteristics as we don't really support dynamic service destruction. If we wanted to allow services to be removed at runtime, we would need to, amongst many other things, keep track of whether we allocated the characteristic or whether it was passed into us.
void Service::addCharacteristic | ( | CharacteristicBase * | characteristic | ) |
Add a single characteristic to the list @characteristic Characteristic to add.
|
pure virtual |
Implemented in CrownstoneService, DeviceInformationService, MicroappService, and SetupService.
|
inline |
|
inline |
|
inline |
|
inline |
void Service::init | ( | Stack * | stack | ) |
Initialize the service: register it at the softdevice.
void Service::onBleEvent | ( | const ble_evt_t * | event | ) |
void Service::onConnect | ( | uint16_t | connectionHandle, |
const ble_gap_evt_connected_t & | event | ||
) |
void Service::onDisconnect | ( | uint16_t | connectionHandle, |
const ble_gap_evt_disconnected_t & | event | ||
) |
void Service::onTxComplete | ( | const ble_common_evt_t * | event | ) |
bool Service::onWrite | ( | const ble_gatts_evt_write_t & | event, |
uint16_t | gattHandle | ||
) |
void Service::setUUID | ( | const UUID & | uuid | ) |
|
inline |
|
private |
List of characteristics.
|
private |
Service handle will be obtained from SoftDevice.
|
private |
Back reference to the stack.
|
private |