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

There is no way to know if a bluetooth adapter is available

XMLWordPrintable

    • Windows, WinRT
    • 8
    • Team 1 Foundation_Sprint 47

      There is apparently no way to check if a bluetooth adapter is present or not.

      All functions below will return "false" even if an adapter is present. I would expect at least one to return "true" when the adapter is present and "false" when it's not. Else, there is no way to inform the end user about bluetooth being available or not.

       

      bool isBluetoothAvailable1()
      {
          return !QBluetoothLocalDevice::allDevices().empty();
      }
      
      bool isBluetoothAvailable2()
      {
          QBluetoothLocalDevice localDevice;
          return localDevice.isValid();
      }
      
      bool isBluetoothAvailable3()
      {
          std::shared_ptr<QLowEnergyController> created( QLowEnergyController::createPeripheral() );
          return created && !created->localAddress().isNull();
      }
      
      bool isBluetoothAvailable4()
      {
          std::shared_ptr<QLowEnergyController> created( QLowEnergyController::createCentral( QBluetoothDeviceInfo() ) );
          return created  && !created->localAddress().isNull();
      }
      

       

      Why Re-Open:

      Just upgraded my environment to Qt 6.9.0, and those functions still do not behave as expected: Under Windows AND Android, regardless if  adapter is ON or OFF, the app always displays true, true, true, true. There is no way to know if bluetooth adapter is ON or OFF.

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

            ivan.solovev Ivan Solovev
            jpo38 Jean Porcherot
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes