13#include "BluetoothA2DPSink.h"
14#include "BluetoothA2DPSource.h"
109 cfg.
name=
"[Unknown]";
146 LOGE(
"a2dp_buffer resize failed");
152 LOGI(
"Using StartOnConnect")
158 LOGI(
"Starting a2dp_source...");
170 LOGD(
"waiting for connection");
173 LOGI(
"a2dp_source is connected...");
178 LOGI(
"a2dp_source started without connecting");
184 LOGI(
"Starting a2dp_sink...");
194 LOGD(
"waiting for connection");
197 LOGI(
"a2dp_sink is connected...");
200 LOGI(
"a2dp_sink started without connection");
206 LOGE(
"Undefined mode: %d", cfg.
mode);
214 if (
a2dp !=
nullptr) {
238 size_t write(
const uint8_t* data,
size_t len)
override {
254 LOGD(
"Waiting for buffer: writing %d > available %d", (
int) len, (
int) free);
256 timeout -= wait_time;
257 if (timeout <= 0)
return 0;
266 LOGD(
"write %d -> %d", len, result);
277 LOGW(
"readBytes failed because !is_a2dp_active");
280 LOGD(
"readBytes %d", len);
282 LOGI(
"readBytes %d->%d", len,result);
332 BluetoothA2DPCommon *
a2dp=
nullptr;
337 LOGW(
"found Device: %s rssi: %d", ssid, rssi);
348 LOGW(
"==> state: %s", self->
a2dp->to_str(state));
354 int32_t result_len = 0;
355 if (data ==
nullptr || len == 0)
return 0;
374 memset(data, 0, len);
377 int16_t *data16 = (int16_t*)data;
378 for (
int j=0;j<len/4;j+=2){
379 data16[j+1] = data16[j] = (rand() % 50) - 25;
389 LOGD(
"a2dp_stream_source_sound_data: %d -> %d", len, result_len);
397 LOGD(
"a2dp_stream_sink_sound_data %d -> %d", len, result_len);
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define TRACED()
Definition AudioLoggerIDF.h:31
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
#define portMAX_DELAY
Definition QueueZephyr.h:14
#define assert(T)
Definition avr.h:10
RxTxMode
The Microcontroller is the Audio Source (TX_MODE) or Audio Sink (RX_MODE). RXTX_MODE is Source and Si...
Definition AudioTypes.h:26
@ TX_MODE
Definition AudioTypes.h:26
@ RX_MODE
Definition AudioTypes.h:26