在gdbus introspection xml中添加元组

时间:2015-02-17 12:25:37

标签: c++ dbus gdbus

如何接收多个int32值,即当我收到一个值时,我需要将其指定为type = i,

<method name="foo3" >
  <annotation name="org.dsource.dbus.d.Returns" value="bar"/>
  <arg name="bar" type="i" direction="in"/>
</method>

但它不允许我指定为,当我这样做时,我收到错误,因为期望值为null

<method name="foo3" >
  <annotation name="org.dsource.dbus.d.Returns" value="bar"/>
  <arg name="bar" type="ii" direction="in"/>
</method>

然后我试过

<method name="foo3" >
  <annotation name="org.dsource.dbus.d.Returns" value="bar"/>
  <arg name="bar" type="(ii)" direction="in"/>
</method>

错误消息是:

  

错误org.freedesktop.DBus.Error.InvalidArgs:消息类型,&#39;(ii)&#39;,   与预期类型不匹配&#39;((ii))&#39;

正如预期值((ii))给出错误,我需要得到的是我需要将预期值更改为(ii)..请给我答案 提前致谢

1 个答案:

答案 0 :(得分:0)

您可以将其用作

 <method name='YourMethod'>"
    <arg type='i' name='name1' direction='in'/>"
     <arg type='i' name='name2' direction='in'/>"
 </method>"

您可以使用(ii)元组格式来调用方法