nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches
Bluetooth LE GATT Human Interface Device Service API

API for the Bluetooth LE GATT Human Interface Device (HID) Service. More...

Data Structures

struct  bt_hids_info
 HID Service information. More...
 
struct  bt_hids_rep
 Report data. More...
 
struct  bt_hids_inp_rep
 Input Report. More...
 
struct  bt_hids_outp_feat_rep
 Output or Feature Report. More...
 
struct  bt_hids_boot_mouse_inp_rep
 Boot Mouse Input Report. More...
 
struct  bt_hids_boot_kb_inp_rep
 Boot Keyboard Input Report. More...
 
struct  bt_hids_boot_kb_outp_rep
 Boot Keyboard Output Report. More...
 
struct  bt_hids_inp_rep_group
 Collection of all input reports. More...
 
struct  bt_hids_outp_rep_group
 Collection of all output reports. More...
 
struct  bt_hids_feat_rep_group
 Collection of all feature reports. More...
 
struct  bt_hids_rep_map
 Report Map. More...
 
struct  bt_hids_pm_data
 Protocol Mode. More...
 
struct  bt_hids_cp
 Control Point. More...
 
struct  bt_hids_init_param
 HID initialization. More...
 
struct  bt_hids
 HID Service structure. More...
 
struct  bt_hids_conn_data
 HID Connection context data structure. More...
 

Macros

#define CONFIG_BT_HIDS_INPUT_REP_MAX   0
 
#define CONFIG_BT_HIDS_OUTPUT_REP_MAX   0
 
#define CONFIG_BT_HIDS_FEATURE_REP_MAX   0
 
#define BT_HIDS_BOOT_MOUSE_REP_LEN   3
 
#define BT_HIDS_BOOT_KB_INPUT_REP_LEN   8
 
#define BT_HIDS_BOOT_KB_OUTPUT_REP_LEN   1
 
#define BT_HIDS_INFORMATION_LEN   4
 
#define BT_HIDS_SCI_INFORMATION_MAX_GROUPS   BT_CONN_LE_MAX_CONN_INTERVAL_GROUPS
 
#define BT_HIDS_SCI_INFORMATION_MAX_LEN   (1 + 1 + BT_HIDS_SCI_INFORMATION_MAX_GROUPS * (2 + 2 + 2))
 
#define BT_HIDS_SCI_INFORMATION_MIN_LEN   2
 
#define BT_HIDS_MAX_MINIMAL_TRANSPORT_INTERVAL_US   1250
 
#define BT_HIDS_DEF(_name, ...)
 Declare a HIDS instance.
 

Typedefs

typedef void(* bt_hids_notify_handler_t) (enum bt_hids_notify_evt evt)
 HID notification event handler.
 
typedef void(* bt_hids_notify_ext_handler_t) (uint8_t report_id, enum bt_hids_notify_evt evt)
 HID notification event handler, with report identification.
 
typedef void(* bt_hids_rep_handler_t) (struct bt_hids_rep *rep, struct bt_conn *conn, bool write)
 HID Report event handler.
 
typedef void(* bt_hids_pm_evt_handler_t) (enum bt_hids_pm_evt evt, struct bt_conn *conn)
 HID Protocol Mode event handler.
 
typedef void(* bt_hids_cp_evt_handler_t) (enum bt_hids_cp_evt evt)
 HID Control Point event handler.
 
typedef void(* bt_hids_conn_cp_evt_handler_t) (enum bt_hids_cp_evt evt, struct bt_conn *conn)
 HID Control Point event handler.
 

Enumerations

enum  bt_hids_pm { BT_HIDS_PM_BOOT = 0x00 , BT_HIDS_PM_REPORT = 0x01 }
 Possible values for the Protocol Mode Characteristic value. More...
 
enum  bt_hids_report_type { BT_HIDS_REPORT_TYPE_RESERVED = 0x00 , BT_HIDS_REPORT_TYPE_INPUT = 0x01 , BT_HIDS_REPORT_TYPE_OUTPUT = 0x02 , BT_HIDS_REPORT_TYPE_FEATURE = 0x03 }
 Report types as defined in the Report Reference Characteristic descriptor. More...
 
enum  bt_hids_flags { BT_HIDS_REMOTE_WAKE = BIT(0) , BT_HIDS_NORMALLY_CONNECTABLE = BIT(1) , BT_HIDS_SCI_SUPPORTED = BIT(2) , BT_HIDS_SCI_LOW_POWER_MODE_SUPPORTED = BIT(3) }
 HID Service information flags. More...
 
enum  bt_hids_control_point { BT_HIDS_CONTROL_POINT_SUSPEND = 0x00 , BT_HIDS_CONTROL_POINT_EXIT_SUSPEND = 0x01 }
 HID Control Point settings. More...
 
enum  bt_hids_sci_mode_value {
  BT_HIDS_SCI_MODE_NONE = 0x00 , BT_HIDS_SCI_MODE_DEFAULT = 0x02 , BT_HIDS_SCI_MODE_FAST = 0x03 , BT_HIDS_SCI_MODE_LOW_POWER = 0x04 ,
  BT_HIDS_SCI_MODE_FULL_RANGE = 0x05
}
 HID SCI Mode values. More...
 
enum  bt_hids_pm_evt { BT_HIDS_PM_EVT_BOOT_MODE_ENTERED , BT_HIDS_PM_EVT_REPORT_MODE_ENTERED }
 
enum  bt_hids_cp_evt {
  BT_HIDS_CP_EVT_HOST_SUSP = 0x00 , BT_HIDS_CP_EVT_HOST_EXIT_SUSP = 0x01 , BT_HIDS_CP_EVT_HOST_SCI_DEFAULT_REQ = 0x02 , BT_HIDS_CP_EVT_HOST_SCI_FAST_REQ = 0x03 ,
  BT_HIDS_CP_EVT_HOST_SCI_LOW_POWER_REQ = 0x04 , BT_HIDS_CP_EVT_HOST_SCI_FULL_RANGE_REQ = 0x05
}
 
enum  bt_hids_notify_evt { BT_HIDS_CCCD_EVT_NOTIFY_ENABLED , BT_HIDS_CCCD_EVT_NOTIFY_DISABLED }
 

Functions

int bt_hids_init (struct bt_hids *hids_obj, const struct bt_hids_init_param *init_param)
 Initialize the HIDS instance.
 
int bt_hids_uninit (struct bt_hids *hids_obj)
 Uninitialize a HIDS instance.
 
int bt_hids_connected (struct bt_hids *hids_obj, struct bt_conn *conn)
 Function for informing the HID service about connection to the device This function should be used in main application.
 
int bt_hids_disconnected (struct bt_hids *hids_obj, struct bt_conn *conn)
 Function for informing the HID service about disconnection from the device. This function should be used in main application.
 
int bt_hids_inp_rep_send_userdata (struct bt_hids *hids_obj, struct bt_conn *conn, uint8_t rep_index, uint8_t const *rep, uint8_t len, bt_gatt_complete_func_t cb, void *userdata)
 Send Input Report, operation complete callback has user data as argument.
 
static int bt_hids_inp_rep_send (struct bt_hids *hids_obj, struct bt_conn *conn, uint8_t rep_index, uint8_t const *rep, uint8_t len, bt_gatt_complete_func_t cb)
 Send Input Report.
 
int bt_hids_boot_mouse_inp_rep_send (struct bt_hids *hids_obj, struct bt_conn *conn, const uint8_t *buttons, int8_t x_delta, int8_t y_delta, bt_gatt_complete_func_t cb)
 Send Boot Mouse Input Report.
 
int bt_hids_boot_kb_inp_rep_send (struct bt_hids *hids_obj, struct bt_conn *conn, uint8_t const *rep, uint16_t len, bt_gatt_complete_func_t cb)
 Send Boot Keyboard Input Report.
 
int bt_hids_sci_mode_get (struct bt_conn *conn, enum bt_hids_sci_mode_value *mode)
 Get the current SCI mode.
 
int bt_hids_sci_mode_change_request (struct bt_conn *conn, enum bt_hids_sci_mode_value mode)
 Request a new HID SCI mode. This function will request connection parameters for the mode. To actually change the mode bt_hids_sci_mode_updated needs to be called when the connection rate change event is received from the Bluetooth stack (conn_rate_changed callback).
 
bool bt_hids_sci_mode_validate (enum bt_hids_sci_mode_value mode, const struct bt_conn_le_conn_rate_changed *params)
 Validate the new connection parameters against their allowed values for the given SCI mode. Run this after a connection rate change notification is received from the Bluetooth stack.
 
int bt_hids_sci_mode_updated (struct bt_conn *conn, enum bt_hids_sci_mode_value mode)
 Update the SCI mode.
 

Detailed Description

API for the Bluetooth LE GATT Human Interface Device (HID) Service.