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
200enum __packed bt_conn_type {
212};
213
225struct bt_conn *bt_conn_ref(struct bt_conn *conn);
226
233void bt_conn_unref(struct bt_conn *conn);
234
252 void (*func)(struct bt_conn *conn, void *data),
253 void *data);
254
267struct bt_conn *bt_conn_lookup_addr_le(uint8_t id, const bt_addr_le_t *peer);
268
275const bt_addr_le_t *bt_conn_get_dst(const struct bt_conn *conn);
276
287uint8_t bt_conn_index(const struct bt_conn *conn);
288
305#if defined(CONFIG_BT_USER_PHY_UPDATE)
307#endif /* defined(CONFIG_BT_USER_PHY_UPDATE) */
308
309#if defined(CONFIG_BT_USER_DATA_LEN_UPDATE)
310 /* Connection maximum single fragment parameters */
312#endif /* defined(CONFIG_BT_USER_DATA_LEN_UPDATE) */
313};
314
322#define BT_CONN_INTERVAL_TO_MS(interval) ((interval) * 5U / 4U)
323
328#define BT_CONN_INTERVAL_TO_US(interval) ((interval) * 1250U)
329
332 const bt_addr_t *dst;
333};
334
335enum {
338};
339
349};
350
352typedef enum __packed {
368
375};
376
385};
386
388#define BT_CONN_ROLE_MASTER __DEPRECATED_MACRO BT_CONN_ROLE_CENTRAL
389#define BT_CONN_ROLE_SLAVE __DEPRECATED_MACRO BT_CONN_ROLE_PERIPHERAL
390
400 union {
405 };
410};
411
414
417};
418
421
424
427};
428
437
440
443
446
447 union {
450
453 };
454};
455
467};
468
471
474
477
480};
481
482
485
490
493
503
508
516};
517
529};
530
538int bt_conn_get_info(const struct bt_conn *conn, struct bt_conn_info *info);
539
555int bt_conn_get_remote_info(struct bt_conn *conn,
556 struct bt_conn_remote_info *remote_info);
557
566int bt_conn_le_get_tx_power_level(struct bt_conn *conn,
567 struct bt_conn_le_tx_power *tx_power_level);
568
578 struct bt_conn_le_tx_power *tx_power);
579
589 enum bt_conn_le_tx_power_phy phy);
590
601 bool local_enable,
602 bool remote_enable);
603
615int bt_conn_le_param_update(struct bt_conn *conn,
616 const struct bt_le_conn_param *param);
617
625int bt_conn_le_data_len_update(struct bt_conn *conn,
626 const struct bt_conn_le_data_len_param *param);
627
638int bt_conn_le_phy_update(struct bt_conn *conn,
639 const struct bt_conn_le_phy_param *param);
640
663int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason);
664
665enum {
668
674
682};
683
685
688
691
694
700
706
715};
716
723#define BT_CONN_LE_CREATE_PARAM_INIT(_options, _interval, _window) \
724{ \
725 .options = (_options), \
726 .interval = (_interval), \
727 .window = (_window), \
728 .interval_coded = 0, \
729 .window_coded = 0, \
730 .timeout = 0, \
731}
732
739#define BT_CONN_LE_CREATE_PARAM(_options, _interval, _window) \
740 ((struct bt_conn_le_create_param[]) { \
741 BT_CONN_LE_CREATE_PARAM_INIT(_options, _interval, _window) \
742 })
743
747#define BT_CONN_LE_CREATE_CONN \
748 BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \
749 BT_GAP_SCAN_FAST_INTERVAL, \
750 BT_GAP_SCAN_FAST_INTERVAL)
751
756#define BT_CONN_LE_CREATE_CONN_AUTO \
757 BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \
758 BT_GAP_SCAN_FAST_INTERVAL, \
759 BT_GAP_SCAN_FAST_WINDOW)
760
781 const struct bt_conn_le_create_param *create_param,
782 const struct bt_le_conn_param *conn_param,
783 struct bt_conn **conn);
784
786
793
796};
797
815int bt_conn_le_create_synced(const struct bt_le_ext_adv *adv,
816 const struct bt_conn_le_create_synced_param *synced_param,
817 const struct bt_le_conn_param *conn_param, struct bt_conn **conn);
818
834int bt_conn_le_create_auto(const struct bt_conn_le_create_param *create_param,
835 const struct bt_le_conn_param *conn_param);
836
842
858 const struct bt_le_conn_param *param);
859
896int bt_conn_set_security(struct bt_conn *conn, bt_security_t sec);
897
902bt_security_t bt_conn_get_security(const struct bt_conn *conn);
903
913uint8_t bt_conn_enc_key_size(const struct bt_conn *conn);
914
918
921
924
927
930
933
936
939
942
945};
946
982 void (*connected)(struct bt_conn *conn, uint8_t err);
983
1001 void (*disconnected)(struct bt_conn *conn, uint8_t reason);
1002
1015 void (*recycled)(void);
1016
1041 bool (*le_param_req)(struct bt_conn *conn,
1042 struct bt_le_conn_param *param);
1043
1054 void (*le_param_updated)(struct bt_conn *conn, uint16_t interval,
1055 uint16_t latency, uint16_t timeout);
1056#if defined(CONFIG_BT_SMP)
1066 void (*identity_resolved)(struct bt_conn *conn,
1067 const bt_addr_le_t *rpa,
1068 const bt_addr_le_t *identity);
1069#endif /* CONFIG_BT_SMP */
1070#if defined(CONFIG_BT_SMP) || defined(CONFIG_BT_CLASSIC)
1087 void (*security_changed)(struct bt_conn *conn, bt_security_t level,
1088 enum bt_security_err err);
1089#endif /* defined(CONFIG_BT_SMP) || defined(CONFIG_BT_CLASSIC) */
1090
1091#if defined(CONFIG_BT_REMOTE_INFO)
1100 void (*remote_info_available)(struct bt_conn *conn,
1101 struct bt_conn_remote_info *remote_info);
1102#endif /* defined(CONFIG_BT_REMOTE_INFO) */
1103
1104#if defined(CONFIG_BT_USER_PHY_UPDATE)
1113 void (*le_phy_updated)(struct bt_conn *conn,
1114 struct bt_conn_le_phy_info *param);
1115#endif /* defined(CONFIG_BT_USER_PHY_UPDATE) */
1116
1117#if defined(CONFIG_BT_USER_DATA_LEN_UPDATE)
1126 void (*le_data_len_updated)(struct bt_conn *conn,
1127 struct bt_conn_le_data_len_info *info);
1128#endif /* defined(CONFIG_BT_USER_DATA_LEN_UPDATE) */
1129
1130#if defined(CONFIG_BT_DF_CONNECTION_CTE_RX)
1137 void (*cte_report_cb)(struct bt_conn *conn,
1138 const struct bt_df_conn_iq_samples_report *iq_report);
1139#endif /* CONFIG_BT_DF_CONNECTION_CTE_RX */
1140
1141#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL)
1153 void (*tx_power_report)(struct bt_conn *conn,
1154 const struct bt_conn_le_tx_power_report *report);
1155#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */
1156
1157 struct bt_conn_cb *_next;
1158};
1159
1167
1180
1186#define BT_CONN_CB_DEFINE(_name) \
1187 static const STRUCT_SECTION_ITERABLE(bt_conn_cb, \
1188 _CONCAT(bt_conn_cb_, \
1189 _name))
1190
1201void bt_set_bondable(bool enable);
1202
1221int bt_conn_set_bondable(struct bt_conn *conn, bool enable);
1222
1229void bt_le_oob_set_sc_flag(bool enable);
1230
1238
1250int bt_le_oob_set_legacy_tk(struct bt_conn *conn, const uint8_t *tk);
1251
1270int bt_le_oob_set_sc_data(struct bt_conn *conn,
1271 const struct bt_le_oob_sc_data *oobd_local,
1272 const struct bt_le_oob_sc_data *oobd_remote);
1273
1289int bt_le_oob_get_sc_data(struct bt_conn *conn,
1290 const struct bt_le_oob_sc_data **oobd_local,
1291 const struct bt_le_oob_sc_data **oobd_remote);
1292
1297#define BT_PASSKEY_INVALID 0xffffffff
1298
1312int bt_passkey_set(unsigned int passkey);
1313
1317 enum {
1320
1324
1325 union {
1327 struct {
1329 enum {
1332
1335
1338
1343 };
1344};
1345
1346#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
1356
1359
1362
1365
1370
1375};
1376#endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */
1377
1380#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
1408 enum bt_security_err (*pairing_accept)(struct bt_conn *conn,
1409 const struct bt_conn_pairing_feat *const feat);
1410#endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */
1411
1430 void (*passkey_display)(struct bt_conn *conn, unsigned int passkey);
1431
1432#if defined(CONFIG_BT_PASSKEY_KEYPRESS)
1454 void (*passkey_display_keypress)(struct bt_conn *conn,
1455 enum bt_conn_auth_keypress type);
1456#endif
1457
1476 void (*passkey_entry)(struct bt_conn *conn);
1477
1499 void (*passkey_confirm)(struct bt_conn *conn, unsigned int passkey);
1500
1517 void (*oob_data_request)(struct bt_conn *conn,
1518 struct bt_conn_oob_info *info);
1519
1532 void (*cancel)(struct bt_conn *conn);
1533
1552 void (*pairing_confirm)(struct bt_conn *conn);
1553
1554#if defined(CONFIG_BT_CLASSIC)
1573 void (*pincode_entry)(struct bt_conn *conn, bool highsec);
1574#endif
1575};
1576
1588 void (*pairing_complete)(struct bt_conn *conn, bool bonded);
1589
1595 void (*pairing_failed)(struct bt_conn *conn,
1596 enum bt_security_err reason);
1597
1606 void (*bond_deleted)(uint8_t id, const bt_addr_le_t *peer);
1607
1610};
1611
1622
1637int bt_conn_auth_cb_overlay(struct bt_conn *conn, const struct bt_conn_auth_cb *cb);
1638
1649
1659
1670int bt_conn_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey);
1671
1687int bt_conn_auth_keypress_notify(struct bt_conn *conn, enum bt_conn_auth_keypress type);
1688
1697int bt_conn_auth_cancel(struct bt_conn *conn);
1698
1708int bt_conn_auth_passkey_confirm(struct bt_conn *conn);
1709
1719int bt_conn_auth_pairing_confirm(struct bt_conn *conn);
1720
1731int bt_conn_auth_pincode_entry(struct bt_conn *conn, const char *pin);
1732
1736};
1737
1742#define BT_BR_CONN_PARAM_INIT(role_switch) \
1743{ \
1744 .allow_role_switch = (role_switch), \
1745}
1746
1751#define BT_BR_CONN_PARAM(role_switch) \
1752 ((struct bt_br_conn_param[]) { \
1753 BT_BR_CONN_PARAM_INIT(role_switch) \
1754 })
1755
1759#define BT_BR_CONN_PARAM_DEFAULT BT_BR_CONN_PARAM(true)
1760
1761
1774struct bt_conn *bt_conn_create_br(const bt_addr_t *peer,
1775 const struct bt_br_conn_param *param);
1776
1777#ifdef __cplusplus
1778}
1779#endif
1780
1785#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:370
int bt_passkey_set(unsigned int passkey)
Set a fixed passkey to be used for pairing.
void bt_conn_cb_register(struct bt_conn_cb *cb)
Register connection callbacks.
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:523
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_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:456
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.
bt_conn_state
Definition: conn.h:340
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:915
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:200
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.
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:352
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:374
@ BT_SECURITY_FLAG_SC
Paired with Secure Connections.
Definition: conn.h:372
@ BT_CONN_AUTH_KEYPRESS_DIGIT_ERASED
Definition: conn.h:526
@ BT_CONN_AUTH_KEYPRESS_DIGIT_ENTERED
Definition: conn.h:525
@ BT_CONN_AUTH_KEYPRESS_CLEARED
Definition: conn.h:527
@ BT_CONN_AUTH_KEYPRESS_ENTRY_STARTED
Definition: conn.h:524
@ BT_CONN_AUTH_KEYPRESS_ENTRY_COMPLETED
Definition: conn.h:528
@ BT_CONN_LE_TX_POWER_PHY_NONE
Convenience macro for when no PHY is set.
Definition: conn.h:458
@ BT_CONN_LE_TX_POWER_PHY_CODED_S2
LE Coded PHY using S=2 coding.
Definition: conn.h:466
@ BT_CONN_LE_TX_POWER_PHY_CODED_S8
LE Coded PHY using S=8 coding.
Definition: conn.h:464
@ BT_CONN_LE_TX_POWER_PHY_1M
LE 1M PHY.
Definition: conn.h:460
@ BT_CONN_LE_TX_POWER_PHY_2M
LE 2M PHY.
Definition: conn.h:462
@ 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:667
@ BT_CONN_LE_OPT_NO_1M
Disable LE 1M PHY.
Definition: conn.h:681
@ BT_CONN_LE_OPT_CODED
Enable LE Coded PHY.
Definition: conn.h:673
@ BT_CONN_STATE_CONNECTING
Channel in connecting state.
Definition: conn.h:344
@ BT_CONN_STATE_CONNECTED
Channel connected and ready for upper layer traffic on it.
Definition: conn.h:346
@ BT_CONN_STATE_DISCONNECTED
Channel disconnected.
Definition: conn.h:342
@ BT_CONN_STATE_DISCONNECTING
Channel in disconnecting state.
Definition: conn.h:348
@ BT_SECURITY_ERR_OOB_NOT_AVAILABLE
OOB data is not available.
Definition: conn.h:926
@ BT_SECURITY_ERR_AUTH_REQUIREMENT
The requested security level could not be reached.
Definition: conn.h:929
@ BT_SECURITY_ERR_KEY_REJECTED
Distributed Key Rejected.
Definition: conn.h:941
@ BT_SECURITY_ERR_UNSPECIFIED
Pairing failed but the exact reason could not be specified.
Definition: conn.h:944
@ BT_SECURITY_ERR_INVALID_PARAM
Invalid parameters.
Definition: conn.h:938
@ BT_SECURITY_ERR_PAIR_NOT_SUPPORTED
Pairing is not supported.
Definition: conn.h:932
@ BT_SECURITY_ERR_AUTH_FAIL
Authentication failed.
Definition: conn.h:920
@ BT_SECURITY_ERR_PIN_OR_KEY_MISSING
PIN or encryption key is missing.
Definition: conn.h:923
@ BT_SECURITY_ERR_SUCCESS
Security procedure successful.
Definition: conn.h:917
@ BT_SECURITY_ERR_PAIR_NOT_ALLOWED
Pairing is not allowed.
Definition: conn.h:935
@ BT_CONN_TYPE_LE
LE Connection Type.
Definition: conn.h:202
@ BT_CONN_TYPE_ALL
All Connection Type.
Definition: conn.h:210
@ BT_CONN_TYPE_BR
BR/EDR Connection Type.
Definition: conn.h:204
@ BT_CONN_TYPE_ISO
ISO Connection Type.
Definition: conn.h:208
@ BT_CONN_TYPE_SCO
SCO Connection Type.
Definition: conn.h:206
@ BT_CONN_ROLE_PERIPHERAL
Definition: conn.h:337
@ BT_CONN_ROLE_CENTRAL
Definition: conn.h:336
@ BT_SECURITY_L4
Level 4: Authenticated Secure Connections and 128-bit key.
Definition: conn.h:362
@ BT_SECURITY_L0
Level 0: Only for BR/EDR special cases, like SDP.
Definition: conn.h:354
@ BT_SECURITY_L3
Level 3: Encryption and authentication (MITM).
Definition: conn.h:360
@ BT_SECURITY_FORCE_PAIR
Bit to force new pairing procedure, bit-wise OR with requested security level.
Definition: conn.h:366
@ BT_SECURITY_L1
Level 1: No encryption and no authentication.
Definition: conn.h:356
@ BT_SECURITY_L2
Level 2: Encryption and no authentication (no MITM).
Definition: conn.h:358
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 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:1734
bool allow_role_switch
Definition: conn.h:1735
Authenticated pairing callback structure.
Definition: conn.h:1379
void(* passkey_entry)(struct bt_conn *conn)
Request the user to enter a passkey.
Definition: conn.h:1476
void(* passkey_display)(struct bt_conn *conn, unsigned int passkey)
Display a passkey to the user.
Definition: conn.h:1430
void(* passkey_confirm)(struct bt_conn *conn, unsigned int passkey)
Request the user to confirm a passkey.
Definition: conn.h:1499
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:1408
void(* pincode_entry)(struct bt_conn *conn, bool highsec)
Request the user to enter a passkey.
Definition: conn.h:1573
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:1517
void(* pairing_confirm)(struct bt_conn *conn)
Request confirmation for an incoming pairing.
Definition: conn.h:1552
void(* cancel)(struct bt_conn *conn)
Cancel the ongoing user request.
Definition: conn.h:1532
Authenticated pairing information callback structure.
Definition: conn.h:1578
void(* pairing_failed)(struct bt_conn *conn, enum bt_security_err reason)
notify that pairing process has failed.
Definition: conn.h:1595
void(* pairing_complete)(struct bt_conn *conn, bool bonded)
notify that pairing procedure was complete.
Definition: conn.h:1588
void(* bond_deleted)(uint8_t id, const bt_addr_le_t *peer)
Notify that bond has been deleted.
Definition: conn.h:1606
sys_snode_t node
Internally used field for list handling.
Definition: conn.h:1609
BR/EDR Connection Info Structure.
Definition: conn.h:331
const bt_addr_t * dst
Destination (Remote) BR/EDR address.
Definition: conn.h:332
BR/EDR Connection Remote Info structure.
Definition: conn.h:420
uint8_t num_pages
Number of pages in the remote feature set.
Definition: conn.h:426
const uint8_t * features
Remote feature set (pages of bitmasks).
Definition: conn.h:423
Connection callback structure.
Definition: conn.h:957
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:1054
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:1126
void(* recycled)(void)
A connection object has been returned to the pool.
Definition: conn.h:1015
bool(* le_param_req)(struct bt_conn *conn, struct bt_le_conn_param *param)
LE connection parameter update request.
Definition: conn.h:1041
void(* disconnected)(struct bt_conn *conn, uint8_t reason)
A connection has been disconnected.
Definition: conn.h:1001
void(* connected)(struct bt_conn *conn, uint8_t err)
A new connection has been established.
Definition: conn.h:982
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:1113
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:1087
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:1066
void(* remote_info_available)(struct bt_conn *conn, struct bt_conn_remote_info *remote_info)
Remote information procedures has completed.
Definition: conn.h:1100
Connection Info Structure.
Definition: conn.h:392
uint8_t id
Which local identity the connection was created with.
Definition: conn.h:398
struct bt_conn_le_info le
LE Connection specific Info.
Definition: conn.h:402
enum bt_conn_type type
Connection Type.
Definition: conn.h:394
struct bt_conn_br_info br
BR/EDR Connection specific Info.
Definition: conn.h:404
uint8_t role
Connection Role.
Definition: conn.h:396
struct bt_security_info security
Security specific info.
Definition: conn.h:409
enum bt_conn_state state
Connection state.
Definition: conn.h:407
Definition: conn.h:684
uint16_t interval_coded
Scan interval LE Coded PHY (N * 0.625 MS)
Definition: conn.h:699
uint16_t window
Scan window (N * 0.625 ms)
Definition: conn.h:693
uint32_t options
Bit-field of create connection options.
Definition: conn.h:687
uint16_t timeout
Connection initiation timeout (N * 10 MS)
Definition: conn.h:714
uint16_t interval
Scan interval (N * 0.625 ms)
Definition: conn.h:690
uint16_t window_coded
Scan window LE Coded PHY (N * 0.625 MS)
Definition: conn.h:705
Definition: conn.h:785
const bt_addr_le_t * peer
Remote address.
Definition: conn.h:792
uint8_t subevent
The subevent where the connection will be initiated.
Definition: conn.h:795
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:290
const bt_addr_le_t * dst
Destination (Remote) Identity Address or remote Resolvable Private Address (RPA) before identity has ...
Definition: conn.h:296
const struct bt_conn_le_phy_info * phy
Definition: conn.h:306
const bt_addr_le_t * remote
Remote device address used during connection setup.
Definition: conn.h:300
const bt_addr_le_t * local
Local device address used during connection setup.
Definition: conn.h:298
const bt_addr_le_t * src
Source (Local) Identity Address.
Definition: conn.h:292
uint16_t interval
Connection interval.
Definition: conn.h:301
uint16_t latency
Connection peripheral latency.
Definition: conn.h:302
const struct bt_conn_le_data_len_info * data_len
Definition: conn.h:311
uint16_t timeout
Connection supervision timeout.
Definition: conn.h:303
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:413
const uint8_t * features
Remote LE feature set (bitmask).
Definition: conn.h:416
LE Transmit Power Reporting Structure.
Definition: conn.h:484
enum bt_conn_le_tx_power_phy phy
Phy of Transmit power reporting.
Definition: conn.h:492
int8_t delta
Change in transmit power level.
Definition: conn.h:515
uint8_t reason
Reason for Transmit power reporting, as documented in Core Spec.
Definition: conn.h:489
int8_t tx_power_level
Transmit power level.
Definition: conn.h:502
uint8_t tx_power_level_flag
Bit 0: Transmit power level is at minimum level.
Definition: conn.h:507
LE Transmit Power Level Structure.
Definition: conn.h:470
int8_t max_level
Output: maximum transmit power level.
Definition: conn.h:479
int8_t current_level
Output: current transmit power level.
Definition: conn.h:476
uint8_t phy
Input: 1M, 2M, Coded S2 or Coded S8.
Definition: conn.h:473
Info Structure for OOB pairing.
Definition: conn.h:1315
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:1340
@ BT_CONN_OOB_LOCAL_ONLY
Local OOB data requested.
Definition: conn.h:1331
@ BT_CONN_OOB_REMOTE_ONLY
Remote OOB data requested.
Definition: conn.h:1334
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:1337
@ BT_CONN_OOB_LE_LEGACY
LE legacy pairing.
Definition: conn.h:1319
@ BT_CONN_OOB_LE_SC
LE SC pairing.
Definition: conn.h:1322
enum bt_conn_oob_info::@60::@62::@63 oob_config
OOB data configuration.
Pairing request and pairing response info structure.
Definition: conn.h:1353
uint8_t resp_key_dist
Responder Key Distribution/Generation, Core Spec.
Definition: conn.h:1374
uint8_t io_capability
IO Capability, Core Spec.
Definition: conn.h:1355
uint8_t init_key_dist
Initiator Key Distribution/Generation, Core Spec.
Definition: conn.h:1369
uint8_t max_enc_key_size
Maximum Encryption Key Size, Core Spec.
Definition: conn.h:1364
uint8_t auth_req
AuthReq, Core Spec.
Definition: conn.h:1361
uint8_t oob_data_flag
OOB data flag, Core Spec.
Definition: conn.h:1358
Connection Remote Info Structure.
Definition: conn.h:434
uint8_t version
Remote Link Layer version.
Definition: conn.h:439
uint16_t subversion
Per-manufacturer unique revision.
Definition: conn.h:445
uint16_t manufacturer
Remote manufacturer identifier.
Definition: conn.h:442
uint8_t type
Connection Type.
Definition: conn.h:436
struct bt_conn_br_remote_info br
BR/EDR connection remote info.
Definition: conn.h:452
struct bt_conn_le_remote_info le
LE connection remote info.
Definition: conn.h:449
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:2428
Security Info Structure.
Definition: conn.h:378
uint8_t enc_key_size
Encryption Key Size.
Definition: conn.h:382
bt_security_t level
Security Level.
Definition: conn.h:380
enum bt_security_flag flags
Flags.
Definition: conn.h:384