High level Bluetooth Low Energy API and radio abstraction layer

Dependencies:   nRF51822

Dependents:   LinkNode_LIS3DH

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Fri Jun 19 15:52:10 2015 +0100
Parent:
551:d79a7933a6d1
Child:
553:434770194877
Commit message:
Synchronized with git rev 5c2e63a2
Author: Rohit Grover
fix GattServer::onUpdatesDisabled()

Changed in this revision

public/BLE.h Show annotated file Show diff for this revision Revisions of this file
public/GattServer.h Show annotated file Show diff for this revision Revisions of this file
--- a/public/BLE.h	Fri Jun 19 15:52:10 2015 +0100
+++ b/public/BLE.h	Fri Jun 19 15:52:10 2015 +0100
@@ -1215,7 +1215,19 @@
         gattServer().onUpdatesEnabled(callback);
     }
 
-    void onUpdatesDisabled(GattServer::EventCallback_t callback);
+    /**
+     * Setup a callback for when notifications/indications are disabled for a
+     * characteristic on the local GattServer.
+     *
+     * @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.onUpdatesEnabled(...) should be replaced with
+     * ble.gattServer().onUpdatesEnabled(...).
+     */
+    void onUpdatesDisabled(GattServer::EventCallback_t callback) {
+        gattServer().onUpdatesDisabled(callback);
+    }
+
     void onConfirmationReceived(GattServer::EventCallback_t callback);
 
     /**
@@ -1311,12 +1323,6 @@
  * transport.*/
 
 inline void
-BLE::onUpdatesDisabled(GattServer::EventCallback_t callback)
-{
-    transport->getGattServer().setOnUpdatesDisabled(callback);
-}
-
-inline void
 BLE::onConfirmationReceived(GattServer::EventCallback_t callback)
 {
     transport->getGattServer().setOnConfirmationReceived(callback);
--- a/public/GattServer.h	Fri Jun 19 15:52:10 2015 +0100
+++ b/public/GattServer.h	Fri Jun 19 15:52:10 2015 +0100
@@ -38,7 +38,7 @@
         dataWrittenCallChain(),
         dataReadCallChain(),
         updatesEnabledCallback(NULL),
-        onUpdatesDisabled(NULL),
+        updatesDisabledCallback(NULL),
         onConfirmationReceived(NULL) {
         /* empty */
     }
@@ -230,9 +230,14 @@
      * Setup a callback for when notifications/indications are enabled for a
      * characteristic on the local GattServer.
      */
-    void onUpdatesEnabled(EventCallback_t callback)          {updatesEnabledCallback = callback;}
+    void onUpdatesEnabled(EventCallback_t callback) {updatesEnabledCallback = callback;}
 
-    void setOnUpdatesDisabled(EventCallback_t callback)      {onUpdatesDisabled      = callback;}
+    /**
+     * Setup a callback for when notifications/indications are disabled for a
+     * characteristic on the local GattServer.
+     */
+    void onUpdatesDisabled(EventCallback_t callback) {updatesDisabledCallback = callback;}
+
     void setOnConfirmationReceived(EventCallback_t callback) {onConfirmationReceived = callback;}
 
 protected:
@@ -256,8 +261,8 @@
                 }
                 break;
             case GattServerEvents::GATT_EVENT_UPDATES_DISABLED:
-                if (onUpdatesDisabled) {
-                    onUpdatesDisabled(charHandle);
+                if (updatesDisabledCallback) {
+                    updatesDisabledCallback(charHandle);
                 }
                 break;
             case GattServerEvents::GATT_EVENT_CONFIRMATION_RECEIVED:
@@ -285,7 +290,7 @@
     CallChainOfFunctionPointersWithContext<const GattWriteCallbackParams *> dataWrittenCallChain;
     CallChainOfFunctionPointersWithContext<const GattReadCallbackParams *>  dataReadCallChain;
     EventCallback_t                                                         updatesEnabledCallback;
-    EventCallback_t                                                         onUpdatesDisabled;
+    EventCallback_t                                                         updatesDisabledCallback;
     EventCallback_t                                                         onConfirmationReceived;
 
 private: