ترجمة مقال تمهيدي من مطوري D-BUS

دليل D-BUS

https://dbus.freedesktop.org/doc/dbus-tutorial.html، Red Hat، Inc <hp@pobox.com>

ديفيد ويلر ، جون بالميري ، ريد هات ، إنك. <johnp@redhat.com>

كولين والترز ، ريد هات ، إنك. <walters@redhat.com>

الإصدار 0.5.0

ترجمه I.V. Plastov ، plastov.igor@yandex.ru

الوثيقة قيد التطوير

هذا البرنامج التعليمي غير مكتمل. ربما تحتوي على بعض المعلومات المفيدة ، ولكن بها أيضًا الكثير من الثغرات. في الوقت الحالي ، تحتاج أيضًا إلى الرجوع إلى مواصفات D-Bus ، والوثائق المرجعية لـ Doxygen ، والاطلاع على بعض الأمثلة حول كيفية استخدام التطبيقات الأخرى لـ D-Bus.

نقدر بالتأكيد إدخال تحسينات على الدليل - أرسل تصحيحاتك أو اقتراحاتك إلى القائمة البريدية. إذا كنت تقوم بإنشاء رابط D-Bus ، فالرجاء إضافة قسم تعليمي للربط الخاص بك ، على الأقل قسم صغير مع بعض الأمثلة.

ما هو D-Bus؟

D-Bus هو نظام اتصال بين العمليات (IPC). من الناحية المعمارية ، لها عدة طبقات:

  • مكتبة libdbus تسمح لتطبيقين بالاتصال ببعضهما البعض وتبادل الرسائل.

  • ,  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

 (متوفر أيضًا في doc / tutorial.txt و doc / tutorial.html إذا تم إنشاؤه باستخدام python-documenttils ، في توزيع مصدر dbus-python ).

كيو تي API

تم توزيع ربط Qt لـ libdbus ، QtDBus ، منذ Qt 4.2. هذا غير موثق هنا. للحصول على تفاصيل حول كيفية استخدام QtDBus ، راجع وثائق Qt

 http://qt-project.org/doc/qt-5/qtdbus-index.html .




All Articles