DBus connection to omxplayer won't work
Solved
Mobile and Embedded
-
Hy, I try to write a wrapper to navigate the omxplayer on raspberry pi 2. The script dbuscontroll.sh works but the Qt source code do not work.
I am not sure if the application is connected? This is the code:
QDBusConnection *_dbus; _dbus = new QDBusConnection(QDBusConnection::sessionBus()); _dbus->connectToBus(address, "org.mpris.MediaPlayer2.omxplayer"); if( !_dbus->isConnected() ) { qDebug() << "not connected"; } QString dest = "org.mpris.MediaPlayer2.omxplayer"; QString path = "/org/mpris/MediaPlayer2/"; QString interface = "org.mpris.MediaPlayer2.Player"; QString name = "Action"; QDBusMessage msg = QDBusMessage::createMethodCall(dest, path, interface, name); msg.setArguments(QList<QVariant>() << 16); if( !_dbus->send(msg) ) { qWarning() << "error: " << _dbus->lastError().message(); }
And I got this output on the console:
Unable to query physical screen size, defaulting to 100 dpi. To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters). "unix:abstract=/tmp/dbus-FHoNnz9gMj" QDBusConnectionPrivate(0x72208478) : connected successfully not connected error: "Not connected to D-Bus server" QDBusConnectionPrivate(0x72208478) got message (signal): QDBusMessage(type=Signal, service="org.freedesktop.DBus", path="/org/freedesktop/DBus", interface="org.freedesktop.DBus", member="NameAcquired", signature="s", contents=(":1.29") )
I am connected with ssh and use the dbus-monitor. It display the following output:
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=8 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged string ":1.33" string "" string ":1.33" method call sender=:1.33 -> dest=org.freedesktop.DBus serial=1 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=Hello
Can anyone tell me what's going wrong and why the message is not queued?