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:
553:434770194877
Child:
555:d31907908234
Commit message:
Synchronized with git rev 16658a5f
Author: Rohit Grover
fix GattServer::onConfirmationReceived()

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
@@ -1228,7 +1228,18 @@
         gattServer().onUpdatesDisabled(callback);
     }
 
-    void onConfirmationReceived(GattServer::EventCallback_t callback);
+    /**
+     * Setup a callback for when the GATT server receives a response for an
+     * indication event sent previously.
+     *
+     * @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.onConfirmationReceived(callback) should be replaced with
+     * ble.gattServer().onConfirmationReceived(callback).
+     */
+    void onConfirmationReceived(GattServer::EventCallback_t callback) {
+        gattServer().onConfirmationReceived(callback);
+    }
 
     /**
      * Setup a callback for when the security setup procedure (key generation
@@ -1319,13 +1330,4 @@
 typedef BLE BLEDevice; /* DEPRECATED. This type alias is retained for the sake of compatibility with older
                         * code. Will be dropped at some point soon.*/
 
-/* BLE methods. Most of these simply forward the calls to the underlying
- * transport.*/
-
-inline void
-BLE::onConfirmationReceived(GattServer::EventCallback_t callback)
-{
-    transport->getGattServer().setOnConfirmationReceived(callback);
-}
-
 #endif // ifndef __BLE_H__
\ No newline at end of file
--- a/public/GattServer.h	Fri Jun 19 15:52:10 2015 +0100
+++ b/public/GattServer.h	Fri Jun 19 15:52:10 2015 +0100
@@ -39,7 +39,7 @@
         dataReadCallChain(),
         updatesEnabledCallback(NULL),
         updatesDisabledCallback(NULL),
-        onConfirmationReceived(NULL) {
+        confirmationReceivedCallback(NULL) {
         /* empty */
     }
 
@@ -238,7 +238,11 @@
      */
     void onUpdatesDisabled(EventCallback_t callback) {updatesDisabledCallback = callback;}
 
-    void setOnConfirmationReceived(EventCallback_t callback) {onConfirmationReceived = callback;}
+    /**
+     * Setup a callback for when the GATT server receives a response for an
+     * indication event sent previously.
+     */
+    void onConfirmationReceived(EventCallback_t callback) {confirmationReceivedCallback = callback;}
 
 protected:
     void handleDataWrittenEvent(const GattWriteCallbackParams *params) {
@@ -266,8 +270,8 @@
                 }
                 break;
             case GattServerEvents::GATT_EVENT_CONFIRMATION_RECEIVED:
-                if (onConfirmationReceived) {
-                    onConfirmationReceived(charHandle);
+                if (confirmationReceivedCallback) {
+                    confirmationReceivedCallback(charHandle);
                 }
                 break;
             default:
@@ -291,7 +295,7 @@
     CallChainOfFunctionPointersWithContext<const GattReadCallbackParams *>  dataReadCallChain;
     EventCallback_t                                                         updatesEnabledCallback;
     EventCallback_t                                                         updatesDisabledCallback;
-    EventCallback_t                                                         onConfirmationReceived;
+    EventCallback_t                                                         confirmationReceivedCallback;
 
 private:
     /* disallow copy and assignment */