Sunday, 27 February 2011

j661: creating a simple User Application

As you may already know, the ARINC 661 standard is defined around an architecture where:

  • An ARINC 661 Server (also called ARINC 661 Kernel), which is a part of the Cockpit Display System (CDS) is initialized with a set a ARINC 661 Definition Files, and is responsible for the the User Interface

  • System Applications (called user Applications or UA in the standard) handle the logic, and are able to communicate to the Server to change widget parameters that were created at initialization. From the other side, the Server send to the User Application user events on widgets (such as clicks on buttons, change of text fields, etc...)



The ARINC 661 standard makes the UI definition very simple, but there is still the burden of developing the User Application part. The j661 project already provides a generic API which simplifies greatly the User Application / ARINC 661 Server communication, but you still need to develop the User Application code itself.

The Embedded Client framework provided in the project further simplifies this process, at least for prototyping User Applications. This framework is built under the following architecture:

The Embedded Client is a generic User Application with, contrary to the Client provided in the j661 project, has a minimal Graphical user interface, and is much more configurable.

The Embedded Client has the following features:

  • It is possible to start only a User Application, without any associated Server. Note that in this case the arincServer.jar and all associated libraries don't need to be provided

  • It is possible to start a User Application, and it's associated Server, sharing the same configuration properties

  • It is possible to add any list of Scripts to the User Application, to code the logic. Note that as it is the case for an ARINC 661 library embedded in a Java application, the scripts will use the Client java API

  • It is possible to add a list of DataProviders to the User Application, and wire the datas returned by the DataProviders to ARINC 661 parameters



A DataProvider is a source of data that can be plugged to an Embedded Client. To the DataProvider is attached an XML configuration file which defined the correspondence between the datas and the ARINC 661 properties. This way, it is possible to define the communication from the System Datas to the Client (User Application) by only defining a XML configuration file. No more code to write, you only need to wire the system datas to the ARINC 661 properties.

An example of this is provided in the j661 project: The FGPlayback contrib allows to read a FlightGear playback scenario by only defining an XML configuration file wiring the FlightGear variables to the ARINC 661 properties. For example:

<dataProvider provider="FGPlayback">
<context name="testLayer" layerID="1" appliID="1" />
<inputs>
<input context="testLayer" widgetID="1" paramID="A661_STRING"
equ="$1">
<data name="latitude-deg" />
</input>
<input context="testLayer" widgetID="5" paramID="A661_STRING"
equ="$1">
<data name="longitude-deg" />
</input>
<input context="testLayer" widgetID="3" paramID="A661_ROTATION_ANGLE"
equ="$1">
<data name="heading-deg" />
</input>
<input context="testLayer" widgetID="10" paramID="A661_ROTATION_ANGLE"
equ="$1">
<data name="roll-deg" />
</input>
</inputs>
</dataProvider>

Saturday, 12 February 2011

Eclipse, you are bloated

I'm using Netbeans for my day-today java projects, and I really have difficulties when I have to use Eclipse, but I often think that part of it is due to me being new to Eclipse rather than Eclipse itself. However, I also often find that there are real problems with Eclipse, and that my problems are not just coming from my own perception.

Some days ago, I had to install Google Web Toolkit, which is basically an Eclipse Plug-in allowing to generate some complex Javascript code using Java source code . The Java source compilation does not compile Java binary code, but Javascript code, and you can also use a very well done UI designer to create your UI by drag-and-drop rather than having to use complex Javascript libraries.

But this post is not about GWT, on which I have nothing bad to say, but about Eclipse itself, because GWT is an Eclipse plug-in.

First installing Eclipse itself (I used the last Helios version) take ages, in fact it takes so much time (and often it is freezed during the process) that you often think that there may be a problem. And I'm just talking about the first Eclipse internal configuration after you had unzipped the file containing the Eclipse file structure (what, no proper installer?).

Second installing plug ins is really awkward. You have to know the exact URL of the files to be able to download them (from Eclipse), and you HAVE to do it in Eclipse itself. And the UI to choose them is really poorly designed (it seems that you can't put a load of different URLs and download them all at once, you have to download the:m one by one). As for Microsoft software, it also seems that you have to restart Eclipse a lot of times in the process.

Another problem is that if you have to use Eclipse with it's plug-in on a PC not connected to internet, it's really difficult to do so. Basically you have to download it on the spot (something which is not always possible). Which is really awkward considering that there is no proper installer for the core Eclipse itself.

I also have to mention the fact that Eclipse is generally slow (that is, if you succeeded in the previous steps).

I really don't know how Eclipse can be so successful, where it has so much major shortcomings. I have to say that none of these problems exist in Netbeans: finding and downloading plugin-ins is really simple, you can do this by internet or using local files, installing Netbeans is REALLY shorter, and it's generally much more responsive. You can even copy an entire Netbeans directory with it's plugins, and it's working with really minor changes in the configuration (in fact, only one, the path of the JDK).

Sunday, 9 January 2011

Mr Courmont, do you really need to do this?

Mr Remi Courmont, contributor to the VLC media player, thinks that he knows that Apple removed the Mobile VLC app from the appstore because they supposedly "cannot stand software distributed under the GPL on its stores". Mr Remi Courmont think he knows that the AppStore license expressly makes it impossible to distribute GPL software on the AppStore. Mr Courmont thinks that he knows a lot, but he seems to know very little, except of course for his own apparent hate of Apple.

Mr Remi Courmont wanted the app to be removed to prove his point, even if some of his fellow developers thought a little different than himself. His comment on the twitter feed for the VIDEOLAN project was: "I'm not going to pity the owner of iDevices, and not even the mobileVLC developers who doubtless wasted a lot of their time".

Mr Courmont, you seems to be full of it, you know. Asking is something, but spreading FUD without really knowing anything about what you are speaking, and putting a gun on the neck of Apple, but also other VLC developers, and also those who developed the mobileVLC app, is not a very pretty thing to do.

But above all, Mr Courmont can't deny he is working for Nokia. Do you really think that he can convince that it had no impact on what he did?

Sunday, 5 December 2010

A very interesting conference of James Gosling

Happened on November 17, 2010, so it's really fresh. And the fact that Gosling has resigned from Oracle sometime ago and is still unemployed makes it free of a lot of corporate language.

One of the problem of most Fortran code is a) It's doing something really important b) The person who wrote it is probably dead.



Multicore. what can we do about it? What's the right thing to do with Hava? It feels like there's an unbounded supply of PHD thesis topics in there. The problem is that it has been a really rich source of PHD thesis topics for about 30 years.


One of the things about generics is that, you wander around the world, you talk to language designers, 15 years ago, and they would all say, Generics, really really good idea, you got to do it this way, but they all had a different version of this way.


I know that there had been some conversations between Google and Sun to do something early on, that was all just spectacularly weird(..).) Some sort of cooperation should have worked out a whole lot smoother than it did(...) It was weird. I'll leave it there.


(about CLR). They deleted all security feature to allow C pointers, because they wanted to do C. That's like the dumbest thing they have ever done. The instruction set, they added registers to it, that adds nothing, they just wanted to be different.(...) The biggest problem I have with the CLR is that they haven't put nearly as much energy on it(...) We were running at least a factor of two on almost everything. Their code generators are not very good, mostly because they were being lazy(...) Microsoft, in their harder parts, doesn't care about CLR that much because all their real meat and potatoes projects are not that. Word and such are still fundamentally big bags of C code. So they have not really had to depend on it for their own products.

Sunday, 24 October 2010

Have fun with ARINC 661, XUL, Javascript, beanshell, and Java

Remember this post two years ago? Well you can also add Groovy to the list...

The Client-Server ARINC 661 framework project has been Open Sourced for 2 months now. You can get the binaries, and the sources here: http://j661.sourceforge.net/. Just a quick reminder: In the ARINC 661 standard, the Client (called User Application in the standard), handles the logic, and the Server performs the graphic rendering.

The communication protocol in ARINC 661 is specific and a bit complex (no SOAP, no REST, no CORBA, not RMI, but purely specific binary messages on top of the lower-level bus-level layer protocol). So to ease development of Java clients, the j661 project propose a generic API to handle this in the Client side.

The basic Client just allows users to send messages to the Server, but there is more than that. It is possible to script the Client behavior, and even to add a user interface for Client options (for example a Slider - called Scale in XUL, to change a value).

There are three parts which are necessary to script the Client:

  • The graphics part is rendered by one or several XUL script files

  • The controller is performed by Javascript (by using Rhino

  • The logic is performed by beanshell or Groovy



One cool side-effect of using XUL is that users are able to debug their scripts using Firefox.

How is it working? When clicking a button, or performing any user action on the XUL script, the associated XUL widget fire the appropriate JavaScript command (nothing special here). What begins to change a little is the fact that JavaScript is allowed to execute Beanshell or Groovy code, which in return can communicate with the Server using the ARINC 661 protocol.

Let's use an example (check the Scripting tutorial for the j661 project if you want more informations):


<button id="identifier" label="Hide Triangle" disabled="false"
oncommand="triangleHidden()" />


If the user click on the button, it will fire the triangleHidden() method on JavaScript. In this case, this method is directly written inside the XUL script (it could also have been defined in a external JavaScript file):

function triangleHidden() {
changeTriangleVisibility();
}

As there is no changeTriangleVisibility() method in JavaScript, it will look for a method with this name in Beanshell (in our case). The Beanshell script has been referenced in our XUL script in this way:

<script type="text/bsh" src="testScript2.bsh" />


And the Beanshell script contains the following code:

tatefullAPI api;
XULScriptContext ctx;
int LAYER_ID = 56;
int TRIANGLE_ID = 100;
boolean visible = true;
init(StatefullAPI theApi, XULScriptContext theCtx) {
api = theApi;
this.ctx = theCtx;
}
run() {
}
changeTriangleVisibility() {
visible = !visible;
api.setWidgetParameter(LAYER_ID, TRIANGLE_ID, ARINC661.A661_VISIBLE,
visible);
api.sendLayerMessage(LAYER_ID);
}


All of ARINC 661 messages can be handled like this.

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">
<model>
<prop name="ApplicationId" value="1" />
</model>
<a661_layer name="MyLayer" >
<model>
<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" />
</model>
<a661_widget name="panel" type="A661_PANEL">
<model>
<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" />
</model>
<a661_widget name="label" type="A661_LABEL">
<model>
<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" />
</model>
</a661_widget>
</a661_widget>
</a661_layer>
</a661_df>


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

Friday, 10 September 2010

ARINC 661 project: First tutorial

I am still uploading documentation and working on the wiki for the j661 The project here: http://j661.sourceforge.net/. This project provides a generic ARINC 661 Server, a generic ARINC 661 Client (UA), and a Definition File editor.

The first tutorial explains how to configure the Editor, opening a Definition File, doing some modifications, and saving the result.