DBUS API questions
Havoc Pennington
hp at redhat.com
Wed May 2 08:49:40 PDT 2007
Hi,
> I think I understand the difference between interfaces and object
> paths. I am still somewhat confused about how bus paths enter the
> picture. Some enlightenment would be appreciated.
Here is a good analogy:
bus name = hostname
unique bus name = IP address
interface = interface (in a language, like Java)
object path = object reference / pointer
The "hostname" analogy requires you to imagine that each process or
application is a "host"
Don't try to overthink it. interface is just interface, bus name is the
name of something on the bus (and the only things on the bus are
processes), and object paths are names of objects. "Objects" has the
same meaning you are used to, java.lang.Object, python object, GObject, etc.
I'll let others comment on the domain-specific stuff, but re: the API
the DBus naming conventions would be like:
org.libsmbios.Table
GetNumberOfStructures()
IterOverType()
i.e. the method names are AllCaps not javaCaps. The interface names are
also AllCaps (as in Java and many other things).
Also, on the struct interface you posted, I would not have getType(),
getLength(), etc. as remote IPC calls. Remember, when remoting, round
trips = bad. Using this object would involve too many little round trips.
Instead, have one method that returns all the info in one D-Bus struct,
for example.
> I am assuming here that there is a native DBUS interface for getting a
> list of all objects under a specific path. (something like: ls
> /org/libsmbios/table/byHandle/*) In that case, iterOverType() may not be
> necessary.
This info can be in the results of Introspect() but it is not all that
convenient an API for a typical app since it would involve parsing XML.
You might want to have a method that just returns an array of object paths.
Havoc
More information about the dbus
mailing list