nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches
bt_mgmt.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
16#ifndef _BT_MGMT_H_
17#define _BT_MGMT_H_
18
19#include <zephyr/bluetooth/bluetooth.h>
20#include <zephyr/bluetooth/conn.h>
21#include <zephyr/bluetooth/audio/audio.h>
22
23#define LE_AUDIO_EXTENDED_ADV \
24 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, CONFIG_BLE_ACL_EXT_ADV_INT_MIN, \
25 CONFIG_BLE_ACL_EXT_ADV_INT_MAX, NULL)
26
27#define LE_AUDIO_EXTENDED_ADV_CONN \
28 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN, \
29 CONFIG_BLE_ACL_EXT_ADV_INT_MIN, CONFIG_BLE_ACL_EXT_ADV_INT_MAX, NULL)
30
31#define LE_AUDIO_EXTENDED_ADV_CONN_FILTER \
32 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_FILTER_CONN, \
33 CONFIG_BLE_ACL_EXT_ADV_INT_MIN, CONFIG_BLE_ACL_EXT_ADV_INT_MAX, NULL)
34
35#define LE_AUDIO_PERIODIC_ADV \
36 BT_LE_PER_ADV_PARAM(CONFIG_BLE_ACL_PER_ADV_INT_MIN, CONFIG_BLE_ACL_PER_ADV_INT_MAX, \
37 BT_LE_PER_ADV_OPT_NONE)
38
39#define BT_LE_ADV_FAST_CONN \
40 BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_1, BT_GAP_ADV_FAST_INT_MAX_1, \
41 NULL)
42
43#define BLE_SEARCH_NAME_MAX_LEN 33
44
45#if (CONFIG_SCAN_MODE_ACTIVE)
46#define NRF_AUDIO_GATEWAY_SCAN_TYPE BT_LE_SCAN_TYPE_ACTIVE
47#define NRF_AUDIO_GATEWAY_SCAN_PARAMS BT_LE_SCAN_ACTIVE
48#elif (CONFIG_SCAN_MODE_PASSIVE)
49#define NRF_AUDIO_GATEWAY_SCAN_TYPE BT_LE_SCAN_TYPE_PASSIVE
50#define NRF_AUDIO_GATEWAY_SCAN_PARAMS BT_LE_SCAN_PASSIVE
51#else
52#error "Select either CONFIG_SCAN_MODE_ACTIVE or CONFIG_SCAN_MODE_PASSIVE"
53#endif
54
62
63#define BRDCAST_ID_NOT_USED (BT_AUDIO_BROADCAST_ID_MAX + 1)
64
71void bt_mgmt_set_size_filled_get(uint8_t *num_filled);
72
79void bt_mgmt_scan_sirk_set(uint8_t const *const sirk);
80
93int bt_mgmt_adv_buffer_put(struct bt_data *const adv_buf, uint32_t *index, size_t adv_buf_vacant,
94 size_t data_len, uint8_t type, void *data);
95
119int bt_mgmt_scan_start(uint16_t scan_intvl, uint16_t scan_win, enum bt_mgmt_scan_type type,
120 char const *const name, uint32_t brdcast_id);
121
130int bt_mgmt_manufacturer_uuid_populate(struct net_buf_simple *uuid_buf, uint16_t company_id);
131
141int bt_mgmt_per_adv_stop(uint8_t ext_adv_index);
142
148int bt_mgmt_ext_adv_stop(uint8_t ext_adv_index);
149
166int bt_mgmt_adv_start(uint8_t ext_adv_index, const struct bt_data *ext_adv, size_t ext_adv_size,
167 const struct bt_data *per_adv, size_t per_adv_size, bool connectable);
168
174void bt_mgmt_num_conn_get(uint8_t *num_conn);
175
182
187
193void bt_mgmt_broadcast_code_ptr_get(uint8_t **broadcast_code_ptr);
194
202int bt_mgmt_pa_sync_delete(struct bt_le_per_adv_sync *pa_sync);
203
213int bt_mgmt_conn_disconnect(struct bt_conn *conn, uint8_t reason);
214
220int bt_mgmt_init(void);
221
226#endif /* _BT_MGMT_H_ */
int bt_mgmt_pa_sync_delete(struct bt_le_per_adv_sync *pa_sync)
Delete a periodic advertisement sync.
int bt_mgmt_conn_disconnect(struct bt_conn *conn, uint8_t reason)
Disconnect from a remote device or cancel the pending connection.
int bt_mgmt_scan_start(uint16_t scan_intvl, uint16_t scan_win, enum bt_mgmt_scan_type type, char const *const name, uint32_t brdcast_id)
Start scanning for advertisements.
void bt_mgmt_broadcast_code_ptr_get(uint8_t **broadcast_code_ptr)
Get the pointer to broadcast code.
void bt_mgmt_set_size_filled_get(uint8_t *num_filled)
Get the numbers of connected members of a given 'Set Identity Resolving Key' (SIRK)....
int bt_mgmt_manufacturer_uuid_populate(struct net_buf_simple *uuid_buf, uint16_t company_id)
Add manufacturer ID UUID to the advertisement packet.
int bt_mgmt_per_adv_stop(uint8_t ext_adv_index)
Stop periodic advertising.
void bt_mgmt_scan_sirk_set(uint8_t const *const sirk)
Set 'Set Identity Resolving Key' (SIRK). Used for searching for other member of the same set.
void bt_mgmt_num_conn_get(uint8_t *num_conn)
Get the number of active connections.
bt_mgmt_scan_type
Bluetooth management scan type enumeration.
Definition bt_mgmt.h:58
@ BT_MGMT_SCAN_TYPE_BROADCAST
Definition bt_mgmt.h:60
@ BT_MGMT_SCAN_TYPE_CONN
Definition bt_mgmt.h:59
int bt_mgmt_init(void)
Initialize the Bluetooth management module.
int bt_mgmt_ext_adv_stop(uint8_t ext_adv_index)
Stop extended advertising.
int bt_mgmt_adv_start(uint8_t ext_adv_index, const struct bt_data *ext_adv, size_t ext_adv_size, const struct bt_data *per_adv, size_t per_adv_size, bool connectable)
Create and start advertising for an ACL connection.
void bt_mgmt_scan_delegator_init(void)
Scan delegator feature initialization.
int bt_mgmt_bonding_clear(void)
Clear all bonded devices.
int bt_mgmt_adv_buffer_put(struct bt_data *const adv_buf, uint32_t *index, size_t adv_buf_vacant, size_t data_len, uint8_t type, void *data)
Load advertising data into an advertising buffer.