Carmesh Implementation Stories (#3): Adding Geolocation to PiUi

One of the applications we’re working on in Carmesh is a Raspberry Pi based data logger. The architecture of the system is that the RPi is connected to the OBD-II interface and provides a simple web-based interface to OBD-II state to any interested clients. In our case, we will write a mobile app which will avail of this.

We spent a bit of time experimenting with RPi over a weekend. We got a basic configuration running without the ODB-II stuff – the device acted as a WiFi Access Point and served local content to a mobile via mobile web interface.

We chose the PiUi framework as the basis for this: it’s a great little framework that supports the building of nice mobile web experiences – the web app is written in Python and it has a server side which gives instructions to a smart JS client side on how to build the UI in the DOM.

One aspect we wanted to provide was geolocation such that the mobile web app could obtain location relevant info. As the PiUi app was written entirely in Python, this required adding functionality to PiUi to obtain the location from the mobile and relay it to the (Python based) server side so that it could be manipulated and ultimately used to send relevant content back to the client.

The basic version of PiUi has some hooks for geolocation support, but does not have functionality to implement it. It supports the relaying of a get location instruction from the server side to the client. However, the client side has no functionality to deal with this and no means to send a response to the server side. I added these basic components here.

It’s a few small changes and it’s not tested on anything except Chrome (Android and OSX). It still suffers from the significant PiUi session management issue (see known limitations section) which means that only a single client can be connected to the server at any time, but it might be some use to someone.

The branch of the main PiUi repo with this support is here.

In future work, we’ll get the pyobd stuff up and running and serving this content via PiUI…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s