📄 avrgsm__api_8h.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_api.h 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 Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>AVRGSM_FILES/AVRGSM_api.h File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>Atmel Corporation<p><ul><li>File : AVR_api.h</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__api_8h-source.html">AVRGSM_api.h</a>.<p><p>This graph shows which files directly or indirectly include this file:<p><center><img src="AVRGSM__api_8h__dep__incl.png" border="0" usemap="#AVRGSM_api.hdep_map" alt="Included by dependency graph"></center><map name="AVRGSM_api.hdep_map"><area href="AVRGSM__api_8c.html" shape="rect" coords="7,7,121,34" alt=""><area href="main_8c.html" shape="rect" coords="145,7,207,34" alt=""><area href="STATE__functions_8c.html" shape="rect" coords="231,7,367,34" alt=""></map><p><a href="AVRGSM__api_8h-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>int </td><td class="memItemRight" valign=bottom><a class="el" href="AVRGSM__api_8h.html#a1">API_deletemsg</a> (int <a class="el" href="STATE__functions_8c.html#a0">index</a>)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Delete a message from a given index. <a href="#a1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="AVRGSM__api_8h.html#a0">API_modem_init</a> (void)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Used to setup the connected GSM modem. <a href="#a0"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="AVRGSM__api_8h.html#a3">API_readmsg</a> (int ind)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Read message from a given index. <a href="#a3"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="AVRGSM__api_8h.html#a2">API_sendmsg</a> (unsigned char *msg)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Send message. <a href="#a2"></a><br><br></td></tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="a1" doxytag="AVRGSM_api.h::API_deletemsg" ></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_deletemsg </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname1" valign="top" nowrap> <em>index</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>Delete a message from a given index. <p>This function will use the "AT+CMGD" command to delete the 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>index</em> </td><td>index to delete 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>1</em> </td><td>Success </td></tr> <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_8h_a1_cgraph.png" border="0" usemap="#AVRGSM__api_8h_a1_cgraph_map" alt=""></center><map name="AVRGSM__api_8h_a1_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="a0" doxytag="AVRGSM_api.h::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_8h_a0_cgraph.png" border="0" usemap="#AVRGSM__api_8h_a0_cgraph_map" alt=""></center><map name="AVRGSM__api_8h_a0_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="">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -