dbus tutorial terminology

Don Park donp at personaltelco.net
Sat Jun 25 19:11:54 PDT 2005


The dbus tutorial outlines the concepts of calling a method on an object
susinctly with the following diagram:

Address -> [Bus Name] -> Path -> Interface -> Method

Im ignoring address because the dbus library seems to discover this on its
own.

I tried to match up this model, which makes sense to me, to the example
glib code.

The important lines of code from the glib example are:

connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
the DBUS_BUS_SESSION corresponds to the [Bus Name] in the diagram.

After the [Bus Name] comes path, interface, and method.
The code calls:
proxy = dbus_g_proxy_new_for_name (connection,
                                     DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
                                     DBUS_PATH_ORG_FREEDESKTOP_DBUS,
                                     DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS);

PATH obviously corresponds to DBUS_PATH_ORG_FREEDESKTOP_DBUS and the
Interface obviously corresponds to DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS.
What about DBUS_SERVICE_ORG_FREEDESKTOP_DBUS? There is no mention of how
this name fits in the model.

The method name can be found in the code on this line:
  call = dbus_g_proxy_begin_call (proxy, "ListNames", DBUS_TYPE_INVALID);

So the three items to make an object call - path, interface, and method -
can be found in the code but the extra field of service is confusing. Can
someone explain this?


Also, I thought it might be easier to not look at the code but instead
look at the dbus-send utility.

The help text for dbus-send is:
Usage: dbus-send [--help] [--system | --session] [--dest=SERVICE]
[--type=TYPE] [--print-reply] [--reply-timeout=MSEC] <destination object
path> <message name> [contents ...]

Using the familiar terms of path, interface, and method, only path shows
up in this text. I can make the leap between message name and method, but
what is dest and type? I assume one of those corresponds to interface from
the diagram, but that leaves one field name.

Using the service name from the c #define, i came up with the command
line:
dbus-send --dest=org.freedesktop.DBus /org/freedesktop/DBus ListNames

this gives the error:
Must use org.mydomain.Interface.Signal notation, no dot in "ListNames"

So there is a hidden parameter, the Interface is given before the method
name. The modified command line is

dbus-send --dest=org.freedesktop.DBus /org/freedesktop/DBus
org.freedesktop.DBus.ListNames

success! although there is no output from this command. Also I can make up
a method name

dbus-send --dest=org.freedesktop.DBus /org/freedesktop/DBus
org.freedesktop.DBus.ListNothings

still nothing. No error given.

Whats missing? I assume ListNames is an actual function or an error
message would be given.

thanks,
don
ps. for dbus-0.34, the tutorial is out of sync with the new constants.
proxy = dbus_g_proxy_new_for_name (connection,
                                     DBUS_SERVICE_DBUS,
                                     DBUS_PATH_DBUS,
                                     DBUS_INTERFACE_DBUS);



More information about the dbus mailing list