Receiving signals the easy way?
Kees Jongenburger
kees.jongenburger at gmail.com
Sun Nov 1 04:38:43 PST 2009
Hi
I am trying to receive a signal in my dbus-glib based program. I found
a good example on the net to listen to dbus signals itself but am
currently failing
to implement it for my own purposes.
the code looks pretty much like this (the real code can be fetched from
( http://github.com/keesj/dbus_glib_pthread/raw/master/notification_test.c )
/* get a system bus
create a proxy object
register a known signal called Notify with no parameters
register a callback
runt the main loop */
connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
proxy = dbus_g_proxy_new_for_name(connection, "com.test.Notification",
"/com/test/Notification",
"com.test.Notification");
dbus_g_proxy_add_signal(proxy, "Notify",G_TYPE_INVALID);
dbus_g_proxy_connect_signal(proxy, "Notify", test_callback, NULL, NULL);
=================
After that I call
dbus-send \
--system \
/com/test/Notification \
com.test.Notification.Notify
but don't receive anything in my callback so I must be missing something.
I implemented the same signal listener in java
(http://github.com/keesj/dbus_glib_pthread/java) and that one works
like a charm. This leave me with the following questions
1) what am I doing wrong?
2) in this situation there is no object registered on the bus called
Notification, who owns the signal interface?
3) Is there any form of security that I might be missing (can
everybody send signals to everybody and can everybody listen?)
Greetings
More information about the dbus
mailing list