DBUS service using glib: question

Xavier Claessens xclaesse at gmail.com
Wed Jul 19 01:58:37 PDT 2006


On sam, 2006-07-15 at 10:35 +0100, Ross Burton wrote:
> On Sat, 2006-07-15 at 10:44 +0200, Xavier Claessens wrote:
> > On ven, 2006-07-14 at 11:07 +0100, Ross Burton wrote: 
> > > On Fri, 2006-07-14 at 11:13 +0200, Xavier Claessens wrote:
> > > > Thanks ! I can now know when a client connect/disconnect and I keep a
> > > > hash table with information about all clients connected. Then only
> > > > problem remaining: When a method is called on my object, how can I know
> > > > which client called it ?
> > > 
> > > If you are using the low-level methods the DBusMessage object has a
> > > sender field.  If you are using the GLib bindings then you need to
> > > annotate the methods as being Async, then you get a context object that
> > > contains the sender.
> > 
> > I'm using GLib binding. Have you more documentation about this context
> > object ? Or have you example of program that use it ?
> 
> See under "org.freedestkop.DBus.GLib.Async" at
> http://dbus.freedesktop.org/doc/dbus-tutorial.html#glib-annotations.
> 
> If you include dbus-glib-lowlevel.h you can use this function:
> 
> gchar* dbus_g_method_get_sender    (DBusGMethodInvocation *context);
> 
> Ross

It works, thanks !

I've got 2 more questions (sorry):

 - Clients has a name returned by dbus_g_method_get_sender. But how
clients can get his name ? My idea is to register a new object for each
client with path "/org/blah/<client's name>". But the client has to know
his name to know the path. Is it possible ? Or should I register an
object with a method like "GetObjectPath" which returns the path of the
object registered for the client calling this method ?

 - Another question: Is it possible to have methods with valist in args
or with the printf syntax. for example func(char *format, ...); ?

Thanks,

Xavier Claessens.



More information about the dbus mailing list