21#include "esp_a2dp_api.h"
22#include "esp_gap_bt_api.h"
93#define BLUETOOTH_MAX_DEVICES 16
98 char name[ESP_BT_GAP_MAX_BDNAME_LEN + 1];
219 char name[ESP_BT_GAP_MAX_BDNAME_LEN + 1];
223#define BLUETOOTH_MAX_KNOWN 8
bool bluetooth_volume_acked(void)
Report whether the speaker has confirmed the most recent absolute-volume set.
Definition bluetooth.c:804
esp_err_t bluetooth_scan_start(void)
Start an inquiry that collects nearby devices into a list (does not auto-connect).
Definition bluetooth.c:626
esp_err_t bluetooth_init(void)
Bring up the Bluetooth stack in A2DP source mode.
Definition bluetooth.c:462
esp_err_t bluetooth_connect(const esp_bd_addr_t bda)
Connect the A2DP source to a device chosen by address (e.g. a scan result).
Definition bluetooth.c:666
size_t bluetooth_get_devices(bluetooth_device_t *out, size_t cap)
Copy the current scan results into out (thread-safe snapshot).
Definition bluetooth.c:656
bool bluetooth_is_scanning(void)
Report whether an inquiry is currently running.
Definition bluetooth.c:646
void bluetooth_set_last_device(const bt_known_device_t *dev)
Remember a device as the most-recent one and persist it to NVS.
Definition bluetooth.c:731
size_t bluetooth_get_known_devices(bt_known_device_t *out, size_t cap)
Copy the persisted list of known (paired) devices into out, most-recent-first.
Definition bluetooth.c:711
esp_err_t bluetooth_set_absolute_volume(uint8_t volume)
Set the connected speaker's absolute volume over AVRCP (controller role).
Definition bluetooth.c:788
esp_err_t bluetooth_forget_device(const esp_bd_addr_t bda)
Forget a known device: drop it from the persisted list and remove its bond from NVS.
Definition bluetooth.c:753
bool bluetooth_is_connected(void)
Report whether an A2DP source connection is currently established.
Definition bluetooth.c:701
bool bluetooth_get_last_device(bt_known_device_t *out)
Read the last successfully connected device (the one to offer for quick reconnect).
Definition bluetooth.c:721
bool bluetooth_is_powered(void)
Report whether the radio (controller + Bluedroid) is currently powered up.
Definition bluetooth.c:651
void bluetooth_set_auto_shutdown(bool enable)
Enable/disable the automatic radio power-down when the A2DP link drops.
Definition bluetooth.c:621
esp_err_t bluetooth_scan_stop(void)
Stop an inquiry started by bluetooth_scan_start(). No-op if not scanning.
Definition bluetooth.c:639
bool bluetooth_is_avrc_connected(void)
Report whether the AVRCP control channel is established.
Definition bluetooth.c:799
esp_err_t bluetooth_connect_by_name(const char *name_substr)
TEST ONLY — scan and connect to the first device whose name contains name_substr.
Definition bluetooth.c:684
esp_err_t bluetooth_audio_stop(void)
Suspend the media stream started by bluetooth_audio_start().
Definition bluetooth.c:783
esp_err_t bluetooth_reconnect_last(void)
Reconnect to the remembered device by address, without scanning.
Definition bluetooth.c:741
esp_err_t bluetooth_load_known(void)
Load the persisted known-device list without powering the radio up.
Definition bluetooth.c:426
bluetooth_conn_state_t
Coarse connection state for the UI to render (connecting / connected / failure).
Definition bluetooth.h:193
esp_err_t bluetooth_audio_start(esp_a2d_source_data_cb_t pcm_cb)
Start streaming PCM to the connected sink through the A2DP source data path.
Definition bluetooth.c:772
esp_err_t bluetooth_shutdown(void)
Power the radio down: deinit A2DP/AVRCP, Bluedroid and the BR/EDR controller.
Definition bluetooth.c:577
bluetooth_conn_state_t bluetooth_get_conn_state(void)
Read the current connection state.
Definition bluetooth.c:706
esp_err_t bluetooth_disconnect(void)
Disconnect the current A2DP link, if any.
Definition bluetooth.c:695
@ BLUETOOTH_CONN_IDLE
Definition bluetooth.h:194
@ BLUETOOTH_CONN_FAILED
Definition bluetooth.h:197
@ BLUETOOTH_CONN_CONNECTED
Definition bluetooth.h:196
@ BLUETOOTH_CONN_CONNECTING
Definition bluetooth.h:195
One device found during a scan; the unit the UI lists and selects from.
Definition bluetooth.h:96
int8_t rssi
Definition bluetooth.h:99
esp_bd_addr_t bda
Definition bluetooth.h:97
char name[ESP_BT_GAP_MAX_BDNAME_LEN+1]
Definition bluetooth.h:98
The identity of a remembered device, enough to reconnect without scanning again.
Definition bluetooth.h:217
char name[ESP_BT_GAP_MAX_BDNAME_LEN+1]
Definition bluetooth.h:219
esp_bd_addr_t bda
Definition bluetooth.h:218