|
Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
Bluetooth connection handling. More...
#include <stdbool.h>#include <stdint.h>#include <zephyr/bluetooth/bluetooth.h>#include <zephyr/bluetooth/hci_types.h>#include <zephyr/bluetooth/addr.h>#include <zephyr/bluetooth/gap.h>#include <zephyr/bluetooth/direction.h>#include <zephyr/sys/iterable_sections.h>Go to the source code of this file.
Data Structures | |
| struct | bt_le_conn_param |
| Connection parameters for LE connections. More... | |
| struct | bt_conn_le_phy_info |
| Connection PHY information for LE connections. More... | |
| struct | bt_conn_le_phy_param |
| Preferred PHY parameters for LE connections. More... | |
| struct | bt_conn_le_data_len_info |
| Connection data length information for LE connections. More... | |
| struct | bt_conn_le_data_len_param |
| Connection data length parameters for LE connections. More... | |
| struct | bt_conn_le_subrate_param |
| Connection subrating parameters for LE connections. More... | |
| struct | bt_conn_le_subrating_info |
| Subrating information for LE connections. More... | |
| struct | bt_conn_le_subrate_changed |
| Updated subrating connection parameters for LE connections. More... | |
| struct | bt_conn_le_cs_capabilities |
| Remote channel sounding capabilities for LE connections supporting CS. More... | |
| struct | bt_conn_le_cs_fae_table |
| Remote FAE Table for LE connections supporting CS. More... | |
| struct | bt_conn_le_cs_config |
| Channel sounding configuration. More... | |
| struct | bt_conn_le_cs_subevent_result |
| Subevent data for LE connections supporting CS. More... | |
| struct | bt_conn_le_info |
| LE Connection Info Structure. More... | |
| struct | bt_conn_br_info |
| BR/EDR Connection Info Structure. More... | |
| struct | bt_security_info |
| Security Info Structure. More... | |
| struct | bt_conn_info |
| Connection Info Structure. More... | |
| struct | bt_conn_le_remote_info |
| LE Connection Remote Info Structure. More... | |
| struct | bt_conn_br_remote_info |
| BR/EDR Connection Remote Info structure. More... | |
| struct | bt_conn_remote_info |
| Connection Remote Info Structure. More... | |
| struct | bt_conn_le_tx_power |
| LE Transmit Power Level Structure. More... | |
| struct | bt_conn_le_tx_power_report |
| LE Transmit Power Reporting Structure. More... | |
| struct | bt_conn_le_path_loss_threshold_report |
| LE Path Loss Monitoring Threshold Change Report Structure. More... | |
| struct | bt_conn_le_path_loss_reporting_param |
| LE Path Loss Monitoring Parameters Structure as defined in Core Spec. More... | |
| struct | bt_conn_le_create_param |
| struct | bt_conn_le_create_synced_param |
| struct | bt_conn_le_cs_procedure_enable_complete |
| struct | bt_conn_cb |
| Connection callback structure. More... | |
| struct | bt_conn_oob_info |
| Info Structure for OOB pairing. More... | |
| struct | bt_conn_pairing_feat |
| Pairing request and pairing response info structure. More... | |
| struct | bt_conn_auth_cb |
| Authenticated pairing callback structure. More... | |
| struct | bt_conn_auth_info_cb |
| Authenticated pairing information callback structure. More... | |
| struct | bt_br_conn_param |
| Connection parameters for BR/EDR connections. More... | |
Macros | |
| #define | BT_LE_CONN_PARAM_INIT(int_min, int_max, lat, to) |
| Initialize connection parameters. | |
| #define | BT_LE_CONN_PARAM(int_min, int_max, lat, to) |
| Helper to declare connection parameters inline. | |
| #define | BT_LE_CONN_PARAM_DEFAULT |
| Default LE connection parameters: Connection Interval: 30-50 ms Latency: 0 Timeout: 4 s. | |
| #define | BT_CONN_LE_PHY_PARAM_INIT(_pref_tx_phy, _pref_rx_phy) |
| Initialize PHY parameters. | |
| #define | BT_CONN_LE_PHY_PARAM(_pref_tx_phy, _pref_rx_phy) |
| Helper to declare PHY parameters inline. | |
| #define | BT_CONN_LE_PHY_PARAM_1M |
| Only LE 1M PHY. | |
| #define | BT_CONN_LE_PHY_PARAM_2M |
| Only LE 2M PHY. | |
| #define | BT_CONN_LE_PHY_PARAM_CODED |
| Only LE Coded PHY. | |
| #define | BT_CONN_LE_PHY_PARAM_ALL |
| All LE PHYs. | |
| #define | BT_CONN_LE_DATA_LEN_PARAM_INIT(_tx_max_len, _tx_max_time) |
| Initialize transmit data length parameters. | |
| #define | BT_CONN_LE_DATA_LEN_PARAM(_tx_max_len, _tx_max_time) |
| Helper to declare transmit data length parameters inline. | |
| #define | BT_LE_DATA_LEN_PARAM_DEFAULT |
| Default LE data length parameters. | |
| #define | BT_LE_DATA_LEN_PARAM_MAX |
| Maximum LE data length parameters. | |
| #define | BT_CONN_INTERVAL_TO_MS(interval) ((interval) * 5U / 4U) |
| Convert connection interval to milliseconds. | |
| #define | BT_CONN_INTERVAL_TO_US(interval) ((interval) * 1250U) |
| Convert connection interval to microseconds. | |
| #define | BT_CONN_LE_CREATE_PARAM_INIT(_options, _interval, _window) |
| Initialize create connection parameters. | |
| #define | BT_CONN_LE_CREATE_PARAM(_options, _interval, _window) |
| Helper to declare create connection parameters inline. | |
| #define | BT_CONN_LE_CREATE_CONN |
| Default LE create connection parameters. | |
| #define | BT_CONN_LE_CREATE_CONN_AUTO |
| Default LE create connection using filter accept list parameters. | |
| #define | BT_CONN_CB_DEFINE(_name) |
| Register a callback structure for connection events. | |
| #define | BT_PASSKEY_INVALID 0xffffffff |
| Special passkey value that can be used to disable a previously set fixed passkey. | |
| #define | BT_BR_CONN_PARAM_INIT(role_switch) |
| Initialize BR/EDR connection parameters. | |
| #define | BT_BR_CONN_PARAM(role_switch) |
| Helper to declare BR/EDR connection parameters inline. | |
| #define | BT_BR_CONN_PARAM_DEFAULT BT_BR_CONN_PARAM(true) |
| Default BR/EDR connection parameters: Role switch allowed. | |
Functions | |
| struct bt_conn * | bt_conn_ref (struct bt_conn *conn) |
| Increment a connection's reference count. | |
| void | bt_conn_unref (struct bt_conn *conn) |
| Decrement a connection's reference count. | |
| void | bt_conn_foreach (enum bt_conn_type type, void(*func)(struct bt_conn *conn, void *data), void *data) |
| Iterate through all bt_conn objects. | |
| struct bt_conn * | bt_conn_lookup_addr_le (uint8_t id, const bt_addr_le_t *peer) |
| Look up an existing connection by address. | |
| const bt_addr_le_t * | bt_conn_get_dst (const struct bt_conn *conn) |
| Get destination (peer) address of a connection. | |
| uint8_t | bt_conn_index (const struct bt_conn *conn) |
| Get array index of a connection. | |
| int | bt_conn_get_info (const struct bt_conn *conn, struct bt_conn_info *info) |
| Get connection info. | |
| int | bt_conn_get_remote_info (struct bt_conn *conn, struct bt_conn_remote_info *remote_info) |
| Get connection info for the remote device. | |
| int | bt_conn_le_get_tx_power_level (struct bt_conn *conn, struct bt_conn_le_tx_power *tx_power_level) |
| Get connection transmit power level. | |
| int | bt_conn_le_enhanced_get_tx_power_level (struct bt_conn *conn, struct bt_conn_le_tx_power *tx_power) |
| Get local enhanced connection transmit power level. | |
| int | bt_conn_le_get_remote_tx_power_level (struct bt_conn *conn, enum bt_conn_le_tx_power_phy phy) |
| Get remote (peer) transmit power level. | |
| int | bt_conn_le_set_tx_power_report_enable (struct bt_conn *conn, bool local_enable, bool remote_enable) |
| Enable transmit power reporting. | |
| int | bt_conn_le_set_path_loss_mon_param (struct bt_conn *conn, const struct bt_conn_le_path_loss_reporting_param *param) |
| Set Path Loss Monitoring Parameters. | |
| int | bt_conn_le_set_path_loss_mon_enable (struct bt_conn *conn, bool enable) |
| Enable or Disable Path Loss Monitoring. | |
| int | bt_conn_le_subrate_set_defaults (const struct bt_conn_le_subrate_param *params) |
| Set Default Connection Subrating Parameters. | |
| int | bt_conn_le_subrate_request (struct bt_conn *conn, const struct bt_conn_le_subrate_param *params) |
| Request New Subrating Parameters. | |
| int | bt_conn_le_param_update (struct bt_conn *conn, const struct bt_le_conn_param *param) |
| Update the connection parameters. | |
| int | bt_conn_le_data_len_update (struct bt_conn *conn, const struct bt_conn_le_data_len_param *param) |
| Update the connection transmit data length parameters. | |
| int | bt_conn_le_phy_update (struct bt_conn *conn, const struct bt_conn_le_phy_param *param) |
| Update the connection PHY parameters. | |
| int | bt_conn_disconnect (struct bt_conn *conn, uint8_t reason) |
| Disconnect from a remote device or cancel pending connection. | |
| int | bt_conn_le_create (const bt_addr_le_t *peer, const struct bt_conn_le_create_param *create_param, const struct bt_le_conn_param *conn_param, struct bt_conn **conn) |
| Initiate an LE connection to a remote device. | |
| int | bt_conn_le_create_synced (const struct bt_le_ext_adv *adv, const struct bt_conn_le_create_synced_param *synced_param, const struct bt_le_conn_param *conn_param, struct bt_conn **conn) |
| Create a connection to a synced device. | |
| int | bt_conn_le_create_auto (const struct bt_conn_le_create_param *create_param, const struct bt_le_conn_param *conn_param) |
| Automatically connect to remote devices in the filter accept list. | |
| int | bt_conn_create_auto_stop (void) |
| Stop automatic connect creation. | |
| int | bt_le_set_auto_conn (const bt_addr_le_t *addr, const struct bt_le_conn_param *param) |
| Automatically connect to remote device if it's in range. | |
| int | bt_conn_set_security (struct bt_conn *conn, bt_security_t sec) |
| Set security level for a connection. | |
| bt_security_t | bt_conn_get_security (const struct bt_conn *conn) |
| Get security level for a connection. | |
| uint8_t | bt_conn_enc_key_size (const struct bt_conn *conn) |
| Get encryption key size. | |
| int | bt_conn_cb_register (struct bt_conn_cb *cb) |
| Register connection callbacks. | |
| int | bt_conn_cb_unregister (struct bt_conn_cb *cb) |
| Unregister connection callbacks. | |
| static const char * | bt_security_err_to_str (enum bt_security_err err) |
| Converts a security error to string. | |
| void | bt_set_bondable (bool enable) |
| Enable/disable bonding. | |
| bool | bt_get_bondable (void) |
| Get bonding flag. | |
| int | bt_conn_set_bondable (struct bt_conn *conn, bool enable) |
| Set/clear the bonding flag for a given connection. | |
| void | bt_le_oob_set_sc_flag (bool enable) |
| Allow/disallow remote LE SC OOB data to be used for pairing. | |
| void | bt_le_oob_set_legacy_flag (bool enable) |
| Allow/disallow remote legacy OOB data to be used for pairing. | |
| int | bt_le_oob_set_legacy_tk (struct bt_conn *conn, const uint8_t *tk) |
| Set OOB Temporary Key to be used for pairing. | |
| int | bt_le_oob_set_sc_data (struct bt_conn *conn, const struct bt_le_oob_sc_data *oobd_local, const struct bt_le_oob_sc_data *oobd_remote) |
| Set OOB data during LE Secure Connections (SC) pairing procedure. | |
| int | bt_le_oob_get_sc_data (struct bt_conn *conn, const struct bt_le_oob_sc_data **oobd_local, const struct bt_le_oob_sc_data **oobd_remote) |
| Get OOB data used for LE Secure Connections (SC) pairing procedure. | |
| int | bt_passkey_set (unsigned int passkey) |
| Set a fixed passkey to be used for pairing. | |
| int | bt_conn_auth_cb_register (const struct bt_conn_auth_cb *cb) |
| Register authentication callbacks. | |
| int | bt_conn_auth_cb_overlay (struct bt_conn *conn, const struct bt_conn_auth_cb *cb) |
| Overlay authentication callbacks used for a given connection. | |
| int | bt_conn_auth_info_cb_register (struct bt_conn_auth_info_cb *cb) |
| Register authentication information callbacks. | |
| int | bt_conn_auth_info_cb_unregister (struct bt_conn_auth_info_cb *cb) |
| Unregister authentication information callbacks. | |
| int | bt_conn_auth_passkey_entry (struct bt_conn *conn, unsigned int passkey) |
| Reply with entered passkey. | |
| int | bt_conn_auth_keypress_notify (struct bt_conn *conn, enum bt_conn_auth_keypress type) |
| Send Passkey Keypress Notification during pairing. | |
| int | bt_conn_auth_cancel (struct bt_conn *conn) |
| Cancel ongoing authenticated pairing. | |
| int | bt_conn_auth_passkey_confirm (struct bt_conn *conn) |
| Reply if passkey was confirmed to match by user. | |
| int | bt_conn_auth_pairing_confirm (struct bt_conn *conn) |
| Reply if incoming pairing was confirmed by user. | |
| int | bt_conn_auth_pincode_entry (struct bt_conn *conn, const char *pin) |
| Reply with entered PIN code. | |
| struct bt_conn * | bt_conn_create_br (const bt_addr_t *peer, const struct bt_br_conn_param *param) |
| Initiate an BR/EDR connection to a remote device. | |
Bluetooth connection handling.