Using REST on SunSPOTs

This post is the second in this series where we try to describe some of the concrete projects we are working on right now.

The ultimate goal of the project was to create a smart logger that could be attached to shipments in order to monitor them while being transported or through their life-cycle, sort of a “ueber-RFID”. Of course, we wanted to use the REST principles in order to fully integrate the smart logger to the Web as well as to be able easily build applications on top of the logger.

As smart loggers, we use the Sun SPOT Wireless Sensor network on top of which we have built a full RESTful stack. This includes a tiny Web server on the Spot themselves. This Web server offers the functionality of the SPOTs through a RESTful API, partially based on RESTlet a great Java framework for building REST applications. This concretely means for instance that the light sensor of a Sun SPOT can be accessed by browsing to the following URL: http://…/spot1/sensors/light using the GET HTTP verb.

This is concretely what the HTTP packet corresponding to this call looks like (note that the last bit is a JSON snippet, a nice and more lightweight alternative to XML)
GET /spot1/sensors/light HTTP/1.1
Host: localhost:8080
[...]
HTTP/1.x 200 OK
Server: Noelios-Restlet-Engine/1.0..11
Content-Type: text/plain; charset=ISO-8859-1
device: spot1
resource: /sensors/light
method: GET
Gateway-Location: Office B 7.1.60
{"values":
[ {"lightlevel":[80]},
{"threshold":[-1,37]}
]}

Now, as you all know pretty much everything lately understands HTTP and can access the Web. Thus, building applications on top of this Sun SPOT Smart logger is rather trivial and pretty much looks like a web mashup.

This is what we show in the following YouTube video where the data from the Sun SPOT is integrated to a “SAP ERP” (sorry for the rather French accent, the student really tried hard! :-))

We submitted a paper further describing this project a few weeks ago. If it gets accepted you’ll find it here soon, so stay tuned!

The project’s team was composed of Thomas Pham (this project was his Diploma thesis @ SAP Research Zurich), Vlad Trifa and myself (Dominique Guinard).

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *