linux - 如何从控制台创建 dbus 服务?

标签 linux bash dbus

使用 dbus-send 或 dbus-monitor 等工具,或多或少有一些直接的方法可以发出或监听现有 DBus 服务的信号。

如何从 shell 注册服务和对象?期待类似的东西

1> dbus-service --session org.example.Test /Test
  2> qdbus org.example.Test /Test org.example.Test.Call qqq
1> qqq
  2> qdbus org.example.Test /Test org.example.Test.Call www
1> www

或者喜欢

1> dbus-service --argc=2 --session org.example.Test /Test -- /usr/bin/printf "%s Q %s\n"
  2> qdbus org.example.Test /Test org.example.Test.Call qqq ttw
1> qqq Q ttw
  2> qdbus org.example.Test /Test org.example.Test.Call www 111
1> www Q 111

最佳答案

自己实现:http://vi-server.org/pub/dbus-shell-service.pl使用 this question例如。

Usage: dbus-shell-service.pl service_name command_line_arguments...
Example:
  dbus-shell-service.pl org.example.Test /usr/bin/printf '%s Q %s\n' &
  qdbus org.example.Test / org.vi_server.DbusShellService.Call2 s1 s2
  s1 Q s2

关于linux - 如何从控制台创建 dbus 服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10021511/

相关文章:

linux - Bash 脚本 : expansion of argument not using $@ or $*

linux - 从第一列中提取子字符串

linux - 如何在 shell 脚本中使用 sed 从文件的每一行中删除单词?

linux - 如何通过串口采集语音PCM数据并进行处理?

linux - 在 Cubietruck 上安装 node.js 和 mongoDB

linux - "Fatal: there are problems with fetch_image.cgi"使用 LabelMeAnnotationTool

c - 用于控制系统服务的简单 C 或 C++ API

linux - Makefile:124: *** 对函数 `foreach' 的调用未终止:缺少 `)' 。停止

c - dbus - 在接口(interface) NULL 上将对象注册到远程

c - Dbus mainloop.h 缺失错误