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/BLEDevice.h
- Revision:
- 259:a95264ad705c
- Parent:
- 257:7a50601356cc
- Child:
- 260:ea7f9f14cc15
diff -r 85de85adfac7 -r a95264ad705c public/BLEDevice.h --- a/public/BLEDevice.h Wed Jan 21 09:32:48 2015 +0000 +++ b/public/BLEDevice.h Wed Jan 21 09:32:48 2015 +0000 @@ -225,8 +225,16 @@ /** * Setup a callback for the GATT event DATA_SENT. + * + * @Note: it is possible to chain together multiple onDataSent callbacks + * (potentially from different modules of an application) to receive updates + * to characteristics. + * + * @Note: it is also possible to setup a callback into a member function of + * some object. */ - void onDataSent(GattServer::ServerEventCallbackWithCount_t callback); + void onDataSent(void (*callback)(unsigned count)); + template <typename T> void onDataSent(T * objPtr, void (T::*memberPtr)(unsigned count)); /** * Setup a callback for when a characteristic has its value updated by a @@ -525,11 +533,15 @@ } inline void -BLEDevice::onDataSent(GattServer::ServerEventCallbackWithCount_t callback) -{ +BLEDevice::onDataSent(void (*callback)(unsigned count)) { transport->getGattServer().setOnDataSent(callback); } +template <typename T> inline void +BLEDevice::onDataSent(T *objPtr, void (T::*memberPtr)(unsigned count)) { + transport->getGattServer().setOnDataSent(objPtr, memberPtr); +} + inline void BLEDevice::onDataWritten(void (*callback)(const GattCharacteristicWriteCBParams *eventDataP)) { transport->getGattServer().setOnDataWritten(callback);