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 Bluetooth Low Energy

Revision:
294:ab928e365ea1
Parent:
293:6278354cfd98
Child:
295:4883b219983a
--- a/public/BLEDevice.h	Mon Mar 02 11:50:47 2015 +0000
+++ b/public/BLEDevice.h	Mon Mar 02 11:50:47 2015 +0000
@@ -252,6 +252,20 @@
     void onDataWritten(void (*callback)(const GattCharacteristicWriteCBParams *eventDataP));
     template <typename T> void onDataWritten(T * objPtr, void (T::*memberPtr)(const GattCharacteristicWriteCBParams *context));
 
+    /**
+     * Setup a callback for when a characteristic is being read by a client.
+     *
+     * @Note: it is possible to chain together multiple onDataRead callbacks
+     * (potentially from different modules of an application) to receive updates
+     * to characteristics. Services may add their own onDataRead callbacks
+     * behind the scenes to trap interesting events.
+     *
+     * @Note: it is also possible to setup a callback into a member function of
+     * some object.
+     */
+    ble_error_t onDataRead(void (*callback)(const GattCharacteristicReadCBParams *eventDataP));
+    template <typename T> ble_error_t onDataRead(T * objPtr, void (T::*memberPtr)(const GattCharacteristicReadCBParams *context));
+
     void onUpdatesEnabled(GattServer::EventCallback_t callback);
     void onUpdatesDisabled(GattServer::EventCallback_t callback);
     void onConfirmationReceived(GattServer::EventCallback_t callback);
@@ -553,6 +567,16 @@
     transport->getGattServer().setOnDataWritten(objPtr, memberPtr);
 }
 
+inline ble_error_t
+BLEDevice::onDataRead(void (*callback)(const GattCharacteristicReadCBParams *eventDataP)) {
+    return transport->getGattServer().setOnDataRead(callback);
+}
+
+template <typename T> inline ble_error_t
+BLEDevice::onDataRead(T *objPtr, void (T::*memberPtr)(const GattCharacteristicReadCBParams *context)) {
+    return transport->getGattServer().setOnDataRead(objPtr, memberPtr);
+}
+
 inline void
 BLEDevice::onUpdatesEnabled(GattServer::EventCallback_t callback)
 {