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. Dbus interface, replicate script from bash
Forum Updated to NodeBB v4.3 + New Features

Dbus interface, replicate script from bash

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    prawdziwy-sok
    wrote on last edited by
    #1

    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:)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        prawdziwy-sok
        wrote on last edited by
        #3

        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

        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