DBus客户端使用总结(d-feet,qdbus,dbus-send,gdbus)

目录

d-feet客户端

qdbus客户端

​编辑

gdbus客户端

dbus-send客户端


d-feet客户端

d-feet是比较好用的dbus工具,他使用python语言编写的,并且他有可视化界面,在d-feet工具内可以方便的看到系统dbus接口以及session的dbus接口,在查询dbus接口方面是非常不错的.缺点在于如果希望编写自动化脚本测试dbus接口,d-feet客户端就不行了(也许有方法我不知道)

客户端安装

sudo apt install d-feet

详细内容可以看:-> D-Feet的复杂类型使用攻略(DBUS)

qdbus客户端

qdbus客户端是qt的开发客户端工具。使用命令行进行控制,可以很方便的编写自动化用例.

该工具使用table健也可以很方便的查找,dbus接口。

qdbus客户端安装如下:

sudo apt install qtchooser

使用方法如下:

Usage: qdbus [--system | --address ADDRESS] [--literal] [servicename] [path] [method] [args]

  servicename       the service to connect to (e.g., org.freedesktop.DBus)
  path              the path to the object (e.g., /)
  method            the method to call, with or without the interface
  args              arguments to pass to the call
With 0 arguments, qdbus will list the services available on the bus
With just the servicename, qdbus will list the object paths available on the service
With service name and object path, qdbus will list the methods, signals and properties available on the object

Options:
  --system          connect to the system bus
  --address ADDRESS connect to the given bus
  --literal         print replies literally

使用案例

qdbus --literal com.ubx.server /com/ubx/server org.freedesktop.DBus.Introspectable.Introspect

执行结果

 

gdbus客户端

sudo apt install libglib2.0-bin

详细可以点击:-> gdbus命令客户使用攻略

dbus-send客户端

dbus-send是dbus自带的客户端工具

sudo apt install dbus

ddbus-send工具使用方法和qdbus很相识,dbus自带的工具,一般系统都会有,所以不需要安装额外的工具。

用法如下:

dbus-send [--system | --session | --bus=ADDRESS | --peer=ADDRESS] [--dest=NAME] [--type=TYPE] [--print-reply[=literal]] [--reply-timeout=MSEC] <destination object path> <message name> [contents ...]
dbus-send⽀持的参数类型包括:string, int32, uint32, double, byte, boolean

dbus-send --session --print-reply --dest=org.freedesktop.Notifications /org/freedesktop/Notifications com.deepin.dde.Notification.Show

运行结果

method return time=1655429935.909792 sender=:1.2305 -> destination=:1.2396 serial=731 reply_serial=2

如果函数需要传递参数

dbus-send --system --print-reply --dest=org.bluez /org/bluez/audio org.bluez.audio.Manager.CreateDevice string:'11:11:11:11:11:11'

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
蓝牙协议栈Bluez是Linux系统的官方蓝牙协议栈,它是一个开源项目,从Linux 2.4.6版本开始成为Linux内核的一部分。Bluez协议栈支持蓝牙技术,可以实现多种电子设备之间的短距离无线通信,无需任何线缆和用户手工干涉。它由底层硬件模块、中间层和高端应用层三部分组成。Bluez协议栈的功能包括自动同步和建立无线网络,实现设备之间的资源共享。蓝牙Mesh功能在Bluez协议栈的Release 5.47版本开始逐步支持,但目前的最新版本是Release 5.66。需要注意的是,截至目前,蓝牙Mesh的单元测试尚未全部实现。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* [BlueTooth: 蓝牙Bluz协议栈概述](https://blog.csdn.net/Augusdi/article/details/25899123)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [(一)深入理解Bluez协议栈之蓝牙Mesh的支持(1/5)](https://blog.csdn.net/wanguofeng8023/article/details/129213237)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

三雷科技

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值