Fwd: [Interest] [QtBluetooth] Basic tests

Thiago Macieira thiago at macieira.org
Sun Jun 7 02:11:45 PDT 2015


>From my student, Claudiu.

----------  Forwarded Message  ----------

Subject: [Interest] [QtBluetooth] Basic tests
Date: Sunday 07 June 2015, 08:27:54
From: Claudiu Olteanu <olteanu.claudiu at ymail.com>
To: interest at qt-project.org <interest at qt-project.org>

Hi there,

I did some tests with the new Qt 5.5 release in order to check 
for QtBluetooth API functionalities and if there are any regressions compared 
to 
5.4 version. 

Below you can find the details about the tests and the environment.  

TESTS
  1. Turn on the device.
  2. Turn off the device.
  3. Change the device state (discoverable/connectable)
  4. Scan for remote devices.
  5. Pair with a remote device which doesn't request a specific PIN code.
  6. Unpair from a remote device.
  7. Connect to a remote device using QBluetoothSocket and Serial Port Profile 
service.
  8. Transfer data to the device (some simple commands) using the socket.

PLATFORM
  - OS : openSUSE 13.2 (Harlequin) (x86_64) - KDE
  - Qt versions : Qt 5.4.1 and Qt 5.5.0 (beta)
  - BlueZ versions: 5.23-1.1 and 4.101


I used the following combinations:
  - Qt 5.4.1 and BlueZ 5.23-1.1
  - Qt 5.4.1 and BlueZ 4.101
  - Qt 5.5.0(beta) and BlueZ 5.23-1.1
  - Qt 5.5.0(beta) and BlueZ 4.101
  - Qt 5.5.0(beta) and BlueZ 5.29  -- this was done on a virtual machine with 
a Fedora 22.0


The tests passed on all combinations. I hope this is good 
news for Qt team :-) . 

The only problem I encountered was when I tried to remove 
the BlueZ 5.23-1.1 and to install the BlueZ 4.101 from the sources. 
After the installation, the configuration file  
(/etc/dbus-1/system.d/bluetooth.conf) 
which specifies the required security policies for Bluetooth core daemon 
was missing. This gave me some headaches. 

First I used the one from Bluez4.101 package but the 
Scan test (#4) didn't work. I decided to use the configuration 
file from Bluez 5.30 package and to run the test again. I was a little 
surprised but it worked. 

You can find below the differences between the two files:

claudiu at linux-qpot:~/Downloads/bluez-5.30/src>  diff bluetooth.conf 
../../bluez-4.101/src/bluetooth.conf 
<     <allow send_interface="org.bluez.Agent1"/>
<     <allow send_interface="org.bluez.MediaEndpoint1"/>
<     <allow send_interface="org.bluez.MediaPlayer1"/>
<     <allow send_interface="org.bluez.ThermometerWatcher1"/>
<     <allow send_interface="org.bluez.AlertAgent1"/>
<     <allow send_interface="org.bluez.Profile1"/>
<     <allow send_interface="org.bluez.HeartRateWatcher1"/>
<     <allow send_interface="org.bluez.CyclingSpeedWatcher1"/>
<     <allow send_interface="org.bluez.GattCharacteristic1"/>
<     <allow send_interface="org.bluez.GattDescriptor1"/>
<     <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
<     <allow send_interface="org.freedesktop.DBus.Properties"/>
---
>     <allow send_interface="org.bluez.Agent"/>
>     <allow send_interface="org.bluez.HandsfreeAgent"/>
>     <allow send_interface="org.bluez.MediaEndpoint"/>
>     <allow send_interface="org.bluez.MediaPlayer"/>
>     <allow send_interface="org.bluez.Watcher"/>
>     <allow send_interface="org.bluez.ThermometerWatcher"/>


I added a new policy <allow send_interface="org.bluez.Manager1"/> to Bluez 
4.101 
configuration file and decided to try again. It worked.

For the Scanning test with Bluez.4.101 this error was printed to stderr:
qt.bluetooth.bluez: OrgBluezDeviceInterface* getDevice(const 
QBluetoothAddress&, QBluetoothLocalDevicePrivate*) reply failed 
QDBusError("org.bluez.Error.DoesNotExist", "Does Not Exist")

I don't know why because the remote devices were discovered. 
Maybe something is missing from my Bluetooth configuration file. 

I believe that this is not a problem with the QtBluetooth 
API but it will be easier to debug if I know the dbus policies used.

I hope that you can find this useful.

Have a nice weekend,
Claudiu
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

-----------------------------------------
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center


More information about the subsurface mailing list