如何将{sv}参数传递给gdbus?
我有问题以字典格式传递函数的参数(字符串,变体); 我尝试在gnome中运行一个截屏video并启动我需要传递这些asrguments的函数:
-method name="Screencast"- -arg type="s" direction="in" name="file_template"/- -arg type="a{sv}" direction="in" name="options"/- -arg type="b" direction="in" name="flash"/- -arg type="b" direction="out" name="success"/- -arg type="s" direction="out" name="filename_used"/- -/method-
这是我的电话:
~$ gdbus call --session --dest org.gnome.Shell.Screencast --object-path /org/gnome/Shell/Screencast --method org.gnome.Shell.Screencast.Screencast "test_ %d_ %t.webm" {dict:string:variant:"draw-cursor",true,"framerate",35,pipeline,"vp8enc min_quantizer=13 max_quantizer=13 cpu-used=5 deadline=1000000 threads=%T ! queue ! webmmux"}
这是rror输出:“a {sv}”:0-33:无法解析为’a {sv}’类型的值。 错误是在语法中? 谢谢
{sv}应该表示为:
"{'String': <'variant_value'>, 'String2': <'variant_value'>}"
为了解决这个问题,我在某个对象接口上调用了org.freedesktop.DBus.Properties.GetAll,因为它返回{sv}。
例如,wpa_supplicant中的CreateInterface方法采用{sv}:
gdbus call -y -d fi.w1.wpa_supplicant1 -o /fi/w1/wpa_supplicant1 -m fi.w1.wpa_supplicant1.CreateInterface "{'Ifname': <'wlan0'>}"
或者添加多个接口(一个真正的字符串数组:variant):
"{'Ifname': <'wlan0'>, 'Ifname': <'wlan1'>}"