Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
Bluetooth subsystem core APIs. More...
#include <stdbool.h>
#include <string.h>
#include <zephyr/sys/util.h>
#include <zephyr/net_buf.h>
#include <zephyr/bluetooth/gap.h>
#include <zephyr/bluetooth/addr.h>
#include <zephyr/bluetooth/crypto.h>
#include <zephyr/bluetooth/classic/classic.h>
Go to the source code of this file.
Macros | |
#define | BT_ID_DEFAULT 0 |
Convenience macro for specifying the default identity. | |
#define | BT_DATA_SERIALIZED_SIZE(data_len) ((data_len) + 2) |
Bluetooth data serialized size. | |
#define | BT_DATA(_type, _data, _data_len) |
Helper to declare elements of bt_data arrays. | |
#define | BT_DATA_BYTES(_type, _bytes...) |
Helper to declare elements of bt_data arrays. | |
#define | BT_LE_ADV_PARAM_INIT(_options, _int_min, _int_max, _peer) |
Initialize advertising parameters. | |
#define | BT_LE_ADV_PARAM(_options, _int_min, _int_max, _peer) |
Helper to declare advertising parameters inline. | |
#define | BT_LE_ADV_CONN_DIR(_peer) BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, 0, 0, _peer) |
#define | BT_LE_ADV_CONN |
#define | BT_LE_ADV_CONN_FAST_1 |
GAP recommended connectable advertising. | |
#define | BT_LE_ADV_CONN_FAST_2 |
Connectable advertising with T_GAP(adv_fast_interval2) | |
#define | BT_LE_ADV_CONN_ONE_TIME BT_LE_ADV_CONN_FAST_2 __DEPRECATED_MACRO |
#define | BT_LE_ADV_CONN_NAME |
#define | BT_LE_ADV_CONN_NAME_AD |
#define | BT_LE_ADV_CONN_DIR_LOW_DUTY(_peer) |
#define | BT_LE_ADV_NCONN |
Non-connectable advertising with private address. | |
#define | BT_LE_ADV_NCONN_NAME |
#define | BT_LE_ADV_NCONN_IDENTITY |
Non-connectable advertising with BT_LE_ADV_OPT_USE_IDENTITY. | |
#define | BT_LE_EXT_ADV_CONN |
Connectable extended advertising. | |
#define | BT_LE_EXT_ADV_CONN_NAME |
#define | BT_LE_EXT_ADV_SCAN |
Scannable extended advertising. | |
#define | BT_LE_EXT_ADV_SCAN_NAME |
#define | BT_LE_EXT_ADV_NCONN |
Non-connectable extended advertising with private address. | |
#define | BT_LE_EXT_ADV_NCONN_NAME |
#define | BT_LE_EXT_ADV_NCONN_IDENTITY |
Non-connectable extended advertising with BT_LE_ADV_OPT_USE_IDENTITY. | |
#define | BT_LE_EXT_ADV_CODED_NCONN |
Non-connectable extended advertising on coded PHY with private address. | |
#define | BT_LE_EXT_ADV_CODED_NCONN_NAME |
#define | BT_LE_EXT_ADV_CODED_NCONN_IDENTITY |
Non-connectable extended advertising on coded PHY with BT_LE_ADV_OPT_USE_IDENTITY. | |
#define | BT_LE_EXT_ADV_START_PARAM_INIT(_timeout, _n_evts) |
Helper to initialize extended advertising start parameters inline. | |
#define | BT_LE_EXT_ADV_START_PARAM(_timeout, _n_evts) |
Helper to declare extended advertising start parameters inline. | |
#define | BT_LE_EXT_ADV_START_DEFAULT BT_LE_EXT_ADV_START_PARAM(0, 0) |
#define | BT_LE_PER_ADV_PARAM_INIT(_int_min, _int_max, _options) |
Helper to declare periodic advertising parameters inline. | |
#define | BT_LE_PER_ADV_PARAM(_int_min, _int_max, _options) |
Helper to declare periodic advertising parameters inline. | |
#define | BT_LE_PER_ADV_DEFAULT |
#define | BT_LE_SCAN_OPT_FILTER_WHITELIST __DEPRECATED_MACRO BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST |
#define | BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) |
Initialize scan parameters. | |
#define | BT_LE_SCAN_PARAM(_type, _options, _interval, _window) |
Helper to declare scan parameters inline. | |
#define | BT_LE_SCAN_ACTIVE |
Helper macro to enable active scanning to discover new devices. | |
#define | BT_LE_SCAN_ACTIVE_CONTINUOUS |
Helper macro to enable active scanning to discover new devices with window == interval. | |
#define | BT_LE_SCAN_PASSIVE |
Helper macro to enable passive scanning to discover new devices. | |
#define | BT_LE_SCAN_PASSIVE_CONTINUOUS |
Helper macro to enable passive scanning to discover new devices with window==interval. | |
#define | BT_LE_SCAN_CODED_ACTIVE |
Helper macro to enable active scanning to discover new devices. | |
#define | BT_LE_SCAN_CODED_PASSIVE |
Helper macro to enable passive scanning to discover new devices. | |
Typedefs | |
typedef void(* | bt_ready_cb_t) (int err) |
Callback for notifying that Bluetooth has been enabled. | |
typedef void | bt_le_scan_cb_t(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type, struct net_buf_simple *buf) |
Callback type for reporting LE scan results. | |
Functions | |
int | bt_enable (bt_ready_cb_t cb) |
Enable Bluetooth. | |
int | bt_disable (void) |
Disable Bluetooth. | |
bool | bt_is_ready (void) |
Check if Bluetooth is ready. | |
int | bt_set_name (const char *name) |
Set Bluetooth Device Name. | |
const char * | bt_get_name (void) |
Get Bluetooth Device Name. | |
uint16_t | bt_get_appearance (void) |
Get local Bluetooth appearance. | |
int | bt_set_appearance (uint16_t new_appearance) |
Set local Bluetooth appearance. | |
void | bt_id_get (bt_addr_le_t *addrs, size_t *count) |
Get the currently configured identities. | |
int | bt_id_create (bt_addr_le_t *addr, uint8_t *irk) |
Create a new identity. | |
int | bt_id_reset (uint8_t id, bt_addr_le_t *addr, uint8_t *irk) |
Reset/reclaim an identity for reuse. | |
int | bt_id_delete (uint8_t id) |
Delete an identity. | |
size_t | bt_data_get_len (const struct bt_data data[], size_t data_count) |
Get the total size (in bytes) of a given set of bt_data structures. | |
size_t | bt_data_serialize (const struct bt_data *input, uint8_t *output) |
Serialize a bt_data struct into an advertising structure (a flat byte array). | |
int | bt_le_adv_start (const struct bt_le_adv_param *param, const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len) |
Start advertising. | |
int | bt_le_adv_update_data (const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len) |
Update advertising. | |
int | bt_le_adv_stop (void) |
Stop advertising. | |
int | bt_le_ext_adv_create (const struct bt_le_adv_param *param, const struct bt_le_ext_adv_cb *cb, struct bt_le_ext_adv **adv) |
Create advertising set. | |
int | bt_le_ext_adv_start (struct bt_le_ext_adv *adv, const struct bt_le_ext_adv_start_param *param) |
Start advertising with the given advertising set. | |
int | bt_le_ext_adv_stop (struct bt_le_ext_adv *adv) |
Stop advertising with the given advertising set. | |
int | bt_le_ext_adv_set_data (struct bt_le_ext_adv *adv, const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len) |
Set an advertising set's advertising or scan response data. | |
int | bt_le_ext_adv_update_param (struct bt_le_ext_adv *adv, const struct bt_le_adv_param *param) |
Update advertising parameters. | |
int | bt_le_ext_adv_delete (struct bt_le_ext_adv *adv) |
Delete advertising set. | |
uint8_t | bt_le_ext_adv_get_index (struct bt_le_ext_adv *adv) |
Get array index of an advertising set. | |
int | bt_le_ext_adv_get_info (const struct bt_le_ext_adv *adv, struct bt_le_ext_adv_info *info) |
Get advertising set info. | |
int | bt_le_per_adv_set_param (struct bt_le_ext_adv *adv, const struct bt_le_per_adv_param *param) |
Set or update the periodic advertising parameters. | |
int | bt_le_per_adv_set_data (const struct bt_le_ext_adv *adv, const struct bt_data *ad, size_t ad_len) |
Set or update the periodic advertising data. | |
int | bt_le_per_adv_set_subevent_data (const struct bt_le_ext_adv *adv, uint8_t num_subevents, const struct bt_le_per_adv_subevent_data_params *params) |
Set the periodic advertising with response subevent data. | |
int | bt_le_per_adv_start (struct bt_le_ext_adv *adv) |
Starts periodic advertising. | |
int | bt_le_per_adv_stop (struct bt_le_ext_adv *adv) |
Stops periodic advertising. | |
uint8_t | bt_le_per_adv_sync_get_index (struct bt_le_per_adv_sync *per_adv_sync) |
Get array index of an periodic advertising sync object. | |
struct bt_le_per_adv_sync * | bt_le_per_adv_sync_lookup_index (uint8_t index) |
Get a periodic advertising sync object from the array index. | |
int | bt_le_per_adv_sync_get_info (struct bt_le_per_adv_sync *per_adv_sync, struct bt_le_per_adv_sync_info *info) |
Get periodic adv sync information. | |
struct bt_le_per_adv_sync * | bt_le_per_adv_sync_lookup_addr (const bt_addr_le_t *adv_addr, uint8_t sid) |
Look up an existing periodic advertising sync object by advertiser address. | |
int | bt_le_per_adv_sync_create (const struct bt_le_per_adv_sync_param *param, struct bt_le_per_adv_sync **out_sync) |
Create a periodic advertising sync object. | |
int | bt_le_per_adv_sync_delete (struct bt_le_per_adv_sync *per_adv_sync) |
Delete periodic advertising sync. | |
int | bt_le_per_adv_sync_cb_register (struct bt_le_per_adv_sync_cb *cb) |
Register periodic advertising sync callbacks. | |
int | bt_le_per_adv_sync_recv_enable (struct bt_le_per_adv_sync *per_adv_sync) |
Enables receiving periodic advertising reports for a sync. | |
int | bt_le_per_adv_sync_recv_disable (struct bt_le_per_adv_sync *per_adv_sync) |
Disables receiving periodic advertising reports for a sync. | |
int | bt_le_per_adv_sync_transfer (const struct bt_le_per_adv_sync *per_adv_sync, const struct bt_conn *conn, uint16_t service_data) |
Transfer the periodic advertising sync information to a peer device. | |
int | bt_le_per_adv_set_info_transfer (const struct bt_le_ext_adv *adv, const struct bt_conn *conn, uint16_t service_data) |
Transfer the information about a periodic advertising set. | |
int | bt_le_per_adv_sync_transfer_subscribe (const struct bt_conn *conn, const struct bt_le_per_adv_sync_transfer_param *param) |
Subscribe to periodic advertising sync transfers (PASTs). | |
int | bt_le_per_adv_sync_transfer_unsubscribe (const struct bt_conn *conn) |
Unsubscribe from periodic advertising sync transfers (PASTs). | |
int | bt_le_per_adv_list_add (const bt_addr_le_t *addr, uint8_t sid) |
Add a device to the periodic advertising list. | |
int | bt_le_per_adv_list_remove (const bt_addr_le_t *addr, uint8_t sid) |
Remove a device from the periodic advertising list. | |
int | bt_le_per_adv_list_clear (void) |
Clear the periodic advertising list. | |
int | bt_le_scan_start (const struct bt_le_scan_param *param, bt_le_scan_cb_t cb) |
Start (LE) scanning. | |
int | bt_le_scan_stop (void) |
Stop (LE) scanning. | |
int | bt_le_scan_cb_register (struct bt_le_scan_cb *cb) |
Register scanner packet callbacks. | |
void | bt_le_scan_cb_unregister (struct bt_le_scan_cb *cb) |
Unregister scanner packet callbacks. | |
int | bt_le_filter_accept_list_add (const bt_addr_le_t *addr) |
Add device (LE) to filter accept list. | |
int | bt_le_filter_accept_list_remove (const bt_addr_le_t *addr) |
Remove device (LE) from filter accept list. | |
int | bt_le_filter_accept_list_clear (void) |
Clear filter accept list. | |
int | bt_le_set_chan_map (uint8_t chan_map[5]) |
Set (LE) channel map. | |
int | bt_le_set_rpa_timeout (uint16_t new_rpa_timeout) |
Set the Resolvable Private Address timeout in runtime. | |
void | bt_data_parse (struct net_buf_simple *ad, bool(*func)(struct bt_data *data, void *user_data), void *user_data) |
Helper for parsing advertising (or EIR or OOB) data. | |
int | bt_le_oob_get_local (uint8_t id, struct bt_le_oob *oob) |
Get local LE Out of Band (OOB) information. | |
int | bt_le_ext_adv_oob_get_local (struct bt_le_ext_adv *adv, struct bt_le_oob *oob) |
Get local LE Out of Band (OOB) information. | |
int | bt_unpair (uint8_t id, const bt_addr_le_t *addr) |
Clear pairing information. | |
void | bt_foreach_bond (uint8_t id, void(*func)(const struct bt_bond_info *info, void *user_data), void *user_data) |
Iterate through all existing bonds. | |
int | bt_configure_data_path (uint8_t dir, uint8_t id, uint8_t vs_config_len, const uint8_t *vs_config) |
Configure vendor data path. | |
int | bt_le_per_adv_sync_subevent (struct bt_le_per_adv_sync *per_adv_sync, struct bt_le_per_adv_sync_subevent_params *params) |
Synchronize with a subset of subevents. | |
int | bt_le_per_adv_set_response_data (struct bt_le_per_adv_sync *per_adv_sync, const struct bt_le_per_adv_response_params *params, const struct net_buf_simple *data) |
Set the data for a response slot in a specific subevent of the PAwR. | |
Bluetooth subsystem core APIs.