Zephyr API Documentation  3.7.0
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
396 union {
401 };
406};
407
410
413};
414
417
420
423};
424
433
436
439
442
443 union {
446
449 };
450};
451
463};
464
467
470
473
476};
477
478
481
486
489
499
504
512};
513
531};
532
536
539
542
545};
546
563};
564
576};
577
585int bt_conn_get_info(const struct bt_conn *conn, struct bt_conn_info *info);
586
602int bt_conn_get_remote_info(struct bt_conn *conn,
603 struct bt_conn_remote_info *remote_info);
604
613int bt_conn_le_get_tx_power_level(struct bt_conn *conn,
614 struct bt_conn_le_tx_power *tx_power_level);
615
625 struct bt_conn_le_tx_power *tx_power);
626
636 enum bt_conn_le_tx_power_phy phy);
637
648 bool local_enable,
649 bool remote_enable);
650
662int bt_conn_le_set_path_loss_mon_param(struct bt_conn *conn,
663 const struct bt_conn_le_path_loss_reporting_param *param);
664
677int bt_conn_le_set_path_loss_mon_enable(struct bt_conn *conn, bool enable);
678
690int bt_conn_le_param_update(struct bt_conn *conn,
691 const struct bt_le_conn_param *param);
692
700int bt_conn_le_data_len_update(struct bt_conn *conn,
701 const struct bt_conn_le_data_len_param *param);
702
713int bt_conn_le_phy_update(struct bt_conn *conn,
714 const struct bt_conn_le_phy_param *param);
715
738int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason);
739
740enum {
743
749
757};
758
760
763
766
769
775
781
790};
791
798#define BT_CONN_LE_CREATE_PARAM_INIT(_options, _interval, _window) \
799{ \
800 .options = (_options), \
801 .interval = (_interval), \
802 .window = (_window), \
803 .interval_coded = 0, \
804 .window_coded = 0, \
805 .timeout = 0, \
806}
807
814#define BT_CONN_LE_CREATE_PARAM(_options, _interval, _window) \
815 ((struct bt_conn_le_create_param[]) { \
816 BT_CONN_LE_CREATE_PARAM_INIT(_options, _interval, _window) \
817 })
818
822#define BT_CONN_LE_CREATE_CONN \
823 BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \
824 BT_GAP_SCAN_FAST_INTERVAL, \
825 BT_GAP_SCAN_FAST_INTERVAL)
826
831#define BT_CONN_LE_CREATE_CONN_AUTO \
832 BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \
833 BT_GAP_SCAN_FAST_INTERVAL, \
834 BT_GAP_SCAN_FAST_WINDOW)
835
857 const struct bt_conn_le_create_param *create_param,
858 const struct bt_le_conn_param *conn_param,
859 struct bt_conn **conn);
860
862
869
872};
873
891int bt_conn_le_create_synced(const struct bt_le_ext_adv *adv,
892 const struct bt_conn_le_create_synced_param *synced_param,
893 const struct bt_le_conn_param *conn_param, struct bt_conn **conn);
894
910int bt_conn_le_create_auto(const struct bt_conn_le_create_param *create_param,
911 const struct bt_le_conn_param *conn_param);
912
918
934 const struct bt_le_conn_param *param);
935
972int bt_conn_set_security(struct bt_conn *conn, bt_security_t sec);
973
978bt_security_t bt_conn_get_security(const struct bt_conn *conn);
979
989uint8_t bt_conn_enc_key_size(const struct bt_conn *conn);
990
994
997
1000
1003
1006
1009
1012
1015
1018
1021};
1022
1058 void (*connected)(struct bt_conn *conn, uint8_t err);
1059
1077 void (*disconnected)(struct bt_conn *conn, uint8_t reason);
1078
1091 void (*recycled)(void);
1092
1117 bool (*le_param_req)(struct bt_conn *conn,
1118 struct bt_le_conn_param *param);
1119
1130 void (*le_param_updated)(struct bt_conn *conn, uint16_t interval,
1131 uint16_t latency, uint16_t timeout);
1132#if defined(CONFIG_BT_SMP)
1142 void (*identity_resolved)(struct bt_conn *conn,
1143 const bt_addr_le_t *rpa,
1144 const bt_addr_le_t *identity);
1145#endif /* CONFIG_BT_SMP */
1146#if defined(CONFIG_BT_SMP) || defined(CONFIG_BT_CLASSIC)
1163 void (*security_changed)(struct bt_conn *conn, bt_security_t level,
1164 enum bt_security_err err);
1165#endif /* defined(CONFIG_BT_SMP) || defined(CONFIG_BT_CLASSIC) */
1166
1167#if defined(CONFIG_BT_REMOTE_INFO)
1176 void (*remote_info_available)(struct bt_conn *conn,
1177 struct bt_conn_remote_info *remote_info);
1178#endif /* defined(CONFIG_BT_REMOTE_INFO) */
1179
1180#if defined(CONFIG_BT_USER_PHY_UPDATE)
1189 void (*le_phy_updated)(struct bt_conn *conn,
1190 struct bt_conn_le_phy_info *param);
1191#endif /* defined(CONFIG_BT_USER_PHY_UPDATE) */
1192
1193#if defined(CONFIG_BT_USER_DATA_LEN_UPDATE)
1202 void (*le_data_len_updated)(struct bt_conn *conn,
1203 struct bt_conn_le_data_len_info *info);
1204#endif /* defined(CONFIG_BT_USER_DATA_LEN_UPDATE) */
1205
1206#if defined(CONFIG_BT_DF_CONNECTION_CTE_RX)
1213 void (*cte_report_cb)(struct bt_conn *conn,
1214 const struct bt_df_conn_iq_samples_report *iq_report);
1215#endif /* CONFIG_BT_DF_CONNECTION_CTE_RX */
1216
1217#if defined(CONFIG_BT_TRANSMIT_POWER_CONTROL)
1229 void (*tx_power_report)(struct bt_conn *conn,
1230 const struct bt_conn_le_tx_power_report *report);
1231#endif /* CONFIG_BT_TRANSMIT_POWER_CONTROL */
1232
1233#if defined(CONFIG_BT_PATH_LOSS_MONITORING)
1243 void (*path_loss_threshold_report)(struct bt_conn *conn,
1244 const struct bt_conn_le_path_loss_threshold_report *report);
1245#endif /* CONFIG_BT_PATH_LOSS_MONITORING */
1246
1248 sys_snode_t _node;
1249};
1250
1261
1274
1280#define BT_CONN_CB_DEFINE(_name) \
1281 static const STRUCT_SECTION_ITERABLE(bt_conn_cb, \
1282 _CONCAT(bt_conn_cb_, \
1283 _name))
1284
1291#if defined(CONFIG_BT_SECURITY_ERR_TO_STR)
1292const char *bt_security_err_to_str(enum bt_security_err err);
1293#else
1294static inline const char *bt_security_err_to_str(enum bt_security_err err)
1295{
1296 ARG_UNUSED(err);
1297
1298 return "";
1299}
1300#endif
1301
1312void bt_set_bondable(bool enable);
1313
1332int bt_conn_set_bondable(struct bt_conn *conn, bool enable);
1333
1340void bt_le_oob_set_sc_flag(bool enable);
1341
1349
1361int bt_le_oob_set_legacy_tk(struct bt_conn *conn, const uint8_t *tk);
1362
1381int bt_le_oob_set_sc_data(struct bt_conn *conn,
1382 const struct bt_le_oob_sc_data *oobd_local,
1383 const struct bt_le_oob_sc_data *oobd_remote);
1384
1400int bt_le_oob_get_sc_data(struct bt_conn *conn,
1401 const struct bt_le_oob_sc_data **oobd_local,
1402 const struct bt_le_oob_sc_data **oobd_remote);
1403
1408#define BT_PASSKEY_INVALID 0xffffffff
1409
1423int bt_passkey_set(unsigned int passkey);
1424
1428 enum {
1431
1435
1436 union {
1438 struct {
1440 enum {
1443
1446
1449
1454 };
1455};
1456
1457#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
1467
1470
1473
1476
1481
1486};
1487#endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */
1488
1491#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
1519 enum bt_security_err (*pairing_accept)(struct bt_conn *conn,
1520 const struct bt_conn_pairing_feat *const feat);
1521#endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */
1522
1541 void (*passkey_display)(struct bt_conn *conn, unsigned int passkey);
1542
1543#if defined(CONFIG_BT_PASSKEY_KEYPRESS)
1565 void (*passkey_display_keypress)(struct bt_conn *conn,
1566 enum bt_conn_auth_keypress type);
1567#endif
1568
1587 void (*passkey_entry)(struct bt_conn *conn);
1588
1610 void (*passkey_confirm)(struct bt_conn *conn, unsigned int passkey);
1611
1628 void (*oob_data_request)(struct bt_conn *conn,
1629 struct bt_conn_oob_info *info);
1630
1643 void (*cancel)(struct bt_conn *conn);
1644
1663 void (*pairing_confirm)(struct bt_conn *conn);
1664
1665#if defined(CONFIG_BT_CLASSIC)
1684 void (*pincode_entry)(struct bt_conn *conn, bool highsec);
1685#endif
1686};
1687
1699 void (*pairing_complete)(struct bt_conn *conn, bool bonded);
1700
1706 void (*pairing_failed)(struct bt_conn *conn,
1707 enum bt_security_err reason);
1708
1717 void (*bond_deleted)(uint8_t id, const bt_addr_le_t *peer);
1718
1721};
1722
1733
1748int bt_conn_auth_cb_overlay(struct bt_conn *conn, const struct bt_conn_auth_cb *cb);
1749
1760
1770
1781int bt_conn_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey);
1782
1798int bt_conn_auth_keypress_notify(struct bt_conn *conn, enum bt_conn_auth_keypress type);
1799
1808int bt_conn_auth_cancel(struct bt_conn *conn);
1809
1819int bt_conn_auth_passkey_confirm(struct bt_conn *conn);
1820
1830int bt_conn_auth_pairing_confirm(struct bt_conn *conn);
1831
1842int bt_conn_auth_pincode_entry(struct bt_conn *conn, const char *pin);
1843
1847};
1848
1853#define BT_BR_CONN_PARAM_INIT(role_switch) \
1854{ \
1855 .allow_role_switch = (role_switch), \
1856}
1857
1862#define BT_BR_CONN_PARAM(role_switch) \
1863 ((struct bt_br_conn_param[]) { \
1864 BT_BR_CONN_PARAM_INIT(role_switch) \
1865 })
1866
1870#define BT_BR_CONN_PARAM_DEFAULT BT_BR_CONN_PARAM(true)
1871
1872
1885struct bt_conn *bt_conn_create_br(const bt_addr_t *peer,
1886 const struct bt_br_conn_param *param);
1887
1888#ifdef __cplusplus
1889}
1890#endif
1891
1896#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
static const char * bt_security_err_to_str(enum bt_security_err err)
Converts a security error to string.
Definition: conn.h:1294
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:570
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:452
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: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:991
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: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
bt_conn_le_path_loss_zone
Path Loss zone that has been entered.
Definition: conn.h:522
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_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_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:573
@ BT_CONN_AUTH_KEYPRESS_DIGIT_ENTERED
Definition: conn.h:572
@ BT_CONN_AUTH_KEYPRESS_CLEARED
Definition: conn.h:574
@ BT_CONN_AUTH_KEYPRESS_ENTRY_STARTED
Definition: conn.h:571
@ BT_CONN_AUTH_KEYPRESS_ENTRY_COMPLETED
Definition: conn.h:575
@ BT_CONN_LE_TX_POWER_PHY_NONE
Convenience macro for when no PHY is set.
Definition: conn.h:454
@ BT_CONN_LE_TX_POWER_PHY_CODED_S2
LE Coded PHY using S=2 coding.
Definition: conn.h:462
@ BT_CONN_LE_TX_POWER_PHY_CODED_S8
LE Coded PHY using S=8 coding.
Definition: conn.h:460
@ BT_CONN_LE_TX_POWER_PHY_1M
LE 1M PHY.
Definition: conn.h:456
@ BT_CONN_LE_TX_POWER_PHY_2M
LE 2M PHY.
Definition: conn.h:458
@ 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:1002
@ BT_SECURITY_ERR_AUTH_REQUIREMENT
The requested security level could not be reached.
Definition: conn.h:1005
@ BT_SECURITY_ERR_KEY_REJECTED
Distributed Key Rejected.
Definition: conn.h:1017
@ BT_SECURITY_ERR_UNSPECIFIED
Pairing failed but the exact reason could not be specified.
Definition: conn.h:1020
@ BT_SECURITY_ERR_INVALID_PARAM
Invalid parameters.
Definition: conn.h:1014
@ BT_SECURITY_ERR_PAIR_NOT_SUPPORTED
Pairing is not supported.
Definition: conn.h:1008
@ BT_SECURITY_ERR_AUTH_FAIL
Authentication failed.
Definition: conn.h:996
@ BT_SECURITY_ERR_PIN_OR_KEY_MISSING
PIN or encryption key is missing.
Definition: conn.h:999
@ BT_SECURITY_ERR_SUCCESS
Security procedure successful.
Definition: conn.h:993
@ BT_SECURITY_ERR_PAIR_NOT_ALLOWED
Pairing is not allowed.
Definition: conn.h:1011
@ 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
@ BT_CONN_LE_PATH_LOSS_ZONE_ENTERED_MIDDLE
Middle path loss zone entered.
Definition: conn.h:526
@ BT_CONN_LE_PATH_LOSS_ZONE_ENTERED_LOW
Low path loss zone entered.
Definition: conn.h:524
@ BT_CONN_LE_PATH_LOSS_ZONE_ENTERED_HIGH
High path loss zone entered.
Definition: conn.h:528
@ BT_CONN_LE_PATH_LOSS_ZONE_UNAVAILABLE
Path loss has become unavailable.
Definition: conn.h:530
@ BT_CONN_LE_OPT_NONE
Convenience value when no options are specified.
Definition: conn.h:742
@ BT_CONN_LE_OPT_NO_1M
Disable LE 1M PHY.
Definition: conn.h:756
@ BT_CONN_LE_OPT_CODED
Enable LE Coded PHY.
Definition: conn.h:748
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:3053
#define BT_HCI_LE_ZONE_ENTERED_HIGH
Definition: hci_types.h:3054
#define BT_HCI_LE_ZONE_ENTERED_LOW
Definition: hci_types.h:3052
#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:1845
bool allow_role_switch
Definition: conn.h:1846
Authenticated pairing callback structure.
Definition: conn.h:1490
void(* passkey_entry)(struct bt_conn *conn)
Request the user to enter a passkey.
Definition: conn.h:1587
void(* passkey_display)(struct bt_conn *conn, unsigned int passkey)
Display a passkey to the user.
Definition: conn.h:1541
void(* passkey_confirm)(struct bt_conn *conn, unsigned int passkey)
Request the user to confirm a passkey.
Definition: conn.h:1610
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:1519
void(* pincode_entry)(struct bt_conn *conn, bool highsec)
Request the user to enter a passkey.
Definition: conn.h:1684
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:1628
void(* pairing_confirm)(struct bt_conn *conn)
Request confirmation for an incoming pairing.
Definition: conn.h:1663
void(* cancel)(struct bt_conn *conn)
Cancel the ongoing user request.
Definition: conn.h:1643
Authenticated pairing information callback structure.
Definition: conn.h:1689
void(* pairing_failed)(struct bt_conn *conn, enum bt_security_err reason)
notify that pairing process has failed.
Definition: conn.h:1706
void(* pairing_complete)(struct bt_conn *conn, bool bonded)
notify that pairing procedure was complete.
Definition: conn.h:1699
void(* bond_deleted)(uint8_t id, const bt_addr_le_t *peer)
Notify that bond has been deleted.
Definition: conn.h:1717
sys_snode_t node
Internally used field for list handling.
Definition: conn.h:1720
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:416
uint8_t num_pages
Number of pages in the remote feature set.
Definition: conn.h:422
const uint8_t * features
Remote feature set (pages of bitmasks).
Definition: conn.h:419
Connection callback structure.
Definition: conn.h:1033
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:1130
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:1202
void(* recycled)(void)
A connection object has been returned to the pool.
Definition: conn.h:1091
bool(* le_param_req)(struct bt_conn *conn, struct bt_le_conn_param *param)
LE connection parameter update request.
Definition: conn.h:1117
void(* disconnected)(struct bt_conn *conn, uint8_t reason)
A connection has been disconnected.
Definition: conn.h:1077
void(* connected)(struct bt_conn *conn, uint8_t err)
A new connection has been established.
Definition: conn.h:1058
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:1189
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:1163
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:1142
void(* remote_info_available)(struct bt_conn *conn, struct bt_conn_remote_info *remote_info)
Remote information procedures has completed.
Definition: conn.h:1176
Connection Info Structure.
Definition: conn.h:388
uint8_t id
Which local identity the connection was created with.
Definition: conn.h:394
struct bt_conn_le_info le
LE Connection specific Info.
Definition: conn.h:398
enum bt_conn_type type
Connection Type.
Definition: conn.h:390
struct bt_conn_br_info br
BR/EDR Connection specific Info.
Definition: conn.h:400
uint8_t role
Connection Role.
Definition: conn.h:392
struct bt_security_info security
Security specific info.
Definition: conn.h:405
enum bt_conn_state state
Connection state.
Definition: conn.h:403
Definition: conn.h:759
uint16_t interval_coded
Scan interval LE Coded PHY (N * 0.625 MS)
Definition: conn.h:774
uint16_t window
Scan window (N * 0.625 ms)
Definition: conn.h:768
uint32_t options
Bit-field of create connection options.
Definition: conn.h:762
uint16_t timeout
Connection initiation timeout (N * 10 MS)
Definition: conn.h:789
uint16_t interval
Scan interval (N * 0.625 ms)
Definition: conn.h:765
uint16_t window_coded
Scan window LE Coded PHY (N * 0.625 MS)
Definition: conn.h:780
Definition: conn.h:861
const bt_addr_le_t * peer
Remote address.
Definition: conn.h:868
uint8_t subevent
The subevent where the connection will be initiated.
Definition: conn.h:871
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
LE Path Loss Monitoring Parameters Structure as defined in Core Spec.
Definition: conn.h:550
uint8_t high_threshold
High threshold for the path loss (dB).
Definition: conn.h:552
uint8_t low_threshold
Low threshold for the path loss (dB).
Definition: conn.h:556
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:562
uint8_t high_hysteresis
Hysteresis value for the high threshold (dB).
Definition: conn.h:554
uint8_t low_hysteresis
Hysteresis value for the low threshold (dB).
Definition: conn.h:558
LE Path Loss Monitoring Threshold Change Report Structure.
Definition: conn.h:538
enum bt_conn_le_path_loss_zone zone
Path Loss zone as documented in Core Spec.
Definition: conn.h:541
uint8_t path_loss
Current path loss (dB).
Definition: conn.h:544
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:409
const uint8_t * features
Remote LE feature set (bitmask).
Definition: conn.h:412
LE Transmit Power Reporting Structure.
Definition: conn.h:480
enum bt_conn_le_tx_power_phy phy
Phy of Transmit power reporting.
Definition: conn.h:488
int8_t delta
Change in transmit power level.
Definition: conn.h:511
uint8_t reason
Reason for Transmit power reporting, as documented in Core Spec.
Definition: conn.h:485
int8_t tx_power_level
Transmit power level.
Definition: conn.h:498
uint8_t tx_power_level_flag
Bit 0: Transmit power level is at minimum level.
Definition: conn.h:503
LE Transmit Power Level Structure.
Definition: conn.h:466
int8_t max_level
Output: maximum transmit power level.
Definition: conn.h:475
int8_t current_level
Output: current transmit power level.
Definition: conn.h:472
uint8_t phy
Input: 1M, 2M, Coded S2 or Coded S8.
Definition: conn.h:469
Info Structure for OOB pairing.
Definition: conn.h:1426
struct bt_conn_oob_info::@63::@65 lesc
LE Secure Connections OOB pairing parameters.
@ BT_CONN_OOB_NO_DATA
No OOB data requested.
Definition: conn.h:1451
@ BT_CONN_OOB_LOCAL_ONLY
Local OOB data requested.
Definition: conn.h:1442
@ BT_CONN_OOB_REMOTE_ONLY
Remote OOB data requested.
Definition: conn.h:1445
enum bt_conn_oob_info::@63::@65::@66 oob_config
OOB data configuration.
@ BT_CONN_OOB_BOTH_PEERS
Both local and remote OOB data requested.
Definition: conn.h:1448
@ BT_CONN_OOB_LE_LEGACY
LE legacy pairing.
Definition: conn.h:1430
@ BT_CONN_OOB_LE_SC
LE SC pairing.
Definition: conn.h:1433
enum bt_conn_oob_info::@62 type
Type of OOB pairing method.
Pairing request and pairing response info structure.
Definition: conn.h:1464
uint8_t resp_key_dist
Responder Key Distribution/Generation, Core Spec.
Definition: conn.h:1485
uint8_t io_capability
IO Capability, Core Spec.
Definition: conn.h:1466
uint8_t init_key_dist
Initiator Key Distribution/Generation, Core Spec.
Definition: conn.h:1480
uint8_t max_enc_key_size
Maximum Encryption Key Size, Core Spec.
Definition: conn.h:1475
uint8_t auth_req
AuthReq, Core Spec.
Definition: conn.h:1472
uint8_t oob_data_flag
OOB data flag, Core Spec.
Definition: conn.h:1469
Connection Remote Info Structure.
Definition: conn.h:430
uint8_t version
Remote Link Layer version.
Definition: conn.h:435
uint16_t subversion
Per-manufacturer unique revision.
Definition: conn.h:441
uint16_t manufacturer
Remote manufacturer identifier.
Definition: conn.h:438
uint8_t type
Connection Type.
Definition: conn.h:432
struct bt_conn_br_remote_info br
BR/EDR connection remote info.
Definition: conn.h:448
struct bt_conn_le_remote_info le
LE connection remote info.
Definition: conn.h:445
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:2433
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