Extreme Feedback Device – The Cruise Control Lights
Steve on Jul 19th 2010
My Arduino based Cruise Control build indicator lights have been up and running for a couple of months now and so far so good. It’s time to post the source code for the Arduino sketch and the Java app that runs on the machine that the build lights are connected to.
First, here’s a very short video of a successful build. While a build is in progress, all 3 lights turn on, and at the end of the build, you get either solid red or solid green (hopefully), depending upon success!
The lights are connected via USB to a machine that sits nearby. On that machine runs a Java program that attaches to the USB serial port and sends commands to the Arduino sketch to turn any of the 3 coloured lights on or off. The sketch is very simple with no clever logic at all. All it does is read the serial port and based on the value of 3 bytes, turns the lights on or off. All the logic is contained in the Java program.
The Java program running on the attached PC connects to a Cruise Control server using the JMX protocol and waits for status updates for a given project. These status updates occur when builds are started, and when they end. There are also various informational properties that can be obtained from the build server, such as what time the last successful build was. With this information, the lights can be set to show green for a good build less than 2 days old, amber for a build less than 4 days old but older than 2 days, and red for a build that’s older than 4 days (or a failed build).
I won’t go into a long post detailing the code now. It’s a single Java source file with everything in (including the Arduino sketch in the comments), with a section for the command line handling, the JMX connection and the serial port code. It uses the RXTX serial I/O library, so if you want to compile and run it, you’ll need to download that first. I’m happy to answer any questions about the code, and of course, it’s free for you to do whatever you like with (WTFPL). There’s not a lot of documentation specific to the Cruise Control JMX interface, but if you read through the actual Cruise Control source at sourceforge, you get a pretty good idea of all the properties available. The methods to get the properties and the JMX events are fairly standard and the details from Sun here (PDF) helped too.
CruiseControl/Arduino Lights Source Code
Filed in Code,Software | No responses yet
