This gateway application provides a low-level interface to SwissQM. Programs written in SwissQM's bytecode assembly language can be disseminated into the sensor networks where they are executed by the SwissQM Virtual Machine. Result tuples generated by these programs are sent back to the gateway and can be logged into a database and/or a simple log file.
The QM programs are written in SwissQM assembly language and are stored in .s
files. A set of example files are provided in source code distribution of the gateway
software in the subfolder asmprogs
. It contains the following programs:
merge
instruction by operating the synopsis in raw-mode.
See the Instruction Set Card for details about the instruction semantics. A detailed explanation can be found in the EuroSys paper.
Power-up all your nodes. Nodes will turn on their green LED if they have a link to the root, which is required for proper operation. The root node (node with ID 0) will not turn on the green LED, as it has always a connection to itself. You should wait until the green LED of every node except the root node is lit.
Connect the root node to the machine on which you run the gateway.
Change to the folder SwissQM-gateway, where you built and configured the gateway and run
ant asmgui
This will bring up the graphical user interface of the SwissQM Bytecode Assembler, as shown below.
The Bytecode Assembly Interface can be used to sent QM programs into the network, and retrieve result data. The results are shown in a table in the GUI and/or logged into a database for offline analysis. For each program another tab is created that shows the result data.
The network tab is shown when SwissQM is started (see screenshot above).
The left column shows the programs that are currently executing in the
network. The right column shows the
commands that can be sent to SwissQM. A command can sent to be executed by one
specific node or by all nodes of the network. In the former case type the
ID of the target node in to the Node text field, in the latter check
the All Nodes checkbox. Note that when applying the command to all nodes
the TinyOS broadcast address 0xffff
(65535) is used.
Currently supported commands are Node Reset and setting the LEDs of the
nodes. For setting the LEDs use the value and the mask check box. The bits
set in the mask determine which LEDs are affected by the command.
Program stored in .s
files can be opened by pressing the New
button in the Network tab. Then a file open dialog appears (note: the default
directory of this dialog can be configured in swissqm.properties
by the key ch.ethz.inf.swissqm.asmdirectory
). The assembly file
is then parsed. Parsing errors, assembler errors and warnings are then
showed in an error dialog. Warnings can be ingnored, errors must be corrected
in the source file. Pressing the Retry button restarts the parsing process.
If the file is sucessfully parsed and is semantically correct the following field selection dialog is displayed.
The Field Selection dialog shows the fields of the result tuples generated
by the program (specified in the .tupleformat
directive in the
assembly program). These tuple fields can be selected to be logged in a file
and/or database table. All fields are also display in the result table in the
program tab once the program is started. Database logging and file logging can
be enabled or disabled globally using the two checkboxes Log into DB and
Log into file. Depending of this selection the DB and file columns for
the fields are enabled for selection. Note, if database logging is disabled
in swissqm.propeties
it remains disabled and
cannot be re-enabled in this dialog. Specify the name of the file and the database
table for the logging you want use the specific logging mechanism. Log files
are written using tab separators. The program is injected by pressing the Run
button, then a new Program tab is opened, which shows the result tuples received
from the network.
Bytecode Programs can be executed concurrently. The executed bytecode programs are shown in the QM Programs table in the network tab. For each program a tab showing the result tuples is created.