Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hci.h
Go to the documentation of this file.
1/* hci.h - Bluetooth Host Control Interface definitions */
2
3/*
4 * Copyright (c) 2015-2016 Intel Corporation
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8#ifndef ZEPHYR_INCLUDE_BLUETOOTH_HCI_H_
9#define ZEPHYR_INCLUDE_BLUETOOTH_HCI_H_
10
11#include <stdbool.h>
12#include <stddef.h>
13#include <stdint.h>
14
16#include <zephyr/net_buf.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
39#if defined(CONFIG_BT_HCI_ERR_TO_STR)
40const char *bt_hci_err_to_str(uint8_t hci_err);
41#else
42#include <zephyr/toolchain.h>
43
44static inline const char *bt_hci_err_to_str(uint8_t hci_err)
45{
46 ARG_UNUSED(hci_err);
47
48 return "";
49}
50#endif
51
64struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len);
65
83int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf);
84
108int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf,
109 struct net_buf **rsp);
110
118int bt_hci_get_conn_handle(const struct bt_conn *conn, uint16_t *conn_handle);
119
130struct bt_conn *bt_hci_conn_lookup_handle(uint16_t handle);
131
139int bt_hci_get_adv_handle(const struct bt_le_ext_adv *adv, uint8_t *adv_handle);
140
148struct bt_le_ext_adv *bt_hci_adv_lookup_handle(uint8_t handle);
149
157int bt_hci_get_adv_sync_handle(const struct bt_le_per_adv_sync *sync, uint16_t *sync_handle);
158
166struct bt_le_per_adv_sync *bt_hci_per_adv_sync_lookup_handle(uint16_t handle);
167
179const char *bt_hci_get_ver_str(uint8_t core_version);
180
192typedef bool bt_hci_vnd_evt_cb_t(struct net_buf_simple *buf);
193
202
216int bt_hci_le_rand(void *buffer, size_t len);
217
218
219#ifdef __cplusplus
220}
221#endif
222
223#endif /* ZEPHYR_INCLUDE_BLUETOOTH_HCI_H_ */
Bluetooth device address definitions and utilities.
Bluetooth subsystem core APIs.
Bluetooth connection handling.
bool bt_hci_vnd_evt_cb_t(struct net_buf_simple *buf)
Callback type for vendor handling of HCI Vendor-Specific Events.
Definition hci.h:192
int bt_hci_get_adv_handle(const struct bt_le_ext_adv *adv, uint8_t *adv_handle)
Get advertising handle for an advertising set.
static const char * bt_hci_err_to_str(uint8_t hci_err)
Converts a HCI error to string.
Definition hci.h:44
struct bt_le_per_adv_sync * bt_hci_per_adv_sync_lookup_handle(uint16_t handle)
Get periodic advertising sync given an periodic advertising sync handle.
int bt_hci_le_rand(void *buffer, size_t len)
Get Random bytes from the LE Controller.
struct bt_conn * bt_hci_conn_lookup_handle(uint16_t handle)
Get connection given a connection handle.
int bt_hci_get_adv_sync_handle(const struct bt_le_per_adv_sync *sync, uint16_t *sync_handle)
Get periodic advertising sync handle.
struct net_buf * bt_hci_cmd_create(uint16_t opcode, uint8_t param_len)
Allocate a HCI command buffer.
struct bt_le_ext_adv * bt_hci_adv_lookup_handle(uint8_t handle)
Get advertising set given an advertising handle.
int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf, struct net_buf **rsp)
Send a HCI command synchronously.
const char * bt_hci_get_ver_str(uint8_t core_version)
Obtain the version string given a core version number.
int bt_hci_get_conn_handle(const struct bt_conn *conn, uint16_t *conn_handle)
Get connection handle for a connection.
int bt_hci_register_vnd_evt_cb(bt_hci_vnd_evt_cb_t cb)
Register user callback for HCI Vendor-Specific Events.
int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf)
Send a HCI command asynchronously.
Buffer management.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Simple network buffer representation.
Definition net_buf.h:89
Network buffer representation.
Definition net_buf.h:1006
Macros to abstract toolchain specific capabilities.