about object introspection for dbus
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu May 21 03:10:36 PDT 2009
On Thu, 21 May 2009 at 10:59:42 +0100, Simon McVittie wrote:
> On Thu, 21 May 2009 at 12:46:10 +0300, Ville M. Vainio wrote:
> > Intrerestingly, python-dbus binding also seems to work with a trivial
> > introspection (i.e. the introspection xml doesn't really need to
> > contain any of the methods you provide, as long as you reply to
> > "Introspect()" method call).
>
> In the absence of useful results from Introspect(), dbus-python is forced to
> make arbitrary guesses (based on the Python types) about the D-Bus types the
> Python programmer intended to use. These guesses are likely to be wrong in
> many (most?) cases.
Oh, another thing to note is that dbus-python's behaviour with empty results
is the same as if Introspect() raises an error. If you're not going to
implement Introspect correctly, please implement it as raising an error
(DBUS_ERROR_UNKNOWN_METHOD seems a good one) rather than returning
introspection XML that is untrue.
It is always incorrect (IMO) to not reply to a method call at all, unless
DBUS_HEADER_FLAG_NO_REPLY_EXPECTED is set in the header. If you don't
implement a particular method on a particular object at all, you should return
a suitable D-Bus error message (all the high-level bindings will do this for
you automatically, but libdbus won't necessarily). This only applies to
messages of type DBUS_MESSAGE_TYPE_METHOD_CALL.
Simon
More information about the dbus
mailing list