Infobus Sevilla Mobile – A Technical Overview

Infobus Sevilla Mobile is an info widget, that provides you with the estimated arrival time of buses to bus stops in Seville. It was designed for simple usage, for it has to be fast and easy for every user.

All the data is collected at real time from a server, even bus line names and bus stops. This information is currently available at the Municipal Urban Transport Company of Seville (TUSSAM) web page, but it is not easy accessible from mobiles at all.

It has three main views:Infobus Sevilla - Favourite List

  • The main page, with two buttons to access the other sections
  • The search tool, where you can search for an specific bus stop
  • And Your list of favourites (see image)

Once a bus stop is added to your list of favourites, you have access to additional info:

  • Estimated arrival time of next two buses of the same line.
  • Estimated arrival times of buses from other lines to the same bus stop

Development

We have used Eclipse during the development of this applications, with Ant for deploying the widget directly to Opera Widget Emulator and generating the widget package. We also have in mind moving to JIL.

The first stages were developed with we developed with the emulator alone, and  once we had a decent alpha version, we moved to the Samsung H1 device.

Javascript tools

For this widget we have used jQuery. It has full community support, and a lot of plugins. It has also support for inheritance simulation (jQuery.inherit plugin), and we have used it intensively.

All the 4 views and custom controls are div elements, with an associated class that controls it. All view classes inherits from a base class that implements the observer pattern for events, state pattern for transitions, and other common tasks.

The Data API

The data is the basis of this widget, and it is obtained from a .NET Web Service offered  by TUSSAM. This Web Service is the same used by the flash app at TUSSAM web, and it gives you complete information about structure (used for bus lines, line routes, and bus stops), and dynamic info (used for arrival times).

In theory, consuming .NET Web Services is like other SOAP Web Services. There is a lot of SOAP clients out there, and after some tests we choose Mateo Casatis’s client, this one.

Problems with XHR and .NET

Here is an example of one of the problems that we have had, and the solutions we found while developing this widget.

All was fine while using the Opera Widget Emulator, but it was not going to be that easy. Although everything works as expected in Nokia s60, the widget fails to load the data in Samsung H1.  Of course, now we know, Opera engine is not LiMo WebKit engine. We don’t have any way to emulate Samsung H1 on the computer, so we have to “debug”  the device.

Debugging an application running in the device is not an easy task. You have to use a lot of  “widget.showNotification”, and try{}catch{} everywhere. Yes, everywhere. If one callback fails, it will not raise an exception. It silently dies. So you have to put a try-catch block inside every callback function.

After a lot of digging we found it. The problem was that the request failed with a Status 415 (Unsupported Media type). It seems that LiMo WebKit does not send a Content-type header, or it is malformed, and .NET Web Services are very sensitive to this. We modified the SOAP Client library to add this header explicitly, and it worked!

If you now have problems connecting to the server, probably it is related to your carrier, your WiFi config or TUSSAM server being down (nothing strange, believe me).

Of course, there were many other problems (SVG fails, CSS, etc.), but I don’t want to be boring. If you have any question, please, feel free to contact us.

Thanks for reading!