【发布时间】:2020-10-12 15:01:16
【问题描述】:
我有一个正在运行的进程,它有一个采用结构的 DBUS 端点。这是使用 qt 和 q-dbus 开发的。
在 dfeet 中,我看到了端点方法的详细信息
setScreen (Struct of (Int32, Struct of (String), Boolean, Struct of (Int32, UInt32, Byte, Boolean, Byte, Int32, String, String, String, String, String, String, String, String, String), Struct of (Int32, UInt32, Byte, Boolean, Byte, Int32, String, String, String, String, String, String, String, String, String)) screenUi) ↦ (Boolean arg_0)
我试图弄清楚如何以这种格式发送一些示例数据。有什么指点吗?
我尝试通过以下方式使用 dbus-send,但出现格式错误
gdbus call --session --dest com.semanect.S8Displayd --object-path /com/semanect/S8Displayd --method com.semanect.S8Displayd.SetScreen "(0,('JBN1'),true,(2,0,0,true,0,0,'','','','','abc','def','ghi','mmm'),(2,0,0,true,0,0,'','','','','abc','def','ghi','mmm')"
Error: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method 'SetScreen' in interface 'com.semaconnect.S8Displayd' at object path '/com/semaconnect/S8Displayd' (signature 's')
使用 d-feet introspect 我得到的方法 dbus 格式为
' <method name="setScreen">\n'
' <arg type="b" direction="out"/>\n'
' <arg name="screenUi" type="(i(s)b(iuybyisssssssss)(iuybyisssssssss))" '
'direction="in"/>\n'
' <annotation name="org.qtproject.QtDBus.QtTypeName.In0" '
'value="screen_ui_t"/>\n'
' </method>\n'
如果有人对如何使用 python 有建议/指示,我也愿意使用 python
更新:
我能够使用 dbus-send 发送数据
gdbus call --session --dest com.semanect.S8Displayd --object-path /com/semanect/S8Displayd --method com.semanect.S8Displayd.setScreen "(0,('JBN1',),true,(2,0,0,true,0,0,'','','','','abc','def','ghi','mmm','kkk'),(2,0,0,true,0,0,'','','','','abc','def','ghi','mmm','kkk'))"
(true,)
如何使用 python 脚本/C 程序做到这一点?
【问题讨论】:
-
你使用什么语言?
-
@Barmar 我没想到会这样,我也没有要求有人为我编写程序。我只是向了解 dbus 的人寻求语法帮助。添加了我使用 dbus-send 尝试过的内容