Zephyr Project API  3.2.0
A Scalable Open Source RTOS
bluetooth.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2017 Nordic Semiconductor ASA
7 * Copyright (c) 2015-2016 Intel Corporation
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_BLUETOOTH_H_
12#define ZEPHYR_INCLUDE_BLUETOOTH_BLUETOOTH_H_
13
20#include <stdbool.h>
21#include <string.h>
22#include <zephyr/sys/util.h>
23#include <zephyr/net/buf.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
44#define BT_ID_DEFAULT 0
45
47struct bt_le_ext_adv;
48
50struct bt_le_per_adv_sync;
51
52/* Don't require everyone to include conn.h */
53struct bt_conn;
54
55/* Don't require everyone to include iso.h */
56struct bt_iso_biginfo;
57
58/* Don't require everyone to include direction.h */
60
64};
65
68 struct bt_conn *conn;
69};
70
74};
75
88 void (*sent)(struct bt_le_ext_adv *adv,
89 struct bt_le_ext_adv_sent_info *info);
90
100 void (*connected)(struct bt_le_ext_adv *adv,
101 struct bt_le_ext_adv_connected_info *info);
102
113 void (*scanned)(struct bt_le_ext_adv *adv,
114 struct bt_le_ext_adv_scanned_info *info);
115
116#if defined(CONFIG_BT_PRIVACY)
129 bool (*rpa_expired)(struct bt_le_ext_adv *adv);
130#endif /* defined(CONFIG_BT_PRIVACY) */
131};
132
139typedef void (*bt_ready_cb_t)(int err);
140
161
171int bt_disable(void);
172
178bool bt_is_ready(void);
179
193int bt_set_name(const char *name);
194
202const char *bt_get_name(void);
203
215
230int bt_set_appearance(uint16_t new_appearance);
231
252void bt_id_get(bt_addr_le_t *addrs, size_t *count);
253
296
330
348
356struct bt_data {
359 const uint8_t *data;
360};
361
372#define BT_DATA(_type, _data, _data_len) \
373 { \
374 .type = (_type), \
375 .data_len = (_data_len), \
376 .data = (const uint8_t *)(_data), \
377 }
378
388#define BT_DATA_BYTES(_type, _bytes...) \
389 BT_DATA(_type, ((uint8_t []) { _bytes }), \
390 sizeof((uint8_t []) { _bytes }))
391
393enum {
396
406
422
434
456
464
478
483
486
491
502
522
538
550
557
564
567
570
573
583};
584
596
603
613
616
625
634
651};
652
653
655enum {
658
665
672};
673
682
690
693};
694
704#define BT_LE_ADV_PARAM_INIT(_options, _int_min, _int_max, _peer) \
705{ \
706 .id = BT_ID_DEFAULT, \
707 .sid = 0, \
708 .secondary_max_skip = 0, \
709 .options = (_options), \
710 .interval_min = (_int_min), \
711 .interval_max = (_int_max), \
712 .peer = (_peer), \
713}
714
724#define BT_LE_ADV_PARAM(_options, _int_min, _int_max, _peer) \
725 ((struct bt_le_adv_param[]) { \
726 BT_LE_ADV_PARAM_INIT(_options, _int_min, _int_max, _peer) \
727 })
728
729#define BT_LE_ADV_CONN_DIR(_peer) BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \
730 BT_LE_ADV_OPT_ONE_TIME, 0, 0,\
731 _peer)
732
733
734#define BT_LE_ADV_CONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, \
735 BT_GAP_ADV_FAST_INT_MIN_2, \
736 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
737
738#define BT_LE_ADV_CONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \
739 BT_LE_ADV_OPT_USE_NAME, \
740 BT_GAP_ADV_FAST_INT_MIN_2, \
741 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
742
743#define BT_LE_ADV_CONN_NAME_AD BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \
744 BT_LE_ADV_OPT_USE_NAME | \
745 BT_LE_ADV_OPT_FORCE_NAME_IN_AD, \
746 BT_GAP_ADV_FAST_INT_MIN_2, \
747 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
748
749#define BT_LE_ADV_CONN_DIR_LOW_DUTY(_peer) \
750 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | \
751 BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY, \
752 BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, \
753 _peer)
754
756#define BT_LE_ADV_NCONN BT_LE_ADV_PARAM(0, BT_GAP_ADV_FAST_INT_MIN_2, \
757 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
758
760#define BT_LE_ADV_NCONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_USE_NAME, \
761 BT_GAP_ADV_FAST_INT_MIN_2, \
762 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
763
765#define BT_LE_ADV_NCONN_IDENTITY BT_LE_ADV_PARAM(BT_LE_ADV_OPT_USE_IDENTITY, \
766 BT_GAP_ADV_FAST_INT_MIN_2, \
767 BT_GAP_ADV_FAST_INT_MAX_2, \
768 NULL)
769
771#define BT_LE_EXT_ADV_CONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
772 BT_LE_ADV_OPT_CONNECTABLE | \
773 BT_LE_ADV_OPT_USE_NAME, \
774 BT_GAP_ADV_FAST_INT_MIN_2, \
775 BT_GAP_ADV_FAST_INT_MAX_2, \
776 NULL)
777
779#define BT_LE_EXT_ADV_SCAN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
780 BT_LE_ADV_OPT_SCANNABLE | \
781 BT_LE_ADV_OPT_USE_NAME, \
782 BT_GAP_ADV_FAST_INT_MIN_2, \
783 BT_GAP_ADV_FAST_INT_MAX_2, \
784 NULL)
785
787#define BT_LE_EXT_ADV_NCONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, \
788 BT_GAP_ADV_FAST_INT_MIN_2, \
789 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
790
792#define BT_LE_EXT_ADV_NCONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
793 BT_LE_ADV_OPT_USE_NAME, \
794 BT_GAP_ADV_FAST_INT_MIN_2, \
795 BT_GAP_ADV_FAST_INT_MAX_2, \
796 NULL)
797
799#define BT_LE_EXT_ADV_NCONN_IDENTITY \
800 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
801 BT_LE_ADV_OPT_USE_IDENTITY, \
802 BT_GAP_ADV_FAST_INT_MIN_2, \
803 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
804
806#define BT_LE_EXT_ADV_CODED_NCONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
807 BT_LE_ADV_OPT_CODED, \
808 BT_GAP_ADV_FAST_INT_MIN_2, \
809 BT_GAP_ADV_FAST_INT_MAX_2, \
810 NULL)
811
815#define BT_LE_EXT_ADV_CODED_NCONN_NAME \
816 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CODED | \
817 BT_LE_ADV_OPT_USE_NAME, \
818 BT_GAP_ADV_FAST_INT_MIN_2, \
819 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
820
824#define BT_LE_EXT_ADV_CODED_NCONN_IDENTITY \
825 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CODED | \
826 BT_LE_ADV_OPT_USE_IDENTITY, \
827 BT_GAP_ADV_FAST_INT_MIN_2, \
828 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
829
836#define BT_LE_EXT_ADV_START_PARAM_INIT(_timeout, _n_evts) \
837{ \
838 .timeout = (_timeout), \
839 .num_events = (_n_evts), \
840}
841
848#define BT_LE_EXT_ADV_START_PARAM(_timeout, _n_evts) \
849 ((struct bt_le_ext_adv_start_param[]) { \
850 BT_LE_EXT_ADV_START_PARAM_INIT((_timeout), (_n_evts)) \
851 })
852
853#define BT_LE_EXT_ADV_START_DEFAULT BT_LE_EXT_ADV_START_PARAM(0, 0)
854
862#define BT_LE_PER_ADV_PARAM_INIT(_int_min, _int_max, _options) \
863{ \
864 .interval_min = (_int_min), \
865 .interval_max = (_int_max), \
866 .options = (_options), \
867}
868
876#define BT_LE_PER_ADV_PARAM(_int_min, _int_max, _options) \
877 ((struct bt_le_per_adv_param[]) { \
878 BT_LE_PER_ADV_PARAM_INIT(_int_min, _int_max, _options) \
879 })
880
881#define BT_LE_PER_ADV_DEFAULT BT_LE_PER_ADV_PARAM(BT_GAP_PER_ADV_SLOW_INT_MIN, \
882 BT_GAP_PER_ADV_SLOW_INT_MAX, \
883 BT_LE_PER_ADV_OPT_NONE)
884
912int bt_le_adv_start(const struct bt_le_adv_param *param,
913 const struct bt_data *ad, size_t ad_len,
914 const struct bt_data *sd, size_t sd_len);
915
928int bt_le_adv_update_data(const struct bt_data *ad, size_t ad_len,
929 const struct bt_data *sd, size_t sd_len);
930
939
954int bt_le_ext_adv_create(const struct bt_le_adv_param *param,
955 const struct bt_le_ext_adv_cb *cb,
956 struct bt_le_ext_adv **adv);
957
980};
981
995int bt_le_ext_adv_start(struct bt_le_ext_adv *adv,
996 struct bt_le_ext_adv_start_param *param);
997
1008int bt_le_ext_adv_stop(struct bt_le_ext_adv *adv);
1009
1044int bt_le_ext_adv_set_data(struct bt_le_ext_adv *adv,
1045 const struct bt_data *ad, size_t ad_len,
1046 const struct bt_data *sd, size_t sd_len);
1047
1064int bt_le_ext_adv_update_param(struct bt_le_ext_adv *adv,
1065 const struct bt_le_adv_param *param);
1066
1075int bt_le_ext_adv_delete(struct bt_le_ext_adv *adv);
1076
1088uint8_t bt_le_ext_adv_get_index(struct bt_le_ext_adv *adv);
1089
1092 /* Local identity */
1094
1097};
1098
1107int bt_le_ext_adv_get_info(const struct bt_le_ext_adv *adv,
1108 struct bt_le_ext_adv_info *info);
1109
1123typedef void bt_le_scan_cb_t(const bt_addr_le_t *addr, int8_t rssi,
1124 uint8_t adv_type, struct net_buf_simple *buf);
1125
1138int bt_le_per_adv_set_param(struct bt_le_ext_adv *adv,
1139 const struct bt_le_per_adv_param *param);
1140
1154int bt_le_per_adv_set_data(const struct bt_le_ext_adv *adv,
1155 const struct bt_data *ad, size_t ad_len);
1156
1174int bt_le_per_adv_start(struct bt_le_ext_adv *adv);
1175
1187int bt_le_per_adv_stop(struct bt_le_ext_adv *adv);
1188
1192
1195
1198
1201
1204
1211
1218 struct bt_conn *conn;
1219};
1220
1224
1227
1230};
1231
1235
1238
1241
1244
1247};
1248
1249
1253};
1254
1266 void (*synced)(struct bt_le_per_adv_sync *sync,
1267 struct bt_le_per_adv_sync_synced_info *info);
1268
1278 void (*term)(struct bt_le_per_adv_sync *sync,
1279 const struct bt_le_per_adv_sync_term_info *info);
1280
1291 void (*recv)(struct bt_le_per_adv_sync *sync,
1292 const struct bt_le_per_adv_sync_recv_info *info,
1293 struct net_buf_simple *buf);
1294
1305 void (*state_changed)(struct bt_le_per_adv_sync *sync,
1306 const struct bt_le_per_adv_sync_state_info *info);
1307
1318 void (*biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo);
1319
1327 void (*cte_report_cb)(struct bt_le_per_adv_sync *sync,
1328 struct bt_df_per_adv_sync_iq_samples_report const *info);
1329
1331};
1332
1334enum {
1337
1345
1352
1355
1358
1361
1364
1367};
1368
1377
1385
1388
1397
1405};
1406
1418uint8_t bt_le_per_adv_sync_get_index(struct bt_le_per_adv_sync *per_adv_sync);
1419
1424
1427
1430
1433};
1434
1443int bt_le_per_adv_sync_get_info(struct bt_le_per_adv_sync *per_adv_sync,
1444 struct bt_le_per_adv_sync_info *info);
1445
1454struct bt_le_per_adv_sync *bt_le_per_adv_sync_lookup_addr(const bt_addr_le_t *adv_addr,
1455 uint8_t sid);
1456
1470 struct bt_le_per_adv_sync **out_sync);
1471
1488int bt_le_per_adv_sync_delete(struct bt_le_per_adv_sync *per_adv_sync);
1489
1502
1512int bt_le_per_adv_sync_recv_enable(struct bt_le_per_adv_sync *per_adv_sync);
1513
1523int bt_le_per_adv_sync_recv_disable(struct bt_le_per_adv_sync *per_adv_sync);
1524
1526enum {
1529
1536
1544
1552
1555};
1556
1565
1573
1576};
1577
1590int bt_le_per_adv_sync_transfer(const struct bt_le_per_adv_sync *per_adv_sync,
1591 const struct bt_conn *conn,
1592 uint16_t service_data);
1593
1594
1607int bt_le_per_adv_set_info_transfer(const struct bt_le_ext_adv *adv,
1608 const struct bt_conn *conn,
1609 uint16_t service_data);
1610
1625 const struct bt_conn *conn,
1626 const struct bt_le_per_adv_sync_transfer_param *param);
1627
1641int bt_le_per_adv_sync_transfer_unsubscribe(const struct bt_conn *conn);
1642
1657
1670
1679
1680
1681enum {
1684
1687
1690
1693
1700};
1701
1702#define BT_LE_SCAN_OPT_FILTER_WHITELIST __DEPRECATED_MACRO BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST
1703
1704enum {
1707
1716};
1717
1722
1725
1728
1731
1739
1746
1753};
1754
1764
1767
1770
1773
1783
1793
1800
1803
1806};
1807
1810
1817 void (*recv)(const struct bt_le_scan_recv_info *info,
1818 struct net_buf_simple *buf);
1819
1821 void (*timeout)(void);
1822
1824};
1825
1835#define BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) \
1836{ \
1837 .type = (_type), \
1838 .options = (_options), \
1839 .interval = (_interval), \
1840 .window = (_window), \
1841 .timeout = 0, \
1842 .interval_coded = 0, \
1843 .window_coded = 0, \
1844}
1845
1855#define BT_LE_SCAN_PARAM(_type, _options, _interval, _window) \
1856 ((struct bt_le_scan_param[]) { \
1857 BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) \
1858 })
1859
1863#define BT_LE_SCAN_ACTIVE BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \
1864 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1865 BT_GAP_SCAN_FAST_INTERVAL, \
1866 BT_GAP_SCAN_FAST_WINDOW)
1867
1874#define BT_LE_SCAN_PASSIVE BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \
1875 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1876 BT_GAP_SCAN_FAST_INTERVAL, \
1877 BT_GAP_SCAN_FAST_WINDOW)
1878
1883#define BT_LE_SCAN_CODED_ACTIVE \
1884 BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \
1885 BT_LE_SCAN_OPT_CODED | \
1886 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1887 BT_GAP_SCAN_FAST_INTERVAL, \
1888 BT_GAP_SCAN_FAST_WINDOW)
1889
1897#define BT_LE_SCAN_CODED_PASSIVE \
1898 BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \
1899 BT_LE_SCAN_OPT_CODED | \
1900 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1901 BT_GAP_SCAN_FAST_INTERVAL, \
1902 BT_GAP_SCAN_FAST_WINDOW)
1903
1925
1935
1948
1957
1973__deprecated
1974static inline int bt_le_whitelist_add(const bt_addr_le_t *addr)
1975{
1976 return bt_le_filter_accept_list_add(addr);
1977}
1978
1994__deprecated
1995static inline int bt_le_whitelist_rem(const bt_addr_le_t *addr)
1996{
1998}
1999
2013__deprecated
2014static inline int bt_le_whitelist_clear(void)
2015{
2017}
2018
2028
2047int bt_le_set_rpa_timeout(uint16_t new_rpa_timeout);
2048
2067 bool (*func)(struct bt_data *data, void *user_data),
2068 void *user_data);
2069
2074
2077};
2078
2085
2088};
2089
2119
2144int bt_le_ext_adv_oob_get_local(struct bt_le_ext_adv *adv,
2145 struct bt_le_oob *oob);
2146
2150 uint8_t _priv[4];
2151
2154
2157
2160
2163};
2164
2178 size_t count);
2179
2186
2189};
2190
2209 struct bt_br_discovery_result *results, size_t count,
2211
2222
2226};
2227
2237
2238
2251int bt_br_set_discoverable(bool enable);
2252
2265int bt_br_set_connectable(bool enable);
2266
2276int bt_unpair(uint8_t id, const bt_addr_le_t *addr);
2277
2282};
2283
2291void bt_foreach_bond(uint8_t id, void (*func)(const struct bt_bond_info *info,
2292 void *user_data),
2293 void *user_data);
2294
2310 const uint8_t *vs_config);
2311
2316#ifdef __cplusplus
2317}
2318#endif
2323#endif /* ZEPHYR_INCLUDE_BLUETOOTH_BLUETOOTH_H_ */
Bluetooth device address definitions and utilities.
Bluetooth subsystem crypto APIs.
ZTEST_BMEM int count
Definition: main.c:33
Bluetooth Generic Access Profile defines and Assigned Numbers.
int bt_le_filter_accept_list_remove(const bt_addr_le_t *addr)
Remove device (LE) from filter accept list.
int bt_le_per_adv_sync_create(const struct bt_le_per_adv_sync_param *param, struct bt_le_per_adv_sync **out_sync)
Create a periodic advertising sync object.
void bt_id_get(bt_addr_le_t *addrs, size_t *count)
Get the currently configured identities.
int bt_le_per_adv_sync_recv_enable(struct bt_le_per_adv_sync *per_adv_sync)
Enables receiving periodic advertising reports for a sync.
int bt_le_per_adv_sync_transfer_unsubscribe(const struct bt_conn *conn)
Unsubscribe from periodic advertising sync transfers (PASTs).
int bt_disable(void)
Disable Bluetooth.
void bt_le_per_adv_sync_cb_register(struct bt_le_per_adv_sync_cb *cb)
Register periodic advertising sync callbacks.
int bt_le_per_adv_start(struct bt_le_ext_adv *adv)
Starts periodic advertising.
static int bt_le_whitelist_rem(const bt_addr_le_t *addr)
Definition: bluetooth.h:1995
int bt_le_per_adv_list_remove(const bt_addr_le_t *addr, uint8_t sid)
Remove a device from the periodic advertising list.
static int bt_le_whitelist_add(const bt_addr_le_t *addr)
Definition: bluetooth.h:1974
int bt_le_adv_stop(void)
Stop advertising.
int bt_le_ext_adv_update_param(struct bt_le_ext_adv *adv, const struct bt_le_adv_param *param)
Update advertising parameters.
int bt_le_per_adv_stop(struct bt_le_ext_adv *adv)
Stops periodic advertising.
int bt_le_ext_adv_stop(struct bt_le_ext_adv *adv)
Stop advertising with the given advertising set.
static int bt_le_whitelist_clear(void)
Definition: bluetooth.h:2014
int bt_le_per_adv_list_add(const bt_addr_le_t *addr, uint8_t sid)
Add a device to the periodic advertising list.
int bt_le_oob_get_local(uint8_t id, struct bt_le_oob *oob)
Get local LE Out of Band (OOB) information.
int bt_br_oob_get_local(struct bt_br_oob *oob)
Get BR/EDR local Out Of Band information.
uint16_t bt_get_appearance(void)
Get local Bluetooth appearance.
int bt_le_per_adv_sync_recv_disable(struct bt_le_per_adv_sync *per_adv_sync)
Disables receiving periodic advertising reports for a sync.
int bt_le_filter_accept_list_add(const bt_addr_le_t *addr)
Add device (LE) to filter accept list.
void bt_br_discovery_cb_t(struct bt_br_discovery_result *results, size_t count)
Callback type for reporting BR/EDR discovery (inquiry) results.
Definition: bluetooth.h:2177
int bt_br_discovery_stop(void)
Stop BR/EDR discovery.
int bt_le_per_adv_list_clear(void)
Clear the periodic advertising list.
int bt_le_ext_adv_delete(struct bt_le_ext_adv *adv)
Delete advertising set.
void bt_data_parse(struct net_buf_simple *ad, bool(*func)(struct bt_data *data, void *user_data), void *user_data)
Helper for parsing advertising (or EIR or OOB) data.
void(* bt_ready_cb_t)(int err)
Callback for notifying that Bluetooth has been enabled.
Definition: bluetooth.h:139
int bt_le_ext_adv_oob_get_local(struct bt_le_ext_adv *adv, struct bt_le_oob *oob)
Get local LE Out of Band (OOB) information.
int bt_configure_data_path(uint8_t dir, uint8_t id, uint8_t vs_config_len, const uint8_t *vs_config)
Configure vendor data path.
int bt_br_set_connectable(bool enable)
Enable/disable set controller in connectable state.
struct bt_le_per_adv_sync * bt_le_per_adv_sync_lookup_addr(const bt_addr_le_t *adv_addr, uint8_t sid)
Look up an existing periodic advertising sync object by advertiser address.
uint8_t bt_le_per_adv_sync_get_index(struct bt_le_per_adv_sync *per_adv_sync)
Get array index of an periodic advertising sync object.
int bt_le_adv_update_data(const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len)
Update advertising.
int bt_le_set_rpa_timeout(uint16_t new_rpa_timeout)
Set the Resolvable Private Address timeout in runtime.
void bt_le_scan_cb_t(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type, struct net_buf_simple *buf)
Callback type for reporting LE scan results.
Definition: bluetooth.h:1123
int bt_le_per_adv_sync_transfer_subscribe(const struct bt_conn *conn, const struct bt_le_per_adv_sync_transfer_param *param)
Subscribe to periodic advertising sync transfers (PASTs).
int bt_le_per_adv_sync_delete(struct bt_le_per_adv_sync *per_adv_sync)
Delete periodic advertising sync.
int bt_le_scan_stop(void)
Stop (LE) scanning.
int bt_le_per_adv_set_param(struct bt_le_ext_adv *adv, const struct bt_le_per_adv_param *param)
Set or update the periodic advertising parameters.
bool bt_is_ready(void)
Check if Bluetooth is ready.
void bt_foreach_bond(uint8_t id, void(*func)(const struct bt_bond_info *info, void *user_data), void *user_data)
Iterate through all existing bonds.
int bt_id_reset(uint8_t id, bt_addr_le_t *addr, uint8_t *irk)
Reset/reclaim an identity for reuse.
int bt_le_set_chan_map(uint8_t chan_map[5])
Set (LE) channel map.
int bt_le_per_adv_sync_get_info(struct bt_le_per_adv_sync *per_adv_sync, struct bt_le_per_adv_sync_info *info)
Get periodic adv sync information.
int bt_le_ext_adv_get_info(const struct bt_le_ext_adv *adv, struct bt_le_ext_adv_info *info)
Get advertising set info.
void bt_le_scan_cb_unregister(struct bt_le_scan_cb *cb)
Unregister scanner packet callbacks.
int bt_enable(bt_ready_cb_t cb)
Enable Bluetooth.
int bt_le_scan_start(const struct bt_le_scan_param *param, bt_le_scan_cb_t cb)
Start (LE) scanning.
int bt_le_filter_accept_list_clear(void)
Clear filter accept list.
int bt_set_name(const char *name)
Set Bluetooth Device Name.
int bt_le_per_adv_set_info_transfer(const struct bt_le_ext_adv *adv, const struct bt_conn *conn, uint16_t service_data)
Transfer the information about a periodic advertising set.
int bt_unpair(uint8_t id, const bt_addr_le_t *addr)
Clear pairing information.
int bt_le_ext_adv_create(const struct bt_le_adv_param *param, const struct bt_le_ext_adv_cb *cb, struct bt_le_ext_adv **adv)
Create advertising set.
int bt_le_adv_start(const struct bt_le_adv_param *param, const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len)
Start advertising.
int bt_br_set_discoverable(bool enable)
Enable/disable set controller in discoverable state.
int bt_le_ext_adv_set_data(struct bt_le_ext_adv *adv, const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len)
Set an advertising set's advertising or scan response data.
void bt_le_scan_cb_register(struct bt_le_scan_cb *cb)
Register scanner packet callbacks.
const char * bt_get_name(void)
Get Bluetooth Device Name.
int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_start_param *param)
Start advertising with the given advertising set.
int bt_id_create(bt_addr_le_t *addr, uint8_t *irk)
Create a new identity.
uint8_t bt_le_ext_adv_get_index(struct bt_le_ext_adv *adv)
Get array index of an advertising set.
int bt_set_appearance(uint16_t new_appearance)
Set local Bluetooth appearance.
int bt_id_delete(uint8_t id)
Delete an identity.
int bt_br_discovery_start(const struct bt_br_discovery_param *param, struct bt_br_discovery_result *results, size_t count, bt_br_discovery_cb_t cb)
Start BR/EDR discovery.
int bt_le_per_adv_sync_transfer(const struct bt_le_per_adv_sync *per_adv_sync, const struct bt_conn *conn, uint16_t service_data)
Transfer the periodic advertising sync information to a peer device.
int bt_le_per_adv_set_data(const struct bt_le_ext_adv *adv, const struct bt_data *ad, size_t ad_len)
Set or update the periodic advertising data.
@ BT_LE_SCAN_OPT_FILTER_DUPLICATE
Definition: bluetooth.h:1686
@ BT_LE_SCAN_OPT_CODED
Definition: bluetooth.h:1692
@ BT_LE_SCAN_OPT_NO_1M
Disable scan on 1M phy.
Definition: bluetooth.h:1699
@ BT_LE_SCAN_OPT_NONE
Definition: bluetooth.h:1683
@ BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST
Definition: bluetooth.h:1689
@ BT_LE_SCAN_TYPE_PASSIVE
Definition: bluetooth.h:1706
@ BT_LE_SCAN_TYPE_ACTIVE
Scan and request additional information from advertisers.
Definition: bluetooth.h:1715
@ BT_LE_ADV_OPT_FORCE_NAME_IN_AD
Put GAP device name into advert data.
Definition: bluetooth.h:582
@ BT_LE_ADV_OPT_NOTIFY_SCAN_REQ
Definition: bluetooth.h:490
@ BT_LE_ADV_OPT_ANONYMOUS
Advertise without a device address (identity or RPA).
Definition: bluetooth.h:556
@ BT_LE_ADV_OPT_CONNECTABLE
Advertise as connectable.
Definition: bluetooth.h:405
@ BT_LE_ADV_OPT_USE_NAME
Definition: bluetooth.h:455
@ BT_LE_ADV_OPT_USE_IDENTITY
Advertise using identity address.
Definition: bluetooth.h:433
@ BT_LE_ADV_OPT_ONE_TIME
Advertise one time.
Definition: bluetooth.h:421
@ BT_LE_ADV_OPT_FILTER_SCAN_REQ
Definition: bluetooth.h:482
@ BT_LE_ADV_OPT_DISABLE_CHAN_39
Definition: bluetooth.h:572
@ BT_LE_ADV_OPT_NONE
Definition: bluetooth.h:395
@ BT_LE_ADV_OPT_DISABLE_CHAN_37
Definition: bluetooth.h:566
@ BT_LE_ADV_OPT_DISABLE_CHAN_38
Definition: bluetooth.h:569
@ BT_LE_ADV_OPT_DIR_ADDR_RPA
Directed advertising to privacy-enabled peer.
Definition: bluetooth.h:477
@ BT_LE_ADV_OPT_CODED
Advertise on the LE Coded PHY (Long Range).
Definition: bluetooth.h:549
@ BT_LE_ADV_OPT_FILTER_CONN
Definition: bluetooth.h:485
@ BT_LE_ADV_OPT_EXT_ADV
Advertise with extended advertising.
Definition: bluetooth.h:521
@ BT_LE_ADV_OPT_SCANNABLE
Support scan response data.
Definition: bluetooth.h:501
@ BT_LE_ADV_OPT_NO_2M
Disable use of LE 2M PHY on the secondary advertising channel.
Definition: bluetooth.h:537
@ BT_LE_ADV_OPT_USE_TX_POWER
Advertise with transmit power.
Definition: bluetooth.h:563
@ BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY
Low duty cycle directed advertising.
Definition: bluetooth.h:463
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_2US
Definition: bluetooth.h:1363
@ BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT
Definition: bluetooth.h:1366
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_1US
Definition: bluetooth.h:1360
@ BT_LE_PER_ADV_SYNC_OPT_FILTER_DUPLICATE
Definition: bluetooth.h:1354
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA
Definition: bluetooth.h:1357
@ BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED
Disables periodic advertising reports.
Definition: bluetooth.h:1351
@ BT_LE_PER_ADV_SYNC_OPT_USE_PER_ADV_LIST
Use the periodic advertising list to sync with advertiser.
Definition: bluetooth.h:1344
@ BT_LE_PER_ADV_SYNC_OPT_NONE
Definition: bluetooth.h:1336
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOA
No Angle of Arrival (AoA)
Definition: bluetooth.h:1535
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_2US
No Angle of Departure (AoD) 2.
Definition: bluetooth.h:1551
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_1US
No Angle of Departure (AoD) 1 us.
Definition: bluetooth.h:1543
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_ONLY_CTE
Definition: bluetooth.h:1554
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_NONE
Definition: bluetooth.h:1528
@ BT_LE_PER_ADV_OPT_INCLUDE_ADI
Advertise with included AdvDataInfo (ADI).
Definition: bluetooth.h:671
@ BT_LE_PER_ADV_OPT_USE_TX_POWER
Advertise with transmit power.
Definition: bluetooth.h:664
@ BT_LE_PER_ADV_OPT_NONE
Definition: bluetooth.h:657
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
Buffer management.
struct _snode sys_snode_t
Definition: slist.h:33
#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
Definition: addr.h:48
Definition: addr.h:39
Definition: bluetooth.h:2279
bt_addr_le_t addr
Definition: bluetooth.h:2281
Definition: bluetooth.h:2181
uint8_t length
Definition: bluetooth.h:2185
bool limited
Definition: bluetooth.h:2188
BR/EDR discovery result structure.
Definition: bluetooth.h:2148
uint8_t eir[240]
Definition: bluetooth.h:2162
bt_addr_t addr
Definition: bluetooth.h:2153
int8_t rssi
Definition: bluetooth.h:2156
uint8_t cod[3]
Definition: bluetooth.h:2159
Definition: bluetooth.h:2223
bt_addr_t addr
Definition: bluetooth.h:2225
Bluetooth data.
Definition: bluetooth.h:356
uint8_t type
Definition: bluetooth.h:357
uint8_t data_len
Definition: bluetooth.h:358
const uint8_t * data
Definition: bluetooth.h:359
Definition: direction.h:113
Definition: iso.h:403
Definition: bluetooth.h:586
uint32_t options
Definition: bluetooth.h:615
const bt_addr_le_t * peer
Directed advertising to peer.
Definition: bluetooth.h:650
uint8_t sid
Advertising Set Identifier, valid range 0x00 - 0x0f.
Definition: bluetooth.h:602
uint8_t secondary_max_skip
Secondary channel maximum skip count.
Definition: bluetooth.h:612
uint32_t interval_min
Definition: bluetooth.h:624
uint8_t id
Local identity.
Definition: bluetooth.h:595
uint32_t interval_max
Definition: bluetooth.h:633
Definition: bluetooth.h:76
void(* scanned)(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_scanned_info *info)
The advertising set has sent scan response data.
Definition: bluetooth.h:113
void(* connected)(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_connected_info *info)
The advertising set has accepted a new connection.
Definition: bluetooth.h:100
void(* sent)(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_sent_info *info)
The advertising set has finished sending adv data.
Definition: bluetooth.h:88
Definition: bluetooth.h:66
struct bt_conn * conn
Definition: bluetooth.h:68
Advertising set info structure.
Definition: bluetooth.h:1091
uint8_t id
Definition: bluetooth.h:1093
int8_t tx_power
Definition: bluetooth.h:1096
Definition: bluetooth.h:71
bt_addr_le_t * addr
Definition: bluetooth.h:73
Definition: bluetooth.h:61
uint8_t num_sent
Definition: bluetooth.h:63
Definition: bluetooth.h:958
uint16_t timeout
Advertiser timeout (N * 10 ms).
Definition: bluetooth.h:972
uint8_t num_events
Number of advertising events.
Definition: bluetooth.h:979
Definition: bluetooth.h:2071
uint8_t c[16]
Definition: bluetooth.h:2076
uint8_t r[16]
Definition: bluetooth.h:2073
Definition: bluetooth.h:2080
bt_addr_le_t addr
Definition: bluetooth.h:2084
struct bt_le_oob_sc_data le_sc_data
Definition: bluetooth.h:2087
Definition: bluetooth.h:674
uint16_t interval_min
Minimum Periodic Advertising Interval (N * 1.25 ms)
Definition: bluetooth.h:681
uint16_t interval_max
Maximum Periodic Advertising Interval (N * 1.25 ms)
Definition: bluetooth.h:689
uint32_t options
Definition: bluetooth.h:692
Definition: bluetooth.h:1255
sys_snode_t node
Definition: bluetooth.h:1330
void(* recv)(struct bt_le_per_adv_sync *sync, const struct bt_le_per_adv_sync_recv_info *info, struct net_buf_simple *buf)
Periodic advertising data received.
Definition: bluetooth.h:1291
void(* state_changed)(struct bt_le_per_adv_sync *sync, const struct bt_le_per_adv_sync_state_info *info)
The periodic advertising sync state has changed.
Definition: bluetooth.h:1305
void(* synced)(struct bt_le_per_adv_sync *sync, struct bt_le_per_adv_sync_synced_info *info)
The periodic advertising has been successfully synced.
Definition: bluetooth.h:1266
void(* biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo)
BIGInfo advertising report received.
Definition: bluetooth.h:1318
void(* term)(struct bt_le_per_adv_sync *sync, const struct bt_le_per_adv_sync_term_info *info)
The periodic advertising sync has been terminated.
Definition: bluetooth.h:1278
void(* cte_report_cb)(struct bt_le_per_adv_sync *sync, struct bt_df_per_adv_sync_iq_samples_report const *info)
Callback for IQ samples report collected when sampling CTE received with periodic advertising PDU.
Definition: bluetooth.h:1327
Advertising set info structure.
Definition: bluetooth.h:1421
uint16_t interval
Definition: bluetooth.h:1429
uint8_t phy
Definition: bluetooth.h:1432
bt_addr_le_t addr
Definition: bluetooth.h:1423
uint8_t sid
Definition: bluetooth.h:1426
Definition: bluetooth.h:1369
uint16_t timeout
Synchronization timeout (N * 10 ms)
Definition: bluetooth.h:1404
uint32_t options
Definition: bluetooth.h:1387
uint8_t sid
Advertiser SID.
Definition: bluetooth.h:1384
bt_addr_le_t addr
Periodic Advertiser Address.
Definition: bluetooth.h:1376
uint16_t skip
Maximum event skip.
Definition: bluetooth.h:1396
Definition: bluetooth.h:1232
uint8_t cte_type
Definition: bluetooth.h:1246
uint8_t sid
Definition: bluetooth.h:1237
const bt_addr_le_t * addr
Definition: bluetooth.h:1234
int8_t tx_power
Definition: bluetooth.h:1240
int8_t rssi
Definition: bluetooth.h:1243
Definition: bluetooth.h:1250
bool recv_enabled
Definition: bluetooth.h:1252
Definition: bluetooth.h:1189
bool recv_enabled
Definition: bluetooth.h:1203
uint16_t interval
Definition: bluetooth.h:1197
uint8_t sid
Definition: bluetooth.h:1194
const bt_addr_le_t * addr
Definition: bluetooth.h:1191
uint8_t phy
Definition: bluetooth.h:1200
struct bt_conn * conn
Peer that transferred the periodic advertising sync.
Definition: bluetooth.h:1218
uint16_t service_data
Service Data provided by the peer when sync is transferred.
Definition: bluetooth.h:1210
Definition: bluetooth.h:1221
const bt_addr_le_t * addr
Definition: bluetooth.h:1223
uint8_t reason
Definition: bluetooth.h:1229
uint8_t sid
Definition: bluetooth.h:1226
Definition: bluetooth.h:1557
uint32_t options
Definition: bluetooth.h:1575
uint16_t timeout
Synchronization timeout (N * 10 ms)
Definition: bluetooth.h:1572
uint16_t skip
Maximum event skip.
Definition: bluetooth.h:1564
Definition: bluetooth.h:1809
void(* timeout)(void)
The scanner has stopped scanning after scan timeout.
Definition: bluetooth.h:1821
sys_snode_t node
Definition: bluetooth.h:1823
void(* recv)(const struct bt_le_scan_recv_info *info, struct net_buf_simple *buf)
Advertisement packet and scan response received callback.
Definition: bluetooth.h:1817
Definition: bluetooth.h:1719
uint8_t type
Definition: bluetooth.h:1721
uint16_t interval
Definition: bluetooth.h:1727
uint16_t window
Definition: bluetooth.h:1730
uint16_t timeout
Scan timeout (N * 10 ms)
Definition: bluetooth.h:1738
uint16_t interval_coded
Scan interval LE Coded PHY (N * 0.625 MS)
Definition: bluetooth.h:1745
uint16_t window_coded
Scan window LE Coded PHY (N * 0.625 MS)
Definition: bluetooth.h:1752
uint32_t options
Definition: bluetooth.h:1724
Definition: bluetooth.h:1756
uint16_t interval
Periodic advertising interval.
Definition: bluetooth.h:1799
int8_t tx_power
Definition: bluetooth.h:1772
uint8_t sid
Definition: bluetooth.h:1766
uint8_t primary_phy
Definition: bluetooth.h:1802
int8_t rssi
Definition: bluetooth.h:1769
const bt_addr_le_t * addr
Advertiser LE address and type.
Definition: bluetooth.h:1763
uint8_t secondary_phy
Definition: bluetooth.h:1805
uint8_t adv_type
Advertising packet type.
Definition: bluetooth.h:1782
uint16_t adv_props
Advertising packet properties bitfield.
Definition: bluetooth.h:1792
Simple network buffer representation.
Definition: buf.h:82
static fdata_t data[2]
Definition: test_fifo_contexts.c:15
static int results[3]
Definition: timeout_order.c:16
static const intptr_t user_data[5]
Definition: main.c:588
Misc utilities.