Lightly modified version of the BLE stack, that doesn't bring up a DFUService by default... as we have our own.
Fork of BLE_API by
Diff: public/GattServer.h
- Revision:
- 143:8bdf577b1598
- Parent:
- 140:407d134c179d
- Child:
- 258:85de85adfac7
--- a/public/GattServer.h Fri Nov 21 09:23:24 2014 +0000 +++ b/public/GattServer.h Fri Nov 21 09:23:24 2014 +0000 @@ -22,15 +22,7 @@ #include "GattCharacteristicWriteCBParams.h" #include "CallChainOfFunctionPointersWithContext.h" -/**************************************************************************/ -/*! - \brief - The base class used to abstract GATT Server functionality to a specific - radio transceiver, SOC or BLE Stack. -*/ -/**************************************************************************/ -class GattServer -{ +class GattServer { public: /* Event callback handlers. */ typedef void (*EventCallback_t)(uint16_t attributeHandle); @@ -55,25 +47,15 @@ // be sure to call sd_ble_gatts_hvx() twice with notify then indicate! // Strange use case, but valid and must be covered! - void setOnDataSent(ServerEventCallbackWithCount_t callback) { - onDataSent = callback; - } - void setOnDataWritten(void (*callback)(const GattCharacteristicWriteCBParams *eventDataP)) { - onDataWritten.add(callback); - } + void setOnDataSent(ServerEventCallbackWithCount_t callback) {onDataSent = callback;} + void setOnDataWritten(void (*callback)(const GattCharacteristicWriteCBParams *eventDataP)) {onDataWritten.add(callback);} template <typename T> void setOnDataWritten(T *objPtr, void (T::*memberPtr)(const GattCharacteristicWriteCBParams *context)) { onDataWritten.add(objPtr, memberPtr); } - void setOnUpdatesEnabled(EventCallback_t callback) { - onUpdatesEnabled = callback; - } - void setOnUpdatesDisabled(EventCallback_t callback) { - onUpdatesDisabled = callback; - } - void setOnConfirmationReceived(EventCallback_t callback) { - onConfirmationReceived = callback; - } + void setOnUpdatesEnabled(EventCallback_t callback) {onUpdatesEnabled = callback;} + void setOnUpdatesDisabled(EventCallback_t callback) {onUpdatesDisabled = callback;} + void setOnConfirmationReceived(EventCallback_t callback) {onConfirmationReceived = callback;} protected: void handleDataWrittenEvent(const GattCharacteristicWriteCBParams *params) { @@ -120,7 +102,7 @@ EventCallback_t onConfirmationReceived; private: - /* disallow copy and assginment */ + /* disallow copy and assignment */ GattServer(const GattServer &); GattServer& operator=(const GattServer &); };