AT+BTA2DPSRC

pedroATsms
Posts: 7
Joined: Wed Apr 06, 2022 12:55 am

AT+BTA2DPSRC

Postby pedroATsms » Wed Apr 06, 2022 1:07 am

Hi all,

I am new to Esp32, although I have been working with electronics for many years.

I see that the ESP32 has a AT+BTA2DPSRC command - could someone please tell me what this does, and how to use it?

Thanking you
Pedro

ESP_Sun
Posts: 326
Joined: Thu Dec 30, 2021 9:52 am

Re: AT+BTA2DPSRC

Postby ESP_Sun » Tue Apr 12, 2022 2:37 am

Hi,

The AT+BTA2DPSRC command is to get the music resource and give it to the opposite end. The opposite end can play the music. When using this command, you need to establish a connection with the opposite end.

Hope this helps you.

pedroATsms
Posts: 7
Joined: Wed Apr 06, 2022 12:55 am

Re: AT+BTA2DPSRC

Postby pedroATsms » Tue Apr 12, 2022 2:57 am

Thank you for your reply ESP_Sun.

When you say "opposite end" do you mean BT Sink? Therefore, I assume the AT+BTA2DPSRC command is given to the BT Source end, is that correct?

If the command is:-
AT+BTA2DPSRC=0,"http://somesite/music.mp3"
how does it get the music.mp3? Does it switch to WiFi? Does require Ethernet?

Thanking you
Pedro

ESP_Sun
Posts: 326
Joined: Thu Dec 30, 2021 9:52 am

Re: AT+BTA2DPSRC

Postby ESP_Sun » Tue Apr 12, 2022 3:28 am

Yes, your understanding is absolutely correct. "opposite end" refers to BT Sink. AT+BTA2DPSRC command is used for BT Source. You can read the AT command sequence to use this feature.

Code: Select all

AT+CWMODE=1
AT+CWJAP="MERCURY_2414",""
AT+BTINIT=1
AT+BTA2DPINIT=1
AT+BTA2DPCONN=<conn_index>,<remote_address>
AT+BTA2DPSRC=0,"https://dl.espressif.com/dl/audio/ff-16b-2c-44100hz.mp3"
AT+BTA2DPCTRL=0,1

pedroATsms
Posts: 7
Joined: Wed Apr 06, 2022 12:55 am

Re: AT+BTA2DPSRC

Postby pedroATsms » Tue Apr 12, 2022 3:46 am

Thank you again for your reply ESP_Sun.

That's cool. I'm busy on another project at the minute, but I'm keen to try that out in a couple of days...

Kind regards
Pedro

pedroATsms
Posts: 7
Joined: Wed Apr 06, 2022 12:55 am

Re: AT+BTA2DPSRC

Postby pedroATsms » Wed Apr 13, 2022 3:18 am

Hi ESP_Sun,

I tried the +BTA2DPSRC command as per your example, but if didn't work.

These are the commands I sent:-

AT+CWMODE=1
OK
AT+CWJAP=<ssid>,<pw>
WIFI CONNECTED
WIFI GOT IP
OK
AT+BTINIT=1
OK
AT+BTA2DPINIT=1
OK
AT+BTA2DPCONN=0,<bt address>
OK
+BTA2DPCONN:0,<bt address>
AT+BTA2DPSRC=0,"http://xxx.xxx.xxx.xxx:portnumber/musicfolder/musicfile.mp3"
OK
AT+BTA2DPCTRL=0,1
OK


When I didn't hear anything, I checked my server logs - there was no attempt to contact it for the musicfile.mp3.

Do you have any suggestions on what went wrong?

Is there a command to check the playing progress, or whether it is still playing?

Kind regards
Pedro

Who is online

Users browsing this forum: No registered users and 24 guests