Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QDbus from Python: read DBus property

    General and Desktop
    dbus python get property
    1
    1
    1482
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mark81 last edited by

      Hello, I wrote a couple of Python lines that work:

      def get_prop(bus, service, object_path, interface, name):
          obj = bus.get_object(service, object_path)
          iface = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')
          property = iface.Get(interface, name)
          print(property)
      
      bus = dbus.SystemBus()
      get_prop(bus, 'org.bluez', '/org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/player0', "org.bluez.MediaPlayer1", "Status")
      

      This is a common way to read a DBus property.
      I'm in trouble to translate this to Qt5:

      QDBusInterface *iface = new QDBusInterface("org.bluez", "/org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/player0", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus(), this);
      qDebug() <<  iface->call("Get",  "org.bluez.MediaPlayer1", "Status").arguments();
      

      but it returns:

      QVariant(QDBusVariant, )

      Where is my mistake?
      Is there a more convenient way to read DBus properties?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post