Zephyr Project API  3.3.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
1100};
1101
1110int bt_le_ext_adv_get_info(const struct bt_le_ext_adv *adv,
1111 struct bt_le_ext_adv_info *info);
1112
1126typedef void bt_le_scan_cb_t(const bt_addr_le_t *addr, int8_t rssi,
1127 uint8_t adv_type, struct net_buf_simple *buf);
1128
1141int bt_le_per_adv_set_param(struct bt_le_ext_adv *adv,
1142 const struct bt_le_per_adv_param *param);
1143
1157int bt_le_per_adv_set_data(const struct bt_le_ext_adv *adv,
1158 const struct bt_data *ad, size_t ad_len);
1159
1177int bt_le_per_adv_start(struct bt_le_ext_adv *adv);
1178
1190int bt_le_per_adv_stop(struct bt_le_ext_adv *adv);
1191
1195
1198
1201
1204
1207
1214
1221 struct bt_conn *conn;
1222};
1223
1227
1230
1233};
1234
1238
1241
1244
1247
1250};
1251
1252
1256};
1257
1269 void (*synced)(struct bt_le_per_adv_sync *sync,
1270 struct bt_le_per_adv_sync_synced_info *info);
1271
1281 void (*term)(struct bt_le_per_adv_sync *sync,
1282 const struct bt_le_per_adv_sync_term_info *info);
1283
1294 void (*recv)(struct bt_le_per_adv_sync *sync,
1295 const struct bt_le_per_adv_sync_recv_info *info,
1296 struct net_buf_simple *buf);
1297
1308 void (*state_changed)(struct bt_le_per_adv_sync *sync,
1309 const struct bt_le_per_adv_sync_state_info *info);
1310
1321 void (*biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo);
1322
1330 void (*cte_report_cb)(struct bt_le_per_adv_sync *sync,
1331 struct bt_df_per_adv_sync_iq_samples_report const *info);
1332
1334};
1335
1337enum {
1340
1348
1355
1358
1361
1364
1367
1370};
1371
1380
1388
1391
1400
1408};
1409
1421uint8_t bt_le_per_adv_sync_get_index(struct bt_le_per_adv_sync *per_adv_sync);
1422
1436
1441
1444
1447
1450};
1451
1460int bt_le_per_adv_sync_get_info(struct bt_le_per_adv_sync *per_adv_sync,
1461 struct bt_le_per_adv_sync_info *info);
1462
1471struct bt_le_per_adv_sync *bt_le_per_adv_sync_lookup_addr(const bt_addr_le_t *adv_addr,
1472 uint8_t sid);
1473
1487 struct bt_le_per_adv_sync **out_sync);
1488
1505int bt_le_per_adv_sync_delete(struct bt_le_per_adv_sync *per_adv_sync);
1506
1519
1529int bt_le_per_adv_sync_recv_enable(struct bt_le_per_adv_sync *per_adv_sync);
1530
1540int bt_le_per_adv_sync_recv_disable(struct bt_le_per_adv_sync *per_adv_sync);
1541
1543enum {
1546
1553
1561
1569
1572
1580
1588};
1589
1598
1606
1609};
1610
1623int bt_le_per_adv_sync_transfer(const struct bt_le_per_adv_sync *per_adv_sync,
1624 const struct bt_conn *conn,
1625 uint16_t service_data);
1626
1627
1640int bt_le_per_adv_set_info_transfer(const struct bt_le_ext_adv *adv,
1641 const struct bt_conn *conn,
1642 uint16_t service_data);
1643
1658 const struct bt_conn *conn,
1659 const struct bt_le_per_adv_sync_transfer_param *param);
1660
1674int bt_le_per_adv_sync_transfer_unsubscribe(const struct bt_conn *conn);
1675
1690
1703
1712
1713
1714enum {
1717
1720
1723
1726
1733};
1734
1735#define BT_LE_SCAN_OPT_FILTER_WHITELIST __DEPRECATED_MACRO BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST
1736
1737enum {
1740
1749};
1750
1755
1758
1761
1764
1772
1779
1786};
1787
1797
1800
1803
1806
1816
1826
1833
1836
1839};
1840
1843
1850 void (*recv)(const struct bt_le_scan_recv_info *info,
1851 struct net_buf_simple *buf);
1852
1854 void (*timeout)(void);
1855
1857};
1858
1868#define BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) \
1869{ \
1870 .type = (_type), \
1871 .options = (_options), \
1872 .interval = (_interval), \
1873 .window = (_window), \
1874 .timeout = 0, \
1875 .interval_coded = 0, \
1876 .window_coded = 0, \
1877}
1878
1888#define BT_LE_SCAN_PARAM(_type, _options, _interval, _window) \
1889 ((struct bt_le_scan_param[]) { \
1890 BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) \
1891 })
1892
1896#define BT_LE_SCAN_ACTIVE BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \
1897 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1898 BT_GAP_SCAN_FAST_INTERVAL, \
1899 BT_GAP_SCAN_FAST_WINDOW)
1900
1907#define BT_LE_SCAN_PASSIVE BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \
1908 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1909 BT_GAP_SCAN_FAST_INTERVAL, \
1910 BT_GAP_SCAN_FAST_WINDOW)
1911
1916#define BT_LE_SCAN_CODED_ACTIVE \
1917 BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \
1918 BT_LE_SCAN_OPT_CODED | \
1919 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1920 BT_GAP_SCAN_FAST_INTERVAL, \
1921 BT_GAP_SCAN_FAST_WINDOW)
1922
1930#define BT_LE_SCAN_CODED_PASSIVE \
1931 BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \
1932 BT_LE_SCAN_OPT_CODED | \
1933 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1934 BT_GAP_SCAN_FAST_INTERVAL, \
1935 BT_GAP_SCAN_FAST_WINDOW)
1936
1958
1968
1981
1990
2006__deprecated
2007static inline int bt_le_whitelist_add(const bt_addr_le_t *addr)
2008{
2009 return bt_le_filter_accept_list_add(addr);
2010}
2011
2027__deprecated
2028static inline int bt_le_whitelist_rem(const bt_addr_le_t *addr)
2029{
2031}
2032
2046__deprecated
2047static inline int bt_le_whitelist_clear(void)
2048{
2050}
2051
2061
2080int bt_le_set_rpa_timeout(uint16_t new_rpa_timeout);
2081
2100 bool (*func)(struct bt_data *data, void *user_data),
2101 void *user_data);
2102
2107
2110};
2111
2118
2121};
2122
2152
2177int bt_le_ext_adv_oob_get_local(struct bt_le_ext_adv *adv,
2178 struct bt_le_oob *oob);
2179
2183 uint8_t _priv[4];
2184
2187
2190
2193
2196};
2197
2211 size_t count);
2212
2219
2222};
2223
2242 struct bt_br_discovery_result *results, size_t count,
2244
2255
2259};
2260
2270
2271
2284int bt_br_set_discoverable(bool enable);
2285
2298int bt_br_set_connectable(bool enable);
2299
2309int bt_unpair(uint8_t id, const bt_addr_le_t *addr);
2310
2315};
2316
2324void bt_foreach_bond(uint8_t id, void (*func)(const struct bt_bond_info *info,
2325 void *user_data),
2326 void *user_data);
2327
2343 const uint8_t *vs_config);
2344
2349#ifdef __cplusplus
2350}
2351#endif
2356#endif /* ZEPHYR_INCLUDE_BLUETOOTH_BLUETOOTH_H_ */
Bluetooth device address definitions and utilities.
Bluetooth subsystem crypto APIs.
ZTEST_BMEM int index[(3)]
Definition: main.c:32
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:2028
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:2007
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:2047
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:2210
int bt_br_discovery_stop(void)
Stop BR/EDR discovery.
int bt_le_per_adv_list_clear(void)
Clear the periodic advertising list.
struct bt_le_per_adv_sync * bt_le_per_adv_sync_lookup_index(uint8_t index)
Get a periodic advertising sync object from the array index.
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:1126
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:1719
@ BT_LE_SCAN_OPT_CODED
Definition: bluetooth.h:1725
@ BT_LE_SCAN_OPT_NO_1M
Disable scan on 1M phy.
Definition: bluetooth.h:1732
@ BT_LE_SCAN_OPT_NONE
Definition: bluetooth.h:1716
@ BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST
Definition: bluetooth.h:1722
@ BT_LE_SCAN_TYPE_PASSIVE
Definition: bluetooth.h:1739
@ BT_LE_SCAN_TYPE_ACTIVE
Scan and request additional information from advertisers.
Definition: bluetooth.h:1748
@ 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:1366
@ BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT
Definition: bluetooth.h:1369
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_1US
Definition: bluetooth.h:1363
@ BT_LE_PER_ADV_SYNC_OPT_FILTER_DUPLICATE
Definition: bluetooth.h:1357
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA
Definition: bluetooth.h:1360
@ BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED
Disables periodic advertising reports.
Definition: bluetooth.h:1354
@ BT_LE_PER_ADV_SYNC_OPT_USE_PER_ADV_LIST
Use the periodic advertising list to sync with advertiser.
Definition: bluetooth.h:1347
@ BT_LE_PER_ADV_SYNC_OPT_NONE
Definition: bluetooth.h:1339
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOA
No Angle of Arrival (AoA)
Definition: bluetooth.h:1552
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_REPORTING_INITIALLY_DISABLED
Sync to received PAST packets but don't generate sync reports.
Definition: bluetooth.h:1579
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_2US
No Angle of Departure (AoD) 2.
Definition: bluetooth.h:1568
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_1US
No Angle of Departure (AoD) 1 us.
Definition: bluetooth.h:1560
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES
Sync to received PAST packets and generate sync reports with duplicate filtering.
Definition: bluetooth.h:1587
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_ONLY_CTE
Definition: bluetooth.h:1571
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_NONE
Definition: bluetooth.h:1545
@ 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:2312
bt_addr_le_t addr
Definition: bluetooth.h:2314
Definition: bluetooth.h:2214
uint8_t length
Definition: bluetooth.h:2218
bool limited
Definition: bluetooth.h:2221
BR/EDR discovery result structure.
Definition: bluetooth.h:2181
uint8_t eir[240]
Definition: bluetooth.h:2195
bt_addr_t addr
Definition: bluetooth.h:2186
int8_t rssi
Definition: bluetooth.h:2189
uint8_t cod[3]
Definition: bluetooth.h:2192
Definition: bluetooth.h:2256
bt_addr_t addr
Definition: bluetooth.h:2258
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:417
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
const bt_addr_le_t * addr
Definition: bluetooth.h:1099
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:2104
uint8_t c[16]
Definition: bluetooth.h:2109
uint8_t r[16]
Definition: bluetooth.h:2106
Definition: bluetooth.h:2113
bt_addr_le_t addr
Definition: bluetooth.h:2117
struct bt_le_oob_sc_data le_sc_data
Definition: bluetooth.h:2120
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:1258
sys_snode_t node
Definition: bluetooth.h:1333
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:1294
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:1308
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:1269
void(* biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo)
BIGInfo advertising report received.
Definition: bluetooth.h:1321
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:1281
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:1330
Advertising set info structure.
Definition: bluetooth.h:1438
uint16_t interval
Definition: bluetooth.h:1446
uint8_t phy
Definition: bluetooth.h:1449
bt_addr_le_t addr
Definition: bluetooth.h:1440
uint8_t sid
Definition: bluetooth.h:1443
Definition: bluetooth.h:1372
uint16_t timeout
Synchronization timeout (N * 10 ms)
Definition: bluetooth.h:1407
uint32_t options
Definition: bluetooth.h:1390
uint8_t sid
Advertiser SID.
Definition: bluetooth.h:1387
bt_addr_le_t addr
Periodic Advertiser Address.
Definition: bluetooth.h:1379
uint16_t skip
Maximum event skip.
Definition: bluetooth.h:1399
Definition: bluetooth.h:1235
uint8_t cte_type
Definition: bluetooth.h:1249
uint8_t sid
Definition: bluetooth.h:1240
const bt_addr_le_t * addr
Definition: bluetooth.h:1237
int8_t tx_power
Definition: bluetooth.h:1243
int8_t rssi
Definition: bluetooth.h:1246
Definition: bluetooth.h:1253
bool recv_enabled
Definition: bluetooth.h:1255
Definition: bluetooth.h:1192
bool recv_enabled
Definition: bluetooth.h:1206
uint16_t interval
Definition: bluetooth.h:1200
uint8_t sid
Definition: bluetooth.h:1197
const bt_addr_le_t * addr
Definition: bluetooth.h:1194
uint8_t phy
Definition: bluetooth.h:1203
struct bt_conn * conn
Peer that transferred the periodic advertising sync.
Definition: bluetooth.h:1221
uint16_t service_data
Service Data provided by the peer when sync is transferred.
Definition: bluetooth.h:1213
Definition: bluetooth.h:1224
const bt_addr_le_t * addr
Definition: bluetooth.h:1226
uint8_t reason
Definition: bluetooth.h:1232
uint8_t sid
Definition: bluetooth.h:1229
Definition: bluetooth.h:1590
uint32_t options
Definition: bluetooth.h:1608
uint16_t timeout
Synchronization timeout (N * 10 ms)
Definition: bluetooth.h:1605
uint16_t skip
Maximum event skip.
Definition: bluetooth.h:1597
Definition: bluetooth.h:1842
void(* timeout)(void)
The scanner has stopped scanning after scan timeout.
Definition: bluetooth.h:1854
sys_snode_t node
Definition: bluetooth.h:1856
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:1850
Definition: bluetooth.h:1752
uint8_t type
Definition: bluetooth.h:1754
uint16_t interval
Definition: bluetooth.h:1760
uint16_t window
Definition: bluetooth.h:1763
uint16_t timeout
Scan timeout (N * 10 ms)
Definition: bluetooth.h:1771
uint16_t interval_coded
Scan interval LE Coded PHY (N * 0.625 MS)
Definition: bluetooth.h:1778
uint16_t window_coded
Scan window LE Coded PHY (N * 0.625 MS)
Definition: bluetooth.h:1785
uint32_t options
Definition: bluetooth.h:1757
Definition: bluetooth.h:1789
uint16_t interval
Periodic advertising interval.
Definition: bluetooth.h:1832
int8_t tx_power
Definition: bluetooth.h:1805
uint8_t sid
Definition: bluetooth.h:1799
uint8_t primary_phy
Definition: bluetooth.h:1835
int8_t rssi
Definition: bluetooth.h:1802
const bt_addr_le_t * addr
Advertiser LE address and type.
Definition: bluetooth.h:1796
uint8_t secondary_phy
Definition: bluetooth.h:1838
uint8_t adv_type
Advertising packet type.
Definition: bluetooth.h:1815
uint16_t adv_props
Advertising packet properties bitfield.
Definition: bluetooth.h:1825
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.