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

QBluetoothDeviceInfo::isCached() always returns true on Windows

XMLWordPrintable

    • Windows
    • 3
    • 42b3dd064 (dev), 88790da2d (6.10), d2afe045d (tqtc/lts-6.8)
    • Foundation Sprint 140

      On Windows,  QBluetoothDeviceInfo::isCached()  always reports true for all discovered BLE devices, including those actively advertising and not known to the system. This makes it impossible to distinguish cached devices from live ones.

      #include <QtCore>
      #include <QtBluetooth>
      
      int main(int argc, char *argv[]) {
          QCoreApplication app(argc, argv);
          QTextStream out(stdout);
          QBluetoothDeviceDiscoveryAgent agent;
          agent.setLowEnergyDiscoveryTimeout(6000);
          auto show = [&](QString tag, const QBluetoothDeviceInfo &info) {
              auto id = info.address().isNull() ? info.deviceUuid().toString()
                                                : info.address().toString();
              out << tag << " " << info.name() << " [" << id
                  << "] isCached=" << info.isCached()
                  << " rssi=" << info.rssi() << "\n";
          };
          QObject::connect(&agent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered,
                           [&](auto info){ show("DISC", info); });
          QObject::connect(&agent, &QBluetoothDeviceDiscoveryAgent::deviceUpdated,
                           [&](auto info, auto){ show("UPDT", info); });
          QObject::connect(&agent, &QBluetoothDeviceDiscoveryAgent::finished,
                           [&]{ out << "FINISHED\n"; app.quit(); });
          agent.start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
          return app.exec();
      }
      
      • Devices found during the current scan should return false
      • Only devices coming from the system’s cache should return true

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

            ivan.solovev Ivan Solovev
            irfan.omair@digia.com Irfan Omair
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes