This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to start / stop a DFU service from an application?

Hi, I have several services running in the application. one of them is DFU.

I have to hide / stop DFU service for example when the SOC of the battery is less than 50%. And show/start it again when the user plugs in the charger, for example


here is part of my code with DFU init:

...
  ble_dfu_buttonless_init_t dfus_init = {0};
  dfus_init.evt_handler = ble_dfu_evt_handler;

  err_code = ble_dfu_buttonless_init(&dfus_init);
  APP_ERROR_CHECK(err_code);
...

  • Hi Rakhneko, 

    In our softdevice architecture it's only possible to dynamically add a new service to the ATT table and not possible to remove a service/attribute. 

    The only way to remove a service/attribute is to uninitialize and reinitialize the BLE stack. 

    The other option is to add a condition in the DFU buttonless service telling the DFU master to stop the process (do not accept the command to switch to bootloader) if the battery is lower than a certain level. This way you don't need to modify the ATT table and doesn't need to reset the BLE connection. 

Related