Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hid_device.h
Go to the documentation of this file.
1
4
5/*
6 * Copyright 2025 Xiaomi Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10
11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_CLASSIC_HID_DEVICE_H_
12#define ZEPHYR_INCLUDE_BLUETOOTH_CLASSIC_HID_DEVICE_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
32struct bt_hid_device;
33
50 void (*connected)(struct bt_hid_device *hid);
51
61 void (*disconnected)(struct bt_hid_device *hid);
62
80 int (*set_report)(struct bt_hid_device *hid, uint8_t type, struct net_buf *buf);
81
117 int (*get_report)(struct bt_hid_device *hid, uint8_t type, bool size_present,
118 struct net_buf *req, struct net_buf *rsp);
119
134 int (*set_protocol)(struct bt_hid_device *hid, uint8_t protocol);
135
146 void (*output_report)(struct bt_hid_device *hid, struct net_buf *buf);
147
171 void (*vc_unplug)(struct bt_hid_device *hid);
172
193 void (*suspend)(struct bt_hid_device *hid, bool suspended);
194};
195
211
222
233int bt_hid_device_connect(struct bt_conn *conn, struct bt_hid_device **hid);
234
244int bt_hid_device_disconnect(struct bt_hid_device *hid);
245
259
277int bt_hid_device_input_report(struct bt_hid_device *hid, struct net_buf *buf);
278
287int bt_hid_device_virtual_cable_unplug(struct bt_hid_device *hid);
288
302struct bt_conn *bt_hid_device_get_conn(struct bt_hid_device *hid);
303
304#ifdef __cplusplus
305}
306#endif
307
311
312#endif /* ZEPHYR_INCLUDE_BLUETOOTH_CLASSIC_HID_DEVICE_H_ */
Bluetooth HID protocol values shared by the Device and Host roles.
Bluetooth connection handling.
int bt_hid_device_input_report(struct bt_hid_device *hid, struct net_buf *buf)
Send a HID interrupt input report to the HID host.
int bt_hid_device_register(const struct bt_hid_device_cb *cb)
Register HID device callbacks.
int bt_hid_device_unregister(void)
Unregister HID device callbacks and disable HID services.
struct bt_conn * bt_hid_device_get_conn(struct bt_hid_device *hid)
Obtain the ACL connection associated with a HID device.
int bt_hid_device_virtual_cable_unplug(struct bt_hid_device *hid)
Trigger a virtual cable unplug procedure for the given HID association.
struct net_buf * bt_hid_device_create_pdu(struct net_buf_pool *pool)
Allocate/create a PDU buffer suitable for HID over L2CAP.
int bt_hid_device_disconnect(struct bt_hid_device *hid)
Disconnect a previously connected HID association.
int bt_hid_device_connect(struct bt_conn *conn, struct bt_hid_device **hid)
Initiate an outgoing HID association on the given connection.
Buffer management.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Opaque type representing a connection to a remote device.
Callbacks supplied by the HID application.
Definition hid_device.h:41
int(* set_protocol)(struct bt_hid_device *hid, uint8_t protocol)
Set_Protocol request callback.
Definition hid_device.h:134
int(* get_report)(struct bt_hid_device *hid, uint8_t type, bool size_present, struct net_buf *req, struct net_buf *rsp)
Get_Report request callback.
Definition hid_device.h:117
int(* set_report)(struct bt_hid_device *hid, uint8_t type, struct net_buf *buf)
Set_Report request callback.
Definition hid_device.h:80
void(* suspend)(struct bt_hid_device *hid, bool suspended)
Suspend/Exit-Suspend notification callback.
Definition hid_device.h:193
void(* vc_unplug)(struct bt_hid_device *hid)
Virtual Cable Unplug notification callback.
Definition hid_device.h:171
void(* connected)(struct bt_hid_device *hid)
connected callback to application
Definition hid_device.h:50
void(* disconnected)(struct bt_hid_device *hid)
disconnected callback to application
Definition hid_device.h:61
void(* output_report)(struct bt_hid_device *hid, struct net_buf *buf)
Output report callback.
Definition hid_device.h:146
Network buffer pool representation.
Definition net_buf.h:1190
Network buffer representation.
Definition net_buf.h:1054