Bluetooth Stack
btstack implements
A2DP and SDP on top of L2CAP. The program communicates with a USB Bluetooth
dongle using libusb. It sends HCI (host controller interface) commands and
data as USB packets and receives the responses in the same way. This package
contains two programs. One of them is the Bluetooth device daemon, which
handles all connections to a given USB Bluetooth device. The other is an
MP3 player which connects to the daemon and handles the A2DP stuff, as well
as selecting the target Bluetooth speaker etc.
Here is the package:
This contains
many external dependencies as well, such as db, libusb etc.
It's best to run this using the bundled script. There are several environment
variables which must be set for it to work properly. There are no in-program
settings, although I was planning to add some. I stopped working on it after
I got my boombox working.
One of the settings not mentioned in the README file is the address of the
target Bluetooth speaker. In order to find out this address, you need to
configure the rest of the system and turn on debugging. When you first
try to use the program, it will send out some query packets to discover
what's available nearby. Your speaker/headphone will reply to these enquiries
and the program will print its address when that happens. You then just
need to copy/paste that address into the appropriate environment var.
The program has several shortcomings. First of all, it doesn't
properly shutdown neither the connection nor the Bluetooth dongle. Therefore,
you need to pair your speaker with the dongle every time you use it. You
don't have to do anything special for this. Just turn on your speaker in
pairing mode before using it.
Another consequence is that, when either the speaker or the dongle gets
stalled for some reason, the system can't handle that gracefully. The only
thing to do in this case is the following:
- Turn off the speaker.
- Plug the dongle out.
- Kill the two processes created by the script. The GUI can be shutdown
from the window. The daemon must be killed manually. I believe it's
called something like usb-player.
After that, you need to plug the dongle in and then turn on the speaker
before you start the program again.
I tried to follow the Bluetooth specs as much as possible, but I had to
leave out quite a bit. One thing not mentioned in the Bluetooth A2DP
specification is the following: After you have made a control connection
for A2DP with the remote device, you need to open a second connection
on the same port (0x90?? I don't remember) in order to send audio data.
This is not mentioned in the specs and can be found only on Internet forums.
If I can fix the shutdown problem and make a saner event system, the
program is in fact quite decent. It could be useful for more stuff
like Bluetooth keyboards etc. I wonder if BSD guys need some Bluetooth
speaker support..
Links
The first link is to a project also called btstack, but it's not mine. We got
the same name by coincidence.
- btstack - A Portable User-Space Bluetooth Stack - Google Project Hosting
- lwalkera/lwBT · GitHub
- A fork of the lwBT stack. Contribute to lwBT development by creating an account on GitHub.
- Headset Profile
- Bluetooth Tutorial - K6 - Headset Profile
- how to Control arduino by bluetooth from (PC, pocket PC PDA)
- I wanted to make it possible to control an arduino board from my phone.So that I could control other devices.the easiest way seemed to be using blueto...
- How Ubuntu’s broken bluetooth support came to be | Benny's Blog
- Architecture - btstack - Describes the overall architecture and how clients interact with the stack. - A Portable User-Space Bluetooth Stack - Google Project Hosting
- / - smalltooth - Open source Bluetooth stack for embedded devices. - Google Project Hosting
- Programming an embedded Bluetooth stack - 3 | GWeb
- SDP Layer Tutorial
- ObexPushD - Home - Open wiki - Gitorious
- Sub-Band Coding
- draft-ietf-payload-rtp-sbc-05 - RTP Payload Format for Bluetooth\x27s SBC Audio Codec
- Doxygen Trac – OpenOBEX
- Modifying the HC-05 Bluetooth module defaults using AT commands
- The HC-05, a Bluetooth to serial bridge, can be found for around $5 on the internet and therefore may be the cheapest way to add Bluetooth connectivity to your project. However, its default settings may need to be changed depending on your application.
- How to setup Bluetooth - ThinkWiki
- Data transfer between Android and Arduino via Bluetooth
- Data transfer between Android and Arduino via Bluetooth.