Bike service

Fork of BLE_API by Bluetooth Low Energy

Revision:
551:d79a7933a6d1
Parent:
550:35b3962903af
Child:
552:9bf985a8a49b
diff -r 35b3962903af -r d79a7933a6d1 public/BLE.h
--- a/public/BLE.h	Fri Jun 19 15:52:10 2015 +0100
+++ b/public/BLE.h	Fri Jun 19 15:52:10 2015 +0100
@@ -1172,7 +1172,8 @@
     }
 
     /**
-     * Setup a callback for when a characteristic is being read by a client.
+     * Setup a callback to be invoked on the peripheral when an attribute is
+     * being read by a remote client.
      *
      * @Note: this functionality may not be available on all underlying stacks.
      * You could use GattCharacteristic::setReadAuthorizationCallback() as an
@@ -1188,9 +1189,18 @@
      *
      * @return BLE_ERROR_NOT_IMPLEMENTED if this functionality isn't available;
      *         else BLE_ERROR_NONE.
+     *
+     * @note: This API is now *deprecated* and will be dropped in the future.
+     * You should use the parallel API from GattServer directly. A former call
+     * to ble.onDataRead(...) should be replaced with
+     * ble.gattServer().onDataRead(...).
      */
-    ble_error_t onDataRead(void (*callback)(const GattReadCallbackParams *eventDataP));
-    template <typename T> ble_error_t onDataRead(T * objPtr, void (T::*memberPtr)(const GattReadCallbackParams *context));
+    ble_error_t onDataRead(void (*callback)(const GattReadCallbackParams *eventDataP)) {
+        return gattServer().onDataRead(callback);
+    }
+    template <typename T> ble_error_t onDataRead(T * objPtr, void (T::*memberPtr)(const GattReadCallbackParams *context)) {
+        return gattServer().onDataRead(objPtr, memberPtr);
+    }
 
     /**
      * Setup a callback for when notifications/indications are enabled for a
@@ -1300,16 +1310,6 @@
 /* BLE methods. Most of these simply forward the calls to the underlying
  * transport.*/
 
-inline ble_error_t
-BLE::onDataRead(void (*callback)(const GattReadCallbackParams *eventDataP)) {
-    return transport->getGattServer().setOnDataRead(callback);
-}
-
-template <typename T> inline ble_error_t
-BLE::onDataRead(T *objPtr, void (T::*memberPtr)(const GattReadCallbackParams *context)) {
-    return transport->getGattServer().setOnDataRead(objPtr, memberPtr);
-}
-
 inline void
 BLE::onUpdatesDisabled(GattServer::EventCallback_t callback)
 {