Over the last few weeks I’ve been working on a project called uLuas. uLuas is an open source smartphone app developed using the Ubuntu SDK. It provides real-time tram stop information for Dublin’s Luas light rail service. In this post I’d like to talk about my reasons for developing this application and why I chose the Ubuntu platform.
First – and most importantly – I live and work in Dublin and commute daily using Luas. I rely on the Luas real-time passenger information (RTPI) system to provide me with information on stop times and, on unfortunate occasions, service stoppages. To consume this information, I use a number of end-user services, including the Luas website, Real Time Ireland Android app and, despite crashing on every second launch, the Luas Android app. While the backend data that these apps play with is impressive, I feel that they are presented pretty poorly, being essentially wrapped web apps with non-native and clunky interfaces.
I’ve been following the development of Ubuntu for Phones/Tablets (“Ubuntu Touch”) since its announcement just over a year ago. What excited me about it wasn’t necessarily the idea of having Ubuntu on my phone, but instead the consolidation (or “convergence”, as Canonical call it) of the code base, meaning a standardised platform to develop for. Up until this point, developing an app for Ubuntu meant relying on numerous external tools using Gtk+ bindings for drawing GUIs. The Ubuntu SDK, which was announced around the same time as Ubuntu Touch, is based around Qt Quick, which uses QML for GUI markup and JavaScript for programmatic elements. I skimmed through the documentation and followed the Currency Converter tutorial, then never did much more than that until late last year.
After the release of Ubuntu Touch 1.0, which was a release aimed at developers, I decided to flash it to my Nexus 7 and Samsung Galaxy S2. While I could see the potential in the OS, there were still some apps missing that I would require for a device to be my daily driver. One of the missing elements was an app to track the real-time information for the Luas. A quick web search for “Luas API” later and I stumbled upon Neil Cremins’ Luas PHP endpoint. The endpoint consists of a simple PHP script which, when called, returns inbound and outbound tram times for a specific stop in a meaningful JSON format:
aaron@zefram:~$ curl 'http://localhost/luas-api.php?action=times&station=BLA'
{"message":"All services operating normally",
"trams":[{"direction":"Inbound","dueMinutes":"2","destination":"Connolly"},{"direction":"Inbound","dueMinutes":"7","destination":"The Point"},{"direction":"Inbound","dueMinutes":"14","destination":"Connolly"},{"direction":"Inbound","dueMinutes":"18","destination":"The Point"},{"direction":"Outbound","dueMinutes":"1","destination":"Tallaght"},{"direction":"Outbound","dueMinutes":"5","destination":"Saggart"},{"direction":"Outbound","dueMinutes":"9","destination":"Tallaght"},{"direction":"Outbound","dueMinutes":"18","destination":"Saggart"}]}
Armed with my data source and a server to host the PHP script on, I went to work on the actual application. I opted for an interface utilising Ubuntu’s Tabs class, with one tab each for the Luas Red and Green Lines. Choosing a stop is done with an unexpanded OptionSelector which, when tapped, expands to reveal a scrollable list of stops. I have a dedicated Message box which receives updates straight from the Luas API during a service disruption. I even made the box change colour from green to red when such an event occurs – I’m overly proud of that achievement. Finally a list of inbound and outbound trams for the selected stop is presented to the user, with expected times in minutes.
Red Line and Green Line tabs with typical displays:
Example of an RTPI outage, gracefully handled by uLuas. The Message comes straight from the Luas API:
Expanded OptionSelector:
The dedicated site for uLuas can be found at my development website:
http://uluas.thecosmicfrog.org
The source code for uLuas is released under the GNU General Public License and is available on my GitHub profile at the link below:
https://github.com/thecosmicfrog/uluas
5 replies on “uLuas – Developing a real-time Luas app for Ubuntu”
Looks good! I don’t think, though, that you need to display the message box when there are no messages – it provides no real information (“running normally” is the normal state, and thus does not need to be pointed out). Maybe it would be nice to only pop it up when there is a message?
That’s a very good point, Vincent. I actually did think about this as an approach – it’s, of course, trivial to code.
The reason I decided to display it all the time is for one main reason: the idea of “assurance”. When I’m leaving work and walking to my stop, I like to be certain that my tram is coming. Having a message saying “All services operating normally” reinforces this in my mind and, no doubt, in the minds of anyone else using my app.
The other, lesser reason is that the official Luas apps use this behaviour.
Thanks again for your feedback. I really appreciate it and will take it on board for future updates!
Hey, great job! One thing that could be useful would be posting the scheduled times if the forecast system is unavailable. Granted I don’t know if the scheduled arrival times are dispalyed at the stops, but it could be convenient if you’re elsewhere.
Cheers, Kieran!
As far as I understand it, there are no “scheduled times”, as such. It just aims to run at n-minute intervals, as described here. Anything I attempted to implement would be just poor guesswork!
Thanks for the feedback – I really appreciate it.
Hi Aaron,
Would love to have a chat with you in relation to a project I have in mind.
You can contact me on my work details.
Thanks
Leo