None
Fork of nRF51822 by
Diff: source/nRF5xGap.cpp
- Revision:
- 570:f162898cb6c4
- Parent:
- 567:e1800bd55a9e
- Child:
- 571:bbf6410b6a89
diff -r 9e72aa06ec32 -r f162898cb6c4 source/nRF5xGap.cpp --- a/source/nRF5xGap.cpp Mon Jan 11 10:19:20 2016 +0000 +++ b/source/nRF5xGap.cpp Mon Jan 11 10:19:21 2016 +0000 @@ -14,20 +14,17 @@ * limitations under the License. */ -#include "nRF5xGap.h" +#include "nRF5xn.h" #include "mbed.h" +#include "ble/BLE.h" #include "common/common.h" #include "ble_advdata.h" #include "ble_hci.h" -nRF5xGap &nRF5xGap::getInstance() { - static nRF5xGap m_instance; - return m_instance; -} - void radioNotificationStaticCallback(bool param) { - nRF5xGap::getInstance().processRadioNotificationEvent(param); + nRF5xGap &gap = (nRF5xGap &) nRF5xn::Instance(BLE::DEFAULT_INSTANCE).getGap(); + gap.processRadioNotificationEvent(param); } /**************************************************************************/ @@ -338,6 +335,29 @@ /**************************************************************************/ /*! + @brief Clear nRF5xGap's state. + + @returns ble_error_t + + @retval BLE_ERROR_NONE + Everything executed properly +*/ +/**************************************************************************/ +ble_error_t nRF5xGap::reset(void) +{ + /* Clear all state that is from the parent, including private members */ + if (Gap::reset() != BLE_ERROR_NONE) { + return BLE_ERROR_INVALID_STATE; + } + + /* Clear derived class members */ + m_connectionHandle = BLE_CONN_HANDLE_INVALID; + + return BLE_ERROR_NONE; +} + +/**************************************************************************/ +/*! @brief Sets the 16-bit connection handle */ /**************************************************************************/