Skip to content

applications: gesture_recognition: refactor ble_hid to use HID Service from sdk-nrf#75

Open
grochu wants to merge 4 commits intomainfrom
feature/gr_use_bt_hids
Open

applications: gesture_recognition: refactor ble_hid to use HID Service from sdk-nrf#75
grochu wants to merge 4 commits intomainfrom
feature/gr_use_bt_hids

Conversation

@grochu
Copy link
Copy Markdown
Collaborator

@grochu grochu commented Mar 30, 2026

It's been agreed offline, that the application would benefit from using the ready Bluetooth HID Service module from the sdk-nrf repo, which will hide Zephyr Bluetooth API changes (migration will be handled on sdk-nrf level) and ensure quality of the service implementation. At the same time the HID Service API is quite stable, so it shouldn't generate too much maintenance in the add-on.

Not addressed in this PR:

@github-actions
Copy link
Copy Markdown

You can find the documentation preview for this PR here.

Comment on lines 267 to 273
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we start advertising if init fails?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, the consequence will be that the connected device won't see the whole HID service in our attribute table. Perhaps we can advertise without the HID UUID in the advertising data? Or should the application assert in that case?

@grochu grochu force-pushed the feature/gr_use_bt_hids branch from 0fe9e02 to 0789b11 Compare April 1, 2026 11:56
@grochu grochu requested review from Szynkaa, mbarchie and zycz April 1, 2026 12:09
@grochu grochu force-pushed the feature/gr_use_bt_hids branch from 0789b11 to 9dd090f Compare April 1, 2026 12:47
grochu added 4 commits April 3, 2026 14:49
Remove dependency to the bt_hids module (using its log level value).

Signed-off-by: Michał Grochala <michal.grochala@nordicsemi.no>

--to HID log level
Improve interoperability by adding the GAP Appearance value in the
advertising data as recommended by the HOGP specification.

Signed-off-by: Michał Grochala <michal.grochala@nordicsemi.no>
The application had a simple GATT HID Service implementation, It was
refactored to use the bt_hids module from sdk-nrf to simplify the
code and rely on the proper service implementation.

Details of updates:
- ble_hid.h API is unchanged
- ble_hid.c uses hids.c from sdk-nrf
- reduced the attribute value length for the consumer control report
  to 1 byte to comply the report map char. (previously 2 bytes were
  transmitted)

Consequence:
- migrate from static (build-time) attribute definition through
  BT_GATT_SERVICE_DEFINE() macro to dynamic definition using
  bt_gatt_service_register() function as implied by BT_GATT_POOL
  used by BT_HIDS
- increase of ROM (~7KB) and RAM (~1.5KB) footprint

Ref. NCSDK-37242

Signed-off-by: Michał Grochala <michal.grochala@nordicsemi.no>
Gesture Recognition now uses The Bluetooth HID Service subsystem in the
HID interface configuration so it needs to be mentioned in
the Dependencies section.

Signed-off-by: Michał Grochala <michal.grochala@nordicsemi.no>
@grochu grochu force-pushed the feature/gr_use_bt_hids branch from 9dd090f to cf6a57a Compare April 3, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants