Sunday, 8 June 2008

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

One of my project is a Client-Server ARINC 661 framework which use a lot of socket-bound activity from the Client (called User Application in the standard, it handles the logic here) to the Server (which perform 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, I developed a generic API to handle this.

I thought it could be cool to allow users to prototype the logic of the Client. Using beanshell for this was the logic thing to do (pardon the pun), because it is very close to Java, so transcoding from beanshell to Java is straigthforward.

The second step was to be able to add scripted control panels for the Client. I don't want to recreate the wheel, so I decided for the use of XUL. One cool side-effect is that users would be able to debug their scripts using Firefox.

OK, it's one thing to create control panels in Java by parsing XUL scripts, but if you are not able to wire the widgets commands to the logic, it's no use. I decided for using Javascript (by using Rhino). Then I had to wire beanshell methods to Javascript. It involved a bit of code to be able to do that, but it was possible.

But getting or setting widget attributes at the Javascript level is also mandatory ! With some amount of work (in fact not a lot of work, I only had to use the right approach to do it), it was also possible.

So basically now I have a framework where I can script ARINC 661 logic in beanshell, and wire these scripts to commands in XUL declarative files. I have a purely scripted ARINC 661 Client.

In this process, I found that Rhino is really a very good Javascript engine, but that there is few informations or tutorials when you have to perform specific things like I had to do (hmm, it's no so specific). I will blog about what I discovered about Rhino specificities in some days (there's not much to say about beanshell / Java, it just work, but as it is so close to Java, there's no surprise). I thing it can be useful to others.

8 comments:

Brent said...

Wow, ARINC 661, RMI, XUL, beanshell and Rhino -- that's a lot of niche topics in one post!

Anyway, I hope you'll consider making your work available to the public. There is precious little open source software supporting avionics standards on the Web today.

And thanks for starting the Wikipedia article on ARINC 661; it was very informative.

mithrandir said...

Sorry for my very late answer, I have so few comments on this blog that I do not check often ;-) And thanks for your comment !!

I would very much like to put at least some of this work to the public, under something like a LGPL license ;-) It was developed in a very modular approach, so I think that some of it can be useful. I will email progress on that matter !!

petrige said...

Hi,

I found your ARINC 661 approach very interesting and rare.
I wonder how you get documentation about ARINC 661 and if you plane some continuation.

Good luck!
George

mithrandir said...

hmm, I'm late as usual to answer to comments.

In fact I'm a member of the ARINC 661 committee on behalf of my employer. The ARINC 661 standard PDF document is not free (it's like ISO standards), but usually you can download it for free for RC versions (see on the ARINC website here). I did it to understand how it worked before working with the committee. The supplement 4 version draft should appear on the ARINC site "soon" I think (maybe beginning of 2010).

I'm still working on this, and I'm hoping to be able to make it open source in the future.

petrige said...

OK, thanks! I find absolutely normal that one have to pay for the documentation. Unfortunately in my case I just needed a simple clue about how the standard is intend to work - some "Hello world". So only for that reson it is not justified for me to pay some hundred euros. A further question I puttet was to asses whether 661 could used as platform in smaller applications involving information displaying – say a 7 inch pad for car navigation or something like that.
I suppose no publications (some "661 Bible") exists either.

mithrandir said...

For the Hello World app, you can look at the Wikipedia article, where there is an Hello World. Also I am starting to draft a series of posts in this blog to explain how the standard works. Stay tuned!!

And I see no reason for an ARINC 661 CDS / kernel not being able to be used in smaller environments or screens.

George P. said...

> And I see no reason for an ARINC
> 661 CDS / kernel not being able
> to be used in smaller
> environments or screens.
Thanks, it seems great!
Just one more comment, it will be interesting to evaluate whether that choice for the <<7" pad>> would get real advantages compared with other/existent solutions.

I stay tuned :-)

Leon Victor said...

XUL files are where you define the layout of the program and GUI design is much faster and more fun with XUL.