D-BUS manual
https://dbus.freedesktop.org/doc/dbus-tutorial.html, Red Hat, Inc <hp@pobox.com>
David Wheeler, John Palmieri, Red Hat, Inc. <johnp@redhat.com>
Colin Walters, Red Hat, Inc. <walters@redhat.com>
Version 0.5.0
Translated by I.V. Plastov, plastov.igor@yandex.ru
Document under development
This tutorial is incomplete. It probably contains some useful information, but it also has a lot of gaps. Right now, you also need to consult the D-Bus specification, the Doxygen reference documentation, and see some examples of how other applications use D-Bus.
Improvements to the manual are definitely appreciated - send your corrections or suggestions to the mailing list. If you are creating a D-Bus binding, please add a tutorial section for your binding, at least a small section with a couple of examples.
What is D-Bus?
D-Bus is an Inter-Process Communication (IPC) system. Architecturally, it has several layers:
A libdbus library that allows two applications to connect to each other and exchange messages.
, libdbus, . .
. , libdbus-glib libdbus-qt. , Python. - API-, , D-Bus. libdbus . API libdbus .
libdbus -, raw-. , , . , , . libdbus ( - ) , .
. - , libdbus. , , . .
. - , , sendmail Apache. , , . . .
. IPC , .
D-Bus
, - « » «»: CORBA, DCE, DCOM, DCOP, XML-RPC, SOAP, MBUS, Internet Communications Engine (ICE) . . D-Bus :
; ( ).
, .
GNOME KDE IPC, CORBA DCOP. D-Bus , , . D-Bus ; FAQ IPC.
, , Linux Hotplug:
Linux , - « ». , , . , , : , .
« », ( ) ( ). : , . ( , , .) Linux . D-Bus .
D-Bus , , . , IPC:
, ( X Window System);
;
- , «» ;
, / / .
DCOP, KDE .
.
, D-Bus. , , GLib, Qt Python.
, .
/
, , , « »; . : java.lang.Object, GObject, QObject, Python - . .
D-Bus API libdbus . , . , .
, ,
/org/kde/kspread/sheet/3/cells/4/5
. - ,
/com/mycompany/c5yo817y0c1y1c5b
, .
- (,
/org/kde
). .
. - . - , , ( « ») ( « »). - ; .
, , «Frobate» «OnClicked».
. , GLib, Qt Java. .
D‑Bus ,
org.freedesktop.Introspectable
. , , Java C++.
- - , . D‑Bus API , , . . , -, DBus, , .
:
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();
}
:
Proxy proxy = new Proxy(getBusConnection(), "/remote/object/path");
Object returnValue = proxy.MethodName(arg1, arg2);
, , . ‘:’ (). — , . “:34–907”. , .
, , .
(well-known) . ,
com.mycompany.TextEditor
. ,
/com/mycompany/TextFileManager
,
org.freedesktop.FileHandler.
, .
IP-, . ,
com.mycompany.TextEditor
:34-907
,
mycompany.com
-
192.168.0.5
, , . . ( ), . , , . , .
«» . , , ,
com.mycompany.TextEditor
, , .
, D-Bus, , . ; . , . - .
, , . , .
D-Bus , , . ,
unix:path=/tmp/abcdef
, UNIX
/tmp/abcdef
. TCP/IP , D-Bus.
D-Bus libdbus , . , UNIX ( ).
D-Bus , , , — , . .
, , :
, , — . , .
-> [ ] -> -> ->
, ; DCOP , . , D-Bus , , , .
D-Bus , . , .
4 :
;
;
, ;
— , ( ). « ».
: , .
, , , . , — . , , . — , , . , «i» «32- », «ii» , 32- .
D-Bus ; , A B, , B A. , . , , .
. , .
D-Bus :
, . , -, .
API , .
: , , , , , , , .
.
. , . .
. API . API , , (GObject, java.lang.Object, QObject, . .), .
, .
, , , . , . - .
. , , , . ; , , . , .
D‑Bus , . — . ( ), , « ». (. #), .
( ) . « » — . , .
D‑Bus :
. API , , .
, , , , ; .
« », , . .
, . .
, , , ; , -. API , .
D-Bus
org.freedesktop.DBus.Introspectable
Introspect, XML. XML , . . D-Bus .
GLib API
GLib API D-Bus — GDBus, GLib 2.26. , , GDBus . GLib :
https://developer.gnome.org/gio/stable/gdbus-convenience.html
API, dbus-glib. . dbus-glib GDBus.
Python API
Python API, dbus-python, dbus-python
http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html
(also available in doc / tutorial.txt and doc / tutorial.html if built with python-documenttils , in dbus-python source distribution ).
Qt API
The Qt binding for libdbus , QtDBus, has been distributed since Qt 4.2. This is not documented here. For details on how to use QtDBus see the Qt documentation