Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hids.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Xiaomi Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
11
12#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_HIDS_H_
13#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_HIDS_H_
14
15#include <stdbool.h>
16#include <stddef.h>
17#include <stdint.h>
18#include <sys/types.h>
19
22#include <zephyr/sys/util.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
61
68#define BT_HIDS_REPORT_MAP_MAX_LEN 512U
69
85
100
115
136 void (*set_report)(struct bt_conn *conn, enum bt_hids_report_type report_type,
137 uint8_t report_id, const uint8_t *data, uint16_t len);
138
149 void (*ctrl_point)(struct bt_conn *conn, enum bt_hids_ctrl_point cmd);
150};
151
163
172
185
196
199
200#if CONFIG_BT_HIDS_INPUT_REPORT_COUNT > 0 || defined(__DOXYGEN__)
209 uint8_t input_report_ids[CONFIG_BT_HIDS_INPUT_REPORT_COUNT];
210#endif
211
212#if CONFIG_BT_HIDS_OUTPUT_REPORT_COUNT > 0 || defined(__DOXYGEN__)
218 uint8_t output_report_ids[CONFIG_BT_HIDS_OUTPUT_REPORT_COUNT];
219#endif
220
221#if CONFIG_BT_HIDS_FEATURE_REPORT_COUNT > 0 || defined(__DOXYGEN__)
227 uint8_t feature_report_ids[CONFIG_BT_HIDS_FEATURE_REPORT_COUNT];
228#endif
229
236 const struct bt_hids_cb *cb;
237};
238
257
280
314int bt_hids_report_set(enum bt_hids_report_type report_type, uint8_t report_id,
315 const uint8_t *data, uint16_t len);
316
338int bt_hids_report_get(enum bt_hids_report_type report_type, uint8_t report_id, uint8_t *data,
339 uint16_t *len);
340
373int bt_hids_send_report(struct bt_conn *conn, uint8_t report_id, const uint8_t *data, uint16_t len,
374 bt_gatt_complete_func_t func, void *user_data);
375
379
380#ifdef __cplusplus
381}
382#endif
383
384#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_HIDS_H_ */
Bluetooth connection handling.
Generic Attribute Profile handling.
void(* bt_gatt_complete_func_t)(struct bt_conn *conn, void *user_data)
Notification complete result callback.
Definition gatt.h:1410
bt_hids_report_type
HID Report Type values.
Definition hids.h:75
int bt_hids_unregister(void)
Unregister the HID Service.
bt_hids_info_flags
HID Information flags.
Definition hids.h:93
int bt_hids_send_report(struct bt_conn *conn, uint8_t report_id, const uint8_t *data, uint16_t len, bt_gatt_complete_func_t func, void *user_data)
Send an Input Report to a Host.
bt_hids_ctrl_point
HID Control Point commands.
Definition hids.h:108
int bt_hids_report_get(enum bt_hids_report_type report_type, uint8_t report_id, uint8_t *data, uint16_t *len)
Read back the value of a Report characteristic.
int bt_hids_register(const struct bt_hids_register_param *param)
Register the HID Service.
int bt_hids_report_set(enum bt_hids_report_type report_type, uint8_t report_id, const uint8_t *data, uint16_t len)
Set the value a Host reads from a Report characteristic.
@ BT_HIDS_REPORT_TYPE_INPUT
Input Report.
Definition hids.h:77
@ BT_HIDS_REPORT_TYPE_FEATURE
Feature Report.
Definition hids.h:83
@ BT_HIDS_REPORT_TYPE_OUTPUT
Output Report.
Definition hids.h:80
@ BT_HIDS_INFO_FLAG_REMOTE_WAKE
Device supports remote wake.
Definition hids.h:95
@ BT_HIDS_INFO_FLAG_NORMALLY_CONNECTABLE
Device is normally connectable.
Definition hids.h:98
@ BT_HIDS_CTRL_EXIT_SUSPEND
The Host is exiting Suspend Mode.
Definition hids.h:113
@ BT_HIDS_CTRL_SUSPEND
The Host is entering Suspend Mode.
Definition hids.h:110
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition ft8xx_reference_api.h:153
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
__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.
HID Service callbacks.
Definition hids.h:117
void(* ctrl_point)(struct bt_conn *conn, enum bt_hids_ctrl_point cmd)
Called when a Host writes the HID Control Point.
Definition hids.h:149
void(* set_report)(struct bt_conn *conn, enum bt_hids_report_type report_type, uint8_t report_id, const uint8_t *data, uint16_t len)
Called when a Host writes an Output or Feature Report.
Definition hids.h:136
HID Service registration parameters.
Definition hids.h:153
const struct bt_hids_cb * cb
Application callbacks.
Definition hids.h:236
uint16_t bcd_hid
Version of the USB HID Specification the Device implements.
Definition hids.h:162
uint8_t output_report_ids[CONFIG_BT_HIDS_OUTPUT_REPORT_COUNT]
Report IDs of the Output Report characteristics.
Definition hids.h:218
uint8_t country_code
Country code of the localized hardware.
Definition hids.h:171
uint16_t report_map_len
Length of report_map in bytes.
Definition hids.h:198
const uint8_t * report_map
HID Report Map descriptor data.
Definition hids.h:195
uint8_t flags
HID Information flags, see bt_hids_info_flags.
Definition hids.h:184
uint8_t feature_report_ids[CONFIG_BT_HIDS_FEATURE_REPORT_COUNT]
Report IDs of the Feature Report characteristics.
Definition hids.h:227
uint8_t input_report_ids[CONFIG_BT_HIDS_INPUT_REPORT_COUNT]
Report IDs of the Input Report characteristics.
Definition hids.h:209
Misc utilities.