Search code examples
alljoynwindowsiot

Does AllJoyn Studio Extension support generation of methods with arguments?


I've tried to create a simple project using AllJoyn to expose an interface to my Garage Door via a Raspberry Pi 2 running Windows 10 IoT.

The relevant Introspection XML file is as follows:

<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>

Unfortunately the generated service interface does not include the argument for the Open method.

 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);
  }

The full source code for the project can be found on GitHub: https://github.com/hastarin/HastPiControl

Can anyone tell me if I'm doing something wrong, or if perhaps this is a limitation of the AllJoyn Studio Extension?

Can anyone suggest a workaround?


Solution

  • I had the same issue. Then I stumbled across an example that used <arg> instead of <argument> for the element name. It worked for me - haven't had a chance to look into it further...