Server Side

OpenProximity Plugins

Preparser Usage


A templating system for making AIRcable BASIC code creation easier.


Templates are everywhere around, and python programming language is no exception. By using Cheetah Template Engine we have been able to create some little functions that allow to easily create code that can talk to any stream: Slave, Master and UART.


Installation Prerequisites

Before been able to use this template you will need a few prerequisites. You will need to get Python 2.6 and Cheetah 2.x installed. If you're running any Unix based OS like MacOS or Linux then it's quite sure you all ready have python installed, Cheetah can be easily installed by using the package manager from your OS.
For MacOS you find instructions here: Cheetah Darwin Port. You may need py25-hashlib for MD5 function and call python2.5 instead of the installed standard python.
Windows users might have a more difficult time installing these tools, we've found a useful guide at (1)

Setting up

Once you have the prerequisites filled installation is really easy. First you need to get And store it somewhere in your path. If you're using a Unix based system then you can mark the file as executable by doing chmod +x, so then you can call it as


Usage of the script is easy, you just call the script and pass as argument your template, for example: slave-monitor where slave-monitor is your template.


First we recommend that you understand how Cheetah templating works, for this you can read (1), this is a nice and easy to follow tutorial.
Besides the functions provided by Cheetah we have implemented a few more:

  • $PRINT(stream): Renders as PRINTU, PRINTM, or PRINTS depending on the argument stream. Valid stream values are: 'master', 'slave' and 'uart'.
  • $INPUT(stream): Renders as INPUTU, INPUTM, INPUTS, similar to $PRINT(stream)
  • $GET(stream): Renders as GETU, GETM, GETS
  • $STTY(stream): Renders as STTYU, STTYM, STTYS
  • $DISCONNECT(stream): Renders as A = disconnect 0, or A = disconnect 1 depending on stream. Valid streams are 'master', 'slave'
  • $DEF(variable): Checks if variable is defined or not


For a full example on how to use the templating system you can check our SensorSDK trunk.





This document describes the command line implemented in AIRcable SensorSDK.


Communication between the SensorSDK and the outside world can be done over Bluetooth or the UART port, for automated access a protocol is needed. We created a very simple to use command line, which allows to do some basic functions like:

  • Add entries to history
  • Exchange files over a string stream protocol
  • Show text on the screen
  • Change state of PIO
  • Listen for button press

Downloading Code

The template can be found in our trunk: latest version.

Including Command Line

Command line is provided as a Cheetah template, you need to define the global variable $stream before including the template, for example if you want to use slave profile then you need this lines:

#set global $stream="slave"
#include "shell/AIRcable.bas"

We recommend adding this include after base code and before mode code (monitor, interactive, etc.

Code Example

607 IF A = 0 THEN 650;
## s<file>: send file over spp
608 IF $0[0] = 115 THEN 620;
## u: slave and enable for 20 seconds
609 IF $0[0] = 117 THEN 630;
## S[number][content]: sets line number to 
## content, number is 4 digit long always
610 IF $0[0] = 83 THEN 643;
## L[number]: print content from line 
611 IF $0[0] = 76 THEN 646;
## c<clock>: sets current date and time
612 IF $0[0] = 99 THEN 637;
## d<file>: deletes <file>
613 IF $0[0] = 100 THEN 640;
## l<content> put <content> on the screen
614 IF $0[0] = 108 THEN 680;
## P<timeout>: wait until user does a button press
615 IF $0[0] = 80 THEN 685;
## p<STATE><PIO>: sets <PIO> to either 1 or 0 (pioset/pioclr)
616 IF $0[0] = 112 THEN 688;
## e exit
617 IF $0[0] = 101 THEN 650;

Command Line Functions

In code example section you can see the function dispatcher, there are a few factory functions, but you can modify this to match your needs.

Standard Functions

Expression Variable
s< file > Send < file > over spp. This will print each line after another, waiting for GO before sending a new line.
u Will close the command line, and will enable slave and FTP for a few minutes.
S< number >< content > Sets line < number > to < content >. < number > needs to be 4 digits long always, otherwise you might loose some content. You can fill with 0s and spaces.
L< number > Prints line < number > to the shell.
c< content > Pushes < content > into the device history.
d< file > Deletes < file > from the file system.
l< content > Will display < content > into the LCD screen. There's no scroll with this command.
P< timeout > Will wait until < timeout > for a long or short button press. If there's a timeout then you will get back to the shell.
p< state >< PIO > Will set < PIO > to < state >, < state > can be either 0 or 1.
e Will exit the command line.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License