Bluetooth HID Device
- group BT_HID_DEVICE
-
Provide BT HID profile interfaces.
Typedefs
-
typedef enum t_bt_hid_device_protocol_mode T_BT_HID_DEVICE_PROTOCOL_MODE
-
BT HID device protocol mode.
-
typedef enum t_bt_hid_device_report_type T_BT_HID_DEVICE_REPORT_TYPE
-
BT HID device report type.
-
typedef enum t_bt_hid_device_control_operation T_BT_HID_DEVICE_CONTROL_OPERATION
-
BT HID device control operation.
Enums
-
enum t_bt_hid_device_protocol_mode
-
BT HID device protocol mode.
Values:
-
enumerator BT_HID_DEVICE_BOOT_PROTO_MODE
-
enumerator BT_HID_DEVICE_REPORT_PROTO_MODE
-
enumerator BT_HID_DEVICE_BOOT_PROTO_MODE
-
enum t_bt_hid_device_report_type
-
BT HID device report type.
Values:
-
enumerator BT_HID_DEVICE_REPORT_TYPE_RESERVED
-
enumerator BT_HID_DEVICE_REPORT_TYPE_INPUT
-
enumerator BT_HID_DEVICE_REPORT_TYPE_OUTPUT
-
enumerator BT_HID_DEVICE_REPORT_TYPE_FEATURE
-
enumerator BT_HID_DEVICE_REPORT_TYPE_RESERVED
-
enum t_bt_hid_device_control_operation
-
BT HID device control operation.
Values:
-
enumerator BT_HID_DEVICE_CONTROL_OPERATION_NOP
-
enumerator BT_HID_DEVICE_CONTROL_OPERATION_HARD_RESET
-
enumerator BT_HID_DEVICE_CONTROL_OPERATION_SOFT_RESET
-
enumerator BT_HID_DEVICE_CONTROL_OPERATION_SUSPEND
-
enumerator BT_HID_DEVICE_CONTROL_OPERATION_EXIT_SUSPEND
-
enumerator BT_HID_DEVICE_CONTROL_OPERATION_VIRTUAL_CABLE_UNPLUG
-
enumerator BT_HID_DEVICE_CONTROL_OPERATION_NOP
Functions
-
bool bt_hid_device_init(bool boot_proto_mode)
-
Initialize HID profile.
- Parameters:
-
boot_proto_mode -- [in] Support boot protocol mode.
- Return values:
true -- HID profile was initialized successfully.
false -- HID profile was failed to initialize.
- Returns:
-
The status of initializing HID profile.
-
void bt_hid_device_deinit(void)
-
De-initialize HID profile(HID device role).
-
bool bt_hid_device_descriptor_set(const uint8_t *descriptor, uint16_t len)
-
Set HID descriptor.
- Parameters:
descriptor -- [in] HID report descriptor.
len -- [in] The length of HID report descriptor.
- Return values:
true -- HID descriptor was set successfully.
false -- HID descriptor was failed to set.
- Returns:
-
The status of set HID descriptor.
-
bool bt_hid_device_connect_req(uint8_t bd_addr[6])
-
Send HID connection request.
- Parameters:
-
bd_addr -- [in] Remote BT address.
- Return values:
true -- HID connection request was sent successfully.
false -- HID connection request was failed to send.
- Returns:
-
The status of sending the HID connection request.
-
bool bt_hid_device_connect_cfm(uint8_t bd_addr[6], bool accept)
-
Send HID connection confirmation.
- Parameters:
bd_addr -- [in] Remote BT address.
-
accept -- [in] Accept or reject the connection indication.
true Accept the connection indication.
false Reject the connection indication.
- Return values:
true -- HID connection confirmation was sent successfully.
false -- HID connection confirmation was failed to send.
- Returns:
-
The status of sending the HID connection confirmation.
-
bool bt_hid_device_disconnect_req(uint8_t bd_addr[6])
-
Send HID disconnection request.
- Parameters:
-
bd_addr -- [in] Remote BT address.
- Return values:
true -- HID disconnection request was sent successfully.
false -- HID disconnection request was failed to send.
- Returns:
-
The status of sending the HID disconnection request.
-
bool bt_hid_device_get_report_rsp(uint8_t bd_addr[6], T_BT_HID_DEVICE_REPORT_TYPE report_type, uint8_t *buf, uint16_t len)
-
Send a HID GET_REPORT response message over control channel after receiving GET_REPORT message from HID Host.
Note
This API shall only be used by a Bluetooth HID device.
- Parameters:
bd_addr -- [in] Remote BT address.
report_type -- [in] Report Type T_BT_HID_DEVICE_REPORT_TYPE.
buf -- [in] Message buffer.
len -- [in] Message length.
- Return values:
true -- HID get report response message was send successfully.
false -- HID get report response message was failed to send.
- Returns:
-
The status of sending HID get report response message.
-
bool bt_hid_device_control_req(uint8_t bd_addr[6], T_BT_HID_DEVICE_CONTROL_OPERATION operation)
-
Send HID control message over control channel.
Note
A HID_CONTROL message with a parameter of VIRTUAL_CABLE_UNPLUG is the only HID_CONTROL message a Bluetooth HID device may send to a Bluetooth HID Host.
- Parameters:
bd_addr -- [in] Remote BT address.
operation -- [in] Report Type T_BT_HID_DEVICE_CONTROL_OPERATION.
- Return values:
true -- HID control message was sent successfully.
false -- HID control message was failed to send.
- Returns:
-
The status of sending HID control message over control channel.
-
bool bt_hid_device_interrupt_data_send(uint8_t bd_addr[6], T_BT_HID_DEVICE_REPORT_TYPE report_type, uint8_t *buf, uint16_t len)
-
Send HID DATA message over interrupt channel. s.
- Parameters:
bd_addr -- [in] Remote BT address.
report_type -- [in] Report Type T_BT_HID_DEVICE_REPORT_TYPE.
buf -- [in] Message buffer.
len -- [in] Message length.
- Return values:
true -- HID DATA message was sent successfully.
false -- HID DATA message was failed to send.
- Returns:
-
The status of sending HID DATA message over interrupt channel.
-
typedef enum t_bt_hid_device_protocol_mode T_BT_HID_DEVICE_PROTOCOL_MODE