Minor temporary patch to allow DFU packet callback

Fork of BLE_API by Bluetooth Low Energy

Revision:
296:931da9973b89
Parent:
295:4883b219983a
Child:
297:7036ac0bd496
--- a/public/BLEDevice.h	Mon Mar 02 11:50:47 2015 +0000
+++ b/public/BLEDevice.h	Mon Mar 02 11:50:47 2015 +0000
@@ -250,6 +250,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);
@@ -551,6 +565,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)
 {