Bluetooth HID Host
- group BT_HID_HOST
-
Provide BT HID profile interfaces.
Typedefs
-
typedef enum t_bt_hid_host_protocol_mode T_BT_HID_HOST_PROTOCOL_MODE
-
BT HID protocol mode.
-
typedef enum t_bt_hid_host_report_type T_BT_HID_HOST_REPORT_TYPE
-
BT HID report type.
-
typedef enum t_bt_hid_host_control_operation T_BT_HID_HOST_CONTROL_OPERATION
-
BT HID control operation.
Enums
-
enum t_bt_hid_host_protocol_mode
-
BT HID protocol mode.
Values:
-
enumerator BT_HID_HOST_BOOT_PROTO_MODE
-
enumerator BT_HID_HOST_REPORT_PROTO_MODE
-
enumerator BT_HID_HOST_BOOT_PROTO_MODE
-
enum t_bt_hid_host_report_type
-
BT HID report type.
Values:
-
enumerator BT_HID_HOST_REPORT_TYPE_RESERVED
-
enumerator BT_HID_HOST_REPORT_TYPE_INPUT
-
enumerator BT_HID_HOST_REPORT_TYPE_OUTPUT
-
enumerator BT_HID_HOST_REPORT_TYPE_FEATURE
-
enumerator BT_HID_HOST_REPORT_TYPE_RESERVED
-
enum t_bt_hid_host_control_operation
-
BT HID control operation.
Values:
-
enumerator BT_HID_HOST_CONTROL_OPERATION_NOP
-
enumerator BT_HID_HOST_CONTROL_OPERATION_HARD_RESET
-
enumerator BT_HID_HOST_CONTROL_OPERATION_SOFT_RESET
-
enumerator BT_HID_HOST_CONTROL_OPERATION_SUSPEND
-
enumerator BT_HID_HOST_CONTROL_OPERATION_EXIT_SUSPEND
-
enumerator BT_HID_HOST_CONTROL_OPERATION_VIRTUAL_CABLE_UNPLUG
-
enumerator BT_HID_HOST_CONTROL_OPERATION_NOP
Functions
-
bool bt_hid_host_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_host_deinit(void)
-
De-initialize HID profile(HID Host role).
-
bool bt_hid_host_descriptor_set(uint8_t bd_addr[6], uint8_t *descriptor, uint16_t len)
-
Set HID descriptor.
- Parameters:
bd_addr -- [in] Remote BT address.
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_host_connect_req(uint8_t bd_addr[6], uint8_t proto_mode)
-
Send HID connection request.
- Parameters:
bd_addr -- [in] Remote BT address.
proto_mode -- [in] Protocol mode.
- 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_host_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_host_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_host_control_req(uint8_t bd_addr[6], T_BT_HID_HOST_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_HOST_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_host_get_report_req(uint8_t bd_addr[6], T_BT_HID_HOST_REPORT_TYPE report_type, uint8_t report_id, uint16_t buffer_size)
-
Send HID GET_REPORT message over control channel. This message is used by the Bluetooth HID Host to request the transfer of a HID report from the Bluetooth HID device.
- Parameters:
bd_addr -- [in] Remote BT address.
report_type -- [in] Report Type T_BT_HID_HOST_REPORT_TYPE.
report_id -- [in] Report ID.
buffer_size -- [in] Buffer size.
- Return values:
true -- HID GET_REPORT message was sent successfully.
false -- HID GET_REPORT message was failed to send.
- Returns:
-
The status of sending HID GET_REPORT message over control channel.
-
bool bt_hid_host_set_report_req(uint8_t bd_addr[6], T_BT_HID_HOST_REPORT_TYPE report_type, uint8_t *buf, uint16_t len)
-
Send HID SET_REPORT message over control channel. This message is used by a Bluetooth HID Host to initiate the transfer of a report to a Bluetooth HID device.
- Parameters:
bd_addr -- [in] Remote BT address.
report_type -- [in] Report type T_BT_HID_HOST_REPORT_TYPE.
buf -- [in] Message buffer.
len -- [in] Message length.
- Return values:
true -- HID SET_REPORT message was sent successfully.
false -- HID SET_REPORT message was failed to send.
- Returns:
-
The status of sending HID SET_REPORT message over control channel.
-
bool bt_hid_host_get_protocol_req(uint8_t bd_addr[6])
-
Send HID GET_PROTOCOL message over control channel. This message is used by a Bluetooth HID Host to retrieve the protocol mode of the Bluetooth HID device.
- Parameters:
-
bd_addr -- [in] Remote BT address.
- Return values:
true -- HID GET_PROTOCOL message was sent successfully.
false -- HID GET_PROTOCOL message was failed to send.
- Returns:
-
The status of sending HID GET_PROTOCOL message over control channel.
-
bool bt_hid_host_set_protocol_req(uint8_t bd_addr[6], T_BT_HID_HOST_PROTOCOL_MODE proto_mode)
-
Send HID SET_PROTOCOL message over control channel. This message is used by a Bluetooth HID Host to set protocol mode on the Bluetooth HID device.
- Parameters:
bd_addr -- [in] Remote BT address.
proto_mode -- [in] Protocol mode T_BT_HID_HOST_PROTOCOL_MODE.
- Return values:
true -- HID SET_PROTOCOL message was sent successfully.
false -- HID SET_PROTOCOL message was failed to send.
- Returns:
-
The status of sending HID SET_PROTOCOL message over control channel.
-
bool bt_hid_host_interrupt_data_send(uint8_t bd_addr[6], T_BT_HID_HOST_REPORT_TYPE report_type, uint8_t *buf, uint16_t len)
-
Send HID DATA message over interrupt channel.
- Parameters:
bd_addr -- [in] Remote BT address.
report_type -- [in] Report Type T_BT_HID_HOST_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_host_protocol_mode T_BT_HID_HOST_PROTOCOL_MODE