Dbus interface, replicate script from bash



  • Hi, I'm trying to basically replicate the functionality of a bash script in my program. Sadly, though, my attempts so far have failed.
    [url=https://github.com/popcornmix/omxplayer/blob/master/dbuscontrol.sh]This[/url] is the script that I'm talking about, and basically all I want to do is to call a method, for example "Stop". I checked the script, and it does what expected, so the problem must be on my side.
    [url=https://github.com/popcornmix/omxplayer#dbus-control]Here[/url] is the description of the dbus interface of the program that I want to control.

    This is my code (which doesn't work, of course):
    @
    QDBusConnection bus = QDBusConnection::sessionBus();
    //the string unix:(...) is the content of the /tmp/omxplayerdbus file mentioned in the script
    bus.connectToBus("unix:abstract=/tmp/dbus-emtYKjLikZ,guid=fe0fb2b43bdc0f2bf9920bb753f0a816", "org.mpris.MediaPlayer2.omxplayer");
    QDBusMessage m = QDBusMessage::createMethodCall("org.mpris.MediaPlayer2", "/org/mpris/MediaPlayer2", "Stop");

    bus.send(m);
    

    @

    so, how can I make this work? This of course is my first encounter with dbus, so it might be a silly question. Thanks in advance:)


  • Lifetime Qt Champion

    Hi,

    Please add which version of Qt your are using as well as OS and dbus



  • Oh, sorry. Qt 4.8, and this program is supposed to run on raspibian(debian).
    Linux raspberrypi 3.12.22
    D-Bus Message Bus Daemon 1.6.8


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.