Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hid_host.h
Go to the documentation of this file.
1
4
5/*
6 * Copyright 2026 Xiaomi Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10
11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_HID_HOST_H_
12#define ZEPHYR_INCLUDE_BLUETOOTH_HID_HOST_H_
13
20
21#include <stdbool.h>
22#include <stdint.h>
23
26#include <zephyr/net_buf.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
39struct bt_hid_host;
40
66 void (*connected)(struct bt_hid_host *hid);
67
74 void (*disconnected)(struct bt_hid_host *hid);
75
87 void (*input_report)(struct bt_hid_host *hid, struct net_buf *buf);
88
106 void (*get_report)(struct bt_hid_host *hid, uint8_t result_code, uint8_t type,
107 struct net_buf *buf);
108
119 void (*set_report)(struct bt_hid_host *hid, uint8_t result_code);
120
134 void (*get_protocol)(struct bt_hid_host *hid, uint8_t result_code, uint8_t protocol);
135
147 void (*set_protocol)(struct bt_hid_host *hid, uint8_t result_code);
148
165 void (*vc_unplug)(struct bt_hid_host *hid);
166};
167
179
190
205int bt_hid_host_connect(struct bt_conn *conn, struct bt_hid_host **hid);
206
218struct bt_conn *bt_hid_host_get_conn(struct bt_hid_host *hid);
219
229int bt_hid_host_disconnect(struct bt_hid_host *hid);
230
251int bt_hid_host_get_report(struct bt_hid_host *hid, uint8_t type, uint8_t report_id,
252 uint16_t buffer_size);
253
267int bt_hid_host_set_report(struct bt_hid_host *hid, uint8_t type,
268 struct net_buf *buf);
269
278int bt_hid_host_get_protocol(struct bt_hid_host *hid);
279
290int bt_hid_host_set_protocol(struct bt_hid_host *hid, uint8_t protocol);
291
306int bt_hid_host_output_report(struct bt_hid_host *hid, struct net_buf *buf);
307
316int bt_hid_host_suspend(struct bt_hid_host *hid);
317
326int bt_hid_host_exit_suspend(struct bt_hid_host *hid);
327
340int bt_hid_host_virtual_cable_unplug(struct bt_hid_host *hid);
341
353
354#ifdef __cplusplus
355}
356#endif
357
361
362#endif /* ZEPHYR_INCLUDE_BLUETOOTH_HID_HOST_H_ */
Bluetooth HID protocol values shared by the Device and Host roles.
Bluetooth connection handling.
int bt_hid_host_output_report(struct bt_hid_host *hid, struct net_buf *buf)
Send an output report on the interrupt channel.
int bt_hid_host_suspend(struct bt_hid_host *hid)
Send SUSPEND control to the HID Device.
int bt_hid_host_set_report(struct bt_hid_host *hid, uint8_t type, struct net_buf *buf)
Send a SET_REPORT request to the HID Device.
int bt_hid_host_get_protocol(struct bt_hid_host *hid)
Send a GET_PROTOCOL request to the HID Device.
struct bt_conn * bt_hid_host_get_conn(struct bt_hid_host *hid)
Get the ACL connection of an HID association.
struct net_buf * bt_hid_host_create_pdu(struct net_buf_pool *pool)
Allocate a PDU buffer for HID Host transmissions.
int bt_hid_host_virtual_cable_unplug(struct bt_hid_host *hid)
Send Virtual Cable Unplug to the HID Device.
int bt_hid_host_exit_suspend(struct bt_hid_host *hid)
Send EXIT_SUSPEND control to the HID Device.
int bt_hid_host_register(const struct bt_hid_host_cb *cb)
Register HID Host callbacks.
int bt_hid_host_connect(struct bt_conn *conn, struct bt_hid_host **hid)
Initiate an HID connection to a remote HID Device.
int bt_hid_host_disconnect(struct bt_hid_host *hid)
Disconnect an HID association.
int bt_hid_host_set_protocol(struct bt_hid_host *hid, uint8_t protocol)
Send a SET_PROTOCOL request to the HID Device.
int bt_hid_host_get_report(struct bt_hid_host *hid, uint8_t type, uint8_t report_id, uint16_t buffer_size)
Send a GET_REPORT request to the HID Device.
int bt_hid_host_unregister(void)
Unregister HID Host callbacks.
Buffer management.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Opaque type representing a connection to a remote device.
Callbacks supplied by the HID Host application.
Definition hid_host.h:56
void(* vc_unplug)(struct bt_hid_host *hid)
Virtual Cable Unplug received from Device.
Definition hid_host.h:165
void(* set_report)(struct bt_hid_host *hid, uint8_t result_code)
SET_REPORT result.
Definition hid_host.h:119
void(* set_protocol)(struct bt_hid_host *hid, uint8_t result_code)
SET_PROTOCOL result.
Definition hid_host.h:147
void(* input_report)(struct bt_hid_host *hid, struct net_buf *buf)
Input report received on the interrupt channel.
Definition hid_host.h:87
void(* disconnected)(struct bt_hid_host *hid)
HID connection terminated.
Definition hid_host.h:74
void(* get_protocol)(struct bt_hid_host *hid, uint8_t result_code, uint8_t protocol)
GET_PROTOCOL result.
Definition hid_host.h:134
void(* connected)(struct bt_hid_host *hid)
HID connection established.
Definition hid_host.h:66
void(* get_report)(struct bt_hid_host *hid, uint8_t result_code, uint8_t type, struct net_buf *buf)
GET_REPORT result.
Definition hid_host.h:106
Network buffer pool representation.
Definition net_buf.h:1190
Network buffer representation.
Definition net_buf.h:1054