Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2474

Scanning for BLE devices reports also classic bluetooch devices on MacOs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.7.0
    • 6.2.2
    • PySide
    • PySide6.2.2, Shiboken6.2.2, PyCharm 2022.3.3 (Community Edition), Python 3.9.7
    • macOS

    Description

      Hi all,

      Scanning for BLE devices on MacOs seems to have issues! I detect classic bluetooth devices along with LE devices.

      I am using the following code to scan:

      self.__discovery_agent: QBluetoothDeviceDiscoveryAgent = QBluetoothDeviceDiscoveryAgent()
      self._discovery_agent.deviceDiscovered.connect(self._discovery_agent_device_discovered_handler)
      self._discovery_agent.finished.connect(self._discovery_agent_scan_finished_handler)
      self.__discovery_agent.DiscoveryMethod = QBluetoothDeviceDiscoveryAgent.LowEnergyMethod
      self.__discovery_agent.setLowEnergyDiscoveryTimeout(timeout)
      self.__discovery_agent.start()

      I have an assumption that the following line of code should limit the scanning to BLE devices:

      self.__discovery_agent.DiscoveryMethod = QBluetoothDeviceDiscoveryAgent.LowEnergyMethod 

      This code works pretty fine on WindowsOS.

      I see the following traces during scanning phase:

      2023-09-26 09:27:08.937 Python[85263:5125034] [IOBluetoothDeviceInquiry initWithDelegate:]   0x600002c2d320qt.bluetooth.darwin: IOKit error code: 1
      qt.bluetooth.darwin: IOKit error code: 1
      qt.bluetooth.darwin: IOKit error code: 1
      qt.bluetooth.darwin: IOKit error code: 1qt.bluetooth.darwin: Manually interrupting IOBluetoothDeviceInquiry

      Please note that I've communicated with Qt C++ devs. and they replied that 
      a C++-based code on MacOS does not detect classic bluetooth devices.
      For more informatoin; Please see https://bugreports.qt.io/projects/QTBUG/issues/QTBUG-117009 

      Attachments

        1. image-2023-09-30-13-45-03-227.png
          13 kB
          Rida Shamasneh
        2. image-2023-09-30-13-45-09-171.png
          13 kB
          Rida Shamasneh
        3. image-2023-09-30-13-45-46-305.png
          4 kB
          Rida Shamasneh
        4. scanning_bluetooth_devices_on_mac.py
          2 kB
          Rida Shamasneh

        Issue Links

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

          Activity

            People

              shpremna Shyamnath Premnadh
              rida-shamasneh Rida Shamasneh
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes