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

QLowEnergyController::connected not emitted on central connection

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9.0 RC
    • 5.7.0
    • None
    • bluez (5.43) QT (5.7.0) linux kernel (4.4.6)

    Description

      Using the QT Bluetooth BLE support in peripheral mode, I connect the QLowEnergyController::connected SIGNAL to a SLOT. Upon connecting to the peripheral, the connect SIGNAL is not emitted. However the disconnected SIGNAL is emitted upon disconnection of the connected device.

      Enabling logging thru : QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));

      In the logs I can see:

      Mar 27 12:47:22 worxim wxConfig[14933]: qt.bluetooth.bluez: HCI event triggered, type: 3e
      Mar 27 12:47:22 worxim wxConfig[14933]: qt.bluetooth.bluez: received connection complete event, handle: 1025
      Mar 27 12:47:22 worxim wxConfig[14933]: qt.bluetooth.bluez: GATT connection from device "B8:E8:56:31:99:73"
      Mar 27 12:47:23 worxim wxConfig[14933]: qt.bluetooth.bluez: No settings found for peer device.

      What could be inhibiting connected from being emitted?

      Here is part of the relevant code setting up the QLowEnergyController:
      //! [Start Advertising]
      const QScopedPointer<QLowEnergyController> leController(QLowEnergyController::createPeripheral());
      QSharedPointer<QLowEnergyService> service(leController->addService(serviceData));

      leController->addService(deviceInfoServiceData);
      leController->setRemoteAddressType(QLowEnergyController::RandomAddress);
      leController->startAdvertising(QLowEnergyAdvertisingParameters(), advertisingData, scanResponseData);
      //! [Start Advertising]

      // This Lambda will be called after a BLE client has disconnected to allow us to restart advertising of our services and characteristics.
      auto reconnect = [&leController, advertisingData, scanResponseData]()

      { leController->startAdvertising(QLowEnergyAdvertisingParameters(), advertisingData, scanResponseData); }

      ;
      auto ClientConnected = [&leController]()

      { qInfo() << "Client Connecting : " << leController->remoteAddress(); }

      ;

      QObject::connect(leController.data(), &QLowEnergyController::connected, ClientConnected);

      Attachments

        For Gerrit Dashboard: QTBUG-59754
        # Subject Branch Project Status CR V

        Activity

          People

            ablasche Alex Blasche
            jgadoury Jean-Francois Gadoury
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes