Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
493};
494
502int bt_conn_get_info(const struct bt_conn *conn, struct bt_conn_info *info);
503
519int bt_conn_get_remote_info(struct bt_conn *conn,
520 struct bt_conn_remote_info *remote_info);
521
530int bt_conn_le_get_tx_power_level(struct bt_conn *conn,
531 struct bt_conn_le_tx_power *tx_power_level);
532
544int bt_conn_le_param_update(struct bt_conn *conn,
545 const struct bt_le_conn_param *param);
546
554int bt_conn_le_data_len_update(struct bt_conn *conn,
555 const struct bt_conn_le_data_len_param *param);
556
567int bt_conn_le_phy_update(struct bt_conn *conn,
568 const struct bt_conn_le_phy_param *param);
569
592int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason);
593
594enum {
597
603
611};
612
614
617
620
623
629
635
644};
645
652#define BT_CONN_LE_CREATE_PARAM_INIT(_options, _interval, _window) \
653{ \
654 .options = (_options), \
655 .interval = (_interval), \
656 .window = (_window), \
657 .interval_coded = 0, \
658 .window_coded = 0, \
659 .timeout = 0, \
660}
661
668#define BT_CONN_LE_CREATE_PARAM(_options, _interval, _window) \
669 ((struct bt_conn_le_create_param[]) { \
670 BT_CONN_LE_CREATE_PARAM_INIT(_options, _interval, _window) \
671 })
672
676#define BT_CONN_LE_CREATE_CONN \
677 BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \
678 BT_GAP_SCAN_FAST_INTERVAL, \
679 BT_GAP_SCAN_FAST_INTERVAL)
680
685#define BT_CONN_LE_CREATE_CONN_AUTO \
686 BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \
687 BT_GAP_SCAN_FAST_INTERVAL, \
688 BT_GAP_SCAN_FAST_WINDOW)
689
710 const struct bt_conn_le_create_param *create_param,
711 const struct bt_le_conn_param *conn_param,
712 struct bt_conn **conn);
713
715
722
725};
726
744int bt_conn_le_create_synced(const struct bt_le_ext_adv *adv,
745 const struct bt_conn_le_create_synced_param *synced_param,
746 const struct bt_le_conn_param *conn_param, struct bt_conn **conn);
747
763int bt_conn_le_create_auto(const struct bt_conn_le_create_param *create_param,
764 const struct bt_le_conn_param *conn_param);
765
771
787 const struct bt_le_conn_param *param);
788
824int bt_conn_set_security(struct bt_conn *conn, bt_security_t sec);
825
830bt_security_t bt_conn_get_security(const struct bt_conn *conn);
831
841uint8_t bt_conn_enc_key_size(const struct bt_conn *conn);
842
846
849
852
855
858
861
864
867
870
873};
874
910 void (*connected)(struct bt_conn *conn, uint8_t err);
911
929 void (*disconnected)(struct bt_conn *conn, uint8_t reason);
930
955 bool (*le_param_req)(struct bt_conn *conn,
956 struct bt_le_conn_param *param);
957
968 void (*le_param_updated)(struct bt_conn *conn, uint16_t interval,
969 uint16_t latency, uint16_t timeout);
970#if defined(CONFIG_BT_SMP)
980 void (*identity_resolved)(struct bt_conn *conn,
981 const bt_addr_le_t *rpa,
982 const bt_addr_le_t *identity);
983#endif /* CONFIG_BT_SMP */
984#if defined(CONFIG_BT_SMP) || defined(CONFIG_BT_BREDR)
1001 void (*security_changed)(struct bt_conn *conn, bt_security_t level,
1002 enum bt_security_err err);
1003#endif /* defined(CONFIG_BT_SMP) || defined(CONFIG_BT_BREDR) */
1004
1005#if defined(CONFIG_BT_REMOTE_INFO)
1014 void (*remote_info_available)(struct bt_conn *conn,
1015 struct bt_conn_remote_info *remote_info);
1016#endif /* defined(CONFIG_BT_REMOTE_INFO) */
1017
1018#if defined(CONFIG_BT_USER_PHY_UPDATE)
1027 void (*le_phy_updated)(struct bt_conn *conn,
1028 struct bt_conn_le_phy_info *param);
1029#endif /* defined(CONFIG_BT_USER_PHY_UPDATE) */
1030
1031#if defined(CONFIG_BT_USER_DATA_LEN_UPDATE)
1040 void (*le_data_len_updated)(struct bt_conn *conn,
1041 struct bt_conn_le_data_len_info *info);
1042#endif /* defined(CONFIG_BT_USER_DATA_LEN_UPDATE) */
1043
1044#if defined(CONFIG_BT_DF_CONNECTION_CTE_RX)
1051 void (*cte_report_cb)(struct bt_conn *conn,
1052 const struct bt_df_conn_iq_samples_report *iq_report);
1053#endif /* CONFIG_BT_DF_CONNECTION_CTE_RX */
1054
1055 struct bt_conn_cb *_next;
1056};
1057
1065
1071#define BT_CONN_CB_DEFINE(_name) \
1072 static const STRUCT_SECTION_ITERABLE(bt_conn_cb, \
1073 _CONCAT(bt_conn_cb_, \
1074 _name))
1075
1086void bt_set_bondable(bool enable);
1087
1106int bt_conn_set_bondable(struct bt_conn *conn, bool enable);
1107
1114void bt_le_oob_set_sc_flag(bool enable);
1115
1123
1135int bt_le_oob_set_legacy_tk(struct bt_conn *conn, const uint8_t *tk);
1136
1155int bt_le_oob_set_sc_data(struct bt_conn *conn,
1156 const struct bt_le_oob_sc_data *oobd_local,
1157 const struct bt_le_oob_sc_data *oobd_remote);
1158
1174int bt_le_oob_get_sc_data(struct bt_conn *conn,
1175 const struct bt_le_oob_sc_data **oobd_local,
1176 const struct bt_le_oob_sc_data **oobd_remote);
1177
1182#define BT_PASSKEY_INVALID 0xffffffff
1183
1197int bt_passkey_set(unsigned int passkey);
1198
1202 enum {
1205
1209
1210 union {
1212 struct {
1214 enum {
1217
1220
1223
1228 };
1229};
1230
1231#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
1241
1244
1247
1250
1255
1260};
1261#endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */
1262
1265#if defined(CONFIG_BT_SMP_APP_PAIRING_ACCEPT)
1293 enum bt_security_err (*pairing_accept)(struct bt_conn *conn,
1294 const struct bt_conn_pairing_feat *const feat);
1295#endif /* CONFIG_BT_SMP_APP_PAIRING_ACCEPT */
1296
1315 void (*passkey_display)(struct bt_conn *conn, unsigned int passkey);
1316
1317#if defined(CONFIG_BT_PASSKEY_KEYPRESS)
1339 void (*passkey_display_keypress)(struct bt_conn *conn,
1340 enum bt_conn_auth_keypress type);
1341#endif
1342
1361 void (*passkey_entry)(struct bt_conn *conn);
1362
1384 void (*passkey_confirm)(struct bt_conn *conn, unsigned int passkey);
1385
1402 void (*oob_data_request)(struct bt_conn *conn,
1403 struct bt_conn_oob_info *info);
1404
1417 void (*cancel)(struct bt_conn *conn);
1418
1437 void (*pairing_confirm)(struct bt_conn *conn);
1438
1439#if defined(CONFIG_BT_BREDR)
1458 void (*pincode_entry)(struct bt_conn *conn, bool highsec);
1459#endif
1460};
1461
1473 void (*pairing_complete)(struct bt_conn *conn, bool bonded);
1474
1480 void (*pairing_failed)(struct bt_conn *conn,
1481 enum bt_security_err reason);
1482
1491 void (*bond_deleted)(uint8_t id, const bt_addr_le_t *peer);
1492
1495};
1496
1507
1522int bt_conn_auth_cb_overlay(struct bt_conn *conn, const struct bt_conn_auth_cb *cb);
1523
1534
1544
1555int bt_conn_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey);
1556
1572int bt_conn_auth_keypress_notify(struct bt_conn *conn, enum bt_conn_auth_keypress type);
1573
1582int bt_conn_auth_cancel(struct bt_conn *conn);
1583
1593int bt_conn_auth_passkey_confirm(struct bt_conn *conn);
1594
1604int bt_conn_auth_pairing_confirm(struct bt_conn *conn);
1605
1616int bt_conn_auth_pincode_entry(struct bt_conn *conn, const char *pin);
1617
1621};
1622
1627#define BT_BR_CONN_PARAM_INIT(role_switch) \
1628{ \
1629 .allow_role_switch = (role_switch), \
1630}
1631
1636#define BT_BR_CONN_PARAM(role_switch) \
1637 ((struct bt_br_conn_param[]) { \
1638 BT_BR_CONN_PARAM_INIT(role_switch) \
1639 })
1640
1644#define BT_BR_CONN_PARAM_DEFAULT BT_BR_CONN_PARAM(true)
1645
1646
1659struct bt_conn *bt_conn_create_br(const bt_addr_t *peer,
1660 const struct bt_br_conn_param *param);
1661
1673struct bt_conn *bt_conn_create_sco(const bt_addr_t *peer);
1674
1675#ifdef __cplusplus
1676}
1677#endif
1678
1683#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_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:487
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_get_tx_power_level(struct bt_conn *conn, struct bt_conn_le_tx_power *tx_power_level)
Get connection transmit power level.
bt_security_err
Definition: conn.h:843
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
struct bt_conn * bt_conn_create_sco(const bt_addr_t *peer)
Initiate an SCO connection to a remote device.
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.
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_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_ROLE_PERIPHERAL
Definition: conn.h:337
@ BT_CONN_ROLE_CENTRAL
Definition: conn.h:336
@ 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:490
@ BT_CONN_AUTH_KEYPRESS_DIGIT_ENTERED
Definition: conn.h:489
@ BT_CONN_AUTH_KEYPRESS_CLEARED
Definition: conn.h:491
@ BT_CONN_AUTH_KEYPRESS_ENTRY_STARTED
Definition: conn.h:488
@ BT_CONN_AUTH_KEYPRESS_ENTRY_COMPLETED
Definition: conn.h:492
@ 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_OPT_NONE
Convenience value when no options are specified.
Definition: conn.h:596
@ BT_CONN_LE_OPT_NO_1M
Disable LE 1M PHY.
Definition: conn.h:610
@ BT_CONN_LE_OPT_CODED
Enable LE Coded PHY.
Definition: conn.h:602
@ 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:854
@ BT_SECURITY_ERR_AUTH_REQUIREMENT
The requested security level could not be reached.
Definition: conn.h:857
@ BT_SECURITY_ERR_KEY_REJECTED
Distributed Key Rejected.
Definition: conn.h:869
@ BT_SECURITY_ERR_UNSPECIFIED
Pairing failed but the exact reason could not be specified.
Definition: conn.h:872
@ BT_SECURITY_ERR_INVALID_PARAM
Invalid parameters.
Definition: conn.h:866
@ BT_SECURITY_ERR_PAIR_NOT_SUPPORTED
Pairing is not supported.
Definition: conn.h:860
@ BT_SECURITY_ERR_AUTH_FAIL
Authentication failed.
Definition: conn.h:848
@ BT_SECURITY_ERR_PIN_OR_KEY_MISSING
PIN or encryption key is missing.
Definition: conn.h:851
@ BT_SECURITY_ERR_SUCCESS
Security procedure successful.
Definition: conn.h:845
@ BT_SECURITY_ERR_PAIR_NOT_ALLOWED
Pairing is not allowed.
Definition: conn.h:863
@ 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_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:1619
bool allow_role_switch
Definition: conn.h:1620
Authenticated pairing callback structure.
Definition: conn.h:1264
void(* passkey_entry)(struct bt_conn *conn)
Request the user to enter a passkey.
Definition: conn.h:1361
void(* passkey_display)(struct bt_conn *conn, unsigned int passkey)
Display a passkey to the user.
Definition: conn.h:1315
void(* passkey_confirm)(struct bt_conn *conn, unsigned int passkey)
Request the user to confirm a passkey.
Definition: conn.h:1384
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:1293
void(* pincode_entry)(struct bt_conn *conn, bool highsec)
Request the user to enter a passkey.
Definition: conn.h:1458
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:1402
void(* pairing_confirm)(struct bt_conn *conn)
Request confirmation for an incoming pairing.
Definition: conn.h:1437
void(* cancel)(struct bt_conn *conn)
Cancel the ongoing user request.
Definition: conn.h:1417
Authenticated pairing information callback structure.
Definition: conn.h:1463
void(* pairing_failed)(struct bt_conn *conn, enum bt_security_err reason)
notify that pairing process has failed.
Definition: conn.h:1480
void(* pairing_complete)(struct bt_conn *conn, bool bonded)
notify that pairing procedure was complete.
Definition: conn.h:1473
void(* bond_deleted)(uint8_t id, const bt_addr_le_t *peer)
Notify that bond has been deleted.
Definition: conn.h:1491
sys_snode_t node
Internally used field for list handling.
Definition: conn.h:1494
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:885
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:968
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:1040
bool(* le_param_req)(struct bt_conn *conn, struct bt_le_conn_param *param)
LE connection parameter update request.
Definition: conn.h:955
void(* disconnected)(struct bt_conn *conn, uint8_t reason)
A connection has been disconnected.
Definition: conn.h:929
void(* connected)(struct bt_conn *conn, uint8_t err)
A new connection has been established.
Definition: conn.h:910
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:1027
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:1001
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:980
void(* remote_info_available)(struct bt_conn *conn, struct bt_conn_remote_info *remote_info)
Remote information procedures has completed.
Definition: conn.h:1014
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:613
uint16_t interval_coded
Scan interval LE Coded PHY (N * 0.625 MS)
Definition: conn.h:628
uint16_t window
Scan window (N * 0.625 ms)
Definition: conn.h:622
uint32_t options
Bit-field of create connection options.
Definition: conn.h:616
uint16_t timeout
Connection initiation timeout (N * 10 MS)
Definition: conn.h:643
uint16_t interval
Scan interval (N * 0.625 ms)
Definition: conn.h:619
uint16_t window_coded
Scan window LE Coded PHY (N * 0.625 MS)
Definition: conn.h:634
Definition: conn.h:714
const bt_addr_le_t * peer
Remote address.
Definition: conn.h:721
uint8_t subevent
The subevent where the connection will be initiated.
Definition: conn.h:724
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 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:1200
enum bt_conn_oob_info::@52::@54::@55 oob_config
OOB data configuration.
@ BT_CONN_OOB_NO_DATA
No OOB data requested.
Definition: conn.h:1225
@ BT_CONN_OOB_LOCAL_ONLY
Local OOB data requested.
Definition: conn.h:1216
@ BT_CONN_OOB_REMOTE_ONLY
Remote OOB data requested.
Definition: conn.h:1219
@ BT_CONN_OOB_BOTH_PEERS
Both local and remote OOB data requested.
Definition: conn.h:1222
struct bt_conn_oob_info::@52::@54 lesc
LE Secure Connections OOB pairing parameters.
@ BT_CONN_OOB_LE_LEGACY
LE legacy pairing.
Definition: conn.h:1204
@ BT_CONN_OOB_LE_SC
LE SC pairing.
Definition: conn.h:1207
enum bt_conn_oob_info::@51 type
Type of OOB pairing method.
Pairing request and pairing response info structure.
Definition: conn.h:1238
uint8_t resp_key_dist
Responder Key Distribution/Generation, Core Spec.
Definition: conn.h:1259
uint8_t io_capability
IO Capability, Core Spec.
Definition: conn.h:1240
uint8_t init_key_dist
Initiator Key Distribution/Generation, Core Spec.
Definition: conn.h:1254
uint8_t max_enc_key_size
Maximum Encryption Key Size, Core Spec.
Definition: conn.h:1249
uint8_t auth_req
AuthReq, Core Spec.
Definition: conn.h:1246
uint8_t oob_data_flag
OOB data flag, Core Spec.
Definition: conn.h:1243
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:2320
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