Front End Software
The underlying technology for the front-end has changed a few times.
I used a Visual Basic program running on Win3.1 in the distant past. After
discovering
the javax.comm classes, I replaced it with a java/swing UI. This time
around, I thought of using a browser as a front-end. This would let me
write it all using java and not touch the code hairball of the previous
swing based function. Besides java, it needs some HTML, javascript and
ajax. Having just finished a commercial project with the same ingredients,
it was easy to get something up and running.
Features
The program has(or will have) the following features.
- Increase or decrease the speed of the loco by a single
step. Only 14 speed steps are supported. The current speed is
displayed.
- Stop the loco.
- Send out packets to the command station in my own format.
- Display a schematic of the layout
- Control turnouts on the schematic layout
- Front-end is configured using an XML file
- Emergency Stop for the entire layout
- Front-end for programming a decoder
- Programming front-end is configured using another XML file
System Design
The front-end program is written in java. It implements a simple
web server and also interfaces to the Command Station through a serial
port. The program serves up the HTML/javascript front-end to the browser.
Any user interaction of the user with the browser front-end results in an
ajax request to the program. The program converts the request into a
packet sent to the command station.
The block diagram above shows the components of the browser based layout
control.
- Browser front-end
The browser front-end is served up by the web server. It uses javascript to
build up the user interface. It uses ajax to communicate with the
back-end.
 |
 |
Pic 1 - Browser based front-end |
Pic 2 - Programming front-end |
- Web Server
Handles all requests from the browser. It supports two types of requests -
one for static files and the other is for commands to be executed. The
commands are used to send DCC packets to control the layout.
- Layout Engine
Holds the current status of the layout. It also communicates with the
Command Station Interface to send DCC commands. The current version
acts as a simulator to allow the front-end to be tested without a
command station connected.
- Decoder Engine
Not shown in the diagram but is similar in concept to the Layout Engine.
Holds the current status of the layout item being programmed. It converts
commands received from the Web Server into one or more Command Station
instructions. The current version acts as a simulator to allow the
programming front-end to be tested without a command station and decoder.
- Command Station Interface
The Command Station Interface takes high level commands from the Layout
Engine and translates them into DCC commands. These are then sent out to
the Command Station over the RS-232 serial port.
Future enhancements
Some features I intend to add when I get around to it are
- Support for signals.
- Support for functions like headlights on a loco.
- Support for oddball DCC driven accessories like turntables.
Previous Versions
The front-end has undergone major changes. The pages describing previous swing based front-end and the VB based front-end are available.
Updated on 15 Jan 2002. Feedback to
