Zephyr API Documentation  2.7.0-rc2
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 <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};
1157
1161
1164
1167
1170
1173};
1174
1175
1179};
1180
1192 void (*synced)(struct bt_le_per_adv_sync *sync,
1193 struct bt_le_per_adv_sync_synced_info *info);
1194
1204 void (*term)(struct bt_le_per_adv_sync *sync,
1205 const struct bt_le_per_adv_sync_term_info *info);
1206
1217 void (*recv)(struct bt_le_per_adv_sync *sync,
1218 const struct bt_le_per_adv_sync_recv_info *info,
1219 struct net_buf_simple *buf);
1220
1231 void (*state_changed)(struct bt_le_per_adv_sync *sync,
1232 const struct bt_le_per_adv_sync_state_info *info);
1233
1244 void (*biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo);
1245
1253 void (*cte_report_cb)(struct bt_le_per_adv_sync *sync,
1254 struct bt_df_per_adv_sync_iq_samples_report const *info);
1255
1257};
1258
1260enum {
1263
1271
1278
1281
1284
1287
1290};
1291
1299
1306
1309
1317
1325};
1326
1338uint8_t bt_le_per_adv_sync_get_index(struct bt_le_per_adv_sync *per_adv_sync);
1339
1344
1347
1350
1353};
1354
1363int bt_le_per_adv_sync_get_info(struct bt_le_per_adv_sync *per_adv_sync,
1364 struct bt_le_per_adv_sync_info *info);
1365
1374struct bt_le_per_adv_sync *bt_le_per_adv_sync_lookup_addr(const bt_addr_le_t *adv_addr,
1375 uint8_t sid);
1376
1390 struct bt_le_per_adv_sync **out_sync);
1391
1408int bt_le_per_adv_sync_delete(struct bt_le_per_adv_sync *per_adv_sync);
1409
1422
1432int bt_le_per_adv_sync_recv_enable(struct bt_le_per_adv_sync *per_adv_sync);
1433
1443int bt_le_per_adv_sync_recv_disable(struct bt_le_per_adv_sync *per_adv_sync);
1444
1446enum {
1449
1456
1464
1472
1475};
1476
1485
1493
1496};
1497
1510int bt_le_per_adv_sync_transfer(const struct bt_le_per_adv_sync *per_adv_sync,
1511 const struct bt_conn *conn,
1512 uint16_t service_data);
1513
1514
1527int bt_le_per_adv_set_info_transfer(const struct bt_le_ext_adv *adv,
1528 const struct bt_conn *conn,
1529 uint16_t service_data);
1530
1545 const struct bt_conn *conn,
1546 const struct bt_le_per_adv_sync_transfer_param *param);
1547
1561int bt_le_per_adv_sync_transfer_unsubscribe(const struct bt_conn *conn);
1562
1577
1590
1599
1600
1601enum {
1604
1607
1610
1613
1620};
1621
1622#define BT_LE_SCAN_OPT_FILTER_WHITELIST __DEPRECATED_MACRO BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST
1623
1624enum {
1627
1630};
1631
1636
1639
1642
1645
1653
1660
1667};
1668
1678
1681
1684
1687
1690
1693
1700
1703
1706};
1707
1710
1717 void (*recv)(const struct bt_le_scan_recv_info *info,
1718 struct net_buf_simple *buf);
1719
1722
1724};
1725
1735#define BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) \
1736{ \
1737 .type = (_type), \
1738 .options = (_options), \
1739 .interval = (_interval), \
1740 .window = (_window), \
1741 .timeout = 0, \
1742 .interval_coded = 0, \
1743 .window_coded = 0, \
1744}
1745
1755#define BT_LE_SCAN_PARAM(_type, _options, _interval, _window) \
1756 ((struct bt_le_scan_param[]) { \
1757 BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window) \
1758 })
1759
1763#define BT_LE_SCAN_ACTIVE BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \
1764 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1765 BT_GAP_SCAN_FAST_INTERVAL, \
1766 BT_GAP_SCAN_FAST_WINDOW)
1767
1774#define BT_LE_SCAN_PASSIVE BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \
1775 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1776 BT_GAP_SCAN_FAST_INTERVAL, \
1777 BT_GAP_SCAN_FAST_WINDOW)
1778
1783#define BT_LE_SCAN_CODED_ACTIVE \
1784 BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_ACTIVE, \
1785 BT_LE_SCAN_OPT_CODED | \
1786 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1787 BT_GAP_SCAN_FAST_INTERVAL, \
1788 BT_GAP_SCAN_FAST_WINDOW)
1789
1797#define BT_LE_SCAN_CODED_PASSIVE \
1798 BT_LE_SCAN_PARAM(BT_LE_SCAN_TYPE_PASSIVE, \
1799 BT_LE_SCAN_OPT_CODED | \
1800 BT_LE_SCAN_OPT_FILTER_DUPLICATE, \
1801 BT_GAP_SCAN_FAST_INTERVAL, \
1802 BT_GAP_SCAN_FAST_WINDOW)
1803
1825
1835
1848
1857
1873__deprecated
1874static inline int bt_le_whitelist_add(const bt_addr_le_t *addr)
1875{
1876 return bt_le_filter_accept_list_add(addr);
1877}
1878
1894__deprecated
1895static inline int bt_le_whitelist_rem(const bt_addr_le_t *addr)
1896{
1898}
1899
1913__deprecated
1914static inline int bt_le_whitelist_clear(void)
1915{
1917}
1918
1928
1944 bool (*func)(struct bt_data *data, void *user_data),
1945 void *user_data);
1946
1951
1954};
1955
1962
1965};
1966
1996
2021int bt_le_ext_adv_oob_get_local(struct bt_le_ext_adv *adv,
2022 struct bt_le_oob *oob);
2023
2027 uint8_t _priv[4];
2028
2031
2034
2037
2040};
2041
2055 size_t count);
2056
2063
2066};
2067
2086 struct bt_br_discovery_result *results, size_t count,
2088
2099
2103};
2104
2114
2115
2128int bt_br_set_discoverable(bool enable);
2129
2142int bt_br_set_connectable(bool enable);
2143
2153int bt_unpair(uint8_t id, const bt_addr_le_t *addr);
2154
2159};
2160
2168void bt_foreach_bond(uint8_t id, void (*func)(const struct bt_bond_info *info,
2169 void *user_data),
2170 void *user_data);
2171
2176#ifdef __cplusplus
2177}
2178#endif
2183#endif /* ZEPHYR_INCLUDE_BLUETOOTH_BLUETOOTH_H_ */
Bluetooth device address definitions and utilities.
ZTEST_BMEM int count
Definition: main.c:33
Bluetooth subsystem crypto APIs.
void
Definition: eswifi_shell.c:15
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:1895
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:1874
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:1914
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:2054
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_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_TYPE_PASSIVE
Definition: bluetooth.h:1626
@ BT_LE_SCAN_TYPE_ACTIVE
Definition: bluetooth.h:1629
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOA
No Angle of Arrival (AoA)
Definition: bluetooth.h:1455
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_2US
No Angle of Departure (AoD) 2.
Definition: bluetooth.h:1471
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_1US
No Angle of Departure (AoD) 1 us.
Definition: bluetooth.h:1463
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_ONLY_CTE
Definition: bluetooth.h:1474
@ BT_LE_PER_ADV_SYNC_TRANSFER_OPT_NONE
Definition: bluetooth.h:1448
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_2US
Definition: bluetooth.h:1286
@ BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT
Definition: bluetooth.h:1289
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_1US
Definition: bluetooth.h:1283
@ BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA
Definition: bluetooth.h:1280
@ BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED
Disables periodic advertising reports.
Definition: bluetooth.h:1277
@ BT_LE_PER_ADV_SYNC_OPT_USE_PER_ADV_LIST
Use the periodic advertising list to sync with advertiser.
Definition: bluetooth.h:1270
@ BT_LE_PER_ADV_SYNC_OPT_NONE
Definition: bluetooth.h:1262
@ BT_LE_SCAN_OPT_FILTER_DUPLICATE
Definition: bluetooth.h:1606
@ BT_LE_SCAN_OPT_CODED
Definition: bluetooth.h:1612
@ BT_LE_SCAN_OPT_NO_1M
Disable scan on 1M phy.
Definition: bluetooth.h:1619
@ BT_LE_SCAN_OPT_NONE
Definition: bluetooth.h:1603
@ BT_LE_SCAN_OPT_FILTER_ACCEPT_LIST
Definition: bluetooth.h:1609
@ 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_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:39
Definition: addr.h:34
Definition: bluetooth.h:2156
bt_addr_le_t addr
Definition: bluetooth.h:2158
Definition: bluetooth.h:2058
uint8_t length
Definition: bluetooth.h:2062
bool limited
Definition: bluetooth.h:2065
BR/EDR discovery result structure.
Definition: bluetooth.h:2025
uint8_t eir[240]
Definition: bluetooth.h:2039
bt_addr_t addr
Definition: bluetooth.h:2030
int8_t rssi
Definition: bluetooth.h:2033
uint8_t cod[3]
Definition: bluetooth.h:2036
Definition: bluetooth.h:2100
bt_addr_t addr
Definition: bluetooth.h:2102
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:91
Definition: iso.h:350
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:1948
uint8_t c[16]
Definition: bluetooth.h:1953
uint8_t r[16]
Definition: bluetooth.h:1950
Definition: bluetooth.h:1957
bt_addr_le_t addr
Definition: bluetooth.h:1961
struct bt_le_oob_sc_data le_sc_data
Definition: bluetooth.h:1964
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:1181
sys_snode_t node
Definition: bluetooth.h:1256
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:1217
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:1231
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:1192
void(* biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo)
BIGInfo advertising report received.
Definition: bluetooth.h:1244
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:1204
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:1253
Advertising set info structure.
Definition: bluetooth.h:1341
uint16_t interval
Definition: bluetooth.h:1349
uint8_t phy
Definition: bluetooth.h:1352
bt_addr_le_t addr
Definition: bluetooth.h:1343
uint8_t sid
Definition: bluetooth.h:1346
Definition: bluetooth.h:1292
uint16_t timeout
Synchronization timeout (N * 10 ms)
Definition: bluetooth.h:1324
uint32_t options
Definition: bluetooth.h:1308
uint8_t sid
Advertiser SID.
Definition: bluetooth.h:1305
bt_addr_le_t addr
Periodic Advertiser Address.
Definition: bluetooth.h:1298
uint16_t skip
Maximum event skip.
Definition: bluetooth.h:1316
Definition: bluetooth.h:1158
uint8_t cte_type
Definition: bluetooth.h:1172
uint8_t sid
Definition: bluetooth.h:1163
const bt_addr_le_t * addr
Definition: bluetooth.h:1160
int8_t tx_power
Definition: bluetooth.h:1166
int8_t rssi
Definition: bluetooth.h:1169
Definition: bluetooth.h:1176
bool recv_enabled
Definition: bluetooth.h:1178
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 sid
Definition: bluetooth.h:1155
Definition: bluetooth.h:1477
uint32_t options
Definition: bluetooth.h:1495
uint16_t timeout
Synchronization timeout (N * 10 ms)
Definition: bluetooth.h:1492
uint16_t skip
Maximum event skip.
Definition: bluetooth.h:1484
Definition: bluetooth.h:1709
void(* timeout)(void)
The scanner has stopped scanning after scan timeout.
Definition: bluetooth.h:1721
sys_snode_t node
Definition: bluetooth.h:1723
void(* recv)(const struct bt_le_scan_recv_info *info, struct net_buf_simple *buf)
Advertisement packet received callback.
Definition: bluetooth.h:1717
Definition: bluetooth.h:1633
uint8_t type
Definition: bluetooth.h:1635
uint16_t interval
Definition: bluetooth.h:1641
uint16_t window
Definition: bluetooth.h:1644
uint16_t timeout
Scan timeout (N * 10 ms)
Definition: bluetooth.h:1652
uint16_t interval_coded
Scan interval LE Coded PHY (N * 0.625 MS)
Definition: bluetooth.h:1659
uint16_t window_coded
Scan window LE Coded PHY (N * 0.625 MS)
Definition: bluetooth.h:1666
uint32_t options
Definition: bluetooth.h:1638
Definition: bluetooth.h:1670
uint16_t interval
Periodic advertising interval.
Definition: bluetooth.h:1699
int8_t tx_power
Definition: bluetooth.h:1686
uint8_t sid
Definition: bluetooth.h:1680
uint8_t primary_phy
Definition: bluetooth.h:1702
int8_t rssi
Definition: bluetooth.h:1683
const bt_addr_le_t * addr
Advertiser LE address and type.
Definition: bluetooth.h:1677
uint8_t secondary_phy
Definition: bluetooth.h:1705
uint8_t adv_type
Definition: bluetooth.h:1689
uint16_t adv_props
Definition: bluetooth.h:1692
Simple network buffer representation.
Definition: buf.h:87
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.