Manual D-BUS
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>
VersĂŁo 0.5.0
Traduzido por I.V. Plastov, plastov.igor@yandex.ru
Documento em desenvolvimento
Este tutorial estĂĄ incompleto. Provavelmente contĂ©m algumas informaçÔes Ășteis, mas tambĂ©m contĂ©m muitas lacunas. Agora, vocĂȘ tambĂ©m precisa consultar as especificaçÔes do D-Bus, a documentação de referĂȘncia do Doxygen e ver alguns exemplos de como outros aplicativos usam o D-Bus.
Melhorias no manual sĂŁo definitivamente bem-vindas - envie suas correçÔes ou sugestĂ”es para a lista de discussĂŁo. Se vocĂȘ estiver criando uma ligação D-Bus, adicione uma seção de tutorial para sua ligação, pelo menos uma pequena seção com alguns exemplos.
O que Ă© D-Bus?
D-Bus é um sistema de comunicação entre processos (IPC). Arquitetonicamente, ele tem vårias camadas:
A biblioteca libdbus que permite que dois aplicativos se conectem entre si e troquem mensagens.
, 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.IntrospectableIntrospect, 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
(tambĂ©m disponĂvel em doc / tutorial.txt e doc / tutorial.html se construĂdo com python-documenttils , na distribuição de fonte dbus-python ).
API Qt
O vĂnculo Qt para libdbus , QtDBus, foi distribuĂdo desde Qt 4.2. Isso nĂŁo estĂĄ documentado aqui. Para detalhes sobre como usar o QtDBus veja a documentação do Qt