ARMmbed / ble-nrf51822

Nordic stack and drivers for the mbed BLE_API
Other
46 stars 51 forks source link

Improve shutdown to clear BLE API and not just SD #87

Closed andresag01 closed 8 years ago

andresag01 commented 8 years ago

Improve the shutdown functionality, such that a call to ble.shutdown() from the user application clears the API and nRF5x state and NOT only the SoftDevice. To achieve this the following changes are introduced:

The shutdown procedure is as follows:

  1. The user calls ble.shutdown() which executes the code in nRF5xn::shutdown()
  2. The SoftDevice is shutdown
  3. The static members of Gap.h, SecurityManager.h, GattClient.h and GattServer.h are called to clean up their own state.

If at any point an error occur during the last step, BLE_ERROR_INVALID_STATE is returned.

NOTE: This enhancement also requires changes to the ble module @rgrover @pan- @LiyouZhou

andresag01 commented 8 years ago

@rgrover @pan- I have made changes according to comments in this pull request.

andresag01 commented 8 years ago

@rgrover @pan-: Made changes according to comments.

andresag01 commented 8 years ago

@rgrover made changes to make _gapInstance non-static

rgrover commented 8 years ago

@andresag01 I'm happy with this. Will wait for @pan-

pan- commented 8 years ago

It's alright, I'm looking for the next PR including onShutdown

rgrover commented 8 years ago

ble-nrf51822-2.2.7