Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF5 SDK - missing close functions to match init functions

I'd like to be able to enable/disable the S140 SoftDevice multiple times during operation (SDK 14.2.0).  To achieve this I'm using `nrf_sdh_ble_enable` and `nrf_sdh_ble_disable` at the lowest level which appropriate SDH state observers to monitor state transitions between active, prepare and final states.

When disabling, I'd also like to be able to close all of the application services such as the peer manager, current time service, database discovery etc.  There appear to be missing API functions for deinitialisation of some services.

Some of the missing API's include:

  • `pm_close()` to match `pm_init()`.  Missing `pm_close()` means that peer manager cannot be closed down after SoftDevice disable.
  • `pm_deregister()`  The `pm_register()` call allows for event handlers to be added but never removed.
  • `ble_cts_c_close()` to match `ble_cts_c_init()`.
  • `ble_dfu_buttonless_close()` to match `ble_dfu_buttonless_init()`.

Some API's do include close functions, eg `ble_db_discovery_init()` / `ble_db_discovery_close()`.

Calling the existing `init` functions multiple times sometimes works if all internal state is correctly re-initialised on init.

I have examined the ble_app_gzll example which does SoftDevice enable/disable but this example doesn't use some of the API's I'm using such as the peer manager.

Are there plans to add the missing API functions or is there another preferred method to enable/disable the SoftDevice when using the existing APIs?

Parents Reply Children
  • Thanks for the feedback.  In keeping with the generally high quality of the nRF5 SDK I hope that symmetric init/deinit functions will be considered as part of new interfaces as this seems like a good practice to follow.  Are there any suggestions for how to enable/disable the SoftDevice during operation?  We were planning on shutting down the SoftDevice in some situations to save power, then re-enabling later.

Related