DBus properties naming rules
Thiago Macieira
thiago at kde.org
Wed Sep 9 10:06:26 PDT 2009
Em Quarta-feira 9. Setembro 2009, às 18.28.53, Simon McVittie escreveu:
> (I'm not sure why this thread wasn't on the D-Bus mailing list... see xdg
> archives for history.)
>
> On Tue, 08 Sep 2009 at 15:07:06 -0600, Aaron J. Seigo wrote:
> > we're talking about the allowed character set, not case or stylistic
> > format. it's a slightly different matter, as the former says which
> > characters are legal and the latter suggest how to use those characters.
> > (to state the obvious)
>
> Actually, I'd go a little further than that, and say that new D-Bus APIs
> SHOULD (but definitely not MUST) use capitalized words without punctuation
> (e.g. GetNameOwner) for D-Bus method, signal and property names.
Agreed. That's the D-Bus convention.
> This isn't a mandatory requirement for use of D-Bus, but it should be in
> some list of "how to write a D-Bus API that does not violate
> least-astonishment", along with common interoperability things like:
>
> * reply to each method call exactly once, with either a method reply or an
> error
> * don't reply to things that are not method calls
> * don't send method replies or errors except as replies to method calls,
> and don't send them to destinations other than the method call's sender
You'll note that most bindings don't allow these to happen either. And even in
the low-level libdbus-1 API, you'll find out that you have to jump through
hoops to get them.
> * don't implement more than one of (method, signal, property) with the same
> name on the same interface
> * don't overload methods
These two are the same recommendation, from my point of view.
> * don't use varargs (which can't be represented in Introspect() output)
> * implement Introspectable on every object
High-level bindings will do that for you.
You should use a high-level binding. Really, you should. If you choose to use
the low-level libdbus-1, note that Introspectable is not a very easy method to
implement. If your object is part of a tree, you must also include the sub-
nodes in your introspection.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14 San Francisco, California: Nov 2 - 4
http://qt.nokia.com/qtdevdays2009
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/xdg/attachments/20090909/0eea4c6e/attachment.pgp
More information about the xdg
mailing list