0
votes

I'm trying to make my own bluetooth speaker with some add-ons. My Sony android phone will act as source and a raspberry pi with an usb bluetooth dongle is being the sink.

I already have my bluetooth dongle set up with the A2DP profile and a loopback script is running to link the incoming audio to the connected soundcard.

Next, i want to add some functionality with reading/writing variables and send commands to the raspberry pi over the same bluetooth connection with the RFCOMM profile.

when i open and RFCOMM connection with "sdptool add sp" followed by "sudo rfcomm listen hci0" and try to connect with my phone with an android bluetooth emulator, the emulator says the connection has been opened. After that, the emulator immediately says that the connection has been closed. The raspberry pi doesn't even notice the connection being opened or being closed.

I already read this article which notes my goal is possible, the only question for me is how.

So my question is:

Am I able to use an already paired bluetooth connection for both the A2DP and the RFCOMM profile and how do i have to set my settings with HCI.

If anyone has alternatives to send commands over a socket like connection to my raspberry pi, i certainly would like to try them.

----EDIT----

So last weekend i gave it another try to solve my bluetooth issue. I first tried to set up the RFCOMM connection from the command line and it worked like expected.

Next i disconnected, set the bluetooth profile to 0x20041C (portable audio) and set up the RRCOMM connection again. I don't quite what went wrong last time i tried, but this time it just worked. I even was able to link my android phone as audio source to my usb soundcard with pulseaudio.

So, question solved, i guess.

1

1 Answers

0
votes

Yes, Bluetooth communication is Profile based, you can use many profiles at the same time, I did it with an IPhone and a PandaBoard, Profiles: A2DP (iPhone source, Panda Sink) PBA (iPhone server, Panda client) HFP and MAP, I suggest to try with blueZ, there is a good documented stack in the official web site.

Good luck!