Dbus Inspector & Introspect

Sander Jansen s.jansen at gmail.com
Mon Sep 15 09:26:06 PDT 2008


Thanks for all replies. I wasn't using
dbus_connection_register_object_path, so the /, /org /org/fifthplanet
didn't have the automatic Introspect methods ( I was just using a
simple message filter). Once I changed my code to use the
register_object_path it started to work automatically. The API
description of dbus_connection_register_object_path is somewhat
lacking regarding this behaviour (unless there may be some other
document that describes that).

This also raised another question I have, should I use the
dbus_connection_register_object_path to listen for specific signals
from objects not owned by my application or should I use a message
filter for that (example, I need to receive signals from
"/org/freedesktop/Notifications"). My instinct tells me to use a
message filter for that since I do not provide the object so no
introspection should take place. Or maybe I can use the
register_fallback function for that...

Thanks again,

Sander


P.S. The support on this mailing is really excellent!


On Sun, Sep 14, 2008 at 9:42 AM, John (J5) Palmieri <johnp at redhat.com> wrote:
> On Fri, 2008-09-12 at 23:50 +0200, Thiago Macieira wrote:
>> Sander Jansen wrote:
>> >Currently DBus Inspector won't list any of these methods, since it
>> >doesn't know about the object on path "/org/fifthplanet/gogglesmm". I
>> >see DBus Inspector calling "Introspect" on path "/". Would I have to
>> >respond with the following then?:
>> >
>> ><!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection
>> > 1.0//EN"
>> > "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node
>> > name="/">
>> >  <interface name="org.freedesktop.DBus.Introspectable">
>> >    <method name="Introspect">
>> >      <arg name="xml_data" direction="out" type="s"/>
>> >    </method>
>> >  </interface>
>> >  <node name="/org/fifthplanet/gogglesmm"/>
>> ></node>
>> >
>> >Would this be the correct and standard way of doing this?
>>
>> No.
>>
>> You have to reply with almost the same as above, but the inner <node> tag
>> should be:
>>
>>   <node name="org" />
>>
>> Then the introspect on /org should reply with:
>>
>>   <node name="fifthplanet" />
>>
>> And so on.
>
> While this is good style advice in general (think tabs vs. spaces in
> coding) I don't think it is part of the spec and most certainly
> shouldn't break any tools since tools should just be recursing each
> node. In fact, having org/ then fifthplanet/, etc. becomes less
> efficient since tools have to make an introspect call for each object
> path.
>
>> >The last
>> >response on my question on the list about object path naming
>> >conventions seems to discourage using the "/" path...
>>
>> You misunderstood the problem. We were saying that using the / object for
>> your purposes was probably wrong, if you were writing an interface that
>> was meant to be implemented by other applications.
>>
>> It could also be a bad practice even if it's just your application, since
>> you may want in the future to do things differently.
>>
>> However, the / object is the root object in the object tree. It's always
>> present and the introspection starts by it. You have to provide the
>> correct tree leading to your objects.
>
> Yes, the biggest problem with using / is like the old problem of
> starting with 1 in BASIC.  There is little room to correct errors.
> Also / is not descriptive which in most cases is not a real issue.
> Technically object paths are just like pointers but in reality they do
> convey some meaning and allow an app to provide a logical hierarchy for
> referencing functionality.
>
>
> --
> John (J5) Palmieri <johnp at redhat.com>
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>



-- 
"And any fool knows a dog needs a home
A shelter from pigs on the wing"


More information about the dbus mailing list