本文介绍了如何在dbus发送中使用变体字典(ʻa {sv}`)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 a {sv}

使用 in_signature ='a {ss}'调用方法似乎可以在以下命令行中使用
进行工作:

Calling a method with in_signature='a{ss}' seems to work using the following command line:

dbus-send --dest="org.test.TestService" 
/org/test/TestService/object org.test.TestService.method1 dict:string:string:"a","1","b","2"

现在,我想拥有一个具有变量类型的字典,其值为
in_signature = a {sv} ),

Now I would like to have a dictionary with a variant type for values (in_signature=a{sv}),

如何在 dbus-send 中使用它?

推荐答案

尽管D-Bus支持诸如 a {sv} 之类的签名,但dbus-send不支持。这来自:

Although D-Bus supports signatures such as a{sv}, dbus-send does not. This is from the dbus-send man page:

... D-Bus支持的类型更多,但dbus-send当前不支持。此外,dbus-send不允许空容器或嵌套容器(例如,变体数组) )。

"...D-Bus supports more types than these, but dbus-send currently does not. Also, dbus-send does not permit empty containers or nested containers (e.g. arrays of variants)."

据我所知,您无法使用dbus-send发送字符串字典:variant。

So as far as I can understand it, you cannot send a dict of string:variant using dbus-send.

这篇关于如何在dbus发送中使用变体字典(ʻa {sv}`)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 12:35