dbus signal

Ross Burton ross at burtonini.com
Sat Jun 17 08:51:18 PDT 2006


On Sat, 2006-06-17 at 17:01 +0200, Morten O. Hansen wrote:
> I'm trying to write a small program that send out a signal using dbus,
> and I have been trying to follow the tutorial at [1], but this is old
> and I guess a bit outdated? 
> 
> Anyhow, I'm creating a DBusGConnection, and connecting it to the daemon.
> Then I'm using a GMainLoop to call send_signal every second, in
> send_signal I try to use DBusGMessage to send the signal.. but this is
> were it fails, I can't find anything equivelant to
> dbus_message_new_signal/dbus_message_append_args for the glib-bindings,
> what should I use instead? 
> 
> Is the dbus-glib way of sending signals using a proxy? any hints at what
> functions I should be looking at? I can probably find out how they works
> myself, just need a few pointers :)
> 
> Another question I have, do I need to implement a GObject too expose
> methods?

If you are using the GLib bindings to send signals and process methods
then you need a GObject yes.  DBusGProxy objects are for the "client"
side which receives signals and makes method calls, they cannot send
signals.  In the GLib bindings to send a signal you define it in the XML
file and bind it to an object, from which you fire a signal in the usual
GLib way with g_signal_emit().

If you don't already have GObjects and just need a simple program you
might find it easier to write directly to libdbus -- see my message of
Tuesday 13th June ("Re: Targetted signals") that contains a small test
case of sending and receiving signals by using libdbus directly.

Ross
-- 
Ross Burton                                 mail: ross at burtonini.com
                                          jabber: ross at burtonini.com
                                     www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF





More information about the dbus mailing list