NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
OMAP Wireless Connectivity Bluetooth GUI
Contents
Introduction[edit]
The Bluetooth Demo is an application written in Qt designed to test some Bluetooth capabilities on TI boards. The main features are:
- Scanning and showing Bluetooth devices and their capabilities.
- Streaming audio for Bluetooth devices (speakers, headphones, …)
- To test Bluetooth keyboards and mices.
The other technologies used in this application are: BlueZ, obex-data-server and dbus.
Using the Bluetooth Demo[edit]
Main View[edit]
When you start the BT_Demo for the very first time, the application should look like the image below.
After the application is launched it automatically starts scanning for Bluetooth devices. When it receives the signal DeviceFound (from BlueZ) the device is appended into the list, but this signal does not send all information of the device at the first moment, like name. So initially the device is shown using just the address and as soon as it receives the other informations, the item in the list is updated, as you can see in the next image.
In the image below the parts that compose the view are enumerated.
- An icon showing the kind of the device (input, audio, cell phone, …).
- The profiles implemented by the device.
- This icon indicates whether the device is paired (green) or not (red).
- A device not paired.
- This button has two functions, start/stop the device scanning. When the label is showing "Stop scan", it means the application is scanning (the scan time is 60 seconds, after that the application stops scanning and the label is changed) and if it is clicked the scanning is stopped immediately.
- Start listen SPP.
- Quit the application without killing bluetoothd nor removing the Bluetooth driver.
- Quit and kill the bluetoothd and remove the device driver.
Important thing to consider in this view[edit]
Once a device has been paired it always appears as soon as the application is launched, it happens because the device is known by the Bluetooth adapter (it can easily be checked in /var/lib/Bluetooth/<adpater_address>/*). This is expected behavior and can be verified in other Bluetooth applications as well (gnome-Bluetooth, blueman, …).
Pairing a device[edit]
When a device which is not paired (the right icon with red) is clicked the images below should appear.
The Device View[edit]
When a paired device is clicked the application should look like the next image
Only the tests which can be handled by the device are enabled.
The HID View[edit]
Provides support for devices such as mice, joysticks, keyboards. Bluetooth HID is a lightweight wrapper of the Human Interface Device protocol defined for USB. The use of the HID protocol simplifies host implementation by enabling the re-use of some of the existing support for USB HID to also support Bluetooth HID.
Hardware Setup[edit]
To run this demo you need a Bluetooth HID device like Bluetooth mouse or Bluetooth keyboard that support the BT HID profile
The HID test should look like the image below
It's important to say that there is a well known bug with this profile in the kernel. Once a HID device has been disconnected it cannot be used anymore.
Activating Bluetooth Mouse[edit]
Before activating the bluetooth mouse we need to make a special export in order for the Bluetooth mouse to work properly:
- On EVM, edit the file: /etc/init.d/matrix-gui-2.0
- Replace the line export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0 with export QWS_MOUSE_PROTO="Tslib:/dev/input/touchscreen0 Auto"
- Save and reboot
Please note that with the export above, you now will need to press double click on the touch screen icons instead of single click.
Now you may test the bluetooth mouse (HID Test).
In order to go back to the previous behavior, once you finish the Bluetooth mouse test do the following:
- On EVM, edit the file: /etc/init.d/matrix-gui-2.0
- Replace the line export QWS_MOUSE_PROTO="Tslib:/dev/input/touchscreen0 Auto" with export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0
- Save and reboot
HID Mouse Use Case[edit]
In this use case we would like to test the HID on a Bluetooth mouse device.
As stated earlier, we need to make a special export when working with Bluetooth mouse device. We do it as follows:
- On EVM, edit the file: /etc/init.d/matrix-gui-2.0
To Enable both Mouse and touchscreen simultaneously: Replace
export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0
with
export QWS_MOUSE_PROTO="Tslib:/dev/input/touchscreen0 Auto"
- Save and reboot
for more information access the link: <Mouse with Matrix>
Now we locate the mouse in the Bluetooth device list. In our case the mouse device name is Logitech MX Revolution Mouse
Once we click on it, the pairing process starts. This is because the device is not paired yet.
The pairing process prompts for the PIN code. In our case it is four zeros.
We enter the four zeros using the virtual keyboard as shown below:
Once the pairing is successful, we will get a message notification as follows:
- now Press the Done button
- In order to enter test mode, click on the Logitech MX Revolution Mouse device again. and now the capabilities menu of the device will show up the HID option.
- Choose the HID Test as shown below:
Click/press on “HID Test” (highest) button to start HID test. And press “connect” button on a Bluetooth mouse at the same time. The following screen will be displayed:
And right after this the HID test screen will be opened:
At this point, we should be able to move the mouse cursor using the Bluetooth mouse device.
After quitting the test, we need to reset the modified export as follows:
- On EVM, edit the file: /etc/init.d/matrix-gui-2.0
- Replace the line export QWS_MOUSE_PROTO="Tslib:/dev/input/touchscreen0 Auto" with export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0
- Save and reboot
HID Keyboard Use Case[edit]
In this use case we would like to test the HID on a Bluetooth keyboard device.
We locate the keyboard in the Bluetooth device list. In our case the mouse device name is Microsoft Keyboard
Once we click on it, the pairing process starts. This is because the device is not paired yet.
The pairing process prompts for the PIN code. In our case it is four zeros.
We enter the four zeros using the virtual keyboard as shown below:
Once the pairing is successful, we will get a message notification as follows:
We now press the Done button, and then click on the Microsoft Keyboard device again. We now enter the capabilities menu of the device.
We choose the HID Test as shown below:
Following is the screen we see when choosing the HID Test and typing some text using the Bluetooth keyboard:
Note: Sometime it takes up to 1 minute delay till the typing is possible
The Audio View[edit]
The Advanced Audio Distribution Profile (A2DP) is a Bluetooth profile that allows for the wireless transmission of stereo audio from an A2DP source (typically a phone or computer) to an A2DP Sink (a set of Bluetooth headphones or stereo system).
The EVM can have the role of Source or Sink.
A2DP Source Hardware Setup[edit]
To run this demo, you need a set of stereo BT Headphones (such as the Motorola MOTOROKR S9-HD, or any other headset that supports the BT A2DP profile).
The A2DP test should look like the image below
Just select a wav file (this is the only kind of files enabled) and then click in the play button, the audio then will start to play on device. To stop the audio, just click the stop or done button.
A2DP Source Use Case[edit]
In this use case, we will connect to a Bluetooth headset and listen to music using the Bluetooth GUI application.
In the main screen, we can see our device which is the Samsung SBH500.
Once we click on it, the pairing process starts. This is because the device is not paired yet.
The pairing process prompts for the PIN code. In our case it is four zeros.
We enter the four zeros using the virtual keyboard as shown below:
Once the pairing is successful, we will get a message notification as follows:
We now press the Done button, and then click on the Samsung SBH500 device again. We now enter the capabilities menu of the device.
We choose the A2DP Test as shown below:
Playing Music[edit]
When selecting the A2DP, we will have to select a WAV file to listen to. We navigate to the WAV file which is found in our example under:
/usr/share/wl1271-demos/bluetooth/gallery/Pop.wav
We select the file and then click on the play button to start listening to music.
A2DP Sink Hardware Setup[edit]
To run this demo, you need the following components:
- Two EVM's
- USB hub with external power supply. The USB hub should be connected to the EVM's USB entry.
- External USB sound card which can convert from USB plug to audio out plug. The USB external sound card should be connected to the USB hub.
- Headset, which will be connected to the external USB sound card
A2DP Sink Use Case[edit]
In this use case, we will connect to a two EVM's, where one will have the Source role, and the other will have Sink role.
The EVM's we have are:
- AM335x, which will be the Source
- AM37x, which will be the Sink
First of all, we pair the EVM's as shown below:
Once we click on the a37x-evm, the pairing starts automatically. All we need to do is to confirm the Pass key:
We go now to the Sink EVM (am37x-evm) and press on the am335x-evm (which is green since it is paired):
When we tap on the am335x-evm device we will have the following screen:
You can see now a test called A2DP Sink, when clicking on the test we will have a "Connecting..." screen for a few seconds, followed by the screen:
We are ready now to listen to incoming music from the Source. This is done by going to the am335x-evm, choosing the am37x-evm (Sink) and perform the procedure of Playing Music
You may change the Volume scroll bar value to change the Volume on the A2DP Sink device.
The SPP View[edit]
This profile emulates a serial cable to provide a simple substitute for existing RS-232, including the familiar control signals. The SPP test is pretty simple, it is an application designed to send and receive messages. When you click on it, you will wait that other device connect and send messages for you (when you are the listener, you just receive, you cannot send any message).
We can perform this demo in two ways:
EVM to EVM[edit]
Hardware Setup[edit]
To perform this demo, we'll need
- Two EVMs: One EVM will register for the SPP service while the other EVM will connect to it and send data
- USB Keyboard for typing messages to be sent via SPP
- USB hub with external power supply in order to supply sufficient power for the USB keyboard
First step would be pairing the EVMs via the BT GUI application as show below:
Assuming we want to connect to am37x-evm in the list, once we click on the a37x-evm, the pairing starts automatically. All we need to do is to confirm the Pass key:
Now that we have the EVMs paired, we click on "Listen SPP" button(second button from the left) on the first EVM as shown below:
Once we do it, we will see the SPP Listen screen:
Now the first EVM is ready to receive SPP data transfer.
On the second EVM, we choose the first EVM from the list and click on "SPP Test" button:
The following screen will be opened:
Now, we are ready to send a text message: assume we type (using the connected keyboard) the word "hi", followed by "Enter" on the second EVM, then the word will appear in the first EVM as follows:
PC to EVM[edit]
Hardware Setup[edit]
To perform this demo, you need a PC with bluetooth support or with Bluetooth dongle. Also, make sure that Bluetooth in your laptop is configured to be discoverable or "available to be searched". This may require changing the security level settings on the PC Bluetooth Connection Manager.
NOTE
- The description here refers to the EVM side and not to the PC side. This is because the PC can have different SPP clients and the configuration depends on the client.
- It's up to the user to configure the SPP on the PC side.
First step would be pairing the EVMs via the BT GUI application as show below:
Assuming we wan tot connect to moosa-laptop in the list, once we click on the moosa-laptop, the pairing starts automatically. All we need to do is to confirm the Pass key:
Incoming SPP Data[edit]
If we want the EVM to listen to incoming SPP data, we click on "Listen SPP" button(second button from the left) on the first EVM as shown below:
The SPP test should look like the image below
The PC Bluetooth client should establish an SPP connection to the EVM. Once the connection is established, you can send text via the PC Bluetooth client to the EVM.
The text should appear on the EVM once it is sent from the PC.
Sending Data to PC[edit]
If we want the EVM to send data via SPP, we choose the PC from the devices list and click on "SPP Test" button:
The following screen will be opened:
Now, we are ready to send a text message to the PC by typing the text followed by the "Enter" key.