⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mig.html

📁 tinyos中文手册,是根据tinyos系统自带手册翻译过来的,虽然质量不好,但是对英文不强的人还是有用的
💻 HTML
字号:
<html><head><title>mig - message interface generator for nesC</title></head><body><h3>NAME</h3><blockquote>mig - message interface generator for nesC</blockquote><h3>SYNOPSIS</h3><blockquote>mig [any ncc option] [<b>-o</b> <u>output-file</u>][<b>-java-classname=</b><u>full-class-name</u>][<b>-java-extends=</b><u>class-name</u>]<u>tool</u> <u>msg-format-file</u> <u>message-type</u></blockquote><h3>DESCRIPTION</h3><blockquote>mig is a tool to generate code that processes TinyOS messages.  The<u>tool</u> argument specifies what tool should be generated, the<u>msg-format-file</u> specifies your application's top-level nesC file,and the <u>message-type</u> specifies the C type of the message you wish toprocess. The C type must be defined with `struct <u>message-type'</u> or`union <u>message-type'</u> in a .h file which your nesC application`includes'. If your .h file defining the message type does not depend onany other files, then you can specify the .h file directly as the<u>msg-format-file</u>.<p>If you also need access to some constants from your nesC application,please consult the <a href="ncg.html">ncg</a> man page.<p>If an enum constant named AM_<u>message_type</u> (with <u>message_type</u>capitalized) is found, then the value of that constant is assumed to be theactive message type for <u>message-type</u>.<p>Currently there is only one tool, <b>java</b>, which generates a java classthat encodes and decodes messages. The <b>-java-*</b> options are specificto this tool. It is described below.<p><b>-o</b> <u>output-file</u> <blockquote> specify the file in which tooutput the generated code.</blockquote>mig works by invoking ncc. It will generally be necessary to pass some optionsthrough to ncc so that your file can be compiled. Some commonly necessaryoptions are:<p><b>-target=<u>known-tinyos-platform</u></b> <blockquote> specify the targetarchitecture of your TinyOS application which is generating or receivingmessages. So, e.g., if compiling your application for tossim specify-target=pc. The default target is ncc's default target.</blockquote><b>-I</b> <u>dir</u> <blockquote> specify an additional search directoryfor nesC components.</blockquote><b>-board=<u>known-tinyos-sensorboard</u></b><blockquote> specify one (ormore) sensor boards. This effects the search path and preprocessor symbols(and may therefore be necessary when feeding a file to mig).</blockquote></blockquote><h3>JAVA TOOL</h3><blockquote><p>This tool generates a java class to encode or decode a TinyOS packet,basing itself on the net.tinyos.message infrastructure. For each field<i>fname</i> of structure <u>message-type</u>, there are the following methods(the bit offset and size methods are useful for structures containingbitfields):<ul><li><code>get_</code><i>fname</i>: get field's value<li><code>set_</code><i>fname</i>: set field's value<li><code>offsetBits_</code><i>fname</i>: return bit offset of field in <u>message-type</u><li><code>offset_</code><i>fname</i>: return byte offset of field in <u>message-type</u> <li><code>sizeBits_</code><i>fname</i>: return size in bits of field (not for arrays)<li><code>size_</code><i>fname</i>: return size in bytes of field (not for arrays)(absent if <i>fname</i> is a bitfield)<li><code>isSigned_</code><i>fname</i>: return true if <i>fname</i> is of a signed type<li><code>isArray_</code><i>fname</i>: return true if <i>fname</i> is an array</ul>Embedded structures in <u>message-type</u> are expanded, using _ toseparate the structure name and its fields.<p>A number of extra methods are present for fields that are arrays:<ul><li><code>getElement_</code><i>fname</i>: get an element of the array<li><code>setElement_</code><i>fname</i>: set an element of the array<li><code>elementSize_</code><i>fname</i>: return size in bytes of array elements<li><code>elementSizeBits_</code><i>fname</i>: return size in bits of array elements<li><code>numDimensions_</code><i>fname</i>: return number of dimensions of the array<li><code>numElements_</code><i>fname</i>: return number of elements of the array for a givendimension (left-most dimension is numbered 0) - the dimension is optional for 1-dimensional arrays<li><code>totalSize_</code><i>fname</i>: return size in bytes of the array (absent if the arrayis variable-size)<li><code>totalSizeBits_</code><i>fname</i>: return size in bits of the array (absent if the arrayis variable-size)</ul>If the array is 1-dimensional and the elements are one byte, then thefollowing methods exist:<li><code>getString_</code><i>fname</i>: build a Java string from the array assuming it containsa C-style null-terminated string<li><code>setString_</code><i>fname</i>: set the array to a C-style null-terminated string givena java string</ul><p>The <code>getElement_..., setElement_...,offset_...</code> and<code>offsetBits_...</code> methods take one argument per arraydimension. These methods report errors if the array index is out ofbounds. If an array has a maximum size of 0, mig assumes it represents avariable-size array and does not check the corresponding array index.The data for a message is stored in an array, with explicit base and lengthinformation. The constructors can either allocate this array, receive it asan explicit argument or extract if from another message. The base andlength can also be optionally passed to these constructors.  <p>The optional length argument overrides the default size ofsizeof(message-type); this is useful for variable-size messages. The use ofan explicit base is helpful for messages embedded in other messages.<p>The generated class also has an amType() method which returns the message'sactive message type, or -1 if no AM_<u>message_type</u> constant was found.<p>The java tool accepts the following options:<p><b>-java-classname=</b><u>full-class-name</u> <blockquote> this option is required and specifies the package and name of the generated class. If the full-class-name has no '.', then no package directive is included in the output.</blockquote><b>-java-extends=</b><u>class-name</u>: <blockquote> specify the class thegenerated class will extend.  The default isnet.tinyos.message.Message.</blockquote></blockquote><h3>EXAMPLE</h3><blockquote>        APPDIR=`ncc -print-tosdir`/../apps/Ident<br>	mig java -I $APPDIR  -java-classname=net.tinyos.ident.IdentMsg $APPDIR/App.nc IdentMsg -o IdentMsg.java</blockquote><h3>ERRORS</h3><blockquote>mig reports an error if ncc cannot compile <u>msg-format-file</u>, if<u>message-type</u> isn't found or if it contains pointers.</blockquote><h3>SEE ALSO</h3><blockquote><a href="ncc.html">ncc</a><a href="ncg.html">ncg</a></blockquote></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -