码迷,mamicode.com
首页 > 其他好文 > 详细

Tinyos学习笔记(二)

时间:2014-05-14 12:53:34      阅读:338      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   class   code   java   

1、TinyOS communication tools

  • java serialApp -comm serial@/dev/ttyUSB0:telosb
  • java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telosb
  • java net.tinyos.tools.MsgReader serialMsgApp -comm serial@/dev/ttyUSB0:telos
  • java net.tinyos.sf.SerialForwarder -comm serial@/dev/ttyUSB0:telosb
  • java net.tinyos.sf.SerialForwarder -comm sf@localhost:9002
  • java net.tinyos.sf.SerialForwarder -port 9003 -comm sf@localhost:9002

  Most TinyOS communication tools take an optional -comm parameter, which allows you to specify the packet source as a string. 

  bubuko.com,布布扣 

  bubuko.com,布布扣

  (1) Listen tool

  The Java tool Listen is a basic packet sniffer: it prints out the binary contents of any packet it hears.

  bubuko.com,布布扣

  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:  

           bubuko.com,布布扣

  (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:

sf@HOST: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.

              bubuko.com,布布扣

  Serial AM communication has the same interfaces as radio AM communication.

Tinyos学习笔记(二),布布扣,bubuko.com

Tinyos学习笔记(二)

标签:des   style   blog   class   code   java   

原文地址:http://www.cnblogs.com/gaohongchen01/p/3726795.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!