Zephyr Project API  3.4.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
21#include <stdbool.h>
22#include <string.h>
23
24#include <zephyr/sys/util.h>
25#include <zephyr/net/buf.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
46#define BT_ID_DEFAULT 0
47
49struct bt_le_ext_adv;
50
52struct bt_le_per_adv_sync;
53
54/* Don't require everyone to include conn.h */
55struct bt_conn;
56
57/* Don't require everyone to include iso.h */
58struct bt_iso_biginfo;
59
60/* Don't require everyone to include direction.h */
62
66};
67
70 struct bt_conn *conn;
71};
72
76};
77
81
84};
85
89
97
100
103
106
109};
110
123 void (*sent)(struct bt_le_ext_adv *adv,
124 struct bt_le_ext_adv_sent_info *info);
125
135 void (*connected)(struct bt_le_ext_adv *adv,
136 struct bt_le_ext_adv_connected_info *info);
137
148 void (*scanned)(struct bt_le_ext_adv *adv,
149 struct bt_le_ext_adv_scanned_info *info);
150
151#if defined(CONFIG_BT_PRIVACY)
164 bool (*rpa_expired)(struct bt_le_ext_adv *adv);
165#endif /* defined(CONFIG_BT_PRIVACY) */
166
167#if defined(CONFIG_BT_PER_ADV_RSP)
177 void (*pawr_data_request)(struct bt_le_ext_adv *adv,
178 const struct bt_le_per_adv_data_request *request);
188 void (*pawr_response)(struct bt_le_ext_adv *adv, struct bt_le_per_adv_response_info *info,
189 struct net_buf_simple *buf);
190
191#endif /* defined(CONFIG_BT_PER_ADV_RSP) */
192};
193
200typedef void (*bt_ready_cb_t)(int err);
201
222
232int bt_disable(void);
233
239bool bt_is_ready(void);
240
258int bt_set_name(const char *name);
259
267const char *bt_get_name(void);
268
280
295int bt_set_appearance(uint16_t new_appearance);
296
317void bt_id_get(bt_addr_le_t *addrs, size_t *count);
318
360
394
412
424#define BT_DATA_SERIALIZED_SIZE(data_len) ((data_len) + 2)
425
433struct bt_data {
436 const uint8_t *data;
437};
438
449#define BT_DATA(_type, _data, _data_len) \
450 { \
451 .type = (_type), \
452 .data_len = (_data_len), \
453 .data = (const uint8_t *)(_data), \
454 }
455
465#define BT_DATA_BYTES(_type, _bytes...) \
466 BT_DATA(_type, ((uint8_t []) { _bytes }), \
467 sizeof((uint8_t []) { _bytes }))
468
479size_t bt_data_get_len(const struct bt_data data[], size_t data_count);
480
495size_t bt_data_serialize(const struct bt_data *input, uint8_t *output);
496
498enum {
501
511
527
539
561
569
583
588
591
596
607
627
643
655
662
669
672
675
678
688};
689
701
708
718
721
730
739
756};
757
758
760enum {
763
770
777};
778
787
795
798
799#if defined(CONFIG_BT_PER_ADV_RSP)
805 uint8_t num_subevents;
806
812 uint8_t subevent_interval;
813
819 uint8_t response_slot_delay;
820
826 uint8_t response_slot_spacing;
827
833 uint8_t num_response_slots;
834#endif /* CONFIG_BT_PER_ADV_RSP */
835};
836
846#define BT_LE_ADV_PARAM_INIT(_options, _int_min, _int_max, _peer) \
847{ \
848 .id = BT_ID_DEFAULT, \
849 .sid = 0, \
850 .secondary_max_skip = 0, \
851 .options = (_options), \
852 .interval_min = (_int_min), \
853 .interval_max = (_int_max), \
854 .peer = (_peer), \
855}
856
866#define BT_LE_ADV_PARAM(_options, _int_min, _int_max, _peer) \
867 ((struct bt_le_adv_param[]) { \
868 BT_LE_ADV_PARAM_INIT(_options, _int_min, _int_max, _peer) \
869 })
870
871#define BT_LE_ADV_CONN_DIR(_peer) BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \
872 BT_LE_ADV_OPT_ONE_TIME, 0, 0,\
873 _peer)
874
875
876#define BT_LE_ADV_CONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, \
877 BT_GAP_ADV_FAST_INT_MIN_2, \
878 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
879
880#define BT_LE_ADV_CONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \
881 BT_LE_ADV_OPT_USE_NAME, \
882 BT_GAP_ADV_FAST_INT_MIN_2, \
883 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
884
885#define BT_LE_ADV_CONN_NAME_AD BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \
886 BT_LE_ADV_OPT_USE_NAME | \
887 BT_LE_ADV_OPT_FORCE_NAME_IN_AD, \
888 BT_GAP_ADV_FAST_INT_MIN_2, \
889 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
890
891#define BT_LE_ADV_CONN_DIR_LOW_DUTY(_peer) \
892 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | \
893 BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY, \
894 BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, \
895 _peer)
896
898#define BT_LE_ADV_NCONN BT_LE_ADV_PARAM(0, BT_GAP_ADV_FAST_INT_MIN_2, \
899 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
900
902#define BT_LE_ADV_NCONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_USE_NAME, \
903 BT_GAP_ADV_FAST_INT_MIN_2, \
904 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
905
907#define BT_LE_ADV_NCONN_IDENTITY BT_LE_ADV_PARAM(BT_LE_ADV_OPT_USE_IDENTITY, \
908 BT_GAP_ADV_FAST_INT_MIN_2, \
909 BT_GAP_ADV_FAST_INT_MAX_2, \
910 NULL)
911
913#define BT_LE_EXT_ADV_CONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
914 BT_LE_ADV_OPT_CONNECTABLE | \
915 BT_LE_ADV_OPT_USE_NAME, \
916 BT_GAP_ADV_FAST_INT_MIN_2, \
917 BT_GAP_ADV_FAST_INT_MAX_2, \
918 NULL)
919
921#define BT_LE_EXT_ADV_SCAN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
922 BT_LE_ADV_OPT_SCANNABLE | \
923 BT_LE_ADV_OPT_USE_NAME, \
924 BT_GAP_ADV_FAST_INT_MIN_2, \
925 BT_GAP_ADV_FAST_INT_MAX_2, \
926 NULL)
927
929#define BT_LE_EXT_ADV_NCONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, \
930 BT_GAP_ADV_FAST_INT_MIN_2, \
931 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
932
934#define BT_LE_EXT_ADV_NCONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
935 BT_LE_ADV_OPT_USE_NAME, \
936 BT_GAP_ADV_FAST_INT_MIN_2, \
937 BT_GAP_ADV_FAST_INT_MAX_2, \
938 NULL)
939
941#define BT_LE_EXT_ADV_NCONN_IDENTITY \
942 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
943 BT_LE_ADV_OPT_USE_IDENTITY, \
944 BT_GAP_ADV_FAST_INT_MIN_2, \
945 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
946
948#define BT_LE_EXT_ADV_CODED_NCONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
949 BT_LE_ADV_OPT_CODED, \
950 BT_GAP_ADV_FAST_INT_MIN_2, \
951 BT_GAP_ADV_FAST_INT_MAX_2, \
952 NULL)
953
957#define BT_LE_EXT_ADV_CODED_NCONN_NAME \
958 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CODED | \
959 BT_LE_ADV_OPT_USE_NAME, \
960 BT_GAP_ADV_FAST_INT_MIN_2, \
961 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
962
966#define BT_LE_EXT_ADV_CODED_NCONN_IDENTITY \
967 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CODED | \
968 BT_LE_ADV_OPT_USE_IDENTITY, \
969 BT_GAP_ADV_FAST_INT_MIN_2, \
970 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
971
978#define BT_LE_EXT_ADV_START_PARAM_INIT(_timeout, _n_evts) \
979{ \
980 .timeout = (_timeout), \
981 .num_events = (_n_evts), \
982}
983
990#define BT_LE_EXT_ADV_START_PARAM(_timeout, _n_evts) \
991 ((struct bt_le_ext_adv_start_param[]) { \
992 BT_LE_EXT_ADV_START_PARAM_INIT((_timeout), (_n_evts)) \
993 })
994
995#define BT_LE_EXT_ADV_START_DEFAULT BT_LE_EXT_ADV_START_PARAM(0, 0)
996
1004#define BT_LE_PER_ADV_PARAM_INIT(_int_min, _int_max, _options) \
1005{ \
1006 .interval_min = (_int_min), \
1007 .interval_max = (_int_max), \
1008 .options = (_options), \
1009}
1010
1018#define BT_LE_PER_ADV_PARAM(_int_min, _int_max, _options) \
1019 ((struct bt_le_per_adv_param[]) { \
1020 BT_LE_PER_ADV_PARAM_INIT(_int_min, _int_max, _options) \
1021 })
1022
1023#define BT_LE_PER_ADV_DEFAULT BT_LE_PER_ADV_PARAM(BT_GAP_PER_ADV_SLOW_INT_MIN, \
1024 BT_GAP_PER_ADV_SLOW_INT_MAX, \
1025 BT_LE_PER_ADV_OPT_NONE)
1026
1054int bt_le_adv_start(const struct bt_le_adv_param *param,
1055 const struct bt_data *ad, size_t ad_len,
1056 const struct bt_data *sd, size_t sd_len);
1057
1070int bt_le_adv_update_data(const struct bt_data *ad, size_t ad_len,
1071 const struct bt_data *sd, size_t sd_len);
1072
1081
1097 const struct bt_le_ext_adv_cb *cb,
1098 struct bt_le_ext_adv **adv);
1099
1122};
1123
1137int bt_le_ext_adv_start(struct bt_le_ext_adv *adv,
1138 struct bt_le_ext_adv_start_param *param);
1139
1150int bt_le_ext_adv_stop(struct bt_le_ext_adv *adv);
1151
1186int bt_le_ext_adv_set_data(struct bt_le_ext_adv *adv,
1187 const struct bt_data *ad, size_t ad_len,
1188 const struct bt_data *sd, size_t sd_len);
1189
1206int bt_le_ext_adv_update_param(struct bt_le_ext_adv *adv,
1207 const struct bt_le_adv_param *param);
1208
1217int bt_le_ext_adv_delete(struct bt_le_ext_adv *adv);
1218
1230uint8_t bt_le_ext_adv_get_index(struct bt_le_ext_adv *adv);
1231
1234 /* Local identity */
1236
1239
1242};
1243
1252int bt_le_ext_adv_get_info(const struct bt_le_ext_adv *adv,
1253 struct bt_le_ext_adv_info *info);
1254
1268typedef void bt_le_scan_cb_t(const bt_addr_le_t *addr, int8_t rssi,
1269 uint8_t adv_type, struct net_buf_simple *buf);
1270
1283int bt_le_per_adv_set_param(struct bt_le_ext_adv *adv,
1284 const struct bt_le_per_adv_param *param);
1285
1299int bt_le_per_adv_set_data(const struct bt_le_ext_adv *adv,
1300 const struct bt_data *ad, size_t ad_len);
1301
1305
1308
1311
1313 const struct net_buf_simple *data;
1314};
1315
1331int bt_le_per_adv_set_subevent_data(const struct bt_le_ext_adv *adv, uint8_t num_subevents,
1332 const struct bt_le_per_adv_subevent_data_params *params);
1333
1351int bt_le_per_adv_start(struct bt_le_ext_adv *adv);
1352
1364int bt_le_per_adv_stop(struct bt_le_ext_adv *adv);
1365
1369
1372
1375
1378
1381
1388
1395 struct bt_conn *conn;
1396#if defined(CONFIG_BT_PER_ADV_SYNC_RSP)
1398 uint8_t num_subevents;
1399
1401 uint8_t subevent_interval;
1402
1404 uint8_t response_slot_delay;
1405
1407 uint8_t response_slot_spacing;
1408
1409#endif /* CONFIG_BT_PER_ADV_SYNC_RSP */
1410};
1411
1415
1418
1421};
1422
1426
1429
1432
1435
1438#if defined(CONFIG_BT_PER_ADV_SYNC_RSP)
1440 uint16_t periodic_event_counter;
1441
1443 uint8_t subevent;
1444#endif /* CONFIG_BT_PER_ADV_SYNC_RSP */
1445};
1446
1447
1451};
1452
1464 void (*synced)(struct bt_le_per_adv_sync *sync,
1465 struct bt_le_per_adv_sync_synced_info *info);
1466
1476 void (*term)(struct bt_le_per_adv_sync *sync,
1477 const struct bt_le_per_adv_sync_term_info *info);
1478
1492 void (*recv)(struct bt_le_per_adv_sync *sync,
1493 const struct bt_le_per_adv_sync_recv_info *info,
1494 struct net_buf_simple *buf);
1495
1506 void (*state_changed)(struct bt_le_per_adv_sync *sync,
1507 const struct bt_le_per_adv_sync_state_info *info);
1508
1519 void (*biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo);
1520
1528 void (*cte_report_cb)(struct bt_le_per_adv_sync *sync,
1529 struct bt_df_per_adv_sync_iq_samples_report const *info);
1530
1532};
1533
1535enum {
1538
1546
1553
1556
1559
1562
1565
1568};
1569
1578
1586
1589
1598
1606};
1607
1619uint8_t bt_le_per_adv_sync_get_index(struct bt_le_per_adv_sync *per_adv_sync);
1620
1634
1639
1642
1645
1648};
1649
1658int bt_le_per_adv_sync_get_info(struct bt_le_per_adv_sync *per_adv_sync,
1659 struct bt_le_per_adv_sync_info *info);
1660
1669struct bt_le_per_adv_sync *bt_le_per_adv_sync_lookup_addr(const bt_addr_le_t *adv_addr,
1670 uint8_t sid);
1671
1685 struct bt_le_per_adv_sync **out_sync);
1686
1703int bt_le_per_adv_sync_delete(struct bt_le_per_adv_sync *per_adv_sync);
1704
1717
1727int bt_le_per_adv_sync_recv_enable(struct bt_le_per_adv_sync *per_adv_sync);
1728
1738int bt_le_per_adv_sync_recv_disable(struct bt_le_per_adv_sync *per_adv_sync);
1739
1741enum {
1744
1751
1759
1767
1770
1778
1786};
1787
1796
1804
1807};
1808
1821int bt_le_per_adv_sync_transfer(const struct bt_le_per_adv_sync *per_adv_sync,
1822 const struct bt_conn *conn,
1823 uint16_t service_data);
1824
1825
1838int bt_le_per_adv_set_info_transfer(const struct bt_le_ext_adv *adv,
1839 const struct bt_conn *conn,
1840 uint16_t service_data);
1841
1856 const struct bt_conn *conn,
1857 const struct bt_le_per_adv_sync_transfer_param *param);
1858
1872int bt_le_per_adv_sync_transfer_unsubscribe(const struct bt_conn *conn);
1873
1888
1901
1910
1911
1912enum {
1915
1918
1921
1924
1931};
1932
1933#define BT_LE_SCAN_OPT_FILTER_WHITELIST __DEPRECATED_MACRO BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST
1934
1935enum {
1938
1947};
1948
1953
1956
1959
1962
1970
1977
1984};
1985
1995
1998
2001
2004
2014
2024
2031
2034
2037};
2038
2041
2048 void (*recv)(const struct bt_le_scan_recv_info *info,
2049 struct net_buf_simple *buf);
2050
2052 void (*timeout)(void);
2053
2055};
2056
2066#define BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) \
2067{ \
2068 .type = (_type), \
2069 .options = (_options), \
2070 .interval = (_interval), \
2071 .window = (_window), \
2072 .timeout = 0, \
2073 .interval_coded = 0, \
2074 .window_coded = 0, \
2075}
2076
2086#define BT_LE_SCAN_PARAM(_type, _options, _interval, _window) \
2087 ((struct bt_le_scan_param[]) { \
2088 BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) \
2089 })
2090
2094#define BT_LE_SCAN_ACTIVE BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \
2095 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
2096 BT_GAP_SCAN_FAST_INTERVAL, \
2097 BT_GAP_SCAN_FAST_WINDOW)
2098
2105#define BT_LE_SCAN_PASSIVE BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \
2106 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
2107 BT_GAP_SCAN_FAST_INTERVAL, \
2108 BT_GAP_SCAN_FAST_WINDOW)
2109
2114#define BT_LE_SCAN_CODED_ACTIVE \
2115 BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \
2116 BT_LE_SCAN_OPT_CODED | \
2117 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
2118 BT_GAP_SCAN_FAST_INTERVAL, \
2119 BT_GAP_SCAN_FAST_WINDOW)
2120
2128#define BT_LE_SCAN_CODED_PASSIVE \
2129 BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \
2130 BT_LE_SCAN_OPT_CODED | \
2131 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
2132 BT_GAP_SCAN_FAST_INTERVAL, \
2133 BT_GAP_SCAN_FAST_WINDOW)
2134
2156
2166
2179
2188
2204__deprecated
2205static inline int bt_le_whitelist_add(const bt_addr_le_t *addr)
2206{
2207 return bt_le_filter_accept_list_add(addr);
2208}
2209
2225__deprecated
2226static inline int bt_le_whitelist_rem(const bt_addr_le_t *addr)
2227{
2229}
2230
2244__deprecated
2245static inline int bt_le_whitelist_clear(void)
2246{
2248}
2249
2259
2278int bt_le_set_rpa_timeout(uint16_t new_rpa_timeout);
2279
2298 bool (*func)(struct bt_data *data, void *user_data),
2299 void *user_data);
2300
2305
2308};
2309
2316
2319};
2320
2350
2375int bt_le_ext_adv_oob_get_local(struct bt_le_ext_adv *adv,
2376 struct bt_le_oob *oob);
2377
2381 uint8_t _priv[4];
2382
2385
2388
2391
2394};
2395
2409 size_t count);
2410
2417
2420};
2421
2440 struct bt_br_discovery_result *results, size_t count,
2442
2453
2457};
2458
2468
2469
2482int bt_br_set_discoverable(bool enable);
2483
2496int bt_br_set_connectable(bool enable);
2497
2507int bt_unpair(uint8_t id, const bt_addr_le_t *addr);
2508
2513};
2514
2522void bt_foreach_bond(uint8_t id, void (*func)(const struct bt_bond_info *info,
2523 void *user_data),
2524 void *user_data);
2525
2541 const uint8_t *vs_config);
2542
2550
2553
2560};
2561
2572int bt_le_per_adv_sync_subevent(struct bt_le_per_adv_sync *per_adv_sync,
2573 struct bt_le_per_adv_sync_subevent_params *params);
2574
2585
2592
2595
2598};
2599
2612int bt_le_per_adv_set_response_data(struct bt_le_per_adv_sync *per_adv_sync,
2613 const struct bt_le_per_adv_response_params *params,
2614 const struct net_buf_simple *data);
2615
2620#ifdef __cplusplus
2621}
2622#endif
2627#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:2226
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:2205
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:2245
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.
size_t bt_data_serialize(const struct bt_data *input, uint8_t *output)
Serialize a bt_data struct into an advertising structure (a flat byte array).
size_t bt_data_get_len(const struct bt_data data[], size_t data_count)
Get the total size (in bytes) of a given set of bt_data structures.
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:2408
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:200
int bt_le_per_adv_sync_subevent(struct bt_le_per_adv_sync *per_adv_sync, struct bt_le_per_adv_sync_subevent_params *params)
Synchronize with a subset of subevents.
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_le_per_adv_set_subevent_data(const struct bt_le_ext_adv *adv, uint8_t num_subevents, const struct bt_le_per_adv_subevent_data_params *params)
Set the periodic advertising with response subevent data.
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:1268
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_le_per_adv_set_response_data(struct bt_le_per_adv_sync *per_adv_sync, const struct bt_le_per_adv_response_params *params, const struct net_buf_simple *data)
Set the data for a response slot in a specific subevent of the PAwR.
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:1917
@ BT_LE_SCAN_OPT_CODED
Definition: bluetooth.h:1923
@ BT_LE_SCAN_OPT_NO_1M
Disable scan on 1M phy.
Definition: bluetooth.h:1930
@ BT_LE_SCAN_OPT_NONE
Definition: bluetooth.h:1914
@ BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST
Definition: bluetooth.h:1920
@ BT_LE_SCAN_TYPE_PASSIVE
Definition: bluetooth.h:1937
@ BT_LE_SCAN_TYPE_ACTIVE
Scan and request additional information from advertisers.
Definition: bluetooth.h:1946
@ BT_LE_ADV_OPT_FORCE_NAME_IN_AD
Put GAP device name into advert data.
Definition: bluetooth.h:687
@ BT_LE_ADV_OPT_NOTIFY_SCAN_REQ
Definition: bluetooth.h:595
@ BT_LE_ADV_OPT_ANONYMOUS
Advertise without a device address (identity or RPA).
Definition: bluetooth.h:661
@ BT_LE_ADV_OPT_CONNECTABLE
Advertise as connectable.
Definition: bluetooth.h:510
@ BT_LE_ADV_OPT_USE_NAME
Definition: bluetooth.h:560
@ BT_LE_ADV_OPT_USE_IDENTITY
Advertise using identity address.
Definition: bluetooth.h:538
@ BT_LE_ADV_OPT_ONE_TIME
Advertise one time.
Definition: bluetooth.h:526
@ BT_LE_ADV_OPT_FILTER_SCAN_REQ
Definition: bluetooth.h:587
@ BT_LE_ADV_OPT_DISABLE_CHAN_39
Definition: bluetooth.h:677
@ BT_LE_ADV_OPT_NONE
Definition: bluetooth.h:500
@ BT_LE_ADV_OPT_DISABLE_CHAN_37
Definition: bluetooth.h:671
@ BT_LE_ADV_OPT_DISABLE_CHAN_38
Definition: bluetooth.h:674
@ BT_LE_ADV_OPT_DIR_ADDR_RPA
Directed advertising to privacy-enabled peer.
Definition: bluetooth.h:582
@ BT_LE_ADV_OPT_CODED
Advertise on the LE Coded PHY (Long Range).
Definition: bluetooth.h:654
@ BT_LE_ADV_OPT_FILTER_CONN
Definition: bluetooth.h:590
@ BT_LE_ADV_OPT_EXT_ADV
Advertise with extended advertising.
Definition: bluetooth.h:626
@ BT_LE_ADV_OPT_SCANNABLE
Support scan response data.
Definition: bluetooth.h:606
@ BT_LE_ADV_OPT_NO_2M
Disable use of LE 2M PHY on the secondary advertising channel.
Definition: bluetooth.h:642
@ BT_LE_ADV_OPT_USE_TX_POWER
Advertise with transmit power.
Definition: bluetooth.h:668
@ BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY
Low duty cycle directed advertising.
Definition: bluetooth.h:568
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_2US
Definition: bluetooth.h:1564
@ BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT
Definition: bluetooth.h:1567
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_1US
Definition: bluetooth.h:1561
@ BT_LE_PER_ADV_SYNC_OPT_FILTER_DUPLICATE
Definition: bluetooth.h:1555
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA
Definition: bluetooth.h:1558
@ BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED
Disables periodic advertising reports.
Definition: bluetooth.h:1552
@ BT_LE_PER_ADV_SYNC_OPT_USE_PER_ADV_LIST
Use the periodic advertising list to sync with advertiser.
Definition: bluetooth.h:1545
@ BT_LE_PER_ADV_SYNC_OPT_NONE
Definition: bluetooth.h:1537
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOA
No Angle of Arrival (AoA)
Definition: bluetooth.h:1750
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_REPORTING_INITIALLY_DISABLED
Sync to received PAST packets but don't generate sync reports.
Definition: bluetooth.h:1777
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_2US
No Angle of Departure (AoD) 2.
Definition: bluetooth.h:1766
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_1US
No Angle of Departure (AoD) 1 us.
Definition: bluetooth.h:1758
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES
Sync to received PAST packets and generate sync reports with duplicate filtering.
Definition: bluetooth.h:1785
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_ONLY_CTE
Definition: bluetooth.h:1769
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_NONE
Definition: bluetooth.h:1743
@ BT_LE_PER_ADV_OPT_INCLUDE_ADI
Advertise with included AdvDataInfo (ADI).
Definition: bluetooth.h:776
@ BT_LE_PER_ADV_OPT_USE_TX_POWER
Advertise with transmit power.
Definition: bluetooth.h:769
@ BT_LE_PER_ADV_OPT_NONE
Definition: bluetooth.h:762
#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:49
Definition: addr.h:40
Definition: bluetooth.h:2510
bt_addr_le_t addr
Definition: bluetooth.h:2512
Definition: bluetooth.h:2412
uint8_t length
Definition: bluetooth.h:2416
bool limited
Definition: bluetooth.h:2419
BR/EDR discovery result structure.
Definition: bluetooth.h:2379
uint8_t eir[240]
Definition: bluetooth.h:2393
bt_addr_t addr
Definition: bluetooth.h:2384
int8_t rssi
Definition: bluetooth.h:2387
uint8_t cod[3]
Definition: bluetooth.h:2390
Definition: bluetooth.h:2454
bt_addr_t addr
Definition: bluetooth.h:2456
Bluetooth data.
Definition: bluetooth.h:433
uint8_t type
Definition: bluetooth.h:434
uint8_t data_len
Definition: bluetooth.h:435
const uint8_t * data
Definition: bluetooth.h:436
Definition: direction.h:115
Definition: iso.h:417
Definition: bluetooth.h:691
uint32_t options
Definition: bluetooth.h:720
const bt_addr_le_t * peer
Directed advertising to peer.
Definition: bluetooth.h:755
uint8_t sid
Advertising Set Identifier, valid range 0x00 - 0x0f.
Definition: bluetooth.h:707
uint8_t secondary_max_skip
Secondary channel maximum skip count.
Definition: bluetooth.h:717
uint32_t interval_min
Definition: bluetooth.h:729
uint8_t id
Local identity.
Definition: bluetooth.h:700
uint32_t interval_max
Definition: bluetooth.h:738
Definition: bluetooth.h:111
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:148
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:135
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:123
Definition: bluetooth.h:68
struct bt_conn * conn
Definition: bluetooth.h:70
Advertising set info structure.
Definition: bluetooth.h:1233
uint8_t id
Definition: bluetooth.h:1235
const bt_addr_le_t * addr
Definition: bluetooth.h:1241
int8_t tx_power
Definition: bluetooth.h:1238
Definition: bluetooth.h:73
bt_addr_le_t * addr
Definition: bluetooth.h:75
Definition: bluetooth.h:63
uint8_t num_sent
Definition: bluetooth.h:65
Definition: bluetooth.h:1100
uint16_t timeout
Advertiser timeout (N * 10 ms).
Definition: bluetooth.h:1114
uint8_t num_events
Number of advertising events.
Definition: bluetooth.h:1121
Definition: bluetooth.h:2302
uint8_t c[16]
Definition: bluetooth.h:2307
uint8_t r[16]
Definition: bluetooth.h:2304
Definition: bluetooth.h:2311
bt_addr_le_t addr
Definition: bluetooth.h:2315
struct bt_le_oob_sc_data le_sc_data
Definition: bluetooth.h:2318
Definition: bluetooth.h:78
uint8_t count
Definition: bluetooth.h:83
uint8_t start
Definition: bluetooth.h:80
Definition: bluetooth.h:779
uint16_t interval_min
Minimum Periodic Advertising Interval (N * 1.25 ms)
Definition: bluetooth.h:786
uint16_t interval_max
Maximum Periodic Advertising Interval (N * 1.25 ms)
Definition: bluetooth.h:794
uint32_t options
Definition: bluetooth.h:797
Definition: bluetooth.h:86
uint8_t subevent
Definition: bluetooth.h:88
int8_t rssi
Definition: bluetooth.h:102
uint8_t cte_type
Definition: bluetooth.h:105
int8_t tx_power
Definition: bluetooth.h:99
uint8_t response_slot
Definition: bluetooth.h:108
uint8_t tx_status
Status of the subevent indication.
Definition: bluetooth.h:96
Definition: bluetooth.h:2575
uint8_t response_subevent
Definition: bluetooth.h:2594
uint16_t request_event
The periodic event counter of the request the response is sent to.
Definition: bluetooth.h:2584
uint8_t request_subevent
The subevent counter of the request the response is sent to.
Definition: bluetooth.h:2591
uint8_t response_slot
Definition: bluetooth.h:2597
Definition: bluetooth.h:1302
uint8_t response_slot_start
Definition: bluetooth.h:1307
const struct net_buf_simple * data
Definition: bluetooth.h:1313
uint8_t subevent
Definition: bluetooth.h:1304
uint8_t response_slot_count
Definition: bluetooth.h:1310
Definition: bluetooth.h:1453
sys_snode_t node
Definition: bluetooth.h:1531
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:1492
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:1506
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:1464
void(* biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo)
BIGInfo advertising report received.
Definition: bluetooth.h:1519
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:1476
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:1528
Advertising set info structure.
Definition: bluetooth.h:1636
uint16_t interval
Definition: bluetooth.h:1644
uint8_t phy
Definition: bluetooth.h:1647
bt_addr_le_t addr
Definition: bluetooth.h:1638
uint8_t sid
Definition: bluetooth.h:1641
Definition: bluetooth.h:1570
uint16_t timeout
Synchronization timeout (N * 10 ms)
Definition: bluetooth.h:1605
uint32_t options
Definition: bluetooth.h:1588
uint8_t sid
Advertiser SID.
Definition: bluetooth.h:1585
bt_addr_le_t addr
Periodic Advertiser Address.
Definition: bluetooth.h:1577
uint16_t skip
Maximum event skip.
Definition: bluetooth.h:1597
Definition: bluetooth.h:1423
uint8_t cte_type
Definition: bluetooth.h:1437
uint8_t sid
Definition: bluetooth.h:1428
const bt_addr_le_t * addr
Definition: bluetooth.h:1425
int8_t tx_power
Definition: bluetooth.h:1431
int8_t rssi
Definition: bluetooth.h:1434
Definition: bluetooth.h:1448
bool recv_enabled
Definition: bluetooth.h:1450
Definition: bluetooth.h:2543
uint8_t * subevents
The subevent(s) to synchronize with.
Definition: bluetooth.h:2559
uint16_t properties
Periodic Advertising Properties.
Definition: bluetooth.h:2549
uint8_t num_subevents
Definition: bluetooth.h:2552
Definition: bluetooth.h:1366
bool recv_enabled
Definition: bluetooth.h:1380
uint16_t interval
Definition: bluetooth.h:1374
uint8_t sid
Definition: bluetooth.h:1371
const bt_addr_le_t * addr
Definition: bluetooth.h:1368
uint8_t phy
Definition: bluetooth.h:1377
struct bt_conn * conn
Peer that transferred the periodic advertising sync.
Definition: bluetooth.h:1395
uint16_t service_data
Service Data provided by the peer when sync is transferred.
Definition: bluetooth.h:1387
Definition: bluetooth.h:1412
const bt_addr_le_t * addr
Definition: bluetooth.h:1414
uint8_t reason
Definition: bluetooth.h:1420
uint8_t sid
Definition: bluetooth.h:1417
Definition: bluetooth.h:1788
uint32_t options
Definition: bluetooth.h:1806
uint16_t timeout
Synchronization timeout (N * 10 ms)
Definition: bluetooth.h:1803
uint16_t skip
Maximum event skip.
Definition: bluetooth.h:1795
Definition: bluetooth.h:2040
void(* timeout)(void)
The scanner has stopped scanning after scan timeout.
Definition: bluetooth.h:2052
sys_snode_t node
Definition: bluetooth.h:2054
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:2048
Definition: bluetooth.h:1950
uint8_t type
Definition: bluetooth.h:1952
uint16_t interval
Definition: bluetooth.h:1958
uint16_t window
Definition: bluetooth.h:1961
uint16_t timeout
Scan timeout (N * 10 ms)
Definition: bluetooth.h:1969
uint16_t interval_coded
Scan interval LE Coded PHY (N * 0.625 MS)
Definition: bluetooth.h:1976
uint16_t window_coded
Scan window LE Coded PHY (N * 0.625 MS)
Definition: bluetooth.h:1983
uint32_t options
Definition: bluetooth.h:1955
Definition: bluetooth.h:1987
uint16_t interval
Periodic advertising interval.
Definition: bluetooth.h:2030
int8_t tx_power
Definition: bluetooth.h:2003
uint8_t sid
Definition: bluetooth.h:1997
uint8_t primary_phy
Definition: bluetooth.h:2033
int8_t rssi
Definition: bluetooth.h:2000
const bt_addr_le_t * addr
Advertiser LE address and type.
Definition: bluetooth.h:1994
uint8_t secondary_phy
Definition: bluetooth.h:2036
uint8_t adv_type
Advertising packet type.
Definition: bluetooth.h:2013
uint16_t adv_props
Advertising packet properties bitfield.
Definition: bluetooth.h:2023
Simple network buffer representation.
Definition: buf.h:83
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.