亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mote-pc serial communication and serialforwarder - tinyos documentation wiki.htm

?? 從官方網站上下載tinyos2.0的學習指南
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
$ ./configure
$ ./make
$ ./make install
</PRE>
<P>Then type <CODE>tos-install-jni</CODE>. This should install serial support in 
your system. </P><A name=MOTECOM></A>
<H2><SPAN class=mw-headline>MOTECOM</SPAN></H2>
<P>If you do not pass a <CODE>-comm</CODE> parameter, then tools will check the 
<CODE>MOTECOM</CODE> environment variable for a packet source, and if there is 
no <CODE>MOTECOM</CODE>, they default to a SerialForwarder. This means that if 
you're always communicating with a mote over your serial port, you can just set 
<CODE>MOTECOM</CODE> and no longer have to specify the <CODE>-comm</CODE> 
parameter. For example: </P><PRE>export MOTECOM=serial@COM1:19200 # mica baud rate
export MOTECOM=serial@COM1:mica  # mica baud rate, again
export MOTECOM=serial@COM2:mica2 # the mica2 baud rate, on a different serial port
export MOTECOM=serial@COM3:57600 # explicit mica2 baud rate
</PRE>
<P>Try setting your MOTECOM variable and running TestSerial without a 
<CODE>-comm</CODE> parameter. </P><A 
name=BaseStation_and_net.tinyos.tools.Listen></A>
<H1><SPAN class=mw-headline>BaseStation and net.tinyos.tools.Listen</SPAN></H1>
<P><CODE>BaseStation</CODE> is a basic TinyOS utility application. It acts as a 
bridge between the serial port and radio network. When it receives a packet from 
the serial port, it transmits it on the radio; when it receives a packets over 
the radio, it transmits it to the serial port. Because TinyOS has a toolchain 
for generating and sending packets to a mote over a serial port, using a 
BaseStation allows PC tools to communicate directly with mote networks. </P>
<P>Take one of the two nodes that had BlinkToRadio (from <A 
title="Mote-mote radio communication" 
href="http://docs.tinyos.net/index.php/Mote-mote_radio_communication">lesson 
3</A>) installed and install BaseStation on it. If you turn on the node that 
still has BlinkToRadio installed, you should see LED 1 on the BaseStation 
blinking. BaseStation toggles LED 0 whenever it sends a packet to the radio and 
LED 1 whenever it sends a packet to the serial port. It toggles LED 2 whenever 
it has to drop a packet: this can happen when one of the two receives packets 
faster than the other can send them (e.g., receiving micaZ radio packets at 
256kbps but sending serial packets at 57.6kbps). </P>
<P>BaseStation is receiving your BlinkToRadio packets and sending them to the 
serial port, so if it is plugged into a PC we can view these packets. The Java 
tool Listen is a basic packet sniffer: it prints out the binary contents of any 
packet it hears. Run Listen, using either MOTECOM or a -comm parameter: </P><PRE>$ java net.tinyos.tools.Listen
</PRE>
<P>Listen creates a packet source and just prints out every packet it sees. Your 
output should look something like this: </P><PRE>00 FF FF 00 00 04 22 06 00 02 00 01
00 FF FF 00 00 04 22 06 00 02 00 02
00 FF FF 00 00 04 22 06 00 02 00 03
00 FF FF 00 00 04 22 06 00 02 00 04
00 FF FF 00 00 04 22 06 00 02 00 05
00 FF FF 00 00 04 22 06 00 02 00 06
00 FF FF 00 00 04 22 06 00 02 00 07
00 FF FF 00 00 04 22 06 00 02 00 08
00 FF FF 00 00 04 22 06 00 02 00 09
00 FF FF 00 00 04 22 06 00 02 00 0A
00 FF FF 00 00 04 22 06 00 02 00 0B
</PRE>
<P>Listen is simply printing out the packets that are coming from the mote. Each 
data packet that comes out of the mote contains several fields of data. The 
first byte (00) indicates that this is packet is an AM packet. The next fields 
are the generic Active Message fields, defined in 
<TT>tinyos-2.x/tos/serial/Serial.h</TT>. Finally, the remaining fields are the 
data payload of the message, which was defined in BlinkToRadio.h as: </P><PRE>typedef nx_struct BlinkToRadioMsg {
  nx_uint16_t nodeid;
  nx_uint16_t counter;
} BlinkToRadioMsg;
</PRE>
<P>The overall message format for the BlinkToRadioC application is therefore 
(ignoring the first 00 byte): </P>
<UL>
  <LI><B>Destination address</B> (2 bytes) 
  <LI><B>Link source address</B> (2 bytes) 
  <LI><B>Message length</B> (1 byte) 
  <LI><B>Group ID</B> (1 byte) 
  <LI><B>Active Message handler type</B> (1 byte) 
  <LI><B>Payload</B> (up to 28 bytes): 
  <UL>
    <LI><B>source mote ID</B> (2 bytes) 
    <LI><B>sample counter</B> (2 bytes) </LI></UL></LI></UL>
<P>So we can interpret the data packet as follows: </P>
<TABLE cellSpacing=10>
  <TBODY>
  <TR bgColor=#d0d0d0>
    <TD><B>dest addr</B> </TD>
    <TD><B>link source addr</B> </TD>
    <TD><B>msg len</B> </TD>
    <TD><B>groupID</B> </TD>
    <TD><B>handlerID</B> </TD>
    <TD><B>source addr</B> </TD>
    <TD><B>counter</B> </TD></TR>
  <TR>
    <TD bgColor=#d0d0ff>ff ff </TD>
    <TD bgColor=#d0d0ff>00 00 </TD>
    <TD bgColor=#d0d0ff>04 </TD>
    <TD bgColor=#d0d0ff>22 </TD>
    <TD bgColor=#d0d0ff>06 </TD>
    <TD bgColor=#d0ffd0>00 02 </TD>
    <TD bgColor=#d0ffd0>00 0B </TD></TR></TBODY></TABLE>
<P>The link source address and source address field differ in who sets them. The 
serial stack does not set the link source address; for Blink, it should always 
be <B>00 00</B>. Blink sets the source address to be the node's ID, which 
depends on what mote ID you installed your BlinkToRadio application with. The 
default (if you do not specify and ID) is <CODE>00 01</CODE>. Note that the data 
is sent by the mote in <I>big-endian</I> format; for example, <CODE>01 02</CODE> 
means 258 (256*1 + 2). This format is independent of the endian-ness of the 
processor, because the packet format is an <CODE>nx_struct</CODE>, which is a 
network format, that is, big-endian and byte-aligned. Using 
<CODE>nx_struct</CODE> (rather than a standard C <CODE>struct</CODE>) for a 
message payload ensures that it will work across platforms. </P>
<P>As you watch the packets scroll by, you should see the counter field increase 
as the BlinkToRadio app increments its counter. </P><A 
name=MIG:_generating_packet_objects></A>
<H1><SPAN class=mw-headline>MIG: generating packet objects</SPAN></H1>
<P>The <TT>Listen</TT> program is the most basic way of communicating with the 
mote; it just prints binary packets to the screen. Obviously it is not easy to 
visualize the sensor data using this program. What we'd really like is a better 
way of retrieving and observing data coming from the sensor network. Of course, 
exactly what data to display and how to visualize it can be very application 
specific. For this reason, TinyOS only has a few applications for visualizing 
simple sensor data (in the next lesson, you'll use the Oscilloscope 
application), but it provides support for building new visualization or logging 
systems. </P>
<P>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. The TinyOS 
toolchain makes this process easier by providing tools for automatically 
generating message objects from packet descriptions. Rather than parse packet 
formats manually, you can use the <CODE>mig</CODE> (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. </P>
<P>The mig tool takes three basic arguments: what programming language to 
generate code for (Java, Python, or C), which file in which to find the 
structure, and the name of the structure. The tool also takes standard C 
options, such as -I for includes and -D for defines. The TestSerial application, 
for example, uses mig so that it can easily create and parse the packets over 
the serial port. If you go back to TestSerial and type <CODE>make 
clean;make</CODE>, you should see this: </P><PRE>rm -rf build *.class TestSerialMsg.java
rm -rf _TOSSIMmodule.so TOSSIM.pyc TOSSIM.py
mkdir -p build/telosb
mig java -target=telosb -I%T/lib/oski -java-classname=TestSerialMsg TestSerial.h TestSerialMsg 
-o TestSerialMsg.java
javac *.java
    compiling TestSerialAppC to a telosb binary
ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x66 
-Wnesc-all -DCC2420_DEF_CHANNEL=19 -target=telosb -fnesc-cfile=build/telosb/app.c 
-board= -I%T/lib/oski  TestSerialAppC.nc -lm
    compiled TestSerialAppC to build/telosb/main.exe
            6300 bytes in ROM
             281 bytes in RAM
msp430-objcopy --output-target=ihex build/telosb/main.exe build/telosb/main.ihex
    writing TOS image
</PRE>
<P>Before building the TinyOS application, the Makefile has a rule for 
generating <CODE>TestSerialMsg.java</CODE>. It then compiles TestSerialMsg.java 
as well as TestSerial.java, and finally compiles the TinyOS application. Looking 
at the Makefile, we can see that it has a few more rules than the one for 
BlinkToRadio: </P><PRE>COMPONENT=TestSerialAppC
BUILD_EXTRA_DEPS += TestSerial.class
CLEAN_EXTRA = *.class TestSerialMsg.java

TestSerial.class: $(wildcard *.java) TestSerialMsg.java
        javac *.java

TestSerialMsg.java:
        mig java -target=null -java-classname=TestSerialMsg TestSerial.h TestSerialMsg -o $@

include $(MAKERULES)
</PRE>
<P>The <CODE>BUILD_EXTRA_DEPS</CODE> line tells the TinyOS make system that the 
TinyOS application has additional dependencies that must be satisfied before it 
can be built. The Makefile tells the make system that 
<CODE>TestSerial.class</CODE>, the Java application that we ran to test serial 
communication. The <CODE>CLEAN_EXTRA</CODE> line tells the make system extra 
things that need to be done when a user types <CODE>make clean</CODE> to clean 
up. </P>
<P>The <CODE>BUILD_EXTRA_DEPS</CODE> line tells make to compile TestSerial.class 
before the application; the line </P><PRE>TestSerial.class: $(wildcard *.java) TestSerialMsg.java
        javac *.java
</PRE>
<P>tells it that TestSerial.class depends on all of the .java files in the 
directory as well as TestSerialMsg.java. Once all of these dependencies are 
resolved, the make system will call <CODE>javac *.java</CODE>, which creates 
TestSerial.class. The final line, </P><PRE>TestSerialMsg.java:
        mig java -target=null -java-classname=TestSerialMsg TestSerial.h TestSerialMsg -o $@
</PRE>
<P>tells the make system how to create TestSerialMsg.java, the Java class 
representing the packet sent between the mote and PC. Because TestSerialMsg.java 
is a dependency for TestSerial.class, make will create it if it is needed. To 
create TestSerialMsg.java, the Makefile invokes the mig tool. Let's step through 
the parameters one by one: </P>
<TABLE>
  <TBODY>
  <TR>
    <TD>mig </TD>
    <TD>Invoke mig </TD></TR>
  <TR>
    <TD>java </TD>
    <TD>Build a Java class </TD></TR>
  <TR>
    <TD>-target=null </TD>
    <TD>For the <CODE>null</CODE>platform </TD></TR>
  <TR>
    <TD>-java-classname=TestSerialMsg </TD>
    <TD>Name the Java class TestSerialMsg </TD></TR>
  <TR>
    <TD>TestSerial.h </TD>
    <TD>The structure is in TestSerial.h </TD></TR>
  <TR>
    <TD>TestSerialMsg </TD>
    <TD>The structure is named TestSerialMsg </TD></TR>
  <TR>
    <TD>-o $@ </TD>
    <TD>Write the file to $@, which is TestSerialMsg.java </TD></TR></TBODY></TABLE>
<P>The <CODE>null</CODE> platform is a special platform which is convenient to 
use as the target when using <CODE>mig</CODE>. It includes all the standard 
system components, but with dummy do-nothing implementations. Building an 
application for the <CODE>null</CODE> platform is useless, but it allows 
<CODE>mig</CODE> to extract the layout of packets. </P>
<P>Let's build a Java packet object for BlinkToRadio. Open the Makefile for 
BlinkToRadio and add a dependency: </P><PRE>BUILD_EXTRA_DEPS=BlinkToRadioMsg.class
</PRE>
<P>Then add a step which explains how to compile a .java to a .class: </P><PRE>BlinkToRadioMsg.class: BlinkToRadioMsg.java
        javac BlinkToRadioMsg.java
</PRE>
<P><B>Note that there must be a tab before javac, and not just spaces.</B> 
Finally, add the line which explains how to create BlinkToRadioMsg.java: </P><PRE>BlinkToRadioMsg.java:
        mig java -target=null -java-classname=BlinkToRadioMsg BlinkToRadio.h BlinkToRadioMsg -o $@
</PRE>
<P>As with javac, there must be a tab (not spaces) before mig. Now, when you 
type <CODE>make</CODE> in <CODE>BlinkToRadio/</CODE>, the make system will 
compile BlinkToRadioMsg.class, a Java class that parses a binary packet into 
message fields that can be accessed through methods. </P>
<P>There is one more step, however. When you compiled, you probably saw this 
warning: </P><PRE>warning: Cannot determine AM type for BlinkToRadioMsg
         (Looking for definition of AM_BLINKTORADIOMSG)
</PRE>
<P>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 <CODE>AM_X</CODE>. The 
warning is because we defined our AM type as AM_BLINKTORADIO, but mig wants 
AM_BLINKTORADIOMSG. Modify BlinkToRadio.h so that it defines the latter. You'll 
also need to update BlinkToRadioAppC.nc so that the arguments to AMSenderC and 
AMReceiverC use it. Recompile the application, and you should see no warning. 
Install it on a mote. </P>
<P>Now that we have a Java message class, we can use it to print out the 
messages we see from the BaseStation. With BaseStation plugged into the serial 
port and BlinkToRadio running on another mote, from the BlinkToRadio directory 
type </P><PRE>java net.tinyos.tools.MsgReader BlinkToRadioMsg
</PRE>
<P>Now, when the BaseStation sends a packet to the serial port, MsgReader reads 
it, looks at its AM type, and if it matches the AM type of one of the Java 
message classes passed at the command line, it prints out the packet. You should 
see output like this: </P><PRE>1152232617609: Message
  [nodeid=0x2]
  [counter=0x1049]

1152232617609: Message
  [nodeid=0x2]
  [counter=0x104a]

1152232617609: Message
  [nodeid=0x2]
  [counter=0x104b]

1152232617621: Message
  [nodeid=0x2]
  [counter=0x104c]
</PRE><A name=SerialForwarder_and_other_packet_sources></A>
<H1><SPAN class=mw-headline>SerialForwarder and other packet sources</SPAN></H1>
<P>One problem with directly using the serial port is that only one PC program 
can interact with the mote. Additionally, it requires you to run the application 
on the PC which is physically connected to the mote. The SerialForwarder tool is 
a simple way to remove both of these limitations. </P>
<P>Most generally, the <TT>SerialForwarder</TT> program opens a packet source 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
26uuu成人网一区二区三区| 亚洲视频一区在线| 中文字幕一区二| 免费在线观看成人| 色系网站成人免费| 精品国产成人系列| 亚洲一区日韩精品中文字幕| 精品无人区卡一卡二卡三乱码免费卡| www.欧美精品一二区| 精品免费视频.| 亚洲成av人片一区二区三区| 99精品视频一区| 国产亚洲一区二区三区在线观看| 天天影视网天天综合色在线播放 | eeuss影院一区二区三区| 欧美精品777| 亚洲国产一区二区三区| eeuss鲁一区二区三区| 久久精品视频免费| 激情成人午夜视频| 日韩欧美激情四射| 欧美aaaaaa午夜精品| 在线观看av不卡| 亚洲美女免费在线| 99精品欧美一区二区三区综合在线| 久久免费午夜影院| 国模大尺度一区二区三区| 日韩欧美专区在线| 日韩综合小视频| 91精品国产一区二区三区| 亚洲一区在线视频观看| 欧美自拍丝袜亚洲| 一区二区三区av电影| 色狠狠综合天天综合综合| 国产精品蜜臀av| 欧美一区二区播放| 日本视频一区二区三区| 欧美日韩和欧美的一区二区| 亚洲国产精品尤物yw在线观看| 91色综合久久久久婷婷| 亚洲免费观看高清在线观看| 色综合久久久久综合99| 亚洲最新视频在线播放| 欧美日韩国产在线播放网站| 五月综合激情网| 日韩一级免费观看| 国产一区二区三区香蕉| 国产视频一区在线观看| 成人av动漫网站| 亚洲免费观看高清在线观看| 欧美色手机在线观看| 日本色综合中文字幕| 久久你懂得1024| 99久久99久久久精品齐齐| 亚洲一区二区三区免费视频| 日韩一区二区视频在线观看| 国产尤物一区二区在线| 国产精品福利一区| 欧美日韩亚洲综合一区| 韩国欧美一区二区| 亚洲人成在线播放网站岛国| 91.成人天堂一区| 国产在线不卡一卡二卡三卡四卡| 国产免费久久精品| 欧美日韩免费在线视频| 久久99在线观看| 中文字幕一区二区三区视频| 欧美日韩一区视频| 国产一区久久久| 亚洲精品日韩一| 欧美一级高清片在线观看| 成人黄动漫网站免费app| 一区二区三区在线观看国产| 日韩一二三区视频| 91麻豆免费看| 激情综合一区二区三区| 中文字幕一区二区三区不卡在线| 91麻豆精品国产无毒不卡在线观看| 国产成人免费在线视频| 亚洲国产成人porn| 国产日韩精品久久久| 欧美日本精品一区二区三区| 国产成人av一区二区三区在线观看| 亚洲综合在线免费观看| 久久精品亚洲乱码伦伦中文| 欧美精品久久久久久久多人混战| 国产精品888| 免费看黄色91| 亚洲图片欧美色图| 国产精品成人午夜| 337p粉嫩大胆噜噜噜噜噜91av| 欧美亚洲动漫精品| 99久久er热在这里只有精品66| 久久99热这里只有精品| 亚洲第一久久影院| 亚洲乱码国产乱码精品精98午夜| 国产拍欧美日韩视频二区 | 一本色道久久综合狠狠躁的推荐 | 欧美成人猛片aaaaaaa| 欧美性极品少妇| www.日韩精品| 成人免费视频一区二区| 久久91精品久久久久久秒播| 午夜精品福利一区二区三区蜜桃| 国产精品久久久久久久久搜平片| 久久综合色一综合色88| 国产精品成人网| 精品国产区一区| 日韩免费一区二区三区在线播放| 欧美人与禽zozo性伦| 精品污污网站免费看| 欧美视频在线观看一区二区| 91福利在线免费观看| 91免费观看国产| 99视频精品在线| 91香蕉国产在线观看软件| 成人av在线播放网址| 99久久伊人精品| 欧美日韩一区国产| 欧美这里有精品| 欧美午夜片在线看| 欧美日韩成人高清| 91精品国产美女浴室洗澡无遮挡| 欧美三级中文字幕在线观看| 欧美日韩精品一区视频| 欧美疯狂性受xxxxx喷水图片| 欧美日韩极品在线观看一区| 91精品国产免费| 久久综合狠狠综合久久综合88| 2020日本不卡一区二区视频| 久久先锋资源网| 国产精品美女久久久久av爽李琼| 国产精品国产三级国产普通话三级| 国产精品乱码一区二区三区软件| 1024成人网| 亚洲大片在线观看| 久久精品免费观看| 国产精品一区二区三区99| 成人不卡免费av| 在线观看亚洲一区| 日韩午夜三级在线| 欧美高清在线一区二区| 专区另类欧美日韩| 日韩中文字幕亚洲一区二区va在线| 六月丁香综合在线视频| 国产成人在线视频网站| 欧美亚男人的天堂| 亚洲精品一区二区三区精华液| 欧美激情在线看| 亚洲一区二区在线免费观看视频| 日本成人在线一区| 成人丝袜高跟foot| 5858s免费视频成人| 国产欧美精品一区| 午夜激情久久久| 国产成a人亚洲精品| 欧美日韩在线播放一区| 久久精品一区四区| 亚洲国产成人av| 成人综合在线观看| 欧美一区二区视频在线观看2022 | 欧美一区二区三区视频免费播放| 久久亚区不卡日本| 午夜精品福利视频网站| 大美女一区二区三区| 91精品国产综合久久香蕉麻豆| 中文字幕欧美区| 全部av―极品视觉盛宴亚洲| 91色在线porny| 久久亚洲影视婷婷| 日韩成人精品在线| 91亚洲精品久久久蜜桃网站| 精品国产乱码久久| 午夜欧美大尺度福利影院在线看| 成人一区二区三区视频| 日韩欧美一区二区免费| 一区二区高清在线| 成av人片一区二区| 久久久精品综合| 日本欧美加勒比视频| 97久久精品人人爽人人爽蜜臀| 欧美精品一区二区三区蜜桃视频| 午夜精品在线看| 色哟哟国产精品免费观看| 国产日韩欧美激情| 国内精品在线播放| 91精品国产一区二区人妖| 亚洲综合丝袜美腿| 菠萝蜜视频在线观看一区| 日韩精品影音先锋| 日韩国产在线一| 欧美性色黄大片| 亚洲免费看黄网站| 91久久精品一区二区三| 国产精品精品国产色婷婷| 成人免费精品视频| 国产精品乱人伦| 91在线观看成人| 亚洲同性同志一二三专区| 成人av手机在线观看|