Human Interface Device Service (HIDS)
Overview
This module implements the Human Interface Device Service with the corresponding set of characteristics. During initialization, it adds the Human Interface Device Service and a set of characteristics as per the Human Interface Device Service specification and the user requirements to the Bluetooth LE stack database.
If enabled, notification of Input Report characteristics is performed when the application calls one of the corresponding functions:
Configuration
Set the CONFIG_BLE_HIDS Kconfig option to enable the service.
The HID service can be configured by using the following Kconfig options:
CONFIG_BLE_HIDS_BOOT_MOUSE- Adds the boot mouse input characteristic.CONFIG_BLE_HIDS_BOOT_KEYBOARD- Adds the boot keyboard input and output characteristics.CONFIG_BLE_HIDS_PROTOCOL_MODE_REPORT- Sets the default HID protocol mode to report mode.CONFIG_BLE_HIDS_PROTOCOL_MODE_BOOT- Sets the default HID protocol mode to boot mode.CONFIG_BLE_HIDS_INPUT_REPORT_MAX_NUM- Sets the number of input reports.CONFIG_BLE_HIDS_INPUT_REPORT_MAX_LEN- Sets the maximum length of the input reports.CONFIG_BLE_HIDS_OUTPUT_REPORT_MAX_NUM- Sets the number of output reports.CONFIG_BLE_HIDS_OUTPUT_REPORT_MAX_LEN- Sets the maximum length of the output reports.CONFIG_BLE_HIDS_FEATURE_REPORT_MAX_NUM- Sets the number of feature reports.CONFIG_BLE_HIDS_FEATURE_REPORT_MAX_LEN- Sets the maximum length of the feature reports.CONFIG_BLE_HIDS_MAX_CLIENTS- Sets the maximum number of HID clients.
Initialization
The service instance is declared using the BLE_HIDS_DEF macro, specifying the name of the instance.
The service is initialized by calling the ble_hids_init() function.
See the ble_hids_config struct for configuration details, in addition to the HID specification.
Usage
Events from the service are forwarded through the event handler specified during initialization.
For a full list of events see the ble_hids_evt_type enum.
The application can send input reports by calling the ble_hids_inp_rep_send() function.
Separate functions exist for sending boot keyboard and boot mouse input reports.
See the ble_hids_boot_kb_inp_rep_send() and ble_hids_boot_mouse_inp_rep_send() functions, respectively.
The application can get the current output reports by calling the ble_hids_outp_rep_get() function.
Usage of this service is demonstrated in the following samples:
Dependencies
This service has the following Bare Metal dependencies:
SoftDevice (peripheral role) -
CONFIG_SOFTDEVICE_PERIPHERALSoftDevice handler (Bluetooth LE) -
CONFIG_NRF_SDH_BLE
API documentation
include/bm/bluetooth/services/ble_hids.hsubsys/bluetooth/services/ble_hids/