Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDbus from Python: read DBus property
QtWS25 Last Chance

QDbus from Python: read DBus property

Scheduled Pinned Locked Moved Unsolved General and Desktop
dbuspythongetproperty
1 Posts 1 Posters 1.8k Views
  • 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 Offline
    M Offline
    Mark81
    wrote on last edited by
    #1

    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
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved