2

我尝试使用 AllJoyn 创建一个简单的项目,通过运行 Windows 10 IoT 的 Raspberry Pi 2 向我的车库门公开一个接口。

相关的 Introspection XML 文件如下:

<node xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xsi:noNamespaceSchemaLocation="https://allseenalliance.org/schemas/introspect.xsd">
    <interface name="com.hastarin.GarageDoor">
    <!--<annotation name="org.alljoyn.Bus.Secure" value="true" />-->
    <description language="en">Interface for controlling a garage door.</description>
    <property name="IsOpen" type="b" access="read">
      <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
      <description language="en">Is TRUE if the door is open.</description>
    </property>
    <property name="IsPartiallyOpen" type="b" access="read">
      <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
      <description language="en">Is TRUE if the door is only partially open for air flow.</description>
    </property>
    <method name="Open">
      <description language="en">Opens the door if it's closed.</description>
      <argument name="partialOpen" type="b" direction="in">
        <description language="en">
          If TRUE, the door will only be partially opened to allow air flow.
          If FALSE, the door will be fully opened.
        </description>
      </argument>
    </method>
    <method name="Close">
      <description language="en">Close the door if it's open.</description>
    </method>
    <method name="PushButton">
      <description language="en">Will trigger the push button on the garage door.</description>
    </method>
  </interface>
</node>

不幸的是,生成的服务接口不包含 Open 方法的参数。

 public interface IGarageDoorService
  {
    IAsyncOperation<GarageDoorOpenResult> OpenAsync([In] AllJoynMessageInfo info);
    IAsyncOperation<GarageDoorCloseResult> CloseAsync([In] AllJoynMessageInfo info);
    IAsyncOperation<GarageDoorPushButtonResult> PushButtonAsync([In] AllJoynMessageInfo info);
    IAsyncOperation<GarageDoorGetIsOpenResult> GetIsOpenAsync([In] AllJoynMessageInfo info);
    IAsyncOperation<GarageDoorGetIsPartiallyOpenResult> GetIsPartiallyOpenAsync([In] AllJoynMessageInfo info);
  }

该项目的完整源代码可以在 GitHub 上找到: https ://github.com/hastarin/HastPiControl

谁能告诉我我做错了什么,或者这可能是 AllJoyn Studio Extension 的限制?

任何人都可以提出解决方法吗?

4

1 回答 1

3

我遇到过同样的问题。然后我偶然发现了一个使用<arg>而不是<argument>元素名称的示例。它对我有用 - 没有机会进一步研究它......

于 2016-01-14T01:19:27.857 回答