Software:TinyPortal
From WSNWiki
Contents |
Introduction
TinyPortal is a free software application for managing a wireless sensor network, under development by Mark Kranz of the University of Western Australia. It is an application that provides a networkgateway, as it provides the means to communicate with a sensor network through traditional computer networks.
Overview
- NesC XML parser - no messing around with mig or ncg, just add a single compile option to your application and TinyPortal will find everything it needs
- Automatic message conversion - all messages heard over serial port are converted to human readable format
- Custom output targets - send messages to custom outputs, including consoles, files, relational databases, and loggers (via log4j, includes support for writing to system log).
- Protocol support - specify the protocols you wish to use sending and receiving messages via various routing protocols (eg Drip, Drain)
- Plugin-framework - Add new protocols in the form of plugins. Add server-side support for network services, such as remote procedure calls, node log retrieval and database synchronisation (see current plugin list)
- Easy customization for each deployment, via properties files
- Runtime scripting(Experimental) via Jython. Beanshell support may also be offered.
- Java platform, tested under sun jdk 1.3 to 1.5 for PC linux/windows, and Sharp Zaurus
Future Work
In Progress
- Web Management - configure settings and monitor via embedded web server (eg Winstone or Jetty)
- Embedded Database in pure Java, such as H2. Would provide support for DBMS on gateway without needing complicated setup (application could create full profile)
Planned
- User Interface - various abstractions under development for providing consistent access to data and network management. Will range from simple console access for lightweight Portal servers (such as PDA & tablets), to web-based interfaces for traditional servers or Portal proxies.
- Statistics generation - will be available as a plugin with different support depending on application & platform. Will keep track of network topology, network health and traffic metrics, and measurement statistics
- Event framework - generation of custom events based on incoming messages and network state. Will possibly integrate with mail daemons for email notifications.
- Run as a Unix system daemon or Windows service. Provide mechanism for [re | auto]start/stop and crash recovery.
- Heterogeneous Network Support - allow multiple application folders to be specified, to support networks with different code on different nodes
- Properties Tweaking - if there is no properties file in the current directory, try finding a child folder with a
nescDecls.xmlfile. Support auto-reloading of properties file, and [un]loading plugins at run-time.
Motivation
Reinventing the wheel has always been a problem for TinyOS developers, particularly when it comes to gateway development. Developing a means to communicate with a sensor network via a specific protocol or accessing some service of the network usually requires integrating Java code from various independent projects. Quite often the server-side tools are rewritten to apply to the specific network application.
Prototyping new libraries or network functionality is also troublesome, since you need to generate Java message interfaces via mig, develop Java classes to register the message types, and write interfaces to handle sending and receiving messages through the network. There is always a trade-off --- writing a nice application with good abstractions, and adding make targets to automatically update the Java interfaces can take a considerable time, especially if you are prototyping.
Here is a typical Makefile for generating interface files for two message types. There is a lot of duplication, since the include files must be the same as the application itself (or merged with the NesC application Makefile).
MIG = mig java -target=telos -I$(TOSDIR)/lib/CC2420Radio -I$(MOTEIV_DIR)/tos/lib/MultiHopLQI
NCG = ncg java
JAVAC=javac
APP_DIR ?= /opt/myapp
SEND_MSG=$(APP_DIR)/Send.h
RECEIVE_MSG=$(APP_DIR)/Receive.h
CONSTS_FILE=$(APP_DIR)/Consts.h
MULTIHOP_MSG=$(TOSDIR)/lib/MultiHopLQI/MultiHop.h
INCLUDES += -I$(APP_DIR)/../tos/lib/mylib
INCLUDES += -I$(TOSDIR)/lib/sensorboards/fooboard
INCLUDES += -I$(TOSDIR)/lib/foolib
CFLAGS += $(INCLUDES) -DTOSH_DATA_LENGTH=36
BASE_CLASS=net.tinyos.message.MyProtocolMessage
PACKAGE = net.tinyos.foo
MSG_SRCS = SendMsg.java ReceiveMsg.java
MSG_CLASSES = SendMsg.class ReceiveMsg.class
JAVA_SRCS = Main.java $(MSG_SRCS)
JAVA_CLASSES = Main.class $(MSG_CLASSES)
all: $(MSGS) $(JAVA_CLASSES)
%.class: %.java
$(JAVAC) -sourcepath ../../../ $(JAVA_SRCS)
SendMsg.java:
$(MIG) -java-classname=$(PACKAGE).SendMsg -java-extends=$(BASE_CLASS) $(CFLAGS) $(SEND_MSG) SendMsg -o $@
ReceiveMsg.java:
$(MIG) -java-classname=$(PACKAGE).ReceiveMsg -java-extends=$(BASE_CLASS) $(CFLAGS) $(RECEIVE_MSG) ReceiveMsg -o $@
Consts.java:
$(NCG) -java-classname=$(PACKAGE).Consts $(INCLUDES) $(CONSTS_FILE) Consts.h LogConsts -o $@
TinyPortal aims to address these problems. It firstly makes prototyping easier, by parsing the applications Nesc declarations, so no additional interfacing or code generation needs to be done. This encourages programmers to develop the PC-side Java software alongside the NesC application --- making it easier to write network tests, and less likely to rush the Java development at the end of the project. It also provides a common framework for extending and adding support for wireless sensor network functionality. As we build up a collection of useful plugins, we hope to reduce the number of mote developers that need to rewrite protocols and interfaces from scratch.
Add to the application Makefile
GOALS+=nescDecls
and edit the portal.properties file to include the application
portal.app.path=/opt/tinyos-1.x/apps/MyApp portal.app.platform=mica2
... and then dynamically contruct typed messages within a Portal application
CStructValue sendMsg = (CStructValue) nescDecl.getStruct("SendMsg").newValue();
sendMsg.setField("x", new Integer(555));
transmitter.send(PortalTransmitter.TOS_BCAST_ADDR, sendMsg);
Installation
See the full installation guide for more details
Requirements
- NesC version 1.2 or greater (requires XML output features)
- nescDecls.target - should be available in tinyos-1.x/tools/make
- Java Runtime Rnvironment 1.3 or greater
-
javax.commapi implementation for serial port access (eg. JavaComm, RXTX, or TOSComm JNI. You should have this working as part of your TinyOS installation
Optional
- Database, on target and/or external server, with appropriate JDBC driver (Mysql provided)
-
javax.loggingapi implementation for console/logging output (Apache log4j provided)
Plugins
- Plugin Framework. Some work still to do to allow external jars to be loaded, and to load/unload at runtime
- Must contain plugin/extension point, that implements net.tinyos.portal.Plugin.
- Execution
- Initialization: plugin typically reads application settings, gets runtime types, and decides whether plugin will function correctly
- Startup: plugin registers to listen to messages, connects to UI, starts timers etc...
- Shutdown: must correctly cancel timers and unregister listeners to ensure plugin unloads cleanly
Current Plugins
- Protocols
- MultihopLQI
- Drain
- Drip
- Libraries
- JDebug
- Remote Procedure Call
- Auto-Reconnection
- Database synchronization
- Jython Console
Download
Sorry, this version needs a lot more cleaning up - it's current lacking tests, ant-builds, significant documentation. Anyway, until it all gets worked out, I'll just provide a link to my working version
This software is currently licensed under the Lesser General Public License, although I need to clean up the source to indicate this.
Packages (Windows only)
Source and Linux
Documentation
Similar Projects
- Arched Rock provides software for exposing sensor networks as web services, for integration into Enterprise Systems. They use proprietary technology to provide always-connected communication to network nodes, and expose nodes as part of web-service via IP translation layers.
- Pytos provides a TinyOS library for Python that allows dynamic access to NesC structures in a similar way to TinyPortal. It is suitable for rapid prototyping, although I suspect it works well for complete systems too.
Credits/License
Thanks to Kamin Whitehouse for his Remote Procedure Call library, and good use of the nescDecls information for the Pytos Development Environment
