Possible to update HID report map dynamically while connected?

Hi guys. I have several questions when testing the ble_app_hids_keyboard_pca10056_s113 project from 17.1.0 nRF5 SDK.

I'm working on a wireless keyboard "add-on" project:

[A] nRF52840 keyboard: This is the main board acting as the HID Bluetooth keyboard. This main board has exposed connector pins.

[B] Add-on daughter boards: The boards that connect to the exposed connector pins. Multiple add-ons can be added.

EX: Mouse, Touchpad, JoyStick, etc will be added to the nRF52 main board.

When there is no add-ons, I want the HID report map be the keyboard, identical to the le_app_hids_keyboard example.

If an add-on is detected, I wish to modify the HID report map.

Suppose when the nRF52 is powered and the HID report map is set to a keyboard.

While the nRF52 is connected to a BLE central (ex: Android phone, iPhone, Windows, etc), is it possible to change the report map (report_map_data) depending on the add-on?

Or do I have disconnect first /  reset or re-init the HID service before connecting to the BLE central?

Thank you so much for your help!

  • Hi 

    It is not common for a HID device to dynamically change it's HID report, and I doubt this is supported by most phones or PC's. 

    I think the most reliable solution in this case is simply to set up the HID descriptor with all possible features included, and then only send updates on those reports where you actually have the hardware attached. 

    Alternatively I would recommend only reconfiguring the HID report map when you're outside a connection, and keeping the HID report map static within a bond/connection.  

    Best regards
    Torbjørn

  • Thank you Torbjørn. May I ask one last question?

    Alternatively I would recommend only reconfiguring the HID report map when you're outside a connection, and keeping the HID report map static within a bond/connection.  

    If the nRF52 re-configures the HID report map while disconnected, does this mean re-bonding is required?

    When changing the HID report map, I thought the HID characteristics have to change

    (ex: have additional input/output reports due to the change of the report map).

    Since the HID characteristic will be added additionally, changing the characteristic handle values, shouldn't the nRF52 re-bond with the central?

  • Hi 

    There is a so called 'Service Changed Characteristic' that is included in the GATT service, and with this one it is possible to inform the GATT client (phone/PC) that the attribute table in the server is changed. Potentially it might be possible to use this to have the client refresh the characteristics and services when you want to make changes to the HID report descriptor. 

    The issue as I mentioned is that I don't know how well this would be supported across various operating systems and devices. 

    The safer way would be to remove the bond on both sides and pair and bond again. You just need to make sure that you remove the bond on both sides, otherwise the connection might fail as one of the devices try to re-enable encryption using the old bond information. 

    Best regards
    Torbjørn

Related