This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

De-initialisation of custom BLE services

We are looking to implement "dynamic" BLE services that can be configured (i.e. enabled/disabled) externally, however from the examples there appears to be no way of de-initialising a service.

Most services have a *_init function, but no corresponding *_deinit function.

In this case what is the best/"canonical" way of achieving the disabling/enabling of a service without having to restart the device?

Parents Reply Children
  • Hello,

    Thanks for the reply.

    We are working on an application that provides both peripheral and central mode functionality via BLE. We require the SoftDevice to be enabled at all times. We already control the BLE stack as determined by the configuration of the module.

    The nrf52832 device is a slave to the our primary processor. The primary processor provides the configuration with which the nrf module needs to comply.

    When I mentioned BLE services I was referring to the services defined by a GATT profile (peripheral mode functionality, GATT server in the Infocenter language) that needs to be enabled/disabled dynamically as dictated by the current configuration provided by the primary processor.

    In the API for the SoftDevice S132 V6.0.0 GATT server API are there are *_add() and *_get() functions however no mention of removal/clearing/disabling

    As implied in the original question we are looking to have multiple custom services running side-by-side and any one of them can be enabled/disabled as the configuration dictates.

    Kind Regards,

    Alex

  • Hi Alex, 

    Thanks for providing the information! The only way to stop services is to disable the SoftDevice completely, re-enable it and configure it without the service you want to remove. Please see my colleague Torbjørn's answer here.

    Kind regards,
    Øyvind

  • Hi Øyvind,

    Thank you for that.

    Kind Regards,

    Alex

Related