From 2c80818744c3b8987ac0e63fd7b2e90705276098 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 3 Dec 2014 09:48:22 +0000 Subject: [PATCH 1/2] remove un-necessary comment blocks. --- nRF51822n.cpp | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/nRF51822n.cpp b/nRF51822n.cpp index 664b08e..9a59493 100644 --- a/nRF51822n.cpp +++ b/nRF51822n.cpp @@ -36,20 +36,10 @@ createBLEDeviceInstance(void) return (&deviceInstance); } -/**************************************************************************/ -/*! - @brief Constructor -*/ -/**************************************************************************/ nRF51822n::nRF51822n(void) { } -/**************************************************************************/ -/*! - @brief Destructor -*/ -/**************************************************************************/ nRF51822n::~nRF51822n(void) { } @@ -89,22 +79,6 @@ ble_error_t nRF51822n::setTxPower(int8_t txPower) return BLE_ERROR_NONE; } -/**************************************************************************/ -/*! - @brief Initialises anything required to start using BLE - - @returns ble_error_t - - @retval BLE_ERROR_NONE - Everything executed properly - - @section EXAMPLE - - @code - - @endcode -*/ -/**************************************************************************/ ble_error_t nRF51822n::init(void) { /* ToDo: Clear memory contents, reset the SD, etc. */ @@ -115,23 +89,6 @@ ble_error_t nRF51822n::init(void) return BLE_ERROR_NONE; } -/**************************************************************************/ -/*! - @brief Resets the BLE HW, removing any existing services and - characteristics - - @returns ble_error_t - - @retval BLE_ERROR_NONE - Everything executed properly - - @section EXAMPLE - - @code - - @endcode -*/ -/**************************************************************************/ ble_error_t nRF51822n::reset(void) { nrf_delay_us(500000); From 5c80717d97bfbfabf55c111c0398e5d3e9d61ad2 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 3 Dec 2014 11:45:02 +0000 Subject: [PATCH 2/2] add support for shutdown(). This API allows for the GATT/GAP state to be purged. --- nRF51822n.cpp | 7 +++++++ nRF51822n.h | 1 + 2 files changed, 8 insertions(+) diff --git a/nRF51822n.cpp b/nRF51822n.cpp index 9a59493..e0578ad 100644 --- a/nRF51822n.cpp +++ b/nRF51822n.cpp @@ -21,6 +21,8 @@ #include "btle/btle.h" #include "nrf_delay.h" +#include "softdevice_handler.h" + /** * The singleton which represents the nRF51822 transport for the BLEDevice. */ @@ -89,6 +91,11 @@ ble_error_t nRF51822n::init(void) return BLE_ERROR_NONE; } +ble_error_t nRF51822n::shutdown(void) +{ + return (softdevice_handler_sd_disable() == NRF_SUCCESS) ? BLE_ERROR_NONE : BLE_STACK_BUSY; +} + ble_error_t nRF51822n::reset(void) { nrf_delay_us(500000); diff --git a/nRF51822n.h b/nRF51822n.h index 2db49e0..7babf51 100644 --- a/nRF51822n.h +++ b/nRF51822n.h @@ -46,6 +46,7 @@ public: virtual ble_error_t setTxPower(int8_t txPower); virtual ble_error_t init(void); + virtual ble_error_t shutdown(void); virtual ble_error_t reset(void); virtual void waitForEvent(void); };