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:53:06 2015 +0100
Parent:
705:ac12a644580d
Child:
707:94cea82e7d2c
Commit message:
Synchronized with git rev 9183583f
Author: Rohit Grover
disconnect() should take a connection handle.

Changed in this revision

public/BLE.h Show annotated file Show diff for this revision Revisions of this file
public/Gap.h Show annotated file Show diff for this revision Revisions of this file
--- a/public/BLE.h	Fri Jun 19 15:53:06 2015 +0100
+++ b/public/BLE.h	Fri Jun 19 15:53:06 2015 +0100
@@ -661,6 +661,19 @@
      * be communicated to the application with an invocation of the
      * onDisconnection callback.
      *
+     * @param[in] connectionHandle
+     * @param[in] reason
+     *              The reason for disconnection to be sent back to the peer.
+     */
+    ble_error_t disconnect(Gap::Handle_t connectionHandle, Gap::DisconnectionReason_t reason) {
+        return gap().disconnect(connectionHandle, reason);
+    }
+
+    /**
+     * This call initiates the disconnection procedure, and its completion will
+     * be communicated to the application with an invocation of the
+     * onDisconnection callback.
+     *
      * @param  reason
      *           The reason for disconnection to be sent back to the peer.
      *
@@ -668,6 +681,11 @@
      * You should use the parallel API from Gap directly. A former call to
      * ble.disconnect(reason) should be replaced with
      * ble.gap().disconnect(reason).
+     *
+     * @note: this version of disconnect() doesn't take a connection handle. It
+     * will work reliably only for stacks which are limited to a single
+     * connection. This API should be considered *deprecated* in favour of the
+     * alternative which takes a connection handle. It will be dropped in the future.
      */
     ble_error_t disconnect(Gap::DisconnectionReason_t reason) {
         return gap().disconnect(reason);
--- a/public/Gap.h	Fri Jun 19 15:53:06 2015 +0100
+++ b/public/Gap.h	Fri Jun 19 15:53:06 2015 +0100
@@ -74,7 +74,7 @@
         unsigned connected   : 1; /**< peripheral is connected to a central */
     };
 
-    typedef uint16_t Handle_t;
+    typedef uint16_t Handle_t; /* Type for connection handle. */
 
     typedef struct {
         uint16_t minConnectionInterval;      /**< Minimum Connection Interval in 1.25 ms units, see @ref BLE_GAP_CP_LIMITS.*/
@@ -230,6 +230,23 @@
      * @param  reason
      *           The reason for disconnection to be sent back to the peer.
      */
+    virtual ble_error_t disconnect(Handle_t connectionHandle, DisconnectionReason_t reason) {
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
+    }
+
+    /**
+     * This call initiates the disconnection procedure, and its completion will
+     * be communicated to the application with an invocation of the
+     * disconnectionCallback.
+     *
+     * @param  reason
+     *           The reason for disconnection to be sent back to the peer.
+     *
+     * @note: this version of disconnect() doesn't take a connection handle. It
+     * will work reliably only for stacks which are limited to a single
+     * connection. This API should be considered *deprecated* in favour of the
+     * altertive which takes a connection handle. It will be dropped in the future.
+     */
     virtual ble_error_t disconnect(DisconnectionReason_t reason) {
         return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }