Improve readability with getHandle inline
Fork of BLE_API by
Diff: public/GattServer.h
- Revision:
- 135:6cf6e7bd21c9
- Parent:
- 134:49321f76753e
- Child:
- 139:baaf1c5f0db2
--- a/public/GattServer.h Fri Nov 21 09:23:23 2014 +0000 +++ b/public/GattServer.h Fri Nov 21 09:23:23 2014 +0000 @@ -17,7 +17,6 @@ #ifndef __GATT_SERVER_H__ #define __GATT_SERVER_H__ -#include "blecommon.h" #include "GattService.h" #include "GattServerEvents.h" #include "GattCharacteristicWriteCBParams.h" @@ -37,6 +36,7 @@ virtual ble_error_t addService(GattService &) = 0; virtual ble_error_t readValue(uint16_t handle, uint8_t buffer[], uint16_t *const lengthP) = 0; virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t, bool localOnly = false) = 0; + virtual ble_error_t initializeGATTDatabase(void) = 0; // ToDo: For updateValue, check the CCCD to see if the value we are // updating has the notify or indicate bits sent, and if BOTH are set @@ -67,6 +67,12 @@ onConfirmationReceived = callback; } +protected: + GattServer() : serviceCount(0), characteristicCount(0), onDataSent(NULL), onDataWritten(), onUpdatesEnabled(NULL), onUpdatesDisabled(NULL), onConfirmationReceived(NULL) { + /* empty */ + } + +protected: void handleDataWrittenEvent(const GattCharacteristicWriteCBParams *params) { if (onDataWritten.hasCallbacksAttached()) { onDataWritten.call(params); @@ -100,14 +106,8 @@ } protected: - GattServer() : serviceCount(0), characteristicCount(0), onDataSent(NULL), onDataWritten(), onUpdatesEnabled(NULL), onUpdatesDisabled(NULL), onConfirmationReceived(NULL) { - /* empty */ - } - -protected: uint8_t serviceCount; uint8_t characteristicCount; - uint8_t descriptorCount; private: ServerEventCallbackWithCount_t onDataSent;