Archive for the ‘DBus’ Category
Exposing a DBus signal as a Glib signals
April 10th, 2007
Though there is no direct api to make this happen, one can easily route the DBus signal as a Glib signal.
All’s that required is to add a callback to the DBus signal using dbus_g_proxy_connect_signal and then emit the related GLib signal from that callback using g_signal_emit
Download the tarball : GObject-dbus-signal-as-g-signal.tar.gz
This example contains a bare bones implementation of a new object which is derived from GObject - so if you are new to deriving GObject’s, have a look at the code - might be usefull
Dependencies to compile…
`pkg-config –cflags –libs dbus-glib-1`
If your pkg-config runs fine for dbus-glib-1, you can compile the example with “make” - i’m pretty bad at Makefiles, but i’m learning ![]()
Posted in DBus, Technology | Comments (0)
Playing with DBus - 2
March 23rd, 2007
Some more DBus poking…
Listing the interfaces available in session (or system)
#> dbus-send –session –type=method_call –print-reply –dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
method return sender=org.freedesktop.DBus -> dest=:1.49
[string “org.freedesktop.DBus”
string “:1.49″
string “:1.3″
string “org.gnome.PowerManager”
string “org.gnome.ScreenSaver”
string “org.xchat.service”
string “:1.4″
string “:1.0″
string “:1.5″
string “:1.6″
string “:1.2″
Now lets query org.gnome.PowerManager
#> dbus-send –session –type=method_call –print-reply –dest=org.gnome.PowerManager /org/gnome/PowerManager org.freedesktop.DBus.Introspectable.Introspect
method return sender=:1.2 -> dest=:1.52
string “<!DOCTYPE node PUBLIC “-//freedesktop//DTD D-BUS Object Introspection 1.0//EN”
“http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd”>
<node>
<interface name=”org.freedesktop.DBus.Introspectable”>
<method name=”Introspect”>
<arg name=”data” direction=”out” type=”s”/>
</method>
</interface>
<interface name=”org.freedesktop.DBus.Properties”>
<method name=”Get”>
<arg name=”interface” direction=”in” type=”s”/>
<arg name=”propname” direction=”in” type=”s”/>
<arg name=”value” direction=”out” type=”v”/>
</method>[SNIP]
</signal>
<signal name=”OnAcChanged”>
<arg type=”b”/>
</signal>
</interface>
</node>
“
Note : Remember to use –session when introspecting services listed with –session flag & vice-versa (–system)
Posted in DBus | Comments (0)
Playing with DBus
March 22nd, 2007
Check out this listener - still incomplete in many ways…
Compile with “gcc listener.c -o listener `pkg-config –cflags –libs dbus-glib-1`” and run with “./listener” & to create a stream of events, fire up evolution & just start browsing through emails.
–> Signal received!
Signal path : /org/gnome/evolution/mail/newmail
Signal interface : org.gnome.evolution.mail.dbus.Signal
Signal name : MessageReading
Signal sender : :1.5
Payload : [Inbox]
Signal had 1 arguments in the payload
Posted in DBus | Comments (0)