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.

Tinyos学习笔记(二)的更多相关文章

  1. WPF的Binding学习笔记(二)

    原文: http://www.cnblogs.com/pasoraku/archive/2012/10/25/2738428.htmlWPF的Binding学习笔记(二) 上次学了点点Binding的 ...

  2. AJax 学习笔记二(onreadystatechange的作用)

    AJax 学习笔记二(onreadystatechange的作用) 当发送一个请求后,客户端无法确定什么时候会完成这个请求,所以需要用事件机制来捕获请求的状态XMLHttpRequest对象提供了on ...

  3. [Firefly引擎][学习笔记二][已完结]卡牌游戏开发模型的设计

    源地址:http://bbs.9miao.com/thread-44603-1-1.html 在此补充一下Socket的验证机制:socket登陆验证.会采用session会话超时的机制做心跳接口验证 ...

  4. JMX学习笔记(二)-Notification

    Notification通知,也可理解为消息,有通知,必然有发送通知的广播,JMX这里采用了一种订阅的方式,类似于观察者模式,注册一个观察者到广播里,当有通知时,广播通过调用观察者,逐一通知. 这里写 ...

  5. java之jvm学习笔记二(类装载器的体系结构)

    java的class只在需要的时候才内转载入内存,并由java虚拟机的执行引擎来执行,而执行引擎从总的来说主要的执行方式分为四种, 第一种,一次性解释代码,也就是当字节码转载到内存后,每次需要都会重新 ...

  6. Java IO学习笔记二

    Java IO学习笔记二 流的概念 在程序中所有的数据都是以流的方式进行传输或保存的,程序需要数据的时候要使用输入流读取数据,而当程序需要将一些数据保存起来的时候,就要使用输出流完成. 程序中的输入输 ...

  7. 《SQL必知必会》学习笔记二)

    <SQL必知必会>学习笔记(二) 咱们接着上一篇的内容继续.这一篇主要回顾子查询,联合查询,复制表这三类内容. 上一部分基本上都是简单的Select查询,即从单个数据库表中检索数据的单条语 ...

  8. NumPy学习笔记 二

    NumPy学习笔记 二 <NumPy学习笔记>系列将记录学习NumPy过程中的动手笔记,前期的参考书是<Python数据分析基础教程 NumPy学习指南>第二版.<数学分 ...

  9. Learning ROS for Robotics Programming Second Edition学习笔记(二) indigo tools

    中文译著已经出版,详情请参考:http://blog.csdn.net/ZhangRelay/article/category/6506865 Learning ROS for Robotics Pr ...

  10. Redis学习笔记二 (BitMap算法分析与BitCount语法)

    Redis学习笔记二 一.BitMap是什么 就是通过一个bit位来表示某个元素对应的值或者状态,其中的key就是对应元素本身.我们知道8个bit可以组成一个Byte,所以bitmap本身会极大的节省 ...

随机推荐

  1. 解决iframe在iphone不兼容的问题

    <div class="scroll-wrapper"> <iframe src="地址"></iframe> </d ...

  2. window document树

  3. iostat磁盘监控工具

    安装iostat磁盘监控工具 1.安装 yum install sysstat 2.运行 iostat -k -d -x 1 10 -k:以kb为单位统计 -d:显示磁盘状态 -x:显示详细信息 1: ...

  4. @JsonInclude(JsonInclude.Include.NON_NULL) 加在对象上

    @JsonInclude(JsonInclude.Include.NON_NULL) public class ViewWorkermessage implements Serializable { ...

  5. appium API接口

    appium API接口 标签(空格分隔): appium常用api 1.contexts contexts(self) 返回当前会话的上下文,使用可以识别H5页面的控件: driver.contex ...

  6. Linq to sql 之 ExecuteQuery 错误:指定的转换无效

    问题:通过dbContext.ExecuteQuery 得到数据并赋值给一个集合. 代码: public IEnumerable<LeaveCodeSum> GetLeavTotal(st ...

  7. Myeclipse 2014 破解

    Myeclipse 2014 破解补丁,首先需要先下载 Myeclipse 2014 官方安装文件,下载地址http://www.jb51.net/softs/150886.html,然后下载此补丁. ...

  8. linux下外接显示器亮度调节

    下载Brightness Controller 即可调节. 还可以通过如下命令: 使用xrandr | grep -v disconnected | grep connected命令查看连接的显示设备 ...

  9. vmware 共享文件夹

    参考 https://jingyan.baidu.com/article/7f766daf7866be4101e1d0ed.html 只是设置共享文件夹选项还不行,需要从安装vmware的安装路径中找 ...

  10. HOOK -- DLL的远程注入技术详解(1)

    DLL的远程注入技术是目前Win32病毒广泛使用的一种技术.使用这种技术的病毒体通常位于一个DLL中,在系统启动的时候,一个EXE程序会将这个DLL加载至某些系统进程(如Explorer.exe)中运 ...