Issue with connecting sink speaker via MAC address #1610
-
Thank you for the awesome library. I used the sink example to create a Bluetooth speaker, and it works well. Furthermore, I am working on a special project. When an NFC chip is tagged with a mobile device, it uses the speaker's MAC address stored in the NFC chip to connect to the speaker via Bluetooth. This connection works well, and the music is transmitted properly. However, immediately after the mobile device and the speaker are connected via Bluetooth, if I try to disconnect the connection from my mobile device, it reconnects automatically. If I disconnect it again from the mobile device, it reconnects once more, and this cycle repeats for a few seconds. After a few seconds, it stops attempting to reconnect and stays disconnected properly. I thought it might be related to the a2dp_sink.set_auto_reconnect setting in the code, so I tried setting it to false or lowering the try_number, but it didn't help, and the same situation occurred in examples. When using the Bluetooth connection interface of the mobile device, this issue does not occur. However, when connecting to the speaker using the MAC address from the mobile device, it seems to keep attempting to connect for a few seconds after the connection is established. I have looked through the discussions, issue category, wiki, documentation, and references to solve this, but I couldn't find any relevant information. Could you please give me a hint on how to resolve this? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I am confused by your description because you do not provide any clear information about which device is doing what with which settings and I don't understand what NFC has to do with this: Your wording of mobile device is also confusing because it can mean the ESP32 sink or a mobile phone. If you do not activate the automatic reconnect of this library, the A2DP sink will not try to reconnnect if the connection is lost. Independently of the functionality of this library your A2DP source might implement some reconnect functionality and from your description I got the feeling that this seems to be your problem. ps. |
Beta Was this translation helpful? Give feedback.
I am confused by your description because you do not provide any clear information about which device is doing what with which settings and I don't understand what NFC has to do with this: Your wording of mobile device is also confusing because it can mean the ESP32 sink or a mobile phone.
If you do not activate the automatic reconnect of this library, the A2DP sink will not try to reconnnect if the connection is lost.
In any case it will never try to reconnect if you disconnect by calling set_connected(false) or disconnect() (even when the automatic reconnect is active)
Independently of the functionality of this library your A2DP source might implement some reconnect functionality and fr…