DBUS入门笔记

这篇博客介绍了DBUS的基本概念,包括其三层结构和应用场景。DBUS作为Linux下的进程间通信(IPC)工具,提供异步处理、安全连接等特点。文中详细解释了Object Path、接口、代理和Bus Name等核心概念,并通过QTDBUS的remotecontrolledcar案例展示了如何使用DBUS进行通信。在Mac上,博主分享了如何配置dbus-daemon作为守护进程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

DBUS简介

学习网址:https://dbus.freedesktop.org/doc/dbus-tutorial.html

DBUS三层:
libdbus,消息分发的守护进程Dbus daemon,应用程序框架的封装库或绑定 (For example, libdbus-glib and libdbus-qt)

libdbus仅仅支持one-to-one connection

关于传递,对象是message = header (filed) + body (param)
header常包括body中的数据类型信息。

DBUS的应用场景:
同一会话中的桌面应用程序
桌面应用程序和OS(系统级别的守护进程)

DBUS可以解决传统Linux IPC不能应付的远端系统管理员问题:


           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.


            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
            
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值