Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-38624

Bluez4: Service discovery not working

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Not Evaluated
    • 5.3.0 RC1
    • 5.3.0 Beta1
    • None

    Description

      This task originated from the Qt Interest mailing list. The mail was sent by Alexander Zakharov [alexander.v.zakharov@gmail.com]:

      I am trying to connect via Bluetooth to a custom device using RFCOMM.
      The system is Debian Testing running in a virtual machine (VMWare
      Workstation), Qt version is 5.2.1, BlueZ version is 4.101. I hoped to
      write my code under Linux and later use it for Android in the upcoming
      Qt 5.3, but I cannot get it working. The device is known to function
      properly: there is a Windows program (in C#, written using InTheHand
      Bluetooth library) and a Mac OS X program (written using the native
      API), both of which are able to connect to the device and exchange
      data with it. Mac OS X is also running in a virtual machine on the
      same host, so there seems to be no issues with Bluetooth support in
      VMs.

      The device itself can be discovered using
      QBluetoothDeviceDiscoveryAgent and corresponding QBluetoothDeviceInfo
      object can be obtained. However, service discovery in Qt does not work
      for the device. 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.

      Since I have no QBluetoothServiceInfo object for the RFCOMM service of
      the device, but I know its UUID (it is used in both Windows and Mac OS
      X programs and is also printed in 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")));

      As a result, the error slot is called, with
      QBluetoothSocket::ServiceNotFoundError.

      The documentation about Bluetooth in Qt is very scant and I may be
      using QtBluetooth incorrectly, but the case when BTScanner is not
      working while 'bluez-test-device' command does is worrisome. Do you
      have any suggestions?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ablasche Alex Blasche
            ablasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes