jgh

Dependents:   Migration

Fork of BLE_API by Bluetooth Low Energy

Revision:
544:840f428d18c7
Parent:
543:4defb791aa94
Child:
545:45bbdb1d5eca
diff -r 4defb791aa94 -r 840f428d18c7 public/BLE.h
--- a/public/BLE.h	Fri Jun 19 15:52:09 2015 +0100
+++ b/public/BLE.h	Fri Jun 19 15:52:09 2015 +0100
@@ -1080,16 +1080,30 @@
 
     /**
      * Used to setup a callback for GAP disconnection.
+     *
+     * @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.onDisconnection(callback) should be replaced with
+     * ble.gap().onDisconnection(callback).
      */
-    void onDisconnection(Gap::DisconnectionEventCallback_t disconnectionCallback);
+    void onDisconnection(Gap::DisconnectionEventCallback_t disconnectionCallback) {
+        gap().onDisconnection(disconnectionCallback);
+    }
 
     /**
      * Append to a chain of callbacks to be invoked upon disconnection; these
      * callbacks receive no context and are therefore different from the
      * onDisconnection callback.
+     *
+     * @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.addToDisconnectionCallchain(...) should be replaced with
+     * ble.gap().addToDisconnectionCallchain(...).
      */
     template<typename T>
-    void addToDisconnectionCallChain(T *tptr, void (T::*mptr)(void));
+    void addToDisconnectionCallChain(T *tptr, void (T::*mptr)(void)) {
+        gap().addToDisconnectionCallChain(tptr, mptr);
+    }
 
     /**
      * Add a callback for the GATT event DATA_SENT (which is triggered when
@@ -1179,18 +1193,6 @@
  * transport.*/
 
 inline void
-BLE::onDisconnection(Gap::DisconnectionEventCallback_t disconnectionCallback)
-{
-    gap().setOnDisconnection(disconnectionCallback);
-}
-
-template<typename T>
-inline void
-BLE::addToDisconnectionCallChain(T *tptr, void (T::*mptr)(void)) {
-    gap().addToDisconnectionCallChain(tptr, mptr);
-}
-
-inline void
 BLE::onDataSent(void (*callback)(unsigned count)) {
     transport->getGattServer().setOnDataSent(callback);
 }