Sunday, 19 September 2010

An ARINC 661 tutorial: communication (2)

In July I posted a first tutorial on ARINC 661 communications protocols. It was still a little theoretical, but today we will be able to putn= it into application. if you want =play a little with ARINC 661 protocol while following this tutorial, you can download the last version of the Open Sourced j661 project here. Just unzip the archive anywhere. You only need to have a Java 6 JDK available on your machine.

First we will open an ARINC 661 Definition File, for example this very simple one:

<?xml version="1.0" encoding="UTF-8" standalone="no" >
<a661_df name="default" library_version="0" supp_version="2">
<prop name="ApplicationId" value="1" />
<a661_layer name="MyLayer" >
<prop name="MinWidgetIdent" value="1" />
<prop name="MaxWidgetIdent" value="65535" />
<prop name="LayerId" value="1" />
<prop name="ContextNumber" value="0" />
<prop name="Height" value="10000" />
<prop name="Width" value="10000" />
<a661_widget name="panel" type="A661_PANEL">
<prop name="WidgetIdent" value="1" />
<prop name="Enable" value="A661_TRUE" />
<prop name="Visible" value="A661_TRUE" />
<prop name="PosX" value="0" />
<prop name="PosY" value="0" />
<prop name="SizeX" value="10000" />
<prop name="SizeY" value="10000" />
<prop name="StyleSet" value="0" />
<a661_widget name="label" type="A661_LABEL">
<prop name="WidgetIdent" value="2" />
<prop name="Anonymous" value="A661_FALSE" />
<prop name="Visible" value="A661_TRUE" />
<prop name="PosX" value="3527" />
<prop name="PosY" value="3721" />
<prop name="SizeX" value="2978" />
<prop name="SizeY" value="1000" />
<prop name="RotationAngle" value="0.0" />
<prop name="StyleSet" value="0" />
<prop name="MaxStringLength" value="20" />
<prop name="MotionAllowed" value="A661_TRUE" />
<prop name="Font" value="t2" />
<prop name="ColorIndex" value="red" />
<prop name="Alignment" value="A661_CENTER" />
l&t;prop name="LabelString" value="HELLO WORLD" />

(This file is included in the distribution of the j661 Server).

We will first start a Server and load this file (see this tutorial in the project wiki to know how to do it). You should see this:

The we will do the same with the Client. The Client window should look like this:

To look at the content of the messages from the Client to the Server, right-click on the log area at the bottom of the Server window, and click "Log Buffer Events". We will now be able to dump the content of the communication from Client to Server.

Make sure you connected both the Client and the Server. For now we will just change the Color of the "HELLO WORLD" label at the middle of the Layer.:

  • Change the value of the "A661_COLOR_INDEX" in the upper right window for the label, for example to green. This represent a A661_CMD_SET_PARAMETER command

  • Then add this command to the message by clicking "Add"

  • Now send the message to the Server

Of course, the color of the label has now changed to green (what did you expect?), but what is interesting is the hexadecimal dump in the log area:

B0 01 0000 00000018 CA02 000C 0002 0000 B160 06 00 D0 000000

We will now decode together this message content:

  • B0 is the code for the begin block in the message

  • 01 is the Layer identification (1 here)

  • 0000 We now have an ushort for the context number

  • 00000018 (or 24 in decimal) is the length of the block in bytes, including the header

  • CA02 is the code for the A661_CMD_SET_PARAMETER command

  • 000C is the size of the A661_CMD_SET_PARAMETER command

  • 0002 is the widget identification, here the label identification is 2

  • 0000 we now have a padding of an ushort, to align to 32 bit

  • B160 is the code for the A661_COLOR_INDEX property

  • 06 is the index corresponding with the green Color (beware that the association between the value and the color is CDS-dependant)

  • 00 is there to to align to 32 bit

  • D0 is the code for the end block in the message

  • 000000 The last 24 bits are there to align to 32 bit

In the case of the j661 Server, this bytes are sent through an UDP port, but this content (normalized by the standard), can be sent through any low-level protocol (TCP, ARINC 429, AFDX), etc...

No comments: