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

📄 avrgsm__tools_8c.html

📁 SMS傳送Sourcode,compiler with C,AT command
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>AVR323 Interfacing GSM modems: AVRGSM_tools.c File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.7 --><div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</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></div><h1>AVRGSM_FILES/AVRGSM_tools.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>Atmel Corporation<p><ul><li>File : AVRSMS_tools.c</li><li>Compiler : IAR EWAAVR 4.11a</li></ul><p><ul><li>Support mail : <a href="mailto:avr@atmel.com">avr@atmel.com</a></li></ul><p><ul><li>Supported devices : All devices with a UART/USART can be used. The example is written for ATmega128</li></ul><p><ul><li>AppNote : AVR323 - Interfacing GSM modems</li></ul><p><ul><li>Description : Example of how to use AT-Commands to control a GSM modem</li></ul><p><dl compact><dt><b>Revision</b></dt><dd>1.2 </dd></dl><dl compact><dt><b>Date</b></dt><dd>Wednesday, January 26, 2005 10:43:44 UTC </dd></dl><p>Definition in file <a class="el" href="AVRGSM__tools_8c-source.html">AVRGSM_tools.c</a>.<p><code>#include "<a class="el" href="AVRGSM__com_8h-source.html">AVRGSM_com.h</a>"</code><br><code>#include "<a class="el" href="AVRGSM__zip_8h-source.html">AVRGSM_zip.h</a>"</code><br><code>#include "<a class="el" href="AVRGSM__tools_8h-source.html">AVRGSM_tools.h</a>"</code><br><p>Include dependency graph for AVRGSM_tools.c:<p><center><img src="AVRGSM__tools_8c__incl.png" border="0" usemap="#AVRGSM_tools.c_map" alt="Include dependency graph"></center><map name="AVRGSM_tools.c_map"><area href="AVRGSM__com_8h.html" shape="rect" coords="7,7,132,34" alt=""><area href="AVRGSM__zip_8h.html" shape="rect" coords="156,7,271,34" alt=""><area href="AVRGSM__tools_8h.html" shape="rect" coords="295,7,423,34" alt=""></map><p><a href="AVRGSM__tools_8c-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="AVRGSM__tools_8c.html#a1">TOOLS__decodeCMGR</a> (int <a class="el" href="STATE__functions_8c.html#a0">index</a>)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get start of compressed string.  <a href="#a1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="AVRGSM__tools_8c.html#a0">TOOLS_decodeCMTI</a> (void)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Used to get index of newly received message.  <a href="#a0"></a><br><br></td></tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="a1" doxytag="AVRGSM_tools.c::TOOLS__decodeCMGR" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> unsigned char* TOOLS__decodeCMGR           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">int&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>index</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get start of compressed string. <p>When a new message has been read from a given index, thsi function<br> will run through it, and find start of the encoded user text.<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>void</em>&nbsp;</td><td></td></tr>  </table></dl><dl compact><dt><b>Return values:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>in_handle</em>&nbsp;</td><td>if error in_handle points to '', else it will point to the string ready for decompression</td></tr>  </table></dl><p>Local variables <p>Definition at line <a class="el" href="AVRGSM__tools_8c-source.html#l00080">80</a> of file <a class="el" href="AVRGSM__tools_8c-source.html">AVRGSM_tools.c</a>.<p>References <a class="el" href="AVRGSM__com_8c-source.html#l00317">COM_gets()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00289">COM_trim()</a>, and <a class="el" href="AVRGSM__zip_8c-source.html#l00164">ZIP_htoi()</a>.<p>Referenced by <a class="el" href="AVRGSM__api_8c-source.html#l00232">API_readmsg()</a>.<p><pre class="fragment"><div>00081 {00082 00084     <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *in_handle;00085     <span class="keywordtype">int</span> i, len, field_length;00086 00087     len         = <a class="code" href="AVRGSM__com_8c.html#a22">COM_trim</a>();                                   <span class="comment">//Trim off OK\r\n</span>00088     in_handle   = <a class="code" href="AVRGSM__com_8c.html#a23">COM_gets</a>( );                                  <span class="comment">//Get rx_buff</span>00089 00090     in_handle += 2;                                             <span class="comment">//Skip first \r\n</span>00091 00092     <span class="keywordflow">for</span>( i = 0; ( i &lt; len ) &amp;&amp; ( *in_handle++ != <span class="charliteral">'\n'</span> ); i++)   <span class="comment">//Loop until we get '\n'</span>00093     {00094         ;00095     }00096 00097     <span class="comment">//Error</span>00098     <span class="keywordflow">if</span>( i &gt;= len )00099     {00100         in_handle = <span class="charliteral">'\0'</span>;00101         <span class="keywordflow">return</span> in_handle;00102     }00103 00104     <span class="comment">//Everything OK</span>00105     <span class="keywordflow">else</span>00106     {00107 00108         field_length = 16 * <a class="code" href="AVRGSM__zip_8h.html#a6">ZIP_htoi</a>( *in_handle++ );00109         field_length = <a class="code" href="AVRGSM__zip_8h.html#a6">ZIP_htoi</a>( *in_handle++ );00110 00111         in_handle += 2*field_length + 2;                        <span class="comment">//Skip Service center nmbr</span>00112 00113         <span class="comment">//Find length of sender address</span>00114         field_length = 16 * <a class="code" href="AVRGSM__zip_8h.html#a6">ZIP_htoi</a>( *in_handle++ );00115         field_length = <a class="code" href="AVRGSM__zip_8h.html#a6">ZIP_htoi</a>( *in_handle++ );00116 00117         <span class="keywordflow">if</span>( field_length%2 )00118         {00119             field_length++;                                     <span class="comment">//Check for trailing F</span>00120         }00121 00122         in_handle += 2 + field_length;                          <span class="comment">//Skip fields in header</span>00123 00124         in_handle += 14 + 4;                                    <span class="comment">//Skip more fields...TP-PID, TP-DCS and TP-SCTS</span>00125 00126         <span class="keywordflow">return</span> ( in_handle + 2 );                               <span class="comment">//Return correct pointer</span>00127     }00128 }</div></pre><p>Here is the call graph for this function:<p><center><img src="AVRGSM__tools_8c_a1_cgraph.png" border="0" usemap="#AVRGSM__tools_8c_a1_cgraph_map" alt=""></center><map name="AVRGSM__tools_8c_a1_cgraph_map"><area href="AVRGSM__com_8c.html#a23" shape="rect" coords="223,7,308,33" alt=""><area href="AVRGSM__com_8c.html#a22" shape="rect" coords="224,57,307,84" alt=""><area href="AVRGSM__zip_8h.html#a6" shape="rect" coords="230,108,302,135" alt=""></map>    </td>  </tr></table><a class="anchor" name="a0" doxytag="AVRGSM_tools.c::TOOLS_decodeCMTI" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int TOOLS_decodeCMTI           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">void&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Used to get index of newly received message. <p>Will search through the receive buffer found in AVRSMS_com.c, until a <br> ',' is found. If this charcter is found in the buffer, the next parameter will <br> be the new message index.<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>void</em>&nbsp;</td><td></td></tr>  </table></dl><dl compact><dt><b>Return values:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>i</em>&nbsp;</td><td>index of new message </td></tr>    <tr><td></td><td valign=top><em>0</em>&nbsp;</td><td>Error with echo off</td></tr>  </table></dl><p>Local variables <p>Definition at line <a class="el" href="AVRGSM__tools_8c-source.html#l00039">39</a> of file <a class="el" href="AVRGSM__tools_8c-source.html">AVRGSM_tools.c</a>.<p>References <a class="el" href="AVRGSM__com_8c-source.html#l00317">COM_gets()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00289">COM_trim()</a>, and <a class="el" href="AVRGSM__zip_8c-source.html#l00140">ZIP_atoi()</a>.<p>Referenced by <a class="el" href="STATE__functions_8c-source.html#l00141">ST_get_index()</a>.<p><pre class="fragment"><div>00040 {00041 00043     <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *temp;00044     <span class="keywordtype">int</span> length, i;00045 00046     <span class="comment">//init</span>00047     length = 0;00048 00049     length = <a class="code" href="AVRGSM__com_8c.html#a22">COM_trim</a>( );                                     <span class="comment">//Trim off trailing OK\r\n</span>00050     temp   = <a class="code" href="AVRGSM__com_8c.html#a23">COM_gets</a>( );                                     <span class="comment">//Get rx_buff</span>00051 00052     <span class="keywordflow">for</span>( i = 0; ( i &lt; length ) &amp;&amp; ( *temp++ != <span class="charliteral">','</span> ); i++)    <span class="comment">//Loop until we get a ','</span>00053     {00054         ;00055     }00056 00057     <span class="comment">//Error</span>00058     <span class="keywordflow">if</span>( i &gt;= length )00059     {00060         <span class="keywordflow">return</span> 0;00061     }00062 00063     <span class="keywordflow">else</span>00064     {00065         <span class="keywordflow">return</span> <a class="code" href="AVRGSM__zip_8h.html#a5">ZIP_atoi</a>( temp );                             <span class="comment">//Convert ascii int to integer</span>00066     }00067 }</div></pre><p>Here is the call graph for this function:<p><center><img src="AVRGSM__tools_8c_a0_cgraph.png" border="0" usemap="#AVRGSM__tools_8c_a0_cgraph_map" alt=""></center><map name="AVRGSM__tools_8c_a0_cgraph_map"><area href="AVRGSM__com_8c.html#a23" shape="rect" coords="207,7,292,33" alt=""><area href="AVRGSM__com_8c.html#a22" shape="rect" coords="208,57,291,84" alt=""><area href="AVRGSM__zip_8h.html#a5" shape="rect" coords="214,108,286,135" alt=""></map>    </td>  </tr></table><hr size="1"><address style="align: right;"><small>Generated on Tue Nov 1 16:21:41 2005 for AVR323 Interfacing GSM modems by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address></body></html>

⌨️ 快捷键说明

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