Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
conn.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2015-2016 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10#ifndef ZEPHYR_INCLUDE_BLUETOOTH_CONN_H_
11#define ZEPHYR_INCLUDE_BLUETOOTH_CONN_H_
12
20#include <stdbool.h>
21#include <stdint.h>
22
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
35struct bt_conn;
36
43};
44
52#define BT_LE_CONN_PARAM_INIT(int_min, int_max, lat, to) \
53{ \
54 .interval_min = (int_min), \
55 .interval_max = (int_max), \
56 .latency = (lat), \
57 .timeout = (to), \
58}
59
67#define BT_LE_CONN_PARAM(int_min, int_max, lat, to) \
68 ((struct bt_le_conn_param[]) { \
69 BT_LE_CONN_PARAM_INIT(int_min, int_max, lat, to) \
70 })
71
77#define BT_LE_CONN_PARAM_DEFAULT BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, \
78 BT_GAP_INIT_CONN_INT_MAX, \
79 0, 400)
80
85};
86
88enum {
91
94
97};
98
104};
105
111#define BT_CONN_LE_PHY_PARAM_INIT(_pref_tx_phy, _pref_rx_phy) \
112{ \
113 .options = BT_CONN_LE_PHY_OPT_NONE, \
114 .pref_tx_phy = (_pref_tx_phy), \
115 .pref_rx_phy = (_pref_rx_phy), \
116}
117
123#define BT_CONN_LE_PHY_PARAM(_pref_tx_phy, _pref_rx_phy) \
124 ((struct bt_conn_le_phy_param []) { \
125 BT_CONN_LE_PHY_PARAM_INIT(_pref_tx_phy, _pref_rx_phy) \
126 })
127
129#define BT_CONN_LE_PHY_PARAM_1M BT_CONN_LE_PHY_PARAM(BT_GAP_LE_PHY_1M, \
130 BT_GAP_LE_PHY_1M)
131
133#define BT_CONN_LE_PHY_PARAM_2M BT_CONN_LE_PHY_PARAM(BT_GAP_LE_PHY_2M, \
134 BT_GAP_LE_PHY_2M)
135
137#define BT_CONN_LE_PHY_PARAM_CODED BT_CONN_LE_PHY_PARAM(BT_GAP_LE_PHY_CODED, \
138 BT_GAP_LE_PHY_CODED)
139
141#define BT_CONN_LE_PHY_PARAM_ALL BT_CONN_LE_PHY_PARAM(BT_GAP_LE_PHY_1M | \
142 BT_GAP_LE_PHY_2M | \
143 BT_GAP_LE_PHY_CODED, \
144 BT_GAP_LE_PHY_1M | \
145 BT_GAP_LE_PHY_2M | \
146 BT_GAP_LE_PHY_CODED)
147
158};
159
166};
167
173#define BT_CONN_LE_DATA_LEN_PARAM_INIT(_tx_max_len, _tx_max_time) \
174{ \
175 .tx_max_len = (_tx_max_len), \
176 .tx_max_time = (_tx_max_time), \
177}
178
184#define BT_CONN_LE_DATA_LEN_PARAM(_tx_max_len, _tx_max_time) \
185 ((struct bt_conn_le_data_len_param[]) { \
186 BT_CONN_LE_DATA_LEN_PARAM_INIT(_tx_max_len, _tx_max_time) \
187 })
188
190#define BT_LE_DATA_LEN_PARAM_DEFAULT \
191 BT_CONN_LE_DATA_LEN_PARAM(BT_GAP_DATA_LEN_DEFAULT, \
192 BT_GAP_DATA_TIME_DEFAULT)
193
195#define BT_LE_DATA_LEN_PARAM_MAX \
196 BT_CONN_LE_DATA_LEN_PARAM(BT_GAP_DATA_LEN_MAX, \
197 BT_GAP_DATA_TIME_MAX)
198
217};
218
228};
229
248};
249
251enum __packed bt_conn_type {
263};
264
276struct bt_conn *bt_conn_ref(struct bt_conn *conn);
277
284void bt_conn_unref(struct bt_conn *conn);
285
303 void (*func)(struct bt_conn *conn, void *data),
304 void *data);
305
318struct bt_conn *bt_conn_lookup_addr_le(uint8_t id, const bt_addr_le_t *peer);
319
326const bt_addr_le_t *bt_conn_get_dst(const struct bt_conn *conn);
327
338uint8_t bt_conn_index(const struct bt_conn *conn);
339
356#if defined(CONFIG_BT_USER_PHY_UPDATE)
358#endif /* defined(CONFIG_BT_USER_PHY_UPDATE) */
359
360#if defined(CONFIG_BT_USER_DATA_LEN_UPDATE)
361 /* Connection maximum single fragment parameters */
363#endif /* defined(CONFIG_BT_USER_DATA_LEN_UPDATE) */
364
365#if defined(CONFIG_BT_SUBRATING)
366 /* Connection subrating parameters */
367 const struct bt_conn_le_subrating_info *subrate;
368#endif /* defined(CONFIG_BT_SUBRATING) */
369};
370
378#define BT_CONN_INTERVAL_TO_MS(interval) ((interval) * 5U / 4U)
379
384#define BT_CONN_INTERVAL_TO_US(interval) ((interval) * 1250U)
385
388 const bt_addr_t *dst;
389};
390
391enum {
394};
395
405};
406
408typedef enum __packed {
424
431};
432
441};
442
444#define BT_CONN_ROLE_MASTER __DEPRECATED_MACRO BT_CONN_ROLE_CENTRAL
445#define BT_CONN_ROLE_SLAVE __DEPRECATED_MACRO BT_CONN_ROLE_PERIPHERAL
446
456 union {
461 };
466};
467
470
473};
474
477
480
483};
484
493
496
499
502
503 union {
506
509 };
510};
511
523};
524
527
530
533
536};
537
538
541
546
549
559
564
572};
573
591};
592
596
599
602
605};
606
623};
624
636};
637
645int bt_conn_get_info(const struct bt_conn *conn, struct bt_conn_info *info);
646
662int bt_conn_get_remote_info(struct bt_conn *conn,
663 struct bt_conn_remote_info *remote_info);
664
673int bt_conn_le_get_tx_power_level(struct bt_conn *conn,
674 struct bt_conn_le_tx_power *tx_power_level);
675
685 struct bt_conn_le_tx_power *tx_power);
686
696 enum bt_conn_le_tx_power_phy phy);
697
708 bool local_enable,
709 bool remote_enable);
710
722int bt_conn_le_set_path_loss_mon_param(struct bt_conn *conn,
723 const struct bt_conn_le_path_loss_reporting_param *param);
724
737int bt_conn_le_set_path_loss_mon_enable(struct bt_conn *conn, bool enable);
738
754
766int bt_conn_le_subrate_request(struct bt_conn *conn,
767 const struct bt_conn_le_subrate_param *params);
768
780int bt_conn_le_param_update(struct bt_conn *conn,
781 const struct bt_le_conn_param *param);
782
790int bt_conn_le_data_len_update(struct bt_conn *conn,
791 const struct bt_conn_le_data_len_param *param);
792
803int bt_conn_le_phy_update(struct bt_conn *conn,
804 const struct bt_conn_le_phy_param *param);
805
828int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason);
829
830enum {
833
839
847};
848
850
853
856
859
865
871
880};
881
888#define BT_CONN_LE_CREATE_PARAM_INIT(_options, _interval, _window) \
889{ \
890 .options = (_options), \
891 .interval = (_interval), \
892 .window = (_window), \
893 .interval_coded = 0, \
894 .window_coded = 0, \
895 .timeout = 0, \
896}
897
904#define BT_CONN_LE_CREATE_PARAM(_options, _interval, _window) \
905 ((struct bt_conn_le_create_param[]) { \
906 BT_CONN_LE_CREATE_PARAM_INIT(_options, _interval, _window) \
907 })
908
912#define BT_CONN_LE_CREATE_CONN \
913 BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \
914 BT_GAP_SCAN_FAST_INTERVAL, \
915 BT_GAP_SCAN_FAST_INTERVAL)
916
921#define BT_CONN_LE_CREATE_CONN_AUTO \
922 BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \
923 BT_GAP_SCAN_FAST_INTERVAL, \
924 BT_GAP_SCAN_FAST_WINDOW)
925
947 const struct bt_conn_le_create_param *create_param,
948 const struct bt_le_conn_param *conn_param,
949 struct bt_conn **conn);
950
952
959
962};
963
981int bt_conn_le_create_synced(const struct bt_le_ext_adv *adv,
982 const struct bt_conn_le_create_synced_param *synced_param,
983 const struct bt_le_conn_param *conn_param, struct bt_conn **conn);
984
1001 const struct bt_le_conn_param *conn_param);
1002
1008
1024 const struct bt_le_conn_param *param);
1025
1062int bt_conn_set_security(struct bt_conn *conn, bt_security_t sec);
1063
1068bt_security_t bt_conn_get_security(const struct bt_conn *conn);
1069
1079uint8_t bt_conn_enc_key_size(const struct bt_conn *conn);
1080
1084
1087
1090
1093
1096
1099
1102
1105
1108
1111};
1112
1148 void (*connected)(struct bt_conn *conn, uint8_t err);
1149
1167 void (*disconnected)(struct bt_conn *conn, uint8_t reason);
1168
1181 void (*recycled)(void);
1182
1207 bool (*le_param_req)(struct bt_conn *conn,
1208 struct bt_le_conn_param *param);
1209
1220 void (*le_param_updated)(struct bt_conn *conn, uint16_t interval,
1221 uint16_t latency, uint16_t timeout);
1222#if defined(CONFIG_BT_SMP)
1232 void (*identity_resolved)(struct bt_conn *conn,
1233 const bt_addr_le_t *rpa,
1234 const bt_addr_le_t *identity);
1235#endif /* CONFIG_BT_SMP */
1236#if defined(CONFIG_BT_SMP) || defined(CONFIG_BT_CLASSIC)
1253 void (*security_changed)(struct bt_conn *conn, bt_security_t level,
1254 enum bt_security_err err);
1255#endif /* defined(CONFIG_BT_SMP) || defined(CONFIG_BT_CLASSIC) */
1256
1257#if defined(CONFIG_BT_REMOTE_INFO)
1266 void (*remote_info_available)(struct bt_conn *conn,
1267 struct bt_conn_remote_info *remote_info);
1268#endif /* defined(CONFIG_BT_REMOTE_INFO) */
1269
1270#if defined(CONFIG_BT_USER_PHY_UPDATE)
1279 void (*le_phy_updated)(struct bt_conn *conn,
1280 struct bt_conn_le_phy_info *param);
1281#endif /* defined(CONFIG_BT_USER_PHY_UPDATE) */
1282
1283#if defined(CONFIG_BT_USER_DATA_LEN_UPDATE)
1292 void (*le_data_len_updated)(struct bt_conn *conn,
1293 struct bt_conn_le_data_len_info *info);
1294#endif /* defined(CONFIG_BT_USER_DATA_LEN_UPDATE) */
1295
1296#if defined(CONFIG_BT_DF_CONNECTION_CTE_RX)
1303 void (*cte_report_cb)(struct bt_conn *conn,
1304 const struct bt_df_conn_iq_samples_report *iq_report);
1305#endif /* CONFIG_BT_DF_CONNECTION_CTE_RX */
1306
1307#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL)
1319 void (*tx_power_report)(struct bt_conn *conn,
1320 const struct bt_conn_le_tx_power_report *report);
1321#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */
1322
1323#if defined(CONFIG_BT_PATH_LOSS_MONITORING)
1333 void (*path_loss_threshold_report)(struct bt_conn *conn,
1334 const struct bt_conn_le_path_loss_threshold_report *report);
1335#endif /* CONFIG_BT_PATH_LOSS_MONITORING */
1336
1337#if defined(CONFIG_BT_SUBRATING)
1348 void (*subrate_changed)(struct bt_conn *conn,
1349 const struct bt_conn_le_subrate_changed *params);
1350#endif /* CONFIG_BT_SUBRATING */
1351
1353 sys_snode_t _node;
1354};
1355
1366
1379
1385#define BT_CONN_CB_DEFINE(_name) \
1386 static const STRUCT_SECTION_ITERABLE(bt_conn_cb, \
1387 _CONCAT(bt_conn_cb_, \
1388 _name))
1389
1396#if defined(CONFIG_BT_SECURITY_ERR_TO_STR)
1397const char *bt_security_err_to_str(enum bt_security_err err);
1398#else
1399static inline const char *bt_security_err_to_str(enum bt_security_err err)
1400{
1401 ARG_UNUSED(err);
1402
1403 return "";
1404}
1405#endif
1406
1417void bt_set_bondable(bool enable);
1418
1437int bt_conn_set_bondable(struct bt_conn *conn, bool enable);
1438
1445void bt_le_oob_set_sc_flag(bool enable);
1446
1454
1466int bt_le_oob_set_legacy_tk(struct bt_conn *conn, const uint8_t *tk);
1467
1486int bt_le_oob_set_sc_data(struct bt_conn *conn,
1487 const struct bt_le_oob_sc_data *oobd_local,
1488 const struct bt_le_oob_sc_data *oobd_remote);
1489
1505int bt_le_oob_get_sc_data(struct bt_conn *conn,
1506 const struct bt_le_oob_sc_data **oobd_local,
1507 const struct bt_le_oob_sc_data **oobd_remote);
1508
1513#define BT_PASSKEY_INVALID 0xffffffff
1514
1528int bt_passkey_set(unsigned int passkey);
1529
1533 enum {
1536
1540
1541 union {
1543 struct {
1545 enum {
1548
1551
1554
1559 };
1560};
1561
1562#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
1572
1575
1578
1581
1586
1591};
1592#endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */
1593
1596#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
1624 enum bt_security_err (*pairing_accept)(struct bt_conn *conn,
1625 const struct bt_conn_pairing_feat *const feat);
1626#endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */
1627
1646 void (*passkey_display)(struct bt_conn *conn, unsigned int passkey);
1647
1648#if defined(CONFIG_BT_PASSKEY_KEYPRESS)
1670 void (*passkey_display_keypress)(struct bt_conn *conn,
1671 enum bt_conn_auth_keypress type);
1672#endif
1673
1692 void (*passkey_entry)(struct bt_conn *conn);
1693
1715 void (*passkey_confirm)(struct bt_conn *conn, unsigned int passkey);
1716
1733 void (*oob_data_request)(struct bt_conn *conn,
1734 struct bt_conn_oob_info *info);
1735
1748 void (*cancel)(struct bt_conn *conn);
1749
1768 void (*pairing_confirm)(struct bt_conn *conn);
1769
1770#if defined(CONFIG_BT_CLASSIC)
1789 void (*pincode_entry)(struct bt_conn *conn, bool highsec);
1790#endif
1791};
1792
1804 void (*pairing_complete)(struct bt_conn *conn, bool bonded);
1805
1811 void (*pairing_failed)(struct bt_conn *conn,
1812 enum bt_security_err reason);
1813
1822 void (*bond_deleted)(uint8_t id, const bt_addr_le_t *peer);
1823
1826};
1827
1838
1853int bt_conn_auth_cb_overlay(struct bt_conn *conn, const struct bt_conn_auth_cb *cb);
1854
1865
1875
1886int bt_conn_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey);
1887
1903int bt_conn_auth_keypress_notify(struct bt_conn *conn, enum bt_conn_auth_keypress type);
1904
1913int bt_conn_auth_cancel(struct bt_conn *conn);
1914
1924int bt_conn_auth_passkey_confirm(struct bt_conn *conn);
1925
1935int bt_conn_auth_pairing_confirm(struct bt_conn *conn);
1936
1947int bt_conn_auth_pincode_entry(struct bt_conn *conn, const char *pin);
1948
1952};
1953
1958#define BT_BR_CONN_PARAM_INIT(role_switch) \
1959{ \
1960 .allow_role_switch = (role_switch), \
1961}
1962
1967#define BT_BR_CONN_PARAM(role_switch) \
1968 ((struct bt_br_conn_param[]) { \
1969 BT_BR_CONN_PARAM_INIT(role_switch) \
1970 })
1971
1975#define BT_BR_CONN_PARAM_DEFAULT BT_BR_CONN_PARAM(true)
1976
1977
1990struct bt_conn *bt_conn_create_br(const bt_addr_t *peer,
1991 const struct bt_br_conn_param *param);
1992
1993#ifdef __cplusplus
1994}
1995#endif
1996
2001#endif /* ZEPHYR_INCLUDE_BLUETOOTH_CONN_H_ */
Bluetooth device address definitions and utilities.
Bluetooth subsystem core APIs.
Bluetooth Generic Access Profile defines and Assigned Numbers.
void bt_set_bondable(bool enable)
Enable/disable bonding.
struct bt_conn * bt_conn_ref(struct bt_conn *conn)
Increment a connection's reference count.
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_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_le_oob_set_legacy_tk(struct bt_conn *conn, const uint8_t *tk)
Set OOB Temporary Key to be used for pairing.
int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason)
Disconnect from a remote device or cancel pending connection.
int bt_conn_auth_cb_register(const struct bt_conn_auth_cb *cb)
Register authentication callbacks.
struct bt_conn * bt_conn_lookup_addr_le(uint8_t id, const bt_addr_le_t *peer)
Look up an existing connection by address.
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_get_info(const struct bt_conn *conn, struct bt_conn_info *info)
Get connection info.
bt_security_flag
Security Info Flags.
Definition: conn.h:426
static const char * bt_security_err_to_str(enum bt_security_err err)
Converts a security error to string.
Definition: conn.h:1399
int bt_passkey_set(unsigned int passkey)
Set a fixed passkey to be used for pairing.
int bt_conn_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey)
Reply with entered passkey.
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.
int bt_conn_set_bondable(struct bt_conn *conn, bool enable)
Set/clear the bonding flag for a given connection.
void bt_conn_unref(struct bt_conn *conn)
Decrement a connection's reference count.
bt_security_t bt_conn_get_security(const struct bt_conn *conn)
Get security level for a connection.
bt_conn_auth_keypress
Passkey Keypress Notification type.
Definition: conn.h:630
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.
int bt_conn_create_auto_stop(void)
Stop automatic connect creation.
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_get_remote_info(struct bt_conn *conn, struct bt_conn_remote_info *remote_info)
Get connection info for the remote device.
bt_conn_le_tx_power_phy
Definition: conn.h:512
int bt_conn_le_subrate_request(struct bt_conn *conn, const struct bt_conn_le_subrate_param *params)
Request New Subrating Parameters.
const bt_addr_le_t * bt_conn_get_dst(const struct bt_conn *conn)
Get destination (peer) address of a connection.
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_cancel(struct bt_conn *conn)
Cancel ongoing authenticated pairing.
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_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_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_le_set_path_loss_mon_enable(struct bt_conn *conn, bool enable)
Enable or Disable Path Loss Monitoring.
bt_conn_state
Definition: conn.h:396
void bt_le_oob_set_legacy_flag(bool enable)
Allow/disallow remote legacy OOB data to be used for pairing.
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_set_tx_power_report_enable(struct bt_conn *conn, bool local_enable, bool remote_enable)
Enable transmit power reporting.
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.
bt_security_err
Definition: conn.h:1081
int bt_conn_cb_register(struct bt_conn_cb *cb)
Register connection callbacks.
int bt_conn_le_param_update(struct bt_conn *conn, const struct bt_le_conn_param *param)
Update the connection parameters.
int bt_conn_auth_passkey_confirm(struct bt_conn *conn)
Reply if passkey was confirmed to match by user.
bt_conn_type
Connection Type.
Definition: conn.h:251
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_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_le_subrate_set_defaults(const struct bt_conn_le_subrate_param *params)
Set Default Connection Subrating Parameters.
void bt_le_oob_set_sc_flag(bool enable)
Allow/disallow remote LE SC OOB data to be used for pairing.
int bt_conn_cb_unregister(struct bt_conn_cb *cb)
Unregister connection callbacks.
uint8_t bt_conn_index(const struct bt_conn *conn)
Get array index of a connection.
int bt_conn_set_security(struct bt_conn *conn, bt_security_t sec)
Set security level for a connection.
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_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.
bt_security_t
Security level.
Definition: conn.h:408
bt_conn_le_path_loss_zone
Path Loss zone that has been entered.
Definition: conn.h:582
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.
uint8_t bt_conn_enc_key_size(const struct bt_conn *conn)
Get encryption key size.
@ BT_SECURITY_FLAG_OOB
Paired with Out of Band method.
Definition: conn.h:430
@ BT_SECURITY_FLAG_SC
Paired with Secure Connections.
Definition: conn.h:428
@ BT_CONN_AUTH_KEYPRESS_DIGIT_ERASED
Definition: conn.h:633
@ BT_CONN_AUTH_KEYPRESS_DIGIT_ENTERED
Definition: conn.h:632
@ BT_CONN_AUTH_KEYPRESS_CLEARED
Definition: conn.h:634
@ BT_CONN_AUTH_KEYPRESS_ENTRY_STARTED
Definition: conn.h:631
@ BT_CONN_AUTH_KEYPRESS_ENTRY_COMPLETED
Definition: conn.h:635
@ BT_CONN_LE_TX_POWER_PHY_NONE
Convenience macro for when no PHY is set.
Definition: conn.h:514
@ BT_CONN_LE_TX_POWER_PHY_CODED_S2
LE Coded PHY using S=2 coding.
Definition: conn.h:522
@ BT_CONN_LE_TX_POWER_PHY_CODED_S8
LE Coded PHY using S=8 coding.
Definition: conn.h:520
@ BT_CONN_LE_TX_POWER_PHY_1M
LE 1M PHY.
Definition: conn.h:516
@ BT_CONN_LE_TX_POWER_PHY_2M
LE 2M PHY.
Definition: conn.h:518
@ BT_CONN_LE_PHY_OPT_CODED_S2
LE Coded using S=2 coding preferred when transmitting.
Definition: conn.h:93
@ BT_CONN_LE_PHY_OPT_CODED_S8
LE Coded using S=8 coding preferred when transmitting.
Definition: conn.h:96
@ BT_CONN_LE_PHY_OPT_NONE
Convenience value when no options are specified.
Definition: conn.h:90
@ BT_CONN_LE_OPT_NONE
Convenience value when no options are specified.
Definition: conn.h:832
@ BT_CONN_LE_OPT_NO_1M
Disable LE 1M PHY.
Definition: conn.h:846
@ BT_CONN_LE_OPT_CODED
Enable LE Coded PHY.
Definition: conn.h:838
@ BT_CONN_STATE_CONNECTING
Channel in connecting state.
Definition: conn.h:400
@ BT_CONN_STATE_CONNECTED
Channel connected and ready for upper layer traffic on it.
Definition: conn.h:402
@ BT_CONN_STATE_DISCONNECTED
Channel disconnected.
Definition: conn.h:398
@ BT_CONN_STATE_DISCONNECTING
Channel in disconnecting state.
Definition: conn.h:404
@ BT_SECURITY_ERR_OOB_NOT_AVAILABLE
OOB data is not available.
Definition: conn.h:1092
@ BT_SECURITY_ERR_AUTH_REQUIREMENT
The requested security level could not be reached.
Definition: conn.h:1095
@ BT_SECURITY_ERR_KEY_REJECTED
Distributed Key Rejected.
Definition: conn.h:1107
@ BT_SECURITY_ERR_UNSPECIFIED
Pairing failed but the exact reason could not be specified.
Definition: conn.h:1110
@ BT_SECURITY_ERR_INVALID_PARAM
Invalid parameters.
Definition: conn.h:1104
@ BT_SECURITY_ERR_PAIR_NOT_SUPPORTED
Pairing is not supported.
Definition: conn.h:1098
@ BT_SECURITY_ERR_AUTH_FAIL
Authentication failed.
Definition: conn.h:1086
@ BT_SECURITY_ERR_PIN_OR_KEY_MISSING
PIN or encryption key is missing.
Definition: conn.h:1089
@ BT_SECURITY_ERR_SUCCESS
Security procedure successful.
Definition: conn.h:1083
@ BT_SECURITY_ERR_PAIR_NOT_ALLOWED
Pairing is not allowed.
Definition: conn.h:1101
@ BT_CONN_TYPE_LE
LE Connection Type.
Definition: conn.h:253
@ BT_CONN_TYPE_ALL
All Connection Type.
Definition: conn.h:261
@ BT_CONN_TYPE_BR
BR/EDR Connection Type.
Definition: conn.h:255
@ BT_CONN_TYPE_ISO
ISO Connection Type.
Definition: conn.h:259
@ BT_CONN_TYPE_SCO
SCO Connection Type.
Definition: conn.h:257
@ BT_CONN_ROLE_PERIPHERAL
Definition: conn.h:393
@ BT_CONN_ROLE_CENTRAL
Definition: conn.h:392
@ BT_SECURITY_L4
Level 4: Authenticated Secure Connections and 128-bit key.
Definition: conn.h:418
@ BT_SECURITY_L0
Level 0: Only for BR/EDR special cases, like SDP.
Definition: conn.h:410
@ BT_SECURITY_L3
Level 3: Encryption and authentication (MITM).
Definition: conn.h:416
@ BT_SECURITY_FORCE_PAIR
Bit to force new pairing procedure, bit-wise OR with requested security level.
Definition: conn.h:422
@ BT_SECURITY_L1
Level 1: No encryption and no authentication.
Definition: conn.h:412
@ BT_SECURITY_L2
Level 2: Encryption and no authentication (no MITM).
Definition: conn.h:414
@ BT_CONN_LE_PATH_LOSS_ZONE_ENTERED_MIDDLE
Middle path loss zone entered.
Definition: conn.h:586
@ BT_CONN_LE_PATH_LOSS_ZONE_ENTERED_LOW
Low path loss zone entered.
Definition: conn.h:584
@ BT_CONN_LE_PATH_LOSS_ZONE_ENTERED_HIGH
High path loss zone entered.
Definition: conn.h:588
@ BT_CONN_LE_PATH_LOSS_ZONE_UNAVAILABLE
Path loss has become unavailable.
Definition: conn.h:590
struct _snode sys_snode_t
Single-linked list node structure.
Definition: slist.h:39
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
#define BT_HCI_LE_ZONE_ENTERED_MIDDLE
Definition: hci_types.h:3073
#define BT_HCI_LE_ZONE_ENTERED_HIGH
Definition: hci_types.h:3074
#define BT_HCI_LE_ZONE_ENTERED_LOW
Definition: hci_types.h:3072
#define bool
Definition: stdbool.h:13
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
__INT8_TYPE__ int8_t
Definition: stdint.h:72
Bluetooth LE Device Address.
Definition: addr.h:49
Bluetooth Device Address.
Definition: addr.h:40
Connection parameters for BR/EDR connections.
Definition: conn.h:1950
bool allow_role_switch
Definition: conn.h:1951
Authenticated pairing callback structure.
Definition: conn.h:1595
void(* passkey_entry)(struct bt_conn *conn)
Request the user to enter a passkey.
Definition: conn.h:1692
void(* passkey_display)(struct bt_conn *conn, unsigned int passkey)
Display a passkey to the user.
Definition: conn.h:1646
void(* passkey_confirm)(struct bt_conn *conn, unsigned int passkey)
Request the user to confirm a passkey.
Definition: conn.h:1715
enum bt_security_err(* pairing_accept)(struct bt_conn *conn, const struct bt_conn_pairing_feat *const feat)
Query to proceed incoming pairing or not.
Definition: conn.h:1624
void(* pincode_entry)(struct bt_conn *conn, bool highsec)
Request the user to enter a passkey.
Definition: conn.h:1789
void(* oob_data_request)(struct bt_conn *conn, struct bt_conn_oob_info *info)
Request the user to provide Out of Band (OOB) data.
Definition: conn.h:1733
void(* pairing_confirm)(struct bt_conn *conn)
Request confirmation for an incoming pairing.
Definition: conn.h:1768
void(* cancel)(struct bt_conn *conn)
Cancel the ongoing user request.
Definition: conn.h:1748
Authenticated pairing information callback structure.
Definition: conn.h:1794
void(* pairing_failed)(struct bt_conn *conn, enum bt_security_err reason)
notify that pairing process has failed.
Definition: conn.h:1811
void(* pairing_complete)(struct bt_conn *conn, bool bonded)
notify that pairing procedure was complete.
Definition: conn.h:1804
void(* bond_deleted)(uint8_t id, const bt_addr_le_t *peer)
Notify that bond has been deleted.
Definition: conn.h:1822
sys_snode_t node
Internally used field for list handling.
Definition: conn.h:1825
BR/EDR Connection Info Structure.
Definition: conn.h:387
const bt_addr_t * dst
Destination (Remote) BR/EDR address.
Definition: conn.h:388
BR/EDR Connection Remote Info structure.
Definition: conn.h:476
uint8_t num_pages
Number of pages in the remote feature set.
Definition: conn.h:482
const uint8_t * features
Remote feature set (pages of bitmasks).
Definition: conn.h:479
Connection callback structure.
Definition: conn.h:1123
void(* le_param_updated)(struct bt_conn *conn, uint16_t interval, uint16_t latency, uint16_t timeout)
The parameters for an LE connection have been updated.
Definition: conn.h:1220
void(* le_data_len_updated)(struct bt_conn *conn, struct bt_conn_le_data_len_info *info)
The data length parameters of the connection has changed.
Definition: conn.h:1292
void(* recycled)(void)
A connection object has been returned to the pool.
Definition: conn.h:1181
bool(* le_param_req)(struct bt_conn *conn, struct bt_le_conn_param *param)
LE connection parameter update request.
Definition: conn.h:1207
void(* disconnected)(struct bt_conn *conn, uint8_t reason)
A connection has been disconnected.
Definition: conn.h:1167
void(* connected)(struct bt_conn *conn, uint8_t err)
A new connection has been established.
Definition: conn.h:1148
void(* le_phy_updated)(struct bt_conn *conn, struct bt_conn_le_phy_info *param)
The PHY of the connection has changed.
Definition: conn.h:1279
void(* security_changed)(struct bt_conn *conn, bt_security_t level, enum bt_security_err err)
The security level of a connection has changed.
Definition: conn.h:1253
void(* identity_resolved)(struct bt_conn *conn, const bt_addr_le_t *rpa, const bt_addr_le_t *identity)
Remote Identity Address has been resolved.
Definition: conn.h:1232
void(* remote_info_available)(struct bt_conn *conn, struct bt_conn_remote_info *remote_info)
Remote information procedures has completed.
Definition: conn.h:1266
Connection Info Structure.
Definition: conn.h:448
uint8_t id
Which local identity the connection was created with.
Definition: conn.h:454
struct bt_conn_le_info le
LE Connection specific Info.
Definition: conn.h:458
enum bt_conn_type type
Connection Type.
Definition: conn.h:450
struct bt_conn_br_info br
BR/EDR Connection specific Info.
Definition: conn.h:460
uint8_t role
Connection Role.
Definition: conn.h:452
struct bt_security_info security
Security specific info.
Definition: conn.h:465
enum bt_conn_state state
Connection state.
Definition: conn.h:463
Definition: conn.h:849
uint16_t interval_coded
Scan interval LE Coded PHY (N * 0.625 MS)
Definition: conn.h:864
uint16_t window
Scan window (N * 0.625 ms)
Definition: conn.h:858
uint32_t options
Bit-field of create connection options.
Definition: conn.h:852
uint16_t timeout
Connection initiation timeout (N * 10 MS)
Definition: conn.h:879
uint16_t interval
Scan interval (N * 0.625 ms)
Definition: conn.h:855
uint16_t window_coded
Scan window LE Coded PHY (N * 0.625 MS)
Definition: conn.h:870
Definition: conn.h:951
const bt_addr_le_t * peer
Remote address.
Definition: conn.h:958
uint8_t subevent
The subevent where the connection will be initiated.
Definition: conn.h:961
Connection data length information for LE connections.
Definition: conn.h:149
uint16_t tx_max_time
Maximum Link Layer transmission payload time in us.
Definition: conn.h:153
uint16_t rx_max_len
Maximum Link Layer reception payload size in bytes.
Definition: conn.h:155
uint16_t tx_max_len
Maximum Link Layer transmission payload size in bytes.
Definition: conn.h:151
uint16_t rx_max_time
Maximum Link Layer reception payload time in us.
Definition: conn.h:157
Connection data length parameters for LE connections.
Definition: conn.h:161
uint16_t tx_max_len
Maximum Link Layer transmission payload size in bytes.
Definition: conn.h:163
uint16_t tx_max_time
Maximum Link Layer transmission payload time in us.
Definition: conn.h:165
LE Connection Info Structure.
Definition: conn.h:341
const bt_addr_le_t * dst
Destination (Remote) Identity Address or remote Resolvable Private Address (RPA) before identity has ...
Definition: conn.h:347
const struct bt_conn_le_phy_info * phy
Definition: conn.h:357
const bt_addr_le_t * remote
Remote device address used during connection setup.
Definition: conn.h:351
const bt_addr_le_t * local
Local device address used during connection setup.
Definition: conn.h:349
const bt_addr_le_t * src
Source (Local) Identity Address.
Definition: conn.h:343
uint16_t interval
Connection interval.
Definition: conn.h:352
uint16_t latency
Connection peripheral latency.
Definition: conn.h:353
const struct bt_conn_le_data_len_info * data_len
Definition: conn.h:362
uint16_t timeout
Connection supervision timeout.
Definition: conn.h:354
LE Path Loss Monitoring Parameters Structure as defined in Core Spec.
Definition: conn.h:610
uint8_t high_threshold
High threshold for the path loss (dB).
Definition: conn.h:612
uint8_t low_threshold
Low threshold for the path loss (dB).
Definition: conn.h:616
uint16_t min_time_spent
Minimum time in number of connection events to be observed once the path loss crosses the threshold b...
Definition: conn.h:622
uint8_t high_hysteresis
Hysteresis value for the high threshold (dB).
Definition: conn.h:614
uint8_t low_hysteresis
Hysteresis value for the low threshold (dB).
Definition: conn.h:618
LE Path Loss Monitoring Threshold Change Report Structure.
Definition: conn.h:598
enum bt_conn_le_path_loss_zone zone
Path Loss zone as documented in Core Spec.
Definition: conn.h:601
uint8_t path_loss
Current path loss (dB).
Definition: conn.h:604
Connection PHY information for LE connections.
Definition: conn.h:82
uint8_t rx_phy
Connection transmit PHY.
Definition: conn.h:84
uint8_t tx_phy
Definition: conn.h:83
Preferred PHY parameters for LE connections.
Definition: conn.h:100
uint16_t options
Connection PHY options.
Definition: conn.h:101
uint8_t pref_rx_phy
Bitmask of preferred receive PHYs.
Definition: conn.h:103
uint8_t pref_tx_phy
Bitmask of preferred transmit PHYs.
Definition: conn.h:102
LE Connection Remote Info Structure.
Definition: conn.h:469
const uint8_t * features
Remote LE feature set (bitmask).
Definition: conn.h:472
Updated subrating connection parameters for LE connections.
Definition: conn.h:231
uint16_t factor
Connection subrate factor.
Definition: conn.h:238
uint16_t continuation_number
Number of underlying connection events to remain active after a packet containing a Link Layer PDU wi...
Definition: conn.h:243
uint16_t peripheral_latency
Peripheral latency in units of subrated connection intervals.
Definition: conn.h:245
uint16_t supervision_timeout
Connection Supervision timeout (N * 10 ms).
Definition: conn.h:247
uint8_t status
HCI Status from LE Subrate Changed event.
Definition: conn.h:236
Connection subrating parameters for LE connections.
Definition: conn.h:200
uint16_t max_latency
Maximum Peripheral latency in units of subrated connection intervals.
Definition: conn.h:206
uint16_t subrate_max
Maximum subrate factor.
Definition: conn.h:204
uint16_t continuation_number
Minimum number of underlying connection events to remain active after a packet containing a Link Laye...
Definition: conn.h:211
uint16_t supervision_timeout
Connection Supervision timeout (N * 10 ms).
Definition: conn.h:216
uint16_t subrate_min
Minimum subrate factor.
Definition: conn.h:202
Subrating information for LE connections.
Definition: conn.h:220
uint16_t continuation_number
Number of underlying connection events to remain active after a packet containing a Link Layer PDU wi...
Definition: conn.h:227
uint16_t factor
Connection subrate factor.
Definition: conn.h:222
LE Transmit Power Reporting Structure.
Definition: conn.h:540
enum bt_conn_le_tx_power_phy phy
Phy of Transmit power reporting.
Definition: conn.h:548
int8_t delta
Change in transmit power level.
Definition: conn.h:571
uint8_t reason
Reason for Transmit power reporting, as documented in Core Spec.
Definition: conn.h:545
int8_t tx_power_level
Transmit power level.
Definition: conn.h:558
uint8_t tx_power_level_flag
Bit 0: Transmit power level is at minimum level.
Definition: conn.h:563
LE Transmit Power Level Structure.
Definition: conn.h:526
int8_t max_level
Output: maximum transmit power level.
Definition: conn.h:535
int8_t current_level
Output: current transmit power level.
Definition: conn.h:532
uint8_t phy
Input: 1M, 2M, Coded S2 or Coded S8.
Definition: conn.h:529
Info Structure for OOB pairing.
Definition: conn.h:1531
struct bt_conn_oob_info::@60::@62 lesc
LE Secure Connections OOB pairing parameters.
@ BT_CONN_OOB_NO_DATA
No OOB data requested.
Definition: conn.h:1556
@ BT_CONN_OOB_LOCAL_ONLY
Local OOB data requested.
Definition: conn.h:1547
@ BT_CONN_OOB_REMOTE_ONLY
Remote OOB data requested.
Definition: conn.h:1550
enum bt_conn_oob_info::@59 type
Type of OOB pairing method.
@ BT_CONN_OOB_BOTH_PEERS
Both local and remote OOB data requested.
Definition: conn.h:1553
@ BT_CONN_OOB_LE_LEGACY
LE legacy pairing.
Definition: conn.h:1535
@ BT_CONN_OOB_LE_SC
LE SC pairing.
Definition: conn.h:1538
enum bt_conn_oob_info::@60::@62::@63 oob_config
OOB data configuration.
Pairing request and pairing response info structure.
Definition: conn.h:1569
uint8_t resp_key_dist
Responder Key Distribution/Generation, Core Spec.
Definition: conn.h:1590
uint8_t io_capability
IO Capability, Core Spec.
Definition: conn.h:1571
uint8_t init_key_dist
Initiator Key Distribution/Generation, Core Spec.
Definition: conn.h:1585
uint8_t max_enc_key_size
Maximum Encryption Key Size, Core Spec.
Definition: conn.h:1580
uint8_t auth_req
AuthReq, Core Spec.
Definition: conn.h:1577
uint8_t oob_data_flag
OOB data flag, Core Spec.
Definition: conn.h:1574
Connection Remote Info Structure.
Definition: conn.h:490
uint8_t version
Remote Link Layer version.
Definition: conn.h:495
uint16_t subversion
Per-manufacturer unique revision.
Definition: conn.h:501
uint16_t manufacturer
Remote manufacturer identifier.
Definition: conn.h:498
uint8_t type
Connection Type.
Definition: conn.h:492
struct bt_conn_br_remote_info br
BR/EDR connection remote info.
Definition: conn.h:508
struct bt_conn_le_remote_info le
LE connection remote info.
Definition: conn.h:505
Definition: direction.h:165
Connection parameters for LE connections.
Definition: conn.h:38
uint16_t latency
Definition: conn.h:41
uint16_t interval_max
Definition: conn.h:40
uint16_t timeout
Definition: conn.h:42
uint16_t interval_min
Definition: conn.h:39
LE Secure Connections pairing Out of Band data.
Definition: bluetooth.h:2449
Security Info Structure.
Definition: conn.h:434
uint8_t enc_key_size
Encryption Key Size.
Definition: conn.h:438
bt_security_t level
Security Level.
Definition: conn.h:436
enum bt_security_flag flags
Flags.
Definition: conn.h:440