?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 6

Line No. Rev Author Line
1 6 kaklik <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>Procyon AVRlib: STX/ETX Packet Protocol Library (stxetx.c)</title>
4 <link href="dox.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.4.2 -->
7 <div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
8 <h1>STX/ETX Packet Protocol Library (stxetx.c)<br>
9 <small>
10 [<a class="el" href="group__general.html">General Libraries</a>]</small>
11 </h1><hr><a name="_details"></a><h2>Detailed Description</h2>
12 <div class="fragment"><pre class="fragment"><span class="preprocessor"> #include "<a class="code" href="stxetx_8h.html">stxetx.h</a>"</span>
13 </pre></div> <dl compact><dt><b>Overview</b></dt><dd>This library provides functions needed to transmit and receive STX/ETX packets over any interface which can send and receive bytes.  STX/ETX is a simple packet protocol for serial data streams and offers packetization, type tagging, and checksum protection for user data.  Common uses of STX/ETX might include radio communications were it can improve data reliability over lossy channels.  STX/ETX may also be used effectively anywhere multiple access to the communication medium is required.  The packets can be made to contain destination addresses or routing information as well as data.</dd></dl>
14 <dl compact><dt><b>STX/ETX Details</b></dt><dd>STX/ETX is a simple packet protocol that can be wrapped around user data for one or more of the following reasons: 1. packetization is needed<ul>
15 <li>Using packets can be helpful if your data naturally forms little "bunches" or if different types of data must be sent over the same channel (a serial cable, for example). If your data forms "bunches", you can send user data inside STX/ETX packets with a predetermined structure, like an array of A/D conversion results. If you need a way to tell the receiver what kind of data you're sending, you can use the TYPE field in the STX/ETX packet. 2. error checking is needed</li><li>STX/ETX packets will add a checksum to your data. This allows the receiver to verify that data was received correctly and is error-free. Packets which are corrupted in transmission and fail the the checksum test are automatically discarded. Error checking is especially useful when the data transmission channel is unreliable or noisy (examples: radio, infrared, long cables, etc)</li></ul>
16 </dd></dl>
17 STX/ETX packets have the following structure:<p>
18 [STX][status][type][length][user data...][checksum][ETX]<p>
19 All fields are 1 byte except for user data which may be 0-255 bytes. Uppercase fields are constant (STX=0x02, ETX=0x03), lowercase fields vary. The length field is the number of bytes in the user data area. The checksum is the 8-bit sum of all bytes between but not including STX/ETX.
20 <p>
21 <table border="0" cellpadding="0" cellspacing="0">
22 <tr><td></td></tr>
23 <tr><td colspan="2"><br><h2>Defines</h2></td></tr>
24 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga7" doxytag="stxetx::STX"></a>
25 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>STX</b>&nbsp;&nbsp;&nbsp;0x02</td></tr>
26  
27 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga8" doxytag="stxetx::ETX"></a>
28 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>ETX</b>&nbsp;&nbsp;&nbsp;0x03</td></tr>
29  
30 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga9" doxytag="stxetx::STXETX_HEADERLENGTH"></a>
31 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>STXETX_HEADERLENGTH</b>&nbsp;&nbsp;&nbsp;4</td></tr>
32  
33 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga10" doxytag="stxetx::STXETX_TRAILERLENGTH"></a>
34 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>STXETX_TRAILERLENGTH</b>&nbsp;&nbsp;&nbsp;2</td></tr>
35  
36 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga11" doxytag="stxetx::STXETX_STATUSOFFSET"></a>
37 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>STXETX_STATUSOFFSET</b>&nbsp;&nbsp;&nbsp;1</td></tr>
38  
39 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga12" doxytag="stxetx::STXETX_TYPEOFFSET"></a>
40 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>STXETX_TYPEOFFSET</b>&nbsp;&nbsp;&nbsp;2</td></tr>
41  
42 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga13" doxytag="stxetx::STXETX_LENGTHOFFSET"></a>
43 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>STXETX_LENGTHOFFSET</b>&nbsp;&nbsp;&nbsp;3</td></tr>
44  
45 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga14" doxytag="stxetx::STXETX_DATAOFFSET"></a>
46 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>STXETX_DATAOFFSET</b>&nbsp;&nbsp;&nbsp;4</td></tr>
47  
48 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga15" doxytag="stxetx::STXETX_CHECKSUMOFFSET"></a>
49 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>STXETX_CHECKSUMOFFSET</b>&nbsp;&nbsp;&nbsp;4</td></tr>
50  
51 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga16" doxytag="stxetx::STXETX_NOETXSTXCHECKSUM"></a>
52 #define&nbsp;</td><td class="memItemRight" valign="bottom"><b>STXETX_NOETXSTXCHECKSUM</b>&nbsp;&nbsp;&nbsp;3</td></tr>
53  
54 <tr><td colspan="2"><br><h2>Functions</h2></td></tr>
55 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga0" doxytag="stxetx::stxetxInit"></a>
56 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stxetx.html#ga0">stxetxInit</a> (void(*dataout_func)(unsigned char data))</td></tr>
57  
58 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize STX/ETX packet protocol library. <br></td></tr>
59 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga1" doxytag="stxetx::stxetxSend"></a>
60 void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stxetx.html#ga1">stxetxSend</a> (unsigned char status, unsigned char type, unsigned char datalength, unsigned char *dataptr)</td></tr>
61  
62 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Send/Create STX/ETX packet. <br></td></tr>
63 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga2" doxytag="stxetx::stxetxProcess"></a>
64 unsigned char&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stxetx.html#ga2">stxetxProcess</a> (<a class="el" href="structstruct__cBuffer.html">cBuffer</a> *rxBuffer)</td></tr>
65  
66 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Process a buffer containing STX/ETX packets. <br></td></tr>
67 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga3" doxytag="stxetx::stxetxGetRxPacketStatus"></a>
68 unsigned char&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stxetx.html#ga3">stxetxGetRxPacketStatus</a> (void)</td></tr>
69  
70 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the received packet's status. <br></td></tr>
71 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga4" doxytag="stxetx::stxetxGetRxPacketType"></a>
72 unsigned char&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stxetx.html#ga4">stxetxGetRxPacketType</a> (void)</td></tr>
73  
74 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the received packet's type. <br></td></tr>
75 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga5" doxytag="stxetx::stxetxGetRxPacketDatalength"></a>
76 unsigned char&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stxetx.html#ga5">stxetxGetRxPacketDatalength</a> (void)</td></tr>
77  
78 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the received packet's datalength. <br></td></tr>
79 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga6" doxytag="stxetx::stxetxGetRxPacketData"></a>
80 unsigned char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stxetx.html#ga6">stxetxGetRxPacketData</a> (void)</td></tr>
81  
82 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns pointer to the received packet's data. <br></td></tr>
83 </table>
84 <hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:09 2006 for Procyon AVRlib by&nbsp;
85 <a href="http://www.doxygen.org/index.html">
86 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
87 </body>
88 </html>
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3