Jul-15-2018, 05:24 PM
I want to list and extract all trusted bluetooth device by using QtDbus. With the qdbusviewer tool, I can see and call the method GetManagedObjects() just fine. Then I tried to do it in python, but the method cannot be found. The script below output ['Method "GetManagedObjects" with signature "" on interface "org.freedesktop.DBus.ObjectManager" doesn\'t exist']. What am I doing wrong?
#!/usr/bin/python3 import sys from PyQt5 import QtWidgets, QtDBus class Main(QtWidgets.QMainWindow): def __init__(self): super().__init__() bus = QtDBus.QDBusConnection.systemBus() interface = QtDBus.QDBusInterface("org.bluez", "/org/bluez", "org.freedesktop.DBus.ObjectManager", bus) result = interface.call("GetManagedObjects") print(result.arguments()) if __name__== '__main__': app = QtWidgets.QApplication([]) gui = Main() sys.exit(app.exec_())