2003-09-30 03:34:00 +00:00
|
|
|
<?xml version="1.0" standalone="no"?>
|
2013-02-22 17:32:18 +01:00
|
|
|
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
|
2003-09-30 03:34:00 +00:00
|
|
|
[
|
|
|
|
|
]>
|
|
|
|
|
|
|
|
|
|
<article id="index">
|
|
|
|
|
<articleinfo>
|
2006-08-03 20:34:36 +00:00
|
|
|
<title>D-Bus Tutorial</title>
|
2006-08-20 21:41:42 +00:00
|
|
|
<releaseinfo>Version 0.5.0</releaseinfo>
|
|
|
|
|
<date>20 August 2006</date>
|
2003-09-30 03:34:00 +00:00
|
|
|
<authorgroup>
|
|
|
|
|
<author>
|
|
|
|
|
<firstname>Havoc</firstname>
|
|
|
|
|
<surname>Pennington</surname>
|
|
|
|
|
<affiliation>
|
|
|
|
|
<orgname>Red Hat, Inc.</orgname>
|
2005-12-19 18:11:05 +00:00
|
|
|
<address><email>hp@pobox.com</email></address>
|
2003-09-30 03:34:00 +00:00
|
|
|
</affiliation>
|
|
|
|
|
</author>
|
2005-01-23 00:28:41 +00:00
|
|
|
<author>
|
|
|
|
|
<firstname>David</firstname>
|
|
|
|
|
<surname>Wheeler</surname>
|
|
|
|
|
</author>
|
2005-07-15 02:15:08 +00:00
|
|
|
<author>
|
|
|
|
|
<firstname>John</firstname>
|
|
|
|
|
<surname>Palmieri</surname>
|
|
|
|
|
<affiliation>
|
|
|
|
|
<orgname>Red Hat, Inc.</orgname>
|
2005-12-19 18:11:05 +00:00
|
|
|
<address><email>johnp@redhat.com</email></address>
|
2005-07-15 02:15:08 +00:00
|
|
|
</affiliation>
|
|
|
|
|
</author>
|
2005-08-18 04:04:57 +00:00
|
|
|
<author>
|
|
|
|
|
<firstname>Colin</firstname>
|
|
|
|
|
<surname>Walters</surname>
|
|
|
|
|
<affiliation>
|
|
|
|
|
<orgname>Red Hat, Inc.</orgname>
|
2005-12-19 18:11:05 +00:00
|
|
|
<address><email>walters@redhat.com</email></address>
|
2005-08-18 04:04:57 +00:00
|
|
|
</affiliation>
|
|
|
|
|
</author>
|
2003-09-30 03:34:00 +00:00
|
|
|
</authorgroup>
|
|
|
|
|
</articleinfo>
|
|
|
|
|
|
2006-08-20 21:41:42 +00:00
|
|
|
<sect1 id="meta">
|
|
|
|
|
<title>Tutorial Work In Progress</title>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
This tutorial is not complete; it probably contains some useful information, but
|
|
|
|
|
also has plenty of gaps. Right now, you'll also need to refer to the D-Bus specification,
|
|
|
|
|
Doxygen reference documentation, and look at some examples of how other apps use D-Bus.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Enhancing the tutorial is definitely encouraged - send your patches or suggestions to the
|
|
|
|
|
mailing list. If you create a D-Bus binding, please add a section to the tutorial for your
|
|
|
|
|
binding, if only a short section with a couple of examples.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
|
|
2003-10-02 22:34:17 +00:00
|
|
|
<sect1 id="whatis">
|
2006-08-03 20:34:36 +00:00
|
|
|
<title>What is D-Bus?</title>
|
2003-09-30 03:34:00 +00:00
|
|
|
<para>
|
2006-08-03 20:34:36 +00:00
|
|
|
D-Bus is a system for <firstterm>interprocess communication</firstterm>
|
2003-10-02 22:34:17 +00:00
|
|
|
(IPC). Architecturally, it has several layers:
|
|
|
|
|
|
2003-09-30 03:34:00 +00:00
|
|
|
<itemizedlist>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
2003-10-02 22:55:06 +00:00
|
|
|
A library, <firstterm>libdbus</firstterm>, that allows two
|
|
|
|
|
applications to connect to each other and exchange messages.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
2003-10-02 22:55:06 +00:00
|
|
|
A <firstterm>message bus daemon</firstterm> executable, built on
|
|
|
|
|
libdbus, that multiple applications can connect to. The daemon can
|
|
|
|
|
route messages from one application to zero or more other
|
|
|
|
|
applications.
|
2003-09-30 03:34:00 +00:00
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
2006-08-20 21:41:42 +00:00
|
|
|
<firstterm>Wrapper libraries</firstterm> or <firstterm>bindings</firstterm>
|
|
|
|
|
based on particular application frameworks. For example, libdbus-glib and
|
2003-10-02 22:55:06 +00:00
|
|
|
libdbus-qt. There are also bindings to languages such as
|
|
|
|
|
Python. These wrapper libraries are the API most people should use,
|
2006-08-03 20:34:36 +00:00
|
|
|
as they simplify the details of D-Bus programming. libdbus is
|
2004-08-10 02:18:37 +00:00
|
|
|
intended to be a low-level backend for the higher level bindings.
|
|
|
|
|
Much of the libdbus API is only useful for binding implementation.
|
2003-09-30 03:34:00 +00:00
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
</itemizedlist>
|
|
|
|
|
</para>
|
2003-10-02 22:34:17 +00:00
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
libdbus only supports one-to-one connections, just like a raw network
|
|
|
|
|
socket. However, rather than sending byte streams over the connection, you
|
|
|
|
|
send <firstterm>messages</firstterm>. Messages have a header identifying
|
|
|
|
|
the kind of message, and a body containing a data payload. libdbus also
|
|
|
|
|
abstracts the exact transport used (sockets vs. whatever else), and
|
|
|
|
|
handles details such as authentication.
|
|
|
|
|
</para>
|
|
|
|
|
|
2003-09-30 03:34:00 +00:00
|
|
|
<para>
|
2003-10-02 22:49:11 +00:00
|
|
|
The message bus daemon forms the hub of a wheel. Each spoke of the wheel
|
|
|
|
|
is a one-to-one connection to an application using libdbus. An
|
|
|
|
|
application sends a message to the bus daemon over its spoke, and the bus
|
|
|
|
|
daemon forwards the message to other connected applications as
|
|
|
|
|
appropriate. Think of the daemon as a router.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
The bus daemon has multiple instances on a typical computer. The
|
2003-10-02 22:34:17 +00:00
|
|
|
first instance is a machine-global singleton, that is, a system daemon
|
|
|
|
|
similar to sendmail or Apache. This instance has heavy security
|
|
|
|
|
restrictions on what messages it will accept, and is used for systemwide
|
|
|
|
|
communication. The other instances are created one per user login session.
|
|
|
|
|
These instances allow applications in the user's session to communicate
|
|
|
|
|
with one another.
|
2003-09-30 03:34:00 +00:00
|
|
|
</para>
|
2003-10-02 22:34:17 +00:00
|
|
|
|
2003-09-30 03:34:00 +00:00
|
|
|
<para>
|
2003-10-02 22:34:17 +00:00
|
|
|
The systemwide and per-user daemons are separate. Normal within-session
|
|
|
|
|
IPC does not involve the systemwide message bus process and vice versa.
|
2003-09-30 03:34:00 +00:00
|
|
|
</para>
|
2003-10-02 22:34:17 +00:00
|
|
|
|
|
|
|
|
<sect2 id="uses">
|
2006-08-03 20:34:36 +00:00
|
|
|
<title>D-Bus applications</title>
|
2003-10-02 22:34:17 +00:00
|
|
|
<para>
|
|
|
|
|
There are many, many technologies in the world that have "Inter-process
|
|
|
|
|
communication" or "networking" in their stated purpose: <ulink
|
|
|
|
|
url="http://www.omg.org">CORBA</ulink>, <ulink
|
2005-01-23 00:28:41 +00:00
|
|
|
url="http://www.opengroup.org/dce/">DCE</ulink>, <ulink
|
2005-01-23 03:53:34 +00:00
|
|
|
url="http://www.microsoft.com/com/">DCOM</ulink>, <ulink
|
2005-01-23 00:28:41 +00:00
|
|
|
url="http://developer.kde.org/documentation/library/kdeqt/dcop.html">DCOP</ulink>, <ulink
|
2003-10-02 22:34:17 +00:00
|
|
|
url="http://www.xmlrpc.com">XML-RPC</ulink>, <ulink
|
2005-01-23 00:28:41 +00:00
|
|
|
url="http://www.w3.org/TR/SOAP/">SOAP</ulink>, <ulink
|
|
|
|
|
url="http://www.mbus.org/">MBUS</ulink>, <ulink
|
|
|
|
|
url="http://www.zeroc.com/ice.html">Internet Communications Engine (ICE)</ulink>,
|
|
|
|
|
and probably hundreds more.
|
|
|
|
|
Each of these is tailored for particular kinds of application.
|
2006-08-03 20:34:36 +00:00
|
|
|
D-Bus is designed for two specific cases:
|
2003-10-02 22:34:17 +00:00
|
|
|
<itemizedlist>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Communication between desktop applications in the same desktop
|
|
|
|
|
session; to allow integration of the desktop session as a whole,
|
|
|
|
|
and address issues of process lifecycle (when do desktop components
|
|
|
|
|
start and stop running).
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Communication between the desktop session and the operating system,
|
|
|
|
|
where the operating system would typically include the kernel
|
|
|
|
|
and any system daemons or processes.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
</itemizedlist>
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
For the within-desktop-session use case, the GNOME and KDE desktops
|
|
|
|
|
have significant previous experience with different IPC solutions
|
2006-08-03 20:34:36 +00:00
|
|
|
such as CORBA and DCOP. D-Bus is built on that experience and
|
2003-10-02 22:34:17 +00:00
|
|
|
carefully tailored to meet the needs of these desktop projects
|
2006-08-03 20:34:36 +00:00
|
|
|
in particular. D-Bus may or may not be appropriate for other
|
2005-01-23 00:28:41 +00:00
|
|
|
applications; the FAQ has some comparisons to other IPC systems.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
The problem solved by the systemwide or communication-with-the-OS case
|
|
|
|
|
is explained well by the following text from the Linux Hotplug project:
|
|
|
|
|
<blockquote>
|
|
|
|
|
<para>
|
|
|
|
|
A gap in current Linux support is that policies with any sort of
|
|
|
|
|
dynamic "interact with user" component aren't currently
|
|
|
|
|
supported. For example, that's often needed the first time a network
|
|
|
|
|
adapter or printer is connected, and to determine appropriate places
|
|
|
|
|
to mount disk drives. It would seem that such actions could be
|
|
|
|
|
supported for any case where a responsible human can be identified:
|
|
|
|
|
single user workstations, or any system which is remotely
|
|
|
|
|
administered.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
This is a classic "remote sysadmin" problem, where in this case
|
|
|
|
|
hotplugging needs to deliver an event from one security domain
|
|
|
|
|
(operating system kernel, in this case) to another (desktop for
|
|
|
|
|
logged-in user, or remote sysadmin). Any effective response must go
|
|
|
|
|
the other way: the remote domain taking some action that lets the
|
|
|
|
|
kernel expose the desired device capabilities. (The action can often
|
|
|
|
|
be taken asynchronously, for example letting new hardware be idle
|
|
|
|
|
until a meeting finishes.) At this writing, Linux doesn't have
|
|
|
|
|
widely adopted solutions to such problems. However, the new D-Bus
|
|
|
|
|
work may begin to solve that problem.
|
|
|
|
|
</para>
|
|
|
|
|
</blockquote>
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
2006-08-03 20:34:36 +00:00
|
|
|
D-Bus may happen to be useful for purposes other than the one it was
|
2003-10-02 22:34:17 +00:00
|
|
|
designed for. Its general properties that distinguish it from
|
|
|
|
|
other forms of IPC are:
|
|
|
|
|
<itemizedlist>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Binary protocol designed to be used asynchronously
|
|
|
|
|
(similar in spirit to the X Window System protocol).
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Stateful, reliable connections held open over time.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
The message bus is a daemon, not a "swarm" or
|
|
|
|
|
distributed architecture.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Many implementation and deployment issues are specified rather
|
2006-08-20 21:41:42 +00:00
|
|
|
than left ambiguous/configurable/pluggable.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Semantics are similar to the existing DCOP system, allowing
|
|
|
|
|
KDE to adopt it more easily.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Security features to support the systemwide mode of the
|
|
|
|
|
message bus.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
</itemizedlist>
|
|
|
|
|
</para>
|
|
|
|
|
</sect2>
|
2003-09-30 03:34:00 +00:00
|
|
|
</sect1>
|
2003-10-02 22:34:17 +00:00
|
|
|
<sect1 id="concepts">
|
|
|
|
|
<title>Concepts</title>
|
|
|
|
|
<para>
|
|
|
|
|
Some basic concepts apply no matter what application framework you're
|
2006-08-03 20:34:36 +00:00
|
|
|
using to write a D-Bus application. The exact code you write will be
|
2003-10-02 22:34:17 +00:00
|
|
|
different for GLib vs. Qt vs. Python applications, however.
|
|
|
|
|
</para>
|
2005-01-23 03:53:34 +00:00
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Here is a diagram (<ulink url="diagram.png">png</ulink> <ulink
|
|
|
|
|
url="diagram.svg">svg</ulink>) that may help you visualize the concepts
|
|
|
|
|
that follow.
|
|
|
|
|
</para>
|
2003-10-02 22:34:17 +00:00
|
|
|
|
|
|
|
|
<sect2 id="objects">
|
2006-08-20 21:41:42 +00:00
|
|
|
<title>Native Objects and Object Paths</title>
|
2003-10-02 22:34:17 +00:00
|
|
|
<para>
|
2006-08-20 21:41:42 +00:00
|
|
|
Your programming framework probably defines what an "object" is like;
|
|
|
|
|
usually with a base class. For example: java.lang.Object, GObject, QObject,
|
|
|
|
|
python's base Object, or whatever. Let's call this a <firstterm>native object</firstterm>.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
<para>
|
2006-08-20 21:41:42 +00:00
|
|
|
The low-level D-Bus protocol, and corresponding libdbus API, does not care about native objects.
|
|
|
|
|
However, it provides a concept called an
|
|
|
|
|
<firstterm>object path</firstterm>. The idea of an object path is that
|
|
|
|
|
higher-level bindings can name native object instances, and allow remote applications
|
|
|
|
|
to refer to them.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
<para>
|
2006-08-20 21:41:42 +00:00
|
|
|
The object path
|
2003-10-02 22:34:17 +00:00
|
|
|
looks like a filesystem path, for example an object could be
|
|
|
|
|
named <literal>/org/kde/kspread/sheets/3/cells/4/5</literal>.
|
|
|
|
|
Human-readable paths are nice, but you are free to create an
|
|
|
|
|
object named <literal>/com/mycompany/c5yo817y0c1y1c5b</literal>
|
|
|
|
|
if it makes sense for your application.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
Namespacing object paths is smart, by starting them with the components
|
|
|
|
|
of a domain name you own (e.g. <literal>/org/kde</literal>). This
|
|
|
|
|
keeps different code modules in the same process from stepping
|
|
|
|
|
on one another's toes.
|
|
|
|
|
</para>
|
|
|
|
|
</sect2>
|
|
|
|
|
|
2006-08-20 21:41:42 +00:00
|
|
|
<sect2 id="members">
|
|
|
|
|
<title>Methods and Signals</title>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Each object has <firstterm>members</firstterm>; the two kinds of member
|
|
|
|
|
are <firstterm>methods</firstterm> and
|
|
|
|
|
<firstterm>signals</firstterm>. Methods are operations that can be
|
|
|
|
|
invoked on an object, with optional input (aka arguments or "in
|
|
|
|
|
parameters") and output (aka return values or "out parameters").
|
|
|
|
|
Signals are broadcasts from the object to any interested observers
|
|
|
|
|
of the object; signals may contain a data payload.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Both methods and signals are referred to by name, such as
|
|
|
|
|
"Frobate" or "OnClicked".
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
2003-10-02 22:34:17 +00:00
|
|
|
<sect2 id="interfaces">
|
|
|
|
|
<title>Interfaces</title>
|
|
|
|
|
<para>
|
|
|
|
|
Each object supports one or more <firstterm>interfaces</firstterm>.
|
|
|
|
|
Think of an interface as a named group of methods and signals,
|
2004-08-10 04:18:31 +00:00
|
|
|
just as it is in GLib or Qt or Java. Interfaces define the
|
2003-10-02 22:34:17 +00:00
|
|
|
<emphasis>type</emphasis> of an object instance.
|
|
|
|
|
</para>
|
2006-08-20 21:41:42 +00:00
|
|
|
<para>
|
|
|
|
|
DBus identifies interfaces with a simple namespaced string,
|
|
|
|
|
something like <literal>org.freedesktop.Introspectable</literal>.
|
|
|
|
|
Most bindings will map these interface names directly to
|
|
|
|
|
the appropriate programming language construct, for example
|
|
|
|
|
to Java interfaces or C++ pure virtual classes.
|
|
|
|
|
</para>
|
2003-10-02 22:34:17 +00:00
|
|
|
</sect2>
|
2006-08-20 21:41:42 +00:00
|
|
|
|
|
|
|
|
<sect2 id="proxies">
|
|
|
|
|
<title>Proxies</title>
|
2003-10-02 22:34:17 +00:00
|
|
|
<para>
|
2006-08-20 21:41:42 +00:00
|
|
|
A <firstterm>proxy object</firstterm> is a convenient native object created to
|
|
|
|
|
represent a remote object in another process. The low-level DBus API involves manually creating
|
|
|
|
|
a method call message, sending it, then manually receiving and processing
|
|
|
|
|
the method reply message. Higher-level bindings provide proxies as an alternative.
|
|
|
|
|
Proxies look like a normal native object; but when you invoke a method on the proxy
|
|
|
|
|
object, the binding converts it into a DBus method call message, waits for the reply
|
|
|
|
|
message, unpacks the return value, and returns it from the native method..
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
<para>
|
2006-08-20 21:41:42 +00:00
|
|
|
In pseudocode, programming without proxies might look like this:
|
|
|
|
|
<programlisting>
|
|
|
|
|
Message message = new Message("/remote/object/path", "MethodName", arg1, arg2);
|
|
|
|
|
Connection connection = getBusConnection();
|
|
|
|
|
connection.send(message);
|
|
|
|
|
Message reply = connection.waitForReply(message);
|
|
|
|
|
if (reply.isError()) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Object returnValue = reply.getReturnValue();
|
|
|
|
|
}
|
|
|
|
|
</programlisting>
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
Programming with proxies might look like this:
|
|
|
|
|
<programlisting>
|
|
|
|
|
Proxy proxy = new Proxy(getBusConnection(), "/remote/object/path");
|
|
|
|
|
Object returnValue = proxy.MethodName(arg1, arg2);
|
|
|
|
|
</programlisting>
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
</sect2>
|
|
|
|
|
|
2005-01-18 20:42:15 +00:00
|
|
|
<sect2 id="bus-names">
|
|
|
|
|
<title>Bus Names</title>
|
2006-08-20 21:41:42 +00:00
|
|
|
|
2003-10-02 22:34:17 +00:00
|
|
|
<para>
|
2006-08-20 21:41:42 +00:00
|
|
|
When each application connects to the bus daemon, the daemon immediately
|
|
|
|
|
assigns it a name, called the <firstterm>unique connection name</firstterm>.
|
|
|
|
|
A unique name begins with a ':' (colon) character. These names are never
|
|
|
|
|
reused during the lifetime of the bus daemon - that is, you know
|
|
|
|
|
a given name will always refer to the same application.
|
|
|
|
|
An example of a unique name might be
|
|
|
|
|
<literal>:34-907</literal>. The numbers after the colon have
|
|
|
|
|
no meaning other than their uniqueness.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
2006-08-20 21:41:42 +00:00
|
|
|
When a name is mapped
|
2005-01-18 20:42:15 +00:00
|
|
|
to a particular application's connection, that application is said to
|
|
|
|
|
<firstterm>own</firstterm> that name.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Applications may ask to own additional <firstterm>well-known
|
2005-01-18 20:42:15 +00:00
|
|
|
names</firstterm>. For example, you could write a specification to
|
|
|
|
|
define a name called <literal>com.mycompany.TextEditor</literal>.
|
|
|
|
|
Your definition could specify that to own this name, an application
|
2003-10-02 22:34:17 +00:00
|
|
|
should have an object at the path
|
|
|
|
|
<literal>/com/mycompany/TextFileManager</literal> supporting the
|
2006-08-20 21:41:42 +00:00
|
|
|
interface <literal>org.freedesktop.FileHandler</literal>.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
2005-01-18 20:42:15 +00:00
|
|
|
Applications could then send messages to this bus name,
|
2003-10-02 22:34:17 +00:00
|
|
|
object, and interface to execute method calls.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
2005-01-18 20:42:15 +00:00
|
|
|
You could think of the unique names as IP addresses, and the
|
|
|
|
|
well-known names as domain names. So
|
2003-10-02 22:49:11 +00:00
|
|
|
<literal>com.mycompany.TextEditor</literal> might map to something like
|
|
|
|
|
<literal>:34-907</literal> just as <literal>mycompany.com</literal> maps
|
|
|
|
|
to something like <literal>192.168.0.5</literal>.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
2005-01-18 20:42:15 +00:00
|
|
|
Names have a second important use, other than routing messages. They
|
2003-10-02 22:34:17 +00:00
|
|
|
are used to track lifecycle. When an application exits (or crashes), its
|
|
|
|
|
connection to the message bus will be closed by the operating system
|
|
|
|
|
kernel. The message bus then sends out notification messages telling
|
2005-01-18 20:42:15 +00:00
|
|
|
remaining applications that the application's names have lost their
|
2003-10-02 22:34:17 +00:00
|
|
|
owner. By tracking these notifications, your application can reliably
|
|
|
|
|
monitor the lifetime of other applications.
|
|
|
|
|
</para>
|
|
|
|
|
|
2006-08-20 21:41:42 +00:00
|
|
|
<para>
|
|
|
|
|
Bus names can also be used to coordinate single-instance applications.
|
|
|
|
|
If you want to be sure only one
|
|
|
|
|
<literal>com.mycompany.TextEditor</literal> application is running for
|
|
|
|
|
example, have the text editor application exit if the bus name already
|
|
|
|
|
has an owner.
|
|
|
|
|
</para>
|
|
|
|
|
|
2003-10-02 22:34:17 +00:00
|
|
|
</sect2>
|
|
|
|
|
|
|
|
|
|
<sect2 id="addresses">
|
|
|
|
|
<title>Addresses</title>
|
|
|
|
|
|
|
|
|
|
<para>
|
2006-08-03 20:34:36 +00:00
|
|
|
Applications using D-Bus are either servers or clients. A server
|
2003-10-02 22:34:17 +00:00
|
|
|
listens for incoming connections; a client connects to a server. Once
|
|
|
|
|
the connection is established, it is a symmetric flow of messages; the
|
|
|
|
|
client-server distinction only matters when setting up the
|
|
|
|
|
connection.
|
|
|
|
|
</para>
|
|
|
|
|
|
2006-08-20 21:41:42 +00:00
|
|
|
<para>
|
|
|
|
|
If you're using the bus daemon, as you probably are, your application
|
|
|
|
|
will be a client of the bus daemon. That is, the bus daemon listens
|
|
|
|
|
for connections and your application initiates a connection to the bus
|
|
|
|
|
daemon.
|
|
|
|
|
</para>
|
|
|
|
|
|
2003-10-02 22:34:17 +00:00
|
|
|
<para>
|
2006-08-03 20:34:36 +00:00
|
|
|
A D-Bus <firstterm>address</firstterm> specifies where a server will
|
2003-10-02 22:34:17 +00:00
|
|
|
listen, and where a client will connect. For example, the address
|
|
|
|
|
<literal>unix:path=/tmp/abcdef</literal> specifies that the server will
|
|
|
|
|
listen on a UNIX domain socket at the path
|
|
|
|
|
<literal>/tmp/abcdef</literal> and the client will connect to that
|
|
|
|
|
socket. An address can also specify TCP/IP sockets, or any other
|
2006-08-03 20:34:36 +00:00
|
|
|
transport defined in future iterations of the D-Bus specification.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
2006-08-20 21:41:42 +00:00
|
|
|
When using D-Bus with a message bus daemon,
|
2003-10-02 22:34:17 +00:00
|
|
|
libdbus automatically discovers the address of the per-session bus
|
|
|
|
|
daemon by reading an environment variable. It discovers the
|
|
|
|
|
systemwide bus daemon by checking a well-known UNIX domain socket path
|
|
|
|
|
(though you can override this address with an environment variable).
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
2006-08-03 20:34:36 +00:00
|
|
|
If you're using D-Bus without a bus daemon, it's up to you to
|
2003-10-02 22:34:17 +00:00
|
|
|
define which application will be the server and which will be
|
|
|
|
|
the client, and specify a mechanism for them to agree on
|
2006-08-20 21:41:42 +00:00
|
|
|
the server's address. This is an unusual case.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
|
|
<sect2 id="bigpicture">
|
|
|
|
|
<title>Big Conceptual Picture</title>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Pulling all these concepts together, to specify a particular
|
|
|
|
|
method call on a particular object instance, a number of
|
|
|
|
|
nested components have to be named:
|
|
|
|
|
<programlisting>
|
2005-01-21 03:44:10 +00:00
|
|
|
Address -> [Bus Name] -> Path -> Interface -> Method
|
2003-10-02 22:34:17 +00:00
|
|
|
</programlisting>
|
2005-01-18 20:42:15 +00:00
|
|
|
The bus name is in brackets to indicate that it's optional -- you only
|
|
|
|
|
provide a name to route the method call to the right application
|
2003-10-02 22:34:17 +00:00
|
|
|
when using the bus daemon. If you have a direct connection to another
|
2005-01-18 20:42:15 +00:00
|
|
|
application, bus names aren't used; there's no bus daemon.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
The interface is also optional, primarily for historical
|
|
|
|
|
reasons; DCOP does not require specifying the interface,
|
|
|
|
|
instead simply forbidding duplicate method names
|
2006-08-03 20:34:36 +00:00
|
|
|
on the same object instance. D-Bus will thus let you
|
2003-10-02 22:34:17 +00:00
|
|
|
omit the interface, but if your method name is ambiguous
|
|
|
|
|
it is undefined which method will be invoked.
|
|
|
|
|
</para>
|
2006-08-20 21:41:42 +00:00
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
|
|
<sect2 id="messages">
|
|
|
|
|
<title>Messages - Behind the Scenes</title>
|
|
|
|
|
<para>
|
|
|
|
|
D-Bus works by sending messages between processes. If you're using
|
|
|
|
|
a sufficiently high-level binding, you may never work with messages directly.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
There are 4 message types:
|
|
|
|
|
<itemizedlist>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Method call messages ask to invoke a method
|
|
|
|
|
on an object.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Method return messages return the results
|
|
|
|
|
of invoking a method.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Error messages return an exception caused by
|
|
|
|
|
invoking a method.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Signal messages are notifications that a given signal
|
|
|
|
|
has been emitted (that an event has occurred).
|
|
|
|
|
You could also think of these as "event" messages.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
</itemizedlist>
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
A method call maps very simply to messages: you send a method call
|
|
|
|
|
message, and receive either a method return message or an error message
|
|
|
|
|
in reply.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
Each message has a <firstterm>header</firstterm>, including <firstterm>fields</firstterm>,
|
|
|
|
|
and a <firstterm>body</firstterm>, including <firstterm>arguments</firstterm>. You can think
|
|
|
|
|
of the header as the routing information for the message, and the body as the payload.
|
|
|
|
|
Header fields might include the sender bus name, destination bus name, method or signal name,
|
|
|
|
|
and so forth. One of the header fields is a <firstterm>type signature</firstterm> describing the
|
|
|
|
|
values found in the body. For example, the letter "i" means "32-bit integer" so the signature
|
|
|
|
|
"ii" means the payload has two 32-bit integers.
|
|
|
|
|
</para>
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
|
|
<sect2 id="callprocedure">
|
|
|
|
|
<title>Calling a Method - Behind the Scenes</title>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
A method call in DBus consists of two messages; a method call message sent from process A to process B,
|
|
|
|
|
and a matching method reply message sent from process B to process A. Both the call and the reply messages
|
|
|
|
|
are routed through the bus daemon. The caller includes a different serial number in each call message, and the
|
|
|
|
|
reply message includes this number to allow the caller to match replies to calls.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
The call message will contain any arguments to the method.
|
|
|
|
|
The reply message may indicate an error, or may contain data returned by the method.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
A method invocation in DBus happens as follows:
|
|
|
|
|
<itemizedlist>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
The language binding may provide a proxy, such that invoking a method on
|
|
|
|
|
an in-process object invokes a method on a remote object in another process. If so, the
|
|
|
|
|
application calls a method on the proxy, and the proxy
|
|
|
|
|
constructs a method call message to send to the remote process.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
For more low-level APIs, the application may construct a method call message itself, without
|
|
|
|
|
using a proxy.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
In either case, the method call message contains: a bus name belonging to the remote process; the name of the method;
|
|
|
|
|
the arguments to the method; an object path inside the remote process; and optionally the name of the
|
|
|
|
|
interface that specifies the method.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
The method call message is sent to the bus daemon.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
The bus daemon looks at the destination bus name. If a process owns that name,
|
|
|
|
|
the bus daemon forwards the method call to that process. Otherwise, the bus daemon
|
|
|
|
|
creates an error message and sends it back as the reply to the method call message.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
The receiving process unpacks the method call message. In a simple low-level API situation, it
|
|
|
|
|
may immediately run the method and send a method reply message to the bus daemon.
|
|
|
|
|
When using a high-level binding API, the binding might examine the object path, interface,
|
|
|
|
|
and method name, and convert the method call message into an invocation of a method on
|
|
|
|
|
a native object (GObject, java.lang.Object, QObject, etc.), then convert the return
|
|
|
|
|
value from the native method into a method reply message.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
The bus daemon receives the method reply message and sends it to the process that
|
|
|
|
|
made the method call.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
The process that made the method call looks at the method reply and makes use of any
|
|
|
|
|
return values included in the reply. The reply may also indicate that an error occurred.
|
|
|
|
|
When using a binding, the method reply message may be converted into the return value of
|
|
|
|
|
of a proxy method, or into an exception.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
</itemizedlist>
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
The bus daemon never reorders messages. That is, if you send two method call messages to the same recipient,
|
|
|
|
|
they will be received in the order they were sent. The recipient is not required to reply to the calls
|
|
|
|
|
in order, however; for example, it may process each method call in a separate thread, and return reply messages
|
|
|
|
|
in an undefined order depending on when the threads complete. Method calls have a unique serial
|
|
|
|
|
number used by the method caller to match reply messages to call messages.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
|
|
<sect2 id="signalprocedure">
|
|
|
|
|
<title>Emitting a Signal - Behind the Scenes</title>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
A signal in DBus consists of a single message, sent by one process to any number of other processes.
|
|
|
|
|
That is, a signal is a unidirectional broadcast. The signal may contain arguments (a data payload), but
|
|
|
|
|
because it is a broadcast, it never has a "return value." Contrast this with a method call
|
|
|
|
|
(see <xref linkend="callprocedure"/>) where the method call message has a matching method reply message.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
The emitter (aka sender) of a signal has no knowledge of the signal recipients. Recipients register
|
|
|
|
|
with the bus daemon to receive signals based on "match rules" - these rules would typically include the sender and
|
|
|
|
|
the signal name. The bus daemon sends each signal only to recipients who have expressed interest in that
|
|
|
|
|
signal.
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
A signal in DBus happens as follows:
|
|
|
|
|
<itemizedlist>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
A signal message is created and sent to the bus daemon. When using the low-level API this may be
|
|
|
|
|
done manually, with certain bindings it may be done for you by the binding when a native object
|
|
|
|
|
emits a native signal or event.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
The signal message contains the name of the interface that specifies the signal;
|
|
|
|
|
the name of the signal; the bus name of the process sending the signal; and
|
|
|
|
|
any arguments
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Any process on the message bus can register "match rules" indicating which signals it
|
|
|
|
|
is interested in. The bus has a list of registered match rules.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
The bus daemon examines the signal and determines which processes are interested in it.
|
|
|
|
|
It sends the signal message to these processes.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>
|
|
|
|
|
Each process receiving the signal decides what to do with it; if using a binding,
|
|
|
|
|
the binding may choose to emit a native signal on a proxy object. If using the
|
|
|
|
|
low-level API, the process may just look at the signal sender and name and decide
|
|
|
|
|
what to do based on that.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
</itemizedlist>
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
|
|
<sect2 id="introspection">
|
|
|
|
|
<title>Introspection</title>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
D-Bus objects may support the interface <literal>org.freedesktop.DBus.Introspectable</literal>.
|
|
|
|
|
This interface has one method <literal>Introspect</literal> which takes no arguments and returns
|
|
|
|
|
an XML string. The XML string describes the interfaces, methods, and signals of the object.
|
|
|
|
|
See the D-Bus specification for more details on this introspection format.
|
|
|
|
|
</para>
|
|
|
|
|
|
2003-10-02 22:34:17 +00:00
|
|
|
</sect2>
|
|
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
|
|
|
|
|
|
<sect1 id="glib-client">
|
2014-09-10 13:53:39 +01:00
|
|
|
<title>GLib APIs</title>
|
2003-10-02 22:34:17 +00:00
|
|
|
<para>
|
2014-09-10 13:53:39 +01:00
|
|
|
The recommended GLib API for D-Bus is GDBus, which has been
|
|
|
|
|
distributed with GLib since version 2.26. It is not documented here.
|
|
|
|
|
See <ulink url="https://developer.gnome.org/gio/stable/gdbus-convenience.html">the
|
|
|
|
|
GLib documentation</ulink> for details of how to use GDBus.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
2004-08-10 04:18:31 +00:00
|
|
|
|
|
|
|
|
<para>
|
2014-09-10 13:53:39 +01:00
|
|
|
An older API, dbus-glib, also exists. It is deprecated and should
|
|
|
|
|
not be used in new code. Whenever possible, porting existing code
|
|
|
|
|
from dbus-glib to GDBus is also recommended.
|
2005-06-12 Colin Walters <walters@verbum.org>
Async signals and various bugfixes and testing by
Ross Burton <ross@burtonini.com>.
* glib/dbus-gvalue.h: (struct DBusBasicGValue): Delete.
(dbus_gvalue_genmarshal_name_from_type)
(dbus_gvalue_ctype_from_type): Moved to dbus-binding-tool-glib.c.
(dbus_gtype_to_dbus_type): Renamed to dbus_gtype_from_signature.
(dbus_g_value_types_init, dbus_gtype_from_signature)
(dbus_gtype_from_signature_iter, dbus_gtype_to_signature)
(dbus_gtypes_from_arg_signature): New function prototypes.
(dbus_gvalue_demarshal): Take context and error arguments.
(dbus_gvalue_demarshal_variant): New function.
(dbus_gvalue_demarshal_message): New function.
(dbus_gvalue_store): Delete.
* glib/dbus-gvalue.c:
File has been almost entirely rewritten; now we special-case
more types such as DBUS_TYPE_SIGNATURE, handle arrays and
hash tables correctly, etc. Full support for recursive values
is not yet complete.
* glib/dbus-gproxy.c (dbus_g_proxy_class_init): Change last
argument of signal to G_TYPE_POINTER since we now pass a
structure.
(lookup_g_marshaller): Delete in favor of
_dbus_gobject_lookup_marshaller.
(marshal_dbus_message_to_g_marshaller): Use
_dbus_gobject_lookup_marshaller and dbus_gvalue_demarshal_message
to handle remote signal callbacks.
(dbus_g_proxy_new_from_proxy): New function; creates a new
DBusGProxy by copying an existing one.
(dbus_g_proxy_get_interface, dbus_g_proxy_set_interface)
(dbus_g_proxy_get_path): New functions.
(dbus_g_proxy_marshal_args_to_message): New function;
factored out of existing code.
(DBUS_G_VALUE_ARRAY_COLLECT_ALL): Collect all arguments
from a varargs array.
(dbus_g_proxy_begin_call_internal): New function.
(dbus_g_proxy_end_call_internal): New function.
(dbus_g_proxy_begin_call): Take GTypes instead of DBus types
as arguments; simply invoke dbus_g_proxy_begin_call_internal
after collecting args into value array.
(dbus_g_proxy_end_call): Take GTypes instead of DBus types;
invoke dbus_g_proxy_end_call_internal.
(dbus_g_proxy_invoke): Simply invoke begin_call_interanl and
end_call_internal.
(dbus_g_proxy_call_no_reply): Take GTypes instead of DBus
types.
(array_free_all): New function.
(dbus_g_proxy_add_signal): Take GTypes.
* glib/dbus-gobject.h:
(_dbus_glib_marshal_dbus_message_to_gvalue_array): Delete.
(_dbus_gobject_get_path, _dbus_gobject_lookup_marshaller):
Prototype.
* glib/dbus-gobject.c: Add a global marshal_table hash which
stores mappings from type signatures to marshallers. Change lots
of invocations of dbus_gtype_to_dbus_type to
dbus_gtype_to_signature.
(_dbus_glib_marshal_dbus_message_to_gvalue_array): Delete.
(introspect_signals): Fix test for query.return_type.
(set_object_property): Update invocation of dbus_gvalue_demarshal.
(invoke_object_method): Many changes. Handle asynchronous
invocations. Convert arguments with
dbus_gvalue_demarshal_message. Handle errors. Use
DBusSignatureIter instead of strlen on args. Handle all arguments
generically. Special-case variants.
(dbus_g_method_return, dbus_g_method_return_error): New function.
(DBusGSignalClosure): New structure, closes over signal
information.
(dbus_g_signal_closure_new): New function.
(dbus_g_signal_closure_finalize): New function.
(signal_emitter_marshaller): New function; is special marshaller
which emits signals on bus.
(export_signals): New function; introspects object signals and
connects to them.
(dbus_g_object_type_install_info): Take GType instead of
GObjectClass.
(dbus_g_connection_register_g_object): Invoke export_signals.
(dbus_g_connection_lookup_g_object): New function.
(DBusGFuncSignature) New structure; used for mapping type
signatures to marshallers.
(funcsig_hash): New function; hashes DBusGFuncSignature.
(funcsig_equal): New function; compares DBusGFuncSignature.
(_dbus_gobject_lookup_marshaller): New function.
(dbus_g_object_register_marshaller): New function; used to
register a marshaller at runtime for a particular signature.
* glib/dbus-gmain.c (_dbus_gmain_test): Add various tests.
* glib/dbus-binding-tool-glib.h: Add DBUS_GLIB_ANNOTATION_ASYNC
which notes a server method implementation should be
asynchronous.
* glib/dbus-binding-tool-glib.c
(dbus_binding_tool_output_glib_server): Call
dbus_g_value_types_init.
(write_formal_parameters): Use dbus_gtype_from_signature. Handle
variants specially.
(dbus_g_type_get_lookup_function): Turn GType into an invocation
of a lookup function.
(write_args_for_direction): Use dbus_g_type_get_lookup_function.
(write_untyped_out_args): New method; write output arguments.
(write_formal_declarations_for_direction): Function for
writing prototypes.
(write_formal_parameters_for_direction): Function for
writing implementations.
(write_typed_args_for_direction): Function for writing
arguments prefixed with GTypes.
(write_async_method_client): Write out async version
of method.
* glib/dbus-binding-tool-glib.c: Include dbus-gvalue-utils.h.
(dbus_g_type_get_marshal_name): Move mapping from GType
to marshal name into here.
(dbus_g_type_get_c_name): Move into here.
(compute_marshaller): Convert signature to type with
dbus_gtype_from_signature, use dbus_g_type_get_marshal_name.
(compute_marshaller_name): Ditto.
(compute_marshaller): Handle async signal annotations.
(gather_marshallers): Return if we don't have a known
prefix.
(generate_glue): Collect introspection blob here, and
write all of the blob at the end. This allows an object
with multiple interfaces to work.
Mark async methods in introspection blob.
* glib/Makefile.am (libdbus_glib_1_la_SOURCES): Add
dbus-gtype-specialized.c, dbus-gtype-specialized.h,
dbus-gvalue-utils.h, dbus-gvalue-utils.c.
* dbus/dbus-glib.h: Don't include dbus-protocol.h; this
avoids people accidentally using DBUS_TYPE_* which should
not be necessary anymore.
Do include dbus-gtype-specialized.h, which are utilities
for GLib container types.
Add various #defines for types such as
DBUS_TYPE_G_BOOLEAN_ARRAY.
(DBusGValueIterator, DBusGValue): Define, not fully used
yet.
(dbus_g_value_get_g_type): Type for recursive value.
(dbus_g_value_open, dbus_g_value_iterator_get_value)
(dbus_g_value_iterator_get_values, dbus_g_value_iterator_recurse)
(dbus_g_value_free): Prototypes.
(dbus_g_object_register_marshaller, dbus_g_proxy_new_from_proxy): Prototype.
(dbus_g_proxy_set_interface): Prototype.
(dbus_g_proxy_begin_call, dbus_g_proxy_end_call)
(dbus_g_proxy_call_no_reply): Take GLib types instead of DBus
types.
(dbus_g_proxy_get_path, dbus_g_proxy_get_interface):
Accessors.
(DBusGAsyncData, DBusGMethodInvocation): Structures for
doing async invocations.
(dbus_g_method_return, dbus_g_method_return_error):
Prototypes.
* doc/dbus-tutorial.xml: Update GLib section.
* tools/dbus-viewer.c (load_child_nodes): Update
for new invocation type of dbus_g_proxy_end_call.
(load_from_service_thread_func): Ditto.
* tools/print-introspect.c (main): Ditto.
* tools/dbus-names-model.c (have_names_notify)
(names_model_reload, names_model_set_connection)
Use GTypes.
* python/Makefile.am (INCLUDES): Define DBUS_COMPILATION,
needed since Python bindings use GLib bindings.
* test/glib/Makefile.am (INCLUDES): Define DBUS_COMPILATION.
Add --prefix argument.
* tools/Makefile.am: Define DBUS_COMPILATION. Remove
unneeded --ignore-unsupported arg.
* test/glib/test-service-glib.c:
* test/glib/test-service-glib.xml:
* test/glib/test-dbus-glib.c: Add many more tests.
2005-06-13 03:01:30 +00:00
|
|
|
</para>
|
2003-10-02 22:34:17 +00:00
|
|
|
</sect1>
|
|
|
|
|
|
2005-07-15 02:15:08 +00:00
|
|
|
<sect1 id="python-client">
|
2007-01-25 16:42:54 +00:00
|
|
|
<title>Python API</title>
|
2003-10-02 22:34:17 +00:00
|
|
|
<para>
|
2007-01-25 16:42:54 +00:00
|
|
|
The Python API, dbus-python, is now documented separately in
|
|
|
|
|
<ulink url="http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html">the dbus-python tutorial</ulink> (also available in doc/tutorial.txt,
|
|
|
|
|
and doc/tutorial.html if built with python-docutils, in the dbus-python
|
|
|
|
|
source distribution).
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
2005-07-15 02:15:08 +00:00
|
|
|
</sect1>
|
|
|
|
|
|
|
|
|
|
<sect1 id="qt-client">
|
2014-09-10 13:53:39 +01:00
|
|
|
<title>Qt API</title>
|
2003-10-02 22:34:17 +00:00
|
|
|
<para>
|
2014-09-10 13:53:39 +01:00
|
|
|
The Qt binding for libdbus, QtDBus, has been distributed with Qt
|
|
|
|
|
since version 4.2. It is not documented here. See
|
|
|
|
|
<ulink url="http://qt-project.org/doc/qt-5/qtdbus-index.html">the Qt
|
|
|
|
|
documentation</ulink> for details of how to use QtDBus.
|
2003-10-02 22:34:17 +00:00
|
|
|
</para>
|
|
|
|
|
</sect1>
|
2003-09-30 03:34:00 +00:00
|
|
|
</article>
|