Goran Mahovlic / nRF51822_BLE_MIDI

Dependents:   BLE_MIDI

Fork of nRF51822 by Nordic Semiconductor

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Fri Jun 19 15:55:37 2015 +0100
Parent:
357:68c0de4426f1
Child:
359:64918eb1ead2
Commit message:
Synchronized with git rev 77a36839
Author: Rohit Grover
disconnect() should have a version which takes a connection handle

Changed in this revision

nRF51Gap.cpp Show annotated file Show diff for this revision Revisions of this file
nRF51Gap.h Show annotated file Show diff for this revision Revisions of this file
--- a/nRF51Gap.cpp	Fri Jun 19 15:55:37 2015 +0100
+++ b/nRF51Gap.cpp	Fri Jun 19 15:55:37 2015 +0100
@@ -265,24 +265,7 @@
     }
 }
 
-
-/**************************************************************************/
-/*!
-    @brief  Disconnects if we are connected to a central device
-
-    @returns    ble_error_t
-
-    @retval     BLE_ERROR_NONE
-                Everything executed properly
-
-    @section EXAMPLE
-
-    @code
-
-    @endcode
-*/
-/**************************************************************************/
-ble_error_t nRF51Gap::disconnect(DisconnectionReason_t reason)
+ble_error_t nRF51Gap::disconnect(Handle_t connectionHandle, DisconnectionReason_t reason)
 {
     state.advertising = 0;
     state.connected   = 0;
@@ -300,11 +283,24 @@
     }
 
     /* Disconnect if we are connected to a central device */
-    ASSERT_INT(ERROR_NONE, sd_ble_gap_disconnect(m_connectionHandle, code), BLE_ERROR_PARAM_OUT_OF_RANGE);
+    ASSERT_INT(ERROR_NONE, sd_ble_gap_disconnect(connectionHandle, code), BLE_ERROR_PARAM_OUT_OF_RANGE);
 
     return BLE_ERROR_NONE;
 }
 
+/*!
+    @brief  Disconnects if we are connected to a central device
+
+    @returns    ble_error_t
+
+    @retval     BLE_ERROR_NONE
+                Everything executed properly
+*/
+ble_error_t nRF51Gap::disconnect(DisconnectionReason_t reason)
+{
+    return disconnect(m_connectionHandle, reason);
+}
+
 ble_error_t nRF51Gap::getPreferredConnectionParams(ConnectionParams_t *params)
 {
     ASSERT_INT(NRF_SUCCESS,
--- a/nRF51Gap.h	Fri Jun 19 15:55:37 2015 +0100
+++ b/nRF51Gap.h	Fri Jun 19 15:55:37 2015 +0100
@@ -52,6 +52,7 @@
     virtual ble_error_t startAdvertising(const GapAdvertisingParams &);
     virtual ble_error_t stopAdvertising(void);
     virtual ble_error_t connect(const Address_t, Gap::AddressType_t peerAddrType, const ConnectionParams_t *connectionParams, const GapScanningParams *scanParams);
+    virtual ble_error_t disconnect(Handle_t connectionHandle, DisconnectionReason_t reason);
     virtual ble_error_t disconnect(DisconnectionReason_t reason);
 
     virtual ble_error_t setDeviceName(const uint8_t *deviceName);