1、TinyOS communication
tools
- java serialApp -comm [email protected]/dev/ttyUSB0:telosb
- java net.tinyos.tools.Listen
-comm [email protected]/dev/ttyUSB0:telosb - java net.tinyos.tools.MsgReader serialMsgApp
-comm [email protected]/dev/ttyUSB0:telos - java net.tinyos.sf.SerialForwarder -comm [email protected]/dev/ttyUSB0:telosb
- java net.tinyos.sf.SerialForwarder -comm [email protected]:9002
- java net.tinyos.sf.SerialForwarder -port 9003 -comm [email protected]:9002
Most TinyOS communication tools take an optional
-comm
parameter, which allows you to specify the
packet source as a string.
(1) Listen tool
The Java tool Listen is a basic packet sniffer: it prints out the binary contents of any packet it
hears.
One problem with Listen is that it just dumps binary data: a user has to be
able to read the bytes and parse them into a given packet format.
(2) MsgReader
use a Java message class to print out the
messages.
Rather than parse packet formats manually, you can use the
mig
(Message Interface Generator) tool to build a Java, Python, or C
interface to the message structure. Given a sequence of bytes, the MIG-generated
code will automatically parse each of the fields in the packet, and it provides
a set of standard accessors and mutators for printing out received packets or
generating new ones.
e.g.:output like this:
(3) SerialForwarder
Most generally, the SerialForwarder program opens a packet source
and lets many applications connect to it over a TCP/IP stream
in order to use that source. For example, you can run a SerialForwarder whose
packet source is the serial port; instead of connecting to the
serial port directly, applications connect to the SerialForwarder, which acts as
a proxy to read and write packets. Since applications connect to SerialForwarder
over TCP/IP, applications can connect over the Internet.
SerialForwarder is the second kind of packet source.
A SerialForwarder source has this syntax:
[email protected]:PORT
2、Sending an AM packet to the serial
port in TinyOS
The TinyOS serial stack follows the same programming model as the radio
stack. There is a SerialActiveMessageC
for turning
the stack on and off (mote processors often cannot enter their lowest
power state while the serial stack is on), and generic components for
sending and receiving packets. As the serial stack is a dedicated link, however,
it does not provide a snooping interface, and it does not filter based on the
destination address of the packet.
Serial AM communication has the same interfaces as radio AM
communication.