A2DPBluetoothSource Connecting / Pairing #1781
-
I use 5 different Bluetooth sound devices, that all work without problems with a smartphone or pc as a source. But only 1 can be used with the A2DPBluetoothSource. Any idea how to connect them? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 3 replies
-
Just activate the logging and compare the logs. |
Beta Was this translation helpful? Give feedback.
-
I am not aware of any such requirement: at least my bluetooth speaker would not have this! But read the documentaton from your Bluetooth Speaker to find the correspnding details. I never recommended to use auto_reconnect = true and it does what it is documented to do: it tries to reconnect to the last device for the specified time period. |
Beta Was this translation helpful? Give feedback.
-
This is always the same procedure, as you probably know: put the device in pairing mode, search it, connect to its name (address), and thats all. I think the Source should maintain a list of sink device names and addresses and tries to connect them by address on each start. With BluetoothA2DP I experienced, that the device must always be in pairing mode to connected again, except when auto_reconnect is true. A look into the code shows that the last address is stored to NVS. |
Beta Was this translation helpful? Give feedback.
-
Maybe your speaker tries to establish the connection by itself?
All devices I have behave the same: they are always reconnected by a phone, pc, tablet what ever automatically (not in pairing mode), when they have been paired before. |
Beta Was this translation helpful? Give feedback.
-
Can you share the log (with the core debug level set to info and with autoreconnect = false)? ps. also make sure that your phone is not automatically connecting and blocking the ESP32 from working |
Beta Was this translation helpful? Give feedback.
-
auto_reconnect = false: auto_reconnect = true: |
Beta Was this translation helpful? Give feedback.
-
My Bluetooth speaker automatically enters into paring mode when switched on and is therefore discoverable (and it announces itself). So I confirm that the speaker must be in pairing mode (or at least in Discoverable mode) to be found and if you want to avoid this you would need to use the auto_reconnect = true: so that is automatically connects to the last device. I have only this one Bluetooth speaker and using the ESP32 as Bluetooth Sink will be be behaving the same way, so no I was not aware of this. |
Beta Was this translation helpful? Give feedback.
-
If someone wants to use this library in an Bluetooth Source project it does not work as users will expect. Nobody wants to put devices in pairing mode to simply connect them (is is sometimes not intuitive but complicated and the only reason to read the documentation). And ist is not unusual, that users have more than one sink paired with a source. Is it - without modifying the A2DPBluetoothSource library - possible to do the logic of maintaining several devices with name / address and connect them by function calls? I took a look at the sources and found connect_to(addr), which possible could do this. In a2dp_source.start(...) one paramater is the data request callback reference. How is this callback passed to the library when using connect_to(addr)? Thanks |
Beta Was this translation helpful? Give feedback.
-
Please read the Design Overivew Wiki which describes how to extend the functionality w/o modifying the source code. |
Beta Was this translation helpful? Give feedback.
Just activate the logging and compare the logs.
You might need to ajust the supported cod service if your speaker reports something very exotic...