Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Bluetooth in Linux non-functional? (was: "Connect to Bluetooth device using RFCOMM")
Forum Updated to NodeBB v4.3 + New Features

Qt Bluetooth in Linux non-functional? (was: "Connect to Bluetooth device using RFCOMM")

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    A1exander_Z
    wrote on 17 Apr 2014, 11:08 last edited by
    #1

    I am trying to connect via Bluetooth to a custom device supporting RFCOMM. The system is Debian Testing running in a virtual machine (VMWare Workstation) and I thought about using the same code for Android in the upcoming Qt 5.3 (currently I am using Qt 5.2.1). The device is known to be working - there is a Windows program (written using InTheHand Bluetooth library) which is able to exchange data with it.

    The device itself can be discovered using QBluetoothDeviceDiscoveryAgent and corresponding QBluetoothDeviceInfo object can be obtained. However, service discovery does not work. I have tried to use QBluetoothServiceDiscoveryAgent myself and have also run BTScanner example - there are no listed services. At the same time, when I run 'bluez-test-device discover <device ID>' command from terminal, it correctly lists all services. Sometimes BTScanner correctly finds Bluetooth services provided by my phone, but not always.

    Since I have no QBluetoothServiceInfo object for the RFCOMM service of the device, but I know its UUID (from both Windows program and the output of bluez-test-device command), I have tried to create a socket in the following way:

    @QBluetoothSocket* socket =
    new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
    connect(socket, SIGNAL(connected()), this, SLOT(connected()));
    connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)),
    this, SLOT(error(QBluetoothSocket::SocketError)));
    socket->connectToService(device.address(),
    QBluetoothUuid(QString("00001101-0000-1000-8000-00805f9b34fb")));@

    The slots are the following:

    @void BluetoothDiscoverer::connected()
    {
    qDebug() << "Connection established";
    }

    void BluetoothDiscoverer::error(QBluetoothSocket::SocketError e)
    {
    qDebug() << e;
    }@

    As a result, the error slot is called, producing the following output: QBluetoothSocket::ServiceNotFoundError.

    I can only conclude that QBluetoothServiceDiscoveryAgent and QBluetoothSocket in the Linux version of Qt do not work.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      A1exander_Z
      wrote on 18 Apr 2014, 05:43 last edited by
      #2

      Since there were no replies to my original post and I have done some additional research, with somewhat surprising results, I have updated both its header and text.

      1 Reply Last reply
      0
      • U Offline
        U Offline
        uusitalo
        wrote on 18 Apr 2014, 13:12 last edited by
        #3

        Did you get bluetooth working?
        Could you share sources with me, im trying to make simple bluetooth program to connect arduino and display data from it

        1 Reply Last reply
        0
        • A Offline
          A Offline
          A1exander_Z
          wrote on 18 Apr 2014, 13:32 last edited by
          #4

          Unfortunately, I made no further progress. My code, except for the attempt to create QBluetoothSocket (described in my first post), is based on the Bluetooth Scanner example available in Qt 5.2. But even the example program itself is not working properly (it cannot discover any services on my device), so I am out of ideas.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 18 Apr 2014, 20:49 last edited by
            #5

            Hi,

            You should bring this on the interest mailing list. You'll find there Qt's developers/maintainers (this forum is more user oriented)

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            1/5

            17 Apr 2014, 11:08

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved