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

Turning services like HID "on/off" without disconnect.

I have a nrf52832 based device with several GATT services which are used by custom IOS/Android applications via a paired phone.  All of this is working correctly.

I would like to add the HID over BLE service but I need to be able to "turn on and off" as needed without disconnect from phone because of other services.

So the question is: What is the best way to make a GATT service like HID unavailable when a phone is receiving notifications from from multiple GATT services?

  • Hi Michael

    I am not sure there is any way to make the entire service unavailable, but you could unsubscribe the report characteristics from the phone side (set the CCCD to 0). Then you will no longer receive notifications with new HID reports. 

    Would this not be sufficient?

    Best regards
    Torbjørn 

  • Hi Torbjørn,

    Thank you for your response.

    I will investigate setting the CCCD.  However, my preference is to not require the phone side to take any action.  This project is a replacement for a TI based device which does "turn on and off" the HID, per say.


    In this scenario an IOS application which brings up a keyboard has the keyboard go away and come back whenever the TI based device "turns on/off" the HID.  I know the Bluetooth Core specification supports dynamic removal of BLE services as does the Nordic BLE client.  The question is how do I do the equivalent of a remove_service to implement the dynamic removal of a service as in the Bluetooth core specification?

    Best Regards,

    Michael

  • Hi Michael

    You could always stop sending updates from the Nordic side, but I assume that would not be enough to hide the keyboard in the iOS application?

    Do you have more information on how the TI based device turns on/off the HID?
    Removing and adding services continuously during a BLE connection is not something BLE applications normally do. 

    While our SoftDevices support adding services dynamically, there is no way to remove individual services unfortunately. The only way to remove a service is to disable the SoftDevice completely, re-enable it, and add back only the services you need. This will take down the connection, and you would have to reconnect to the device, so it would probably not be very seamless to the user. 

    Can you let me know which chapter of the Bluetooth core specification you are referring to that describes the dynamic removal of services?

    Best regards
    Torbjørn

  • hello ,

     In the case, I  can see that "nordic's SoftDevices support adding services dynamically, there is no way to remove individual services unfortunately."

    Now we also want to achive the function which is asked by Michael, the answer  you can give is still like this ? Do the nordic's stack have updated to support this? 

    Mary

Related