Blurb
This page presents the features of the Google AppEngine running at www.irlrose2011.appspot.com. It's main purpose is to provide a REST interface to create on demand ILDA data. This application was created for the purpose of an engineering project at Télécom ParisTech. This project took place in the fantastic course of embedded systems: ROSE 2011.- @purpose : build an ILDA animation of the text scrolling smoothly
- @param: a string sent by an user via a post request
- @return: a JSon on a Bitstream
Api
All works with HTTP request.GET /pingWould return 200 OK if the server is alive
POST /ILDA/binAwaits for a string called "data" given as a post argument. Send back a binary stream corresponding to the point in an ILDA derivated format* convenient to control laser equipement.
POST /ILDA/jsonSame as /ilda/bin but answer with a json array of points. Be sure to check the format description*.
Code example
Here is a simple python example to connect the API and print a JSON object which represents the smooth animation of a text given as a comment line argument.
import httplib, urllib, sys
params = urllib.urlencode({'data': sys.argv[1]})
headers = {
"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
conn = httplib.HTTPConnection("irlrose2011.appspot.com:80")
conn.request("POST", "/ILDA/json", params, headers)
print conn.getresponse().read()
conn.close()
Here is a python example of how to use this script.
I assume that you can run python in your computer (so far I tested it with python 2.4.5, python 2.6 and python 2.7) and that you have renamed the script above in main.py.
$python main.py joe Status: 200 OK Cache-Control: no-cache Content-Type: application/json Expires: Fri, 01 Jan 1990 00:00:00 GMT Content-Length: 57067 [[[[1, -15348, -13268], [0, -17948, -1326...Anyway, feel free to use the langage of your choice, since the application relies on an http interface it might not alter it's behavior.
Format description
JSON array
The json array returned after a post request in ILDA/json looks like this :
[ <-- This is a "multiframe", an array of frame
[<-- This is a "frame", an array of char
[ <-- This is a "char", an array of points
[S1,X1,Y1],[S2,X2,Y2.. ],[..<-- These are points
], ...
As you see points are made of S, X and Y :
- S represents the status of a point :
- S = 1 : we go to that point with the laser off
- S = 0 : we turn the laser on before going to that point.
Binary stream
Binary data are packed up by group of 6 bytes. Byte 1 comes first. All data are big endian like in the ILDA Image Data Transfer Format which somehow close to what I use (in fact it uses a subset of it).- Bytes 1 and 2 represent X, signed with the most significant bytes coming first. Its values are among [-32768, 32768].
- Bytes 3 and 4 represent Y, msb signed first. Its values are among [-32768, 32768].
- Byte 5 Contains the status in its second position starting from left. 00000000 means we will go to the point laser off. And 01000000 means that we will turn the laser on and go to the point. The last point contains its first bit set at 1.
- Byte 6 Remains unused.
©Copyright IRL team May 2011.