📄 avrgsm__api_8c.html
字号:
<tr><td></td><td valign=top><em>0</em> </td><td>Error </td></tr> </table></dl><p>Definition at line <a class="el" href="AVRGSM__api_8c-source.html#l00125">125</a> of file <a class="el" href="AVRGSM__api_8c-source.html">AVRGSM_api.c</a>.<p>References <a class="el" href="AVRGSM__api_8c-source.html#l00278">API_check_acknowledge()</a>, <a class="el" href="AVRGSM__api_8c-source.html#l00048">AT_CMGD</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00224">COM_put_integer()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00270">COM_putsf()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00101">COM_rx_on()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00085">COM_rx_reset()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00127">COM_setSearchString()</a>, <a class="el" href="AVRGSM__api_8c-source.html#l00051">CRLF</a>, and <a class="el" href="AVRGSM__com_8h-source.html#l00029">OK_</a>.<p>Referenced by <a class="el" href="STATE__functions_8c-source.html#l00118">ST_delete_msg()</a>.<p><pre class="fragment"><div>00126 {00127 00128 <a class="code" href="AVRGSM__com_8c.html#a13">COM_rx_reset</a>( ); <span class="comment">//Reset system</span>00129 <a class="code" href="AVRGSM__com_8h.html#a11">COM_setSearchString</a>( OK_ ); <span class="comment">//Set OK to be search string</span>00130 <a class="code" href="AVRGSM__com_8h.html#a15">COM_putsf</a>( AT_CMGD ); <span class="comment">//Delete message</span>00131 <a class="code" href="AVRGSM__com_8h.html#a13">COM_put_integer</a>( index ); <span class="comment">//@index</span>00132 <a class="code" href="AVRGSM__com_8h.html#a15">COM_putsf</a>( CRLF ); <span class="comment">//CR+LF</span>00133 <a class="code" href="AVRGSM__com_8c.html#a14">COM_rx_on</a>( ); <span class="comment">//Receiver on</span>00134 00135 <span class="keywordflow">if</span>( <a class="code" href="AVRGSM__api_8c.html#a9">API_check_acknowledge</a>( ) > 0 ) <span class="comment">//Delete = OK</span>00136 {00137 <span class="keywordflow">return</span> 1;00138 }00139 00140 <span class="keywordflow">else</span> <span class="comment">//Delete != OK</span>00141 {00142 <span class="keywordflow">return</span> 0;00143 }00144 }</div></pre><p>Here is the call graph for this function:<p><center><img src="AVRGSM__api_8c_a11_cgraph.png" border="0" usemap="#AVRGSM__api_8c_a11_cgraph_map" alt=""></center><map name="AVRGSM__api_8c_a11_cgraph_map"><area href="AVRGSM__api_8c.html#a9" shape="rect" coords="171,7,342,33" alt=""><area href="AVRGSM__com_8c.html#a13" shape="rect" coords="391,57,500,84" alt=""><area href="AVRGSM__com_8h.html#a13" shape="rect" coords="192,108,320,135" alt=""><area href="AVRGSM__com_8h.html#a15" shape="rect" coords="211,159,302,185" alt=""><area href="AVRGSM__com_8c.html#a14" shape="rect" coords="210,209,303,236" alt=""><area href="AVRGSM__com_8h.html#a11" shape="rect" coords="179,260,334,287" alt=""><area href="AVRGSM__com_8c.html#a15" shape="rect" coords="399,7,492,33" alt=""><area href="AVRGSM__com_8h.html#a12" shape="rect" coords="394,133,498,160" alt=""></map> </td> </tr></table><a class="anchor" name="a10" doxytag="AVRGSM_api.c::API_modem_init" ></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 API_modem_init </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Used to setup the connected GSM modem. <p>This function will send AT-Commands to the phone. These commands will setup the phone to: -Use correct storage, AT+CPMS -Indicate new message, AT+CNMI -Turn echo off, ATE0<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> </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>1</em> </td><td>Success </td></tr> <tr><td></td><td valign=top><em>0</em> </td><td>Error with echo off </td></tr> <tr><td></td><td valign=top><em>-1</em> </td><td>Error with preferred storage </td></tr> <tr><td></td><td valign=top><em>-2</em> </td><td>Error with indication </td></tr> </table></dl><p>Definition at line <a class="el" href="AVRGSM__api_8c-source.html#l00073">73</a> of file <a class="el" href="AVRGSM__api_8c-source.html">AVRGSM_api.c</a>.<p>References <a class="el" href="AVRGSM__api_8c-source.html#l00278">API_check_acknowledge()</a>, <a class="el" href="AVRGSM__api_8c-source.html#l00046">AT_CNMI</a>, <a class="el" href="AVRGSM__api_8c-source.html#l00047">AT_CPMS</a>, <a class="el" href="AVRGSM__api_8c-source.html#l00045">ATE0</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00270">COM_putsf()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00101">COM_rx_on()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00085">COM_rx_reset()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00127">COM_setSearchString()</a>, and <a class="el" href="AVRGSM__com_8h-source.html#l00029">OK_</a>.<p>Referenced by <a class="el" href="STATE__functions_8c-source.html#l00051">ST_init_phone()</a>.<p><pre class="fragment"><div>00074 {00075 00076 <a class="code" href="AVRGSM__com_8c.html#a13">COM_rx_reset</a>( ); <span class="comment">//Reset system</span>00077 <a class="code" href="AVRGSM__com_8h.html#a11">COM_setSearchString</a>( OK_ ); <span class="comment">//Set OK to be search string</span>00078 <a class="code" href="AVRGSM__com_8h.html#a15">COM_putsf</a>( ATE0 ); <span class="comment">//Send turn echo off</span>00079 <a class="code" href="AVRGSM__com_8c.html#a14">COM_rx_on</a>( ); <span class="comment">//Receiver on</span>00080 00081 <span class="keywordflow">if</span>( <a class="code" href="AVRGSM__api_8c.html#a9">API_check_acknowledge</a>( ) > 0 ) <span class="comment">//Echo off = OK</span>00082 {00083 <a class="code" href="AVRGSM__com_8h.html#a15">COM_putsf</a>(AT_CPMS); <span class="comment">//Send preferred storage</span>00084 <a class="code" href="AVRGSM__com_8c.html#a14">COM_rx_on</a>( ); <span class="comment">//Receiver on</span>00085 00086 <span class="keywordflow">if</span>( <a class="code" href="AVRGSM__api_8c.html#a9">API_check_acknowledge</a>( ) > 0 ) <span class="comment">//Preferred storage = OK</span>00087 {00088 <a class="code" href="AVRGSM__com_8h.html#a15">COM_putsf</a>(AT_CNMI); <span class="comment">//Send preferred indication of new messages</span>00089 <a class="code" href="AVRGSM__com_8c.html#a14">COM_rx_on</a>( ); <span class="comment">//Receiver on</span>00090 00091 <span class="keywordflow">if</span>( <a class="code" href="AVRGSM__api_8c.html#a9">API_check_acknowledge</a>( ) > 0 ) <span class="comment">//Preferred indication = OK</span>00092 {00093 <span class="keywordflow">return</span> 1;00094 }00095 00096 <span class="keywordflow">else</span> <span class="comment">//Preferred indication != OK</span>00097 {00098 <span class="keywordflow">return</span> -2;00099 }00100 }00101 00102 <span class="keywordflow">else</span> <span class="comment">//Preferred storage != OK</span>00103 {00104 <span class="keywordflow">return</span> -1;00105 }00106 }00107 00108 <span class="keywordflow">else</span> <span class="comment">//Echo off != OK</span>00109 {00110 <span class="keywordflow">return</span> 0;00111 }00112 }</div></pre><p>Here is the call graph for this function:<p><center><img src="AVRGSM__api_8c_a10_cgraph.png" border="0" usemap="#AVRGSM__api_8c_a10_cgraph_map" alt=""></center><map name="AVRGSM__api_8c_a10_cgraph_map"><area href="AVRGSM__api_8c.html#a9" shape="rect" coords="179,7,350,34" alt=""><area href="AVRGSM__com_8c.html#a13" shape="rect" coords="399,58,508,84" alt=""><area href="AVRGSM__com_8h.html#a15" shape="rect" coords="219,108,310,135" alt=""><area href="AVRGSM__com_8c.html#a14" shape="rect" coords="218,159,311,186" alt=""><area href="AVRGSM__com_8h.html#a11" shape="rect" coords="187,210,342,236" alt=""><area href="AVRGSM__com_8c.html#a15" shape="rect" coords="407,7,500,34" alt=""><area href="AVRGSM__com_8h.html#a12" shape="rect" coords="402,108,506,135" alt=""></map> </td> </tr></table><a class="anchor" name="a13" doxytag="AVRGSM_api.c::API_readmsg" ></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 API_readmsg </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname1" valign="top" nowrap> <em>ind</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Read message from a given index. <p>This function is used to read a newly arrived message from a given index. The message is decoded, and stored in the msgbuff.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>ind</em> </td><td>index to read message from</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> </td><td>Length of new message </td></tr> <tr><td></td><td valign=top><em>0</em> </td><td>Error, No acknowledge from phone</td></tr> </table></dl><p>Local variables <p>Definition at line <a class="el" href="AVRGSM__api_8c-source.html#l00232">232</a> of file <a class="el" href="AVRGSM__api_8c-source.html">AVRGSM_api.c</a>.<p>References <a class="el" href="AVRGSM__api_8c-source.html#l00278">API_check_acknowledge()</a>, <a class="el" href="AVRGSM__api_8c-source.html#l00049">AT_CMGR</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00224">COM_put_integer()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00270">COM_putsf()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00101">COM_rx_on()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00085">COM_rx_reset()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00127">COM_setSearchString()</a>, <a class="el" href="AVRGSM__api_8c-source.html#l00051">CRLF</a>, <a class="el" href="AVRGSM__api_8c-source.html#l00042">msgbuff</a>, <a class="el" href="AVRGSM__com_8h-source.html#l00029">OK_</a>, <a class="el" href="AVRGSM__tools_8c-source.html#l00080">TOOLS__decodeCMGR()</a>, and <a class="el" href="AVRGSM__zip_8c-source.html#l00091">ZIP_decompress()</a>.<p>Referenced by <a class="el" href="STATE__functions_8c-source.html#l00158">ST_read()</a>.<p><pre class="fragment"><div>00233 {00234 00236 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *encodedmsg; <span class="comment">//Pointer to encoded message</span>00237 <span class="keywordtype">int</span> i;00238 00239 <span class="comment">//Init</span>00240 encodedmsg = <span class="charliteral">'\0'</span>;00241 i = 0;00242 00243 <a class="code" href="AVRGSM__com_8c.html#a13">COM_rx_reset</a>( ); <span class="comment">//Reset system</span>00244 <a class="code" href="AVRGSM__com_8h.html#a11">COM_setSearchString</a>( OK_ ); <span class="comment">//Set OK to be search string</span>00245 <a class="code" href="AVRGSM__com_8h.html#a15">COM_putsf</a>( AT_CMGR ); <span class="comment">//Read message</span>00246 <a class="code" href="AVRGSM__com_8h.html#a13">COM_put_integer</a>( ind ); <span class="comment">//@index</span>00247 <a class="code" href="AVRGSM__com_8h.html#a15">COM_putsf</a>( CRLF ); <span class="comment">//CR+LF</span>00248 <a class="code" href="AVRGSM__com_8c.html#a14">COM_rx_on</a>( ); <span class="comment">//Receiver on, wait for acknowledge</span>00249 00250 <span class="keywordflow">if</span>( <a class="code" href="AVRGSM__api_8c.html#a9">API_check_acknowledge</a>() > 0 ) <span class="comment">//Read = OK</span>00251 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -