Zephyr API Documentation  3.0.0
A Scalable Open Source RTOS
3.0.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 <sys/util.h>
23#include <net/buf.h>
24#include <bluetooth/gap.h>
25#include <bluetooth/addr.h>
26#include <bluetooth/crypto.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
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
90 void (*sent)(struct bt_le_ext_adv *adv,
91 struct bt_le_ext_adv_sent_info *info);
92
102 void (*connected)(struct bt_le_ext_adv *adv,
103 struct bt_le_ext_adv_connected_info *info);
104
115 void (*scanned)(struct bt_le_ext_adv *adv,
116 struct bt_le_ext_adv_scanned_info *info);
117};
118
125typedef void (*bt_ready_cb_t)(int err);
126
144
158int bt_set_name(const char *name);
159
167const char *bt_get_name(void);
168
189void bt_id_get(bt_addr_le_t *addrs, size_t *count);
190
233
267
285
293struct bt_data {
296 const uint8_t *data;
297};
298
309#define BT_DATA(_type, _data, _data_len) \
310 { \
311 .type = (_type), \
312 .data_len = (_data_len), \
313 .data = (const uint8_t *)(_data), \
314 }
315
325#define BT_DATA_BYTES(_type, _bytes...) \
326 BT_DATA(_type, ((uint8_t []) { _bytes }), \
327 sizeof((uint8_t []) { _bytes }))
328
330enum {
333
343
359
371
393
401
415
420
423
428
439
459
475
487
494
501
504
507
510
520};
521
533
540
550
553
562
571
588};
589
590
592enum {
595
602};
603
612
620
623};
624
634#define BT_LE_ADV_PARAM_INIT(_options, _int_min, _int_max, _peer) \
635{ \
636 .id = BT_ID_DEFAULT, \
637 .sid = 0, \
638 .secondary_max_skip = 0, \
639 .options = (_options), \
640 .interval_min = (_int_min), \
641 .interval_max = (_int_max), \
642 .peer = (_peer), \
643}
644
654#define BT_LE_ADV_PARAM(_options, _int_min, _int_max, _peer) \
655 ((struct bt_le_adv_param[]) { \
656 BT_LE_ADV_PARAM_INIT(_options, _int_min, _int_max, _peer) \
657 })
658
659#define BT_LE_ADV_CONN_DIR(_peer) BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \
660 BT_LE_ADV_OPT_ONE_TIME, 0, 0,\
661 _peer)
662
663
664#define BT_LE_ADV_CONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, \
665 BT_GAP_ADV_FAST_INT_MIN_2, \
666 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
667
668#define BT_LE_ADV_CONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \
669 BT_LE_ADV_OPT_USE_NAME, \
670 BT_GAP_ADV_FAST_INT_MIN_2, \
671 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
672
673#define BT_LE_ADV_CONN_NAME_AD BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \
674 BT_LE_ADV_OPT_USE_NAME | \
675 BT_LE_ADV_OPT_FORCE_NAME_IN_AD, \
676 BT_GAP_ADV_FAST_INT_MIN_2, \
677 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
678
679#define BT_LE_ADV_CONN_DIR_LOW_DUTY(_peer) \
680 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | \
681 BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY, \
682 BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, \
683 _peer)
684
686#define BT_LE_ADV_NCONN BT_LE_ADV_PARAM(0, BT_GAP_ADV_FAST_INT_MIN_2, \
687 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
688
690#define BT_LE_ADV_NCONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_USE_NAME, \
691 BT_GAP_ADV_FAST_INT_MIN_2, \
692 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
693
695#define BT_LE_ADV_NCONN_IDENTITY BT_LE_ADV_PARAM(BT_LE_ADV_OPT_USE_IDENTITY, \
696 BT_GAP_ADV_FAST_INT_MIN_2, \
697 BT_GAP_ADV_FAST_INT_MAX_2, \
698 NULL)
699
701#define BT_LE_EXT_ADV_CONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
702 BT_LE_ADV_OPT_CONNECTABLE | \
703 BT_LE_ADV_OPT_USE_NAME, \
704 BT_GAP_ADV_FAST_INT_MIN_2, \
705 BT_GAP_ADV_FAST_INT_MAX_2, \
706 NULL)
707
709#define BT_LE_EXT_ADV_SCAN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
710 BT_LE_ADV_OPT_SCANNABLE | \
711 BT_LE_ADV_OPT_USE_NAME, \
712 BT_GAP_ADV_FAST_INT_MIN_2, \
713 BT_GAP_ADV_FAST_INT_MAX_2, \
714 NULL)
715
717#define BT_LE_EXT_ADV_NCONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, \
718 BT_GAP_ADV_FAST_INT_MIN_2, \
719 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
720
722#define BT_LE_EXT_ADV_NCONN_NAME BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
723 BT_LE_ADV_OPT_USE_NAME, \
724 BT_GAP_ADV_FAST_INT_MIN_2, \
725 BT_GAP_ADV_FAST_INT_MAX_2, \
726 NULL)
727
729#define BT_LE_EXT_ADV_NCONN_IDENTITY \
730 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
731 BT_LE_ADV_OPT_USE_IDENTITY, \
732 BT_GAP_ADV_FAST_INT_MIN_2, \
733 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
734
736#define BT_LE_EXT_ADV_CODED_NCONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \
737 BT_LE_ADV_OPT_CODED, \
738 BT_GAP_ADV_FAST_INT_MIN_2, \
739 BT_GAP_ADV_FAST_INT_MAX_2, \
740 NULL)
741
745#define BT_LE_EXT_ADV_CODED_NCONN_NAME \
746 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CODED | \
747 BT_LE_ADV_OPT_USE_NAME, \
748 BT_GAP_ADV_FAST_INT_MIN_2, \
749 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
750
754#define BT_LE_EXT_ADV_CODED_NCONN_IDENTITY \
755 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CODED | \
756 BT_LE_ADV_OPT_USE_IDENTITY, \
757 BT_GAP_ADV_FAST_INT_MIN_2, \
758 BT_GAP_ADV_FAST_INT_MAX_2, NULL)
759
766#define BT_LE_EXT_ADV_START_PARAM_INIT(_timeout, _n_evts) \
767{ \
768 .timeout = (_timeout), \
769 .num_events = (_n_evts), \
770}
771
778#define BT_LE_EXT_ADV_START_PARAM(_timeout, _n_evts) \
779 ((struct bt_le_ext_adv_start_param[]) { \
780 BT_LE_EXT_ADV_START_PARAM_INIT((_timeout), (_n_evts)) \
781 })
782
783#define BT_LE_EXT_ADV_START_DEFAULT BT_LE_EXT_ADV_START_PARAM(0, 0)
784
792#define BT_LE_PER_ADV_PARAM_INIT(_int_min, _int_max, _options) \
793{ \
794 .interval_min = (_int_min), \
795 .interval_max = (_int_max), \
796 .options = (_options), \
797}
798
806#define BT_LE_PER_ADV_PARAM(_int_min, _int_max, _options) \
807 ((struct bt_le_per_adv_param[]) { \
808 BT_LE_PER_ADV_PARAM_INIT(_int_min, _int_max, _options) \
809 })
810
811#define BT_LE_PER_ADV_DEFAULT BT_LE_PER_ADV_PARAM(BT_GAP_PER_ADV_SLOW_INT_MIN, \
812 BT_GAP_PER_ADV_SLOW_INT_MAX, \
813 BT_LE_PER_ADV_OPT_NONE)
814
842int bt_le_adv_start(const struct bt_le_adv_param *param,
843 const struct bt_data *ad, size_t ad_len,
844 const struct bt_data *sd, size_t sd_len);
845
858int bt_le_adv_update_data(const struct bt_data *ad, size_t ad_len,
859 const struct bt_data *sd, size_t sd_len);
860
869
884int bt_le_ext_adv_create(const struct bt_le_adv_param *param,
885 const struct bt_le_ext_adv_cb *cb,
886 struct bt_le_ext_adv **adv);
887
910};
911
925int bt_le_ext_adv_start(struct bt_le_ext_adv *adv,
926 struct bt_le_ext_adv_start_param *param);
927
938int bt_le_ext_adv_stop(struct bt_le_ext_adv *adv);
939
974int bt_le_ext_adv_set_data(struct bt_le_ext_adv *adv,
975 const struct bt_data *ad, size_t ad_len,
976 const struct bt_data *sd, size_t sd_len);
977
994int bt_le_ext_adv_update_param(struct bt_le_ext_adv *adv,
995 const struct bt_le_adv_param *param);
996
1005int bt_le_ext_adv_delete(struct bt_le_ext_adv *adv);
1006
1018uint8_t bt_le_ext_adv_get_index(struct bt_le_ext_adv *adv);
1019
1022 /* Local identity */
1024
1027};
1028
1037int bt_le_ext_adv_get_info(const struct bt_le_ext_adv *adv,
1038 struct bt_le_ext_adv_info *info);
1039
1052typedef void bt_le_scan_cb_t(const bt_addr_le_t *addr, int8_t rssi,
1053 uint8_t adv_type, struct net_buf_simple *buf);
1054
1067int bt_le_per_adv_set_param(struct bt_le_ext_adv *adv,
1068 const struct bt_le_per_adv_param *param);
1069
1083int bt_le_per_adv_set_data(const struct bt_le_ext_adv *adv,
1084 const struct bt_data *ad, size_t ad_len);
1085
1103int bt_le_per_adv_start(struct bt_le_ext_adv *adv);
1104
1116int bt_le_per_adv_stop(struct bt_le_ext_adv *adv);
1117
1121
1124
1127
1130
1133
1140
1147 struct bt_conn *conn;
1148};
1149
1153
1156
1159};
1160
1164
1167
1170
1173
1176};
1177
1178
1182};
1183
1195 void (*synced)(struct bt_le_per_adv_sync *sync,
1196 struct bt_le_per_adv_sync_synced_info *info);
1197
1207 void (*term)(struct bt_le_per_adv_sync *sync,
1208 const struct bt_le_per_adv_sync_term_info *info);
1209
1220 void (*recv)(struct bt_le_per_adv_sync *sync,
1221 const struct bt_le_per_adv_sync_recv_info *info,
1222 struct net_buf_simple *buf);
1223
1234 void (*state_changed)(struct bt_le_per_adv_sync *sync,
1235 const struct bt_le_per_adv_sync_state_info *info);
1236
1247 void (*biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo);
1248
1256 void (*cte_report_cb)(struct bt_le_per_adv_sync *sync,
1257 struct bt_df_per_adv_sync_iq_samples_report const *info);
1258
1260};
1261
1263enum {
1266
1274
1281
1284
1287
1290
1293
1296};
1297
1305
1312
1315
1324
1332};
1333
1345uint8_t bt_le_per_adv_sync_get_index(struct bt_le_per_adv_sync *per_adv_sync);
1346
1351
1354
1357
1360};
1361
1370int bt_le_per_adv_sync_get_info(struct bt_le_per_adv_sync *per_adv_sync,
1371 struct bt_le_per_adv_sync_info *info);
1372
1381struct bt_le_per_adv_sync *bt_le_per_adv_sync_lookup_addr(const bt_addr_le_t *adv_addr,
1382 uint8_t sid);
1383
1397 struct bt_le_per_adv_sync **out_sync);
1398
1415int bt_le_per_adv_sync_delete(struct bt_le_per_adv_sync *per_adv_sync);
1416
1429
1439int bt_le_per_adv_sync_recv_enable(struct bt_le_per_adv_sync *per_adv_sync);
1440
1450int bt_le_per_adv_sync_recv_disable(struct bt_le_per_adv_sync *per_adv_sync);
1451
1453enum {
1456
1463
1471
1479
1482};
1483
1492
1500
1503};
1504
1517int bt_le_per_adv_sync_transfer(const struct bt_le_per_adv_sync *per_adv_sync,
1518 const struct bt_conn *conn,
1519 uint16_t service_data);
1520
1521
1534int bt_le_per_adv_set_info_transfer(const struct bt_le_ext_adv *adv,
1535 const struct bt_conn *conn,
1536 uint16_t service_data);
1537
1552 const struct bt_conn *conn,
1553 const struct bt_le_per_adv_sync_transfer_param *param);
1554
1568int bt_le_per_adv_sync_transfer_unsubscribe(const struct bt_conn *conn);
1569
1584
1597
1606
1607
1608enum {
1611
1614
1617
1620
1627};
1628
1629#define BT_LE_SCAN_OPT_FILTER_WHITELIST __DEPRECATED_MACRO BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST
1630
1631enum {
1634
1637};
1638
1643
1646
1649
1652
1660
1667
1674};
1675
1685
1688
1691
1694
1697
1700
1707
1710
1713};
1714
1717
1724 void (*recv)(const struct bt_le_scan_recv_info *info,
1725 struct net_buf_simple *buf);
1726
1728 void (*timeout)(void);
1729
1731};
1732
1742#define BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) \
1743{ \
1744 .type = (_type), \
1745 .options = (_options), \
1746 .interval = (_interval), \
1747 .window = (_window), \
1748 .timeout = 0, \
1749 .interval_coded = 0, \
1750 .window_coded = 0, \
1751}
1752
1762#define BT_LE_SCAN_PARAM(_type, _options, _interval, _window) \
1763 ((struct bt_le_scan_param[]) { \
1764 BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) \
1765 })
1766
1770#define BT_LE_SCAN_ACTIVE BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \
1771 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1772 BT_GAP_SCAN_FAST_INTERVAL, \
1773 BT_GAP_SCAN_FAST_WINDOW)
1774
1781#define BT_LE_SCAN_PASSIVE BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \
1782 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1783 BT_GAP_SCAN_FAST_INTERVAL, \
1784 BT_GAP_SCAN_FAST_WINDOW)
1785
1790#define BT_LE_SCAN_CODED_ACTIVE \
1791 BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \
1792 BT_LE_SCAN_OPT_CODED | \
1793 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1794 BT_GAP_SCAN_FAST_INTERVAL, \
1795 BT_GAP_SCAN_FAST_WINDOW)
1796
1804#define BT_LE_SCAN_CODED_PASSIVE \
1805 BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \
1806 BT_LE_SCAN_OPT_CODED | \
1807 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1808 BT_GAP_SCAN_FAST_INTERVAL, \
1809 BT_GAP_SCAN_FAST_WINDOW)
1810
1832
1842
1855
1864
1880__deprecated
1881static inline int bt_le_whitelist_add(const bt_addr_le_t *addr)
1882{
1883 return bt_le_filter_accept_list_add(addr);
1884}
1885
1901__deprecated
1902static inline int bt_le_whitelist_rem(const bt_addr_le_t *addr)
1903{
1905}
1906
1920__deprecated
1921static inline int bt_le_whitelist_clear(void)
1922{
1924}
1925
1935
1951 bool (*func)(struct bt_data *data, void *user_data),
1952 void *user_data);
1953
1958
1961};
1962
1969
1972};
1973
2003
2028int bt_le_ext_adv_oob_get_local(struct bt_le_ext_adv *adv,
2029 struct bt_le_oob *oob);
2030
2034 uint8_t _priv[4];
2035
2038
2041
2044
2047};
2048
2062 size_t count);
2063
2070
2073};
2074
2093 struct bt_br_discovery_result *results, size_t count,
2095
2106
2110};
2111
2121
2122
2135int bt_br_set_discoverable(bool enable);
2136
2149int bt_br_set_connectable(bool enable);
2150
2160int bt_unpair(uint8_t id, const bt_addr_le_t *addr);
2161
2166};
2167
2175void bt_foreach_bond(uint8_t id, void (*func)(const struct bt_bond_info *info,
2176 void *user_data),
2177 void *user_data);
2178
2194 const uint8_t *vs_config);
2195
2200#ifdef __cplusplus
2201}
2202#endif
2207#endif /* ZEPHYR_INCLUDE_BLUETOOTH_BLUETOOTH_H_ */
Bluetooth device address definitions and utilities.
ZTEST_BMEM int count
Definition: main.c:33
Bluetooth subsystem crypto APIs.
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).
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:1902
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:1881
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:1921
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.
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:2061
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:125
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.
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:1052
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.
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_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:1613
@ BT_LE_SCAN_OPT_CODED
Definition: bluetooth.h:1619
@ BT_LE_SCAN_OPT_NO_1M
Disable scan on 1M phy.
Definition: bluetooth.h:1626
@ BT_LE_SCAN_OPT_NONE
Definition: bluetooth.h:1610
@ BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST
Definition: bluetooth.h:1616
@ BT_LE_SCAN_TYPE_PASSIVE
Definition: bluetooth.h:1633
@ BT_LE_SCAN_TYPE_ACTIVE
Definition: bluetooth.h:1636
@ BT_LE_ADV_OPT_FORCE_NAME_IN_AD
Put GAP device name into advert data.
Definition: bluetooth.h:519
@ BT_LE_ADV_OPT_NOTIFY_SCAN_REQ
Definition: bluetooth.h:427
@ BT_LE_ADV_OPT_ANONYMOUS
Advertise without a device address (identity or RPA).
Definition: bluetooth.h:493
@ BT_LE_ADV_OPT_CONNECTABLE
Advertise as connectable.
Definition: bluetooth.h:342
@ BT_LE_ADV_OPT_USE_NAME
Definition: bluetooth.h:392
@ BT_LE_ADV_OPT_USE_IDENTITY
Advertise using identity address.
Definition: bluetooth.h:370
@ BT_LE_ADV_OPT_ONE_TIME
Advertise one time.
Definition: bluetooth.h:358
@ BT_LE_ADV_OPT_FILTER_SCAN_REQ
Definition: bluetooth.h:419
@ BT_LE_ADV_OPT_DISABLE_CHAN_39
Definition: bluetooth.h:509
@ BT_LE_ADV_OPT_NONE
Definition: bluetooth.h:332
@ BT_LE_ADV_OPT_DISABLE_CHAN_37
Definition: bluetooth.h:503
@ BT_LE_ADV_OPT_DISABLE_CHAN_38
Definition: bluetooth.h:506
@ BT_LE_ADV_OPT_DIR_ADDR_RPA
Directed advertising to privacy-enabled peer.
Definition: bluetooth.h:414
@ BT_LE_ADV_OPT_CODED
Advertise on the LE Coded PHY (Long Range).
Definition: bluetooth.h:486
@ BT_LE_ADV_OPT_FILTER_CONN
Definition: bluetooth.h:422
@ BT_LE_ADV_OPT_EXT_ADV
Advertise with extended advertising.
Definition: bluetooth.h:458
@ BT_LE_ADV_OPT_SCANNABLE
Support scan response data.
Definition: bluetooth.h:438
@ BT_LE_ADV_OPT_NO_2M
Disable use of LE 2M PHY on the secondary advertising channel.
Definition: bluetooth.h:474
@ BT_LE_ADV_OPT_USE_TX_POWER
Advertise with transmit power.
Definition: bluetooth.h:500
@ BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY
Low duty cycle directed advertising.
Definition: bluetooth.h:400
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_2US
Definition: bluetooth.h:1292
@ BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT
Definition: bluetooth.h:1295
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_1US
Definition: bluetooth.h:1289
@ BT_LE_PER_ADV_SYNC_OPT_FILTER_DUPLICATE
Definition: bluetooth.h:1283
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA
Definition: bluetooth.h:1286
@ BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED
Disables periodic advertising reports.
Definition: bluetooth.h:1280
@ BT_LE_PER_ADV_SYNC_OPT_USE_PER_ADV_LIST
Use the periodic advertising list to sync with advertiser.
Definition: bluetooth.h:1273
@ BT_LE_PER_ADV_SYNC_OPT_NONE
Definition: bluetooth.h:1265
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOA
No Angle of Arrival (AoA)
Definition: bluetooth.h:1462
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_2US
No Angle of Departure (AoD) 2.
Definition: bluetooth.h:1478
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_1US
No Angle of Departure (AoD) 1 us.
Definition: bluetooth.h:1470
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_ONLY_CTE
Definition: bluetooth.h:1481
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_NONE
Definition: bluetooth.h:1455
@ BT_LE_PER_ADV_OPT_USE_TX_POWER
Advertise with transmit power.
Definition: bluetooth.h:601
@ BT_LE_PER_ADV_OPT_NONE
Definition: bluetooth.h:594
#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
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
__INT8_TYPE__ int8_t
Definition: stdint.h:42
Definition: addr.h:48
Definition: addr.h:39
Definition: bluetooth.h:2163
bt_addr_le_t addr
Definition: bluetooth.h:2165
Definition: bluetooth.h:2065
uint8_t length
Definition: bluetooth.h:2069
bool limited
Definition: bluetooth.h:2072
BR/EDR discovery result structure.
Definition: bluetooth.h:2032
uint8_t eir[240]
Definition: bluetooth.h:2046
bt_addr_t addr
Definition: bluetooth.h:2037
int8_t rssi
Definition: bluetooth.h:2040
uint8_t cod[3]
Definition: bluetooth.h:2043
Definition: bluetooth.h:2107
bt_addr_t addr
Definition: bluetooth.h:2109
Bluetooth data.
Definition: bluetooth.h:293
uint8_t type
Definition: bluetooth.h:294
uint8_t data_len
Definition: bluetooth.h:295
const uint8_t * data
Definition: bluetooth.h:296
Definition: direction.h:104
Definition: iso.h:361
Definition: bluetooth.h:523
uint32_t options
Definition: bluetooth.h:552
const bt_addr_le_t * peer
Directed advertising to peer.
Definition: bluetooth.h:587
uint8_t sid
Advertising Set Identifier, valid range 0x00 - 0x0f.
Definition: bluetooth.h:539
uint8_t secondary_max_skip
Secondary channel maximum skip count.
Definition: bluetooth.h:549
uint32_t interval_min
Definition: bluetooth.h:561
uint8_t id
Local identity.
Definition: bluetooth.h:532
uint32_t interval_max
Definition: bluetooth.h:570
Definition: bluetooth.h:78
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:115
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:102
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:90
Definition: bluetooth.h:68
struct bt_conn * conn
Definition: bluetooth.h:70
Advertising set info structure.
Definition: bluetooth.h:1021
uint8_t id
Definition: bluetooth.h:1023
int8_t tx_power
Definition: bluetooth.h:1026
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:888
uint16_t timeout
Advertiser timeout (N * 10 ms).
Definition: bluetooth.h:902
uint8_t num_events
Number of advertising events.
Definition: bluetooth.h:909
Definition: bluetooth.h:1955
uint8_t c[16]
Definition: bluetooth.h:1960
uint8_t r[16]
Definition: bluetooth.h:1957
Definition: bluetooth.h:1964
bt_addr_le_t addr
Definition: bluetooth.h:1968
struct bt_le_oob_sc_data le_sc_data
Definition: bluetooth.h:1971
Definition: bluetooth.h:604
uint16_t interval_min
Minimum Periodic Advertising Interval (N * 1.25 ms)
Definition: bluetooth.h:611
uint16_t interval_max
Maximum Periodic Advertising Interval (N * 1.25 ms)
Definition: bluetooth.h:619
uint32_t options
Definition: bluetooth.h:622
Definition: bluetooth.h:1184
sys_snode_t node
Definition: bluetooth.h:1259
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:1220
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:1234
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:1195
void(* biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo)
BIGInfo advertising report received.
Definition: bluetooth.h:1247
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:1207
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:1256
Advertising set info structure.
Definition: bluetooth.h:1348
uint16_t interval
Definition: bluetooth.h:1356
uint8_t phy
Definition: bluetooth.h:1359
bt_addr_le_t addr
Definition: bluetooth.h:1350
uint8_t sid
Definition: bluetooth.h:1353
Definition: bluetooth.h:1298
uint16_t timeout
Synchronization timeout (N * 10 ms)
Definition: bluetooth.h:1331
uint32_t options
Definition: bluetooth.h:1314
uint8_t sid
Advertiser SID.
Definition: bluetooth.h:1311
bt_addr_le_t addr
Periodic Advertiser Address.
Definition: bluetooth.h:1304
uint16_t skip
Maximum event skip.
Definition: bluetooth.h:1323
Definition: bluetooth.h:1161
uint8_t cte_type
Definition: bluetooth.h:1175
uint8_t sid
Definition: bluetooth.h:1166
const bt_addr_le_t * addr
Definition: bluetooth.h:1163
int8_t tx_power
Definition: bluetooth.h:1169
int8_t rssi
Definition: bluetooth.h:1172
Definition: bluetooth.h:1179
bool recv_enabled
Definition: bluetooth.h:1181
Definition: bluetooth.h:1118
bool recv_enabled
Definition: bluetooth.h:1132
uint16_t interval
Definition: bluetooth.h:1126
uint8_t sid
Definition: bluetooth.h:1123
const bt_addr_le_t * addr
Definition: bluetooth.h:1120
uint8_t phy
Definition: bluetooth.h:1129
struct bt_conn * conn
Peer that transferred the periodic advertising sync.
Definition: bluetooth.h:1147
uint16_t service_data
Service Data provided by the peer when sync is transferred.
Definition: bluetooth.h:1139
Definition: bluetooth.h:1150
const bt_addr_le_t * addr
Definition: bluetooth.h:1152
uint8_t reason
Definition: bluetooth.h:1158
uint8_t sid
Definition: bluetooth.h:1155
Definition: bluetooth.h:1484
uint32_t options
Definition: bluetooth.h:1502
uint16_t timeout
Synchronization timeout (N * 10 ms)
Definition: bluetooth.h:1499
uint16_t skip
Maximum event skip.
Definition: bluetooth.h:1491
Definition: bluetooth.h:1716
void(* timeout)(void)
The scanner has stopped scanning after scan timeout.
Definition: bluetooth.h:1728
sys_snode_t node
Definition: bluetooth.h:1730
void(* recv)(const struct bt_le_scan_recv_info *info, struct net_buf_simple *buf)
Advertisement packet received callback.
Definition: bluetooth.h:1724
Definition: bluetooth.h:1640
uint8_t type
Definition: bluetooth.h:1642
uint16_t interval
Definition: bluetooth.h:1648
uint16_t window
Definition: bluetooth.h:1651
uint16_t timeout
Scan timeout (N * 10 ms)
Definition: bluetooth.h:1659
uint16_t interval_coded
Scan interval LE Coded PHY (N * 0.625 MS)
Definition: bluetooth.h:1666
uint16_t window_coded
Scan window LE Coded PHY (N * 0.625 MS)
Definition: bluetooth.h:1673
uint32_t options
Definition: bluetooth.h:1645
Definition: bluetooth.h:1677
uint16_t interval
Periodic advertising interval.
Definition: bluetooth.h:1706
int8_t tx_power
Definition: bluetooth.h:1693
uint8_t sid
Definition: bluetooth.h:1687
uint8_t primary_phy
Definition: bluetooth.h:1709
int8_t rssi
Definition: bluetooth.h:1690
const bt_addr_le_t * addr
Advertiser LE address and type.
Definition: bluetooth.h:1684
uint8_t secondary_phy
Definition: bluetooth.h:1712
uint8_t adv_type
Definition: bluetooth.h:1696
uint16_t adv_props
Definition: bluetooth.h:1699
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:590
Misc utilities.