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
  • java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSB0:telosb

  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.

  The core code you have to add to Makefile is as follows:

BUILD_EXTRA_DEPS+=SenseMsg.class

CLEAN_EXTRA = *.class SenseMsg.java

SenseMsg.class:SenseMsg.java
javac SenseMsg.java SenseMsg.java:
mig java -target=null -java-classname=SenseMsg sense.h SenseMsg -o $@

  One part of the TinyOS communication toolchain requires being able to figure out which AM types correspond to what kinds of packets. To determine this, for a packet type named X, mig looks for a constant of the form AM_X. If you get the message:xxx does not have an AM type - ignored,you have to change the packet type(the arguments to AMSenderC and AMReceiverC),like AM_X.Then,manually remove the old .java and .class files.Recompile the application, and you should see no warning. Install it on a mote.

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

  (4) PrintfClient

  After starting the service, calls to the standard c-style printf command are made to print various strings of text over the serial line. The output can be displayed using the PrintfClient.

  To use the tool successfully,you have to add "CFLAGS += -I$(TOSDIR)/lib/printf" to Makefile and "#include "printf"" to xxxC.nc file.To chang the printf buffer size,you can add "CFLAGS += -DPRINTF_BUFFER_SIZE=XXX" to Makefile.

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.

最新文章

  1. 报错: Unable to start activity ComponentInfo:You need to use a Theme.AppCompat theme
  2. Visual Basic 2012 借助DataGridView控件将SQL server2012 数据导入到Excel 2010
  3. STL MAP及字典树在关键字统计中的性能分析
  4. Standing on Shouder of Giants
  5. C++中不可重载的5个运算符
  6. 核心思想:百度网盘怎么盈利(互联网的高速更新决定了:亏钱你还有点机会,放弃连门都进不了),战略预备队 good
  7. Buffer cache 的调整与优化
  8. Android中图表AChartEngine学习使用与例子
  9. Xml 学习
  10. Jquery-zTree的基本用法
  11. javascript 写职责链
  12. [Mugeda HTML5技术教程之6]添加元素
  13. MySQL数据库中文变问号
  14. win10下Resin安装--入门(1)
  15. CRLF在过滤XSS语句后打Cookie方式
  16. 如何在Idea提交代码到Github上
  17. linux系统下安装redis及配置
  18. Swift语言精要 - 浅谈代理模式(Delegate)
  19. TL Cop
  20. Spring4笔记8--Spring与JDBC模板(IoC应用的例子)

热门文章

  1. chrome 扩展 调试
  2. python return 及lambda函数
  3. JMeter学习(十六)JMeter测试Java(二)(转载)
  4. PHPUnit 组织测试
  5. vmware 完全关闭时间同步
  6. div 绑定keyup
  7. oracle 创建包体的一些问题
  8. 贪吃蛇Global Java实现(二)
  9. centos6与centos7区别
  10. 在IDEA中使用gradle配置打可执行jar包[可执行jar与其所依赖的jar分离]