disconnect() should have a version which takes a connection handle
This commit is contained in:
parent
716a8f6258
commit
77a3683918
2 changed files with 16 additions and 19 deletions
34
nRF51Gap.cpp
34
nRF51Gap.cpp
|
@ -265,24 +265,7 @@ ble_error_t nRF51Gap::connect(const Address_t peerAddr,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@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 @@ ble_error_t nRF51Gap::disconnect(DisconnectionReason_t reason)
|
|||
}
|
||||
|
||||
/* 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,
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue