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

QBluetoothDeviceDiscoveryAgent won't stop when timeout value is too low

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.14.1
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Linux peppy 5.5.4-arch1-1 #1 SMP PREEMPT Sat, 15 Feb 2020 00:36:29 +0000 x86_64 GNU/Linux
      python-pyqt5 5.14.1-2
      bluez 5.53-1
    • Platform/s:
      Linux/X11

      Description

      BLE discovery never stops when lowEnergyDiscoveryTimeout is too low (<535 for me)
      Finished signal is emitted, but new devices appear in the bluetoothctl console.
      Calling stop() afterwards has no effect.

      Suggestion: Please add a way to skip the BLE discovery without setting a timeout.

       

      #!/usr/bin/python3
      import sys
      from PyQt5 import QtWidgets, QtBluetooth
      
      class Main(QtWidgets.QMainWindow):
          def __init__(self, parent):
              super().__init__()
              self.agent = QtBluetooth.QBluetoothDeviceDiscoveryAgent(self)
              self.agent.setLowEnergyDiscoveryTimeout(1)
              self.agent.deviceDiscovered.connect(self.discovered)
              self.agent.finished.connect(self.finished)
              self.agent.start()
              # self.agent.stop()
      
          def discovered(self, dev):
              name = dev.name()
              addr = dev.address().toString()
              print(name, addr)
      
          def finished(self):
              print("done")
      
      if __name__ == '__main__':
          app = QtWidgets.QApplication(sys.argv)
          gui = Main(app)
          sys.exit(app.exec_())
      

        Attachments

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

          Activity

            People

            Assignee:
            ablasche Alex Blasche
            Reporter:
            william.belanger William Belanger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes