GATT Human Interface Device Service (HIDS) Client

The HIDS Client uses the GATT Discovery Manager to acquire all attribute handles that are required to interact with the HIDS server.

Overview

Some additional data must be read from the discovered descriptors before the HIDS Client is ready. This process is started automatically just after the handles are assigned. If the process finishes successfully, the bt_hogp_ready_cb function is called. Otherwise, bt_hogp_prep_fail_cb is called.

Configuration

Use the following Kconfig options to configure the library:

  • CONFIG_BT_HOGP - Enable the library in the application build.

  • CONFIG_BT_HOGP_REPORTS_MAX - Set the maximum number of total reports supported by the library.

    The report memory is shared with all HIDS Client objects, so set this option to the maximum total number of reports supported by the application.

Usage

You can use the GATT HIDS Client library to interact with a connected HIDS server.

Retrieving the HIDS Client readiness state

The following functions are available to retrieve the readiness state of the service client object:

Reading the report map

To read the report map, call the bt_hogp_map_read() function. If the report map does not fit into a single PDU, call the function repeatedly with different offsets.

The HIDS report map interpretation implemented in the HIDS Client is not specifically supported.

Accessing the reports

To read or write a report, use one of the following functions:

To manage input report notifications, use the following functions:

The report size is always updated before the callback function is called while reading or notifying. It can be obtained by calling bt_hogp_rep_size().

All report operations require a report info pointer as input. How to retrieve this pointer depends on whether you are processing a normal report or a boot report.

Call the bt_hogp_rep_next() function to retrieve the report info pointer. This function iterates through all detected reports (excluding boot reports).

Use the bt_hogp_rep_find() function to find a specific report. This function locates a report based on its type and ID.

Changing protocol mode

To manage protocol modes, use the following functions:

  • bt_hogp_pm_write() - Switch between Boot Protocol Mode and Report Protocol Mode.

    Every time the protocol mode is changed, the bt_hogp_pm_update_cb function is called.

  • bt_hogp_pm_get() - Retrieve the current protocol.

    This function returns the internally cached version of the current protocol mode.

  • bt_hogp_pm_update() - Update the protocol mode value directly from the device.

Suspending and resuming

To suspend or resume the connected device, call the following functions:

Samples using the library

The following nRF Connect SDK modules use this library:

The following nRF Connect SDK application uses this library:

Additional information

Do not access any of the values in the bt_hogp object structure directly. All values that should be accessed have accessor functions. The structure is fully defined to allow the application to allocate the memory for it.

Dependencies

There are no dependencies for using this library.

API documentation

Header file: include/bluetooth/services/hogp.h
Source file: subsys/bluetooth/services/hogp.c
Bluetooth LE GATT HIDS Client API