Using D-Bus Introspection
To control a D-Bus-enabled application, you need the interface definition to find out which methods are offered and which parameters they expect.
Of course, you can get the relevant interface definition from the application’s source distribution. But there’s an easier way: Ask the object in question via D-Bus to give you the interface description. All objects implementing the org.freedesktop.DBus.Introspectable interface offer an Introspect() method that returns an XML document describing the methods and their signatures.
Instead of python, we’ll use the dbus-send command line utility this time. The following command dumps the definition of rhythmbox’ /org/gnome/Rhythmbox/Player object:
dbus-send --session --type=method_call --print-reply
--dest=org.gnome.Rhythmbox
/org/gnome/Rhythmbox/Player
org.freedesktop.DBus.Introspectable.Introspect
The service to query is org.gnome.Rhythmbox and the object’s interface is org.freedesktop.DBus.Introspectable. Note that for dbus-send, the method’s name (Introspect here) has to be appended to the interface. See the dbus-send manpage for more information, like calling methods with parameters.
April 13, 2007 at 09:45
I’m looking for such an article. Thanks alot :)
December 31, 2007 at 05:48
[...] to my music. A bit of googling around came up with some hits on using dbus-send to find the info [1,2] but the output was a little more raw than I was hoping for. While I was have a brief look [...]
April 22, 2008 at 08:21
This article had ended my problems, Now I can start working on DBus