Hello.
I’m developing an application that communicate 2 devices with Bluetooth LE connection, I’ve been trying with PyBluez but it has been very difficult to get a stable version, so, I found an example (link) in the QT5 documentation for C++ and tried to port it to PyQt5 and added a few lines. So, when I executed it prints the following error, and don’t know where to begin to fix it.
Any help or documentation that you could give me will be appreciated.
Error:
Agent error
args (4,)
kwargs {}
qt.bluetooth: Dummy backend running. Qt Bluetooth module is non-functional.
PyQt5 Code
import sys
from PyQt5 import QtBluetooth as QtBt
from PyQt5 import QtCore
class Application(QtCore.QCoreApplication):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.scan_for_devices()
self.exec()
def display_status(self):
print(self.agent.isActive(), self.agent.discoveredDevices())
def show_info(self, info: QtBt.QBluetoothDeviceInfo):
print('Device discovered')
print(info)
print(f'Name: {info.name()}')
print(f'UUID: {info.deviceUuid()}')
pass
def agent_finished(self,*args, **kwargs):
print('Agent finished')
print(f'args {args}')
print(f'kwargs {kwargs}')
def agent_error(self,*args, **kwargs):
print('Agent error')
print(f'args {args}')
print(f'kwargs {kwargs}')
def scan_for_devices(self):
self.agent = QtBt.QBluetoothDeviceDiscoveryAgent()
self.agent.setLowEnergyDiscoveryTimeout(5000)
self.agent.deviceDiscovered.connect(self.show_info)
self.agent.finished.connect(self.agent_finished)
self.agent.error.connect(self.agent_error)
timer = QtCore.QTimer(self.agent)
timer.start(1000)
timer.timeout.connect(self.display_status)
self.agent.start()
if __name__ == '__main__':
app = Application(sys.argv)