2

I use Qt 5.4 for Windows and I'm trying to write a basic desktop program. I've tried all the examples for bluetooth bundled with Qt. (Scanning, chat, qml scanning...)

None of them works. I've researched about that and many says "Compile with Dbus enabled". I've searched how to compile with dbus enabled but all of the advice I've found are too complicated for me. I couldn't find an exact solution.

I've added some codes to my .pro file like:

CONFIG+=enable-qdbus
#Default to building glib-dbus based connection
!disable-dbus {
    enable-qdbus {
        CONFIG += qdbus-dbus-connection
    } else {
        CONFIG += glib-dbus-connection
    }
}

CONFIG += config_bluez

None worked. How can i compile with dbus enable? What is my mistake?

Nikko
  • 4,182
  • 1
  • 26
  • 44
user22165
  • 21
  • 1
  • 2
    As stated in the [documentation](http://doc.qt.io/qt-5/qtbluetooth-index.html): "Currently the API is supported on Android, BlackBerry 10 and Linux (BlueZ 4.x/5.x)". So, no BT on Windows. – BaCaRoZzo Dec 23 '14 at 16:10
  • oh how i couldnt see that. What a lazy search! Thanks Nikko. – user22165 Dec 23 '14 at 19:52
  • I need an answer too. When i cross compiled it for Android from Windows, Can i use Bluetooth Libraries? or Examples work on android well if i cross compile them from windows platform? – user22165 Dec 23 '14 at 19:59
  • 1
    AFAIK, the advices you have found are for generic Linux distros. Bluetooth should work out of the box on Android. Just download [this](http://download.qt-project.org/official_releases/qt/5.4/5.4.0/qt-opensource-windows-x86-android-5.4.0.exe) version or add it via the "maintainace tool" located into Qt installation dir. If you choose the second option: (1) start maintainance tool, (2) select "package manager" click "setting", (3) add (http://download.qt.io/online/qt5/windows/x86_android/online_repository/), (4) click ok, (5) click "next", (6) select "android armv7". That's it for installation. – BaCaRoZzo Dec 23 '14 at 20:47
  • @BaCaRoZzo I am stuck with the same problem and I am building on Ubuntu 4.04. The 'Scan' button on scan demo is disabled. Should the bluetooth demos just work out of the box? But mine don't! Any tips? – zar Oct 26 '15 at 20:53
  • @zadane are you building for Android or for Linux target? I didn't get it, sorry. In the latter case, it is not so obvious that bluetooth works out of the box. :D You should check Bluez version w.r.t. Qt version and also Bluez and dbus status. Have a look at [this](http://lists.qt-project.org/pipermail/interest/2015-July/017586.html) and [this](http://lists.qt-project.org/pipermail/interest/2014-September/013598.html). If you are building for Android...it should work. To tell you the truth, I've used Android Java code when I had to talk to a BT device on Android. :-/ – BaCaRoZzo Oct 26 '15 at 21:46
  • @BaCaRoZzo I am building for Linux. I do see dbus in google search but I not sure how that come into play. The bluetooth scanner demo doesn't use it. It seems like that's the 2nd way of working with it but I don't know how to wire things up with Bluez for linux. I have asked my question here http://askubuntu.com/questions/690290/how-to-setup-qt-to-use-bluez-bluetooth-stack and don't see too many experts with this. – zar Oct 27 '15 at 01:36
  • @zadane unfortunately I'm neither an expert on that nor I had to become one at the time. My advice is to ask for help in the [Qt interest list](http://lists.qt-project.org/mailman/listinfo/interest). The very same I've linked above. There are several developers reading the questions and they can surely help more than so called "expert". I'm sorry but I cannot be more helpful than that. :-/ – BaCaRoZzo Oct 27 '15 at 01:52
  • 1
    @BaCaRoZzo I had not found anyone who had even commented so I just wanted to chat with you since you had worked it, I really appreciate it. Thanks – zar Oct 27 '15 at 13:38

0 Answers0