dbus object path
Michael 'Mickey' Lauer
mickey at vanille-media.de
Sat Mar 14 16:36:03 PDT 2009
Am Samstag, den 14.03.2009, 14:41 -0300 schrieb Thiago Macieira:
> Michael 'Mickey' Lauer wrote:
> >Am Dienstag, den 10.03.2009, 14:38 +0300 schrieb Alexandr Lebedev:
> >> Dear colleagues. Help me please. How I can receive the list of objects
> >> under the service name?
> >This is one of the missing features in dbus. You need to use
> >introspection. Have a look at dbus-hlid @ http://git.freesmartphone.org
> >which you can use for that.
> No, you don't.
> Please read my email: unless you're writing a program whose
> purpose is to scan existing objects in D-Bus and show them to the user
> (i.e., a program that *is* a D-Bus browser), finding objects through
> introspection is always the wrong solution.
> The correct thing is to:
> 1) know the path before-hand (via well-known path) or out-of-band
Not applicable. Objects can come and go at any time.
> or 2) request that the object reveal itself via signalling (one signal
> request, one reply or method call)
This is a band-aid for something that should be in dbus itself. While
that works, it sounds like double bookkeeping to me.
> I have taken a look at http://git.freesmartphone.org/?p=dbus-
> hlid.git;a=blob;f=src/obj.vala;hb=HEAD and I can tell that it probably
> works, but it is WRONG. Please do not introspect every object in a
> service. That's a lot of round-trips for what you could do with two (#2
> above) or zero (#1).
> Not to mention, of course, that some services do not like being
> introspected at all and may not reply, thus causing your code to hang for
> 25 seconds while calling to /.
> Also, you didn't use a proper XML parser. Some services may reply with
> introspections containing no new-lines, for instance, or with different
> whitespace count.
Yes, I'm aware that it may not cover all cases. Alas, it covers my
usecase (well behaved services, well-formatted introspection data).
More information about the dbus