dbus c:什么绑定(gdbus?)和客户机/服务器的简单示例

时间:2021-09-23 04:57:41

I would like to use dbus for communication between applications (actually I'm using a localhost socket). I'm searching for a very basic (but complete/compilable) working example, so googleing around I found that the low level api is not to use because it is better to use bindings, dbus-glib bindings have some documentation but are also not to use because now there's the new gdbus (dbus integrated in glib) since version 2.26. about gdbus except for the api http://developer.gnome.org/gio/stable/gdbus-convenience.html I cannot find any mini tutorial/minimal working example. Can anybody help me out with this? Thanks.

我希望使用dbus来在应用程序之间进行通信(实际上,我使用的是本地主机套接字)。我寻找一个非常基本的(但完整/ compilable)工作的例子,所以谷歌我发现低级别api是不使用,因为它是最好使用绑定,dbus-glib绑定有一些文档,但是也不使用,因为现在有新的gdbus自版本2.26(glib dbus集成)。关于gdbus,除了api http://developer.gnome.org/gio/stable/gdbus-convenience.html之外,我找不到任何迷你教程/最小工作示例。有人能帮我一下吗?谢谢。

1 个解决方案

#1


3  

Here's a short tutorial which is mainly focused on how to migrate to GDBus from the low-level dbus-glib. However, there are some fairly good examples which helped me.

这里有一个简短的教程,主要关注如何从底层的dbus-glib迁移到GDBus。然而,有一些相当好的例子对我有帮助。

If you are using GObject, you can expose your object to GDBus fairly easy without messing with any code generation from xml. (see the tutorial above)

如果您正在使用GObject,则可以相当容易地将对象暴露给GDBus,而不会影响从xml生成任何代码。(见上面的教程)

#1


3  

Here's a short tutorial which is mainly focused on how to migrate to GDBus from the low-level dbus-glib. However, there are some fairly good examples which helped me.

这里有一个简短的教程,主要关注如何从底层的dbus-glib迁移到GDBus。然而,有一些相当好的例子对我有帮助。

If you are using GObject, you can expose your object to GDBus fairly easy without messing with any code generation from xml. (see the tutorial above)

如果您正在使用GObject,则可以相当容易地将对象暴露给GDBus,而不会影响从xml生成任何代码。(见上面的教程)