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

📄 avrgsm__api_8c.html

📁 SMS傳送Sourcode,compiler with C,AT command
💻 HTML
📖 第 1 页 / 共 4 页
字号:
00252         encodedmsg = <a class="code" href="AVRGSM__tools_8h.html#a1">TOOLS__decodeCMGR</a>( ind );      <span class="comment">//Get encoded message from the data returned from the phone</span>00253         i = <a class="code" href="AVRGSM__zip_8h.html#a4">ZIP_decompress</a>( encodedmsg, msgbuff );  <span class="comment">//Decompress this message</span>00254 00255         <span class="comment">//COM_puts( msgbuff );                      //Could be used during test, where the GSM modem is switched with a terminal application</span>00256 00257         <span class="keywordflow">return</span> i;00258     }00259 00260     <span class="keywordflow">else</span>                                            <span class="comment">//Read != OK</span>00261     {00262         <span class="keywordflow">return</span> 0;00263     }00264 }</div></pre><p>Here is the call graph for this function:<p><center><img src="AVRGSM__api_8c_a13_cgraph.png" border="0" usemap="#AVRGSM__api_8c_a13_cgraph_map" alt=""></center><map name="AVRGSM__api_8c_a13_cgraph_map"><area href="AVRGSM__api_8c.html#a9" shape="rect" coords="160,7,331,34" alt=""><area href="AVRGSM__com_8c.html#a13" shape="rect" coords="380,58,489,84" alt=""><area href="AVRGSM__com_8h.html#a13" shape="rect" coords="181,108,309,135" alt=""><area href="AVRGSM__com_8h.html#a15" shape="rect" coords="200,159,291,186" alt=""><area href="AVRGSM__com_8c.html#a14" shape="rect" coords="199,210,292,236" alt=""><area href="AVRGSM__com_8h.html#a11" shape="rect" coords="168,260,323,287" alt=""><area href="AVRGSM__tools_8h.html#a1" shape="rect" coords="163,311,328,338" alt=""><area href="AVRGSM__zip_8h.html#a4" shape="rect" coords="184,362,307,388" alt=""><area href="AVRGSM__com_8c.html#a15" shape="rect" coords="388,7,481,34" alt=""><area href="AVRGSM__com_8h.html#a12" shape="rect" coords="383,134,487,160" alt=""><area href="AVRGSM__com_8c.html#a23" shape="rect" coords="392,260,477,287" alt=""><area href="AVRGSM__com_8c.html#a22" shape="rect" coords="393,311,476,338" alt=""><area href="AVRGSM__zip_8h.html#a6" shape="rect" coords="399,362,471,388" alt=""></map>    </td>  </tr></table><a class="anchor" name="a12" doxytag="AVRGSM_api.c::API_sendmsg" ></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_sendmsg           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">unsigned char *&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>msg</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>Send message. <p>This function will take your user defined message, encode this text, add the header information found in AVRSMS_header.h. If successful, the message will be forwarded to the connected GSM modem<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td></td><td valign=top><em>*msg</em>&nbsp;</td><td>unsigned char pointer user defined message</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>&nbsp;</td><td>Success, message sent </td></tr>    <tr><td></td><td valign=top><em>0</em>&nbsp;</td><td>Error doing compression </td></tr>    <tr><td></td><td valign=top><em>-1</em>&nbsp;</td><td>No "&gt; " from phone </td></tr>    <tr><td></td><td valign=top><em>-2</em>&nbsp;</td><td>No message sent acknowledge</td></tr>  </table></dl><p>Local variables <p>Definition at line <a class="el" href="AVRGSM__api_8c-source.html#l00160">160</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#l00050">AT_CMGS</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00224">COM_put_integer()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00198">COM_putchar()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00254">COM_puts()</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__header_8h-source.html#l00044">HEADER_LEN</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__header_8h-source.html#l00031">PDU_HEADER</a>, <a class="el" href="AVRGSM__com_8h-source.html#l00031">READY_</a>, <a class="el" href="AVRGSM__zip_8c-source.html#l00040">ZIP_compress()</a>, and <a class="el" href="AVRGSM__zip_8c-source.html#l00187">ZIP_itoh()</a>.<p>Referenced by <a class="el" href="STATE__functions_8c-source.html#l00100">ST_send()</a>.<p><pre class="fragment"><div>00161 {00162 00164   <span class="keywordtype">int</span> payload_len, len;                                           <span class="comment">//Total length of message, and length of user text</span>00165   <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> payload_len_c[3], jump;00166 00167   <span class="comment">//Init</span>00168   payload_len = len = 0;00169   payload_len_c[0] = jump = <span class="charliteral">'\0'</span>;00170 00171   <span class="comment">//If necessary turn interrupts off</span>00172   <span class="keywordflow">if</span>( ( payload_len = <a class="code" href="AVRGSM__zip_8h.html#a3">ZIP_compress</a>( msg, &amp;jump, msgbuff) ) == 0 ) <span class="comment">//Convert user text to pdu format</span>00173   {00174     <span class="keywordflow">return</span> 0;                                                     <span class="comment">//Something wrong happend during compression</span>00175   }00176 00177   <span class="comment">//Compression ok</span>00178   <span class="keywordflow">else</span>00179   {00180     <a class="code" href="AVRGSM__zip_8h.html#a7">ZIP_itoh</a>(payload_len, &amp;payload_len_c[0]);                     <span class="comment">//Convert Integer payload to hex in string format</span>00181     len = <a class="code" href="AVRGSM__header_8h.html#a0">HEADER_LEN</a> + payload_len - jump;                        <span class="comment">//Calculate overall length</span>00182 00183     <a class="code" href="AVRGSM__com_8c.html#a13">COM_rx_reset</a>( );                                              <span class="comment">//Clear rx_buff</span>00184     <a class="code" href="AVRGSM__com_8h.html#a11">COM_setSearchString</a>( READY_ );                                <span class="comment">//Set "&gt; " to be search string</span>00185     <a class="code" href="AVRGSM__com_8h.html#a15">COM_putsf</a>( AT_CMGS );                                         <span class="comment">//Send message</span>00186     <a class="code" href="AVRGSM__com_8h.html#a13">COM_put_integer</a>( len );                                       <span class="comment">//append length</span>00187     <a class="code" href="AVRGSM__com_8h.html#a15">COM_putsf</a>( CRLF );                                            <span class="comment">//CR+LF</span>00188     <a class="code" href="AVRGSM__com_8c.html#a14">COM_rx_on</a>( );                                                 <span class="comment">//Receiver on</span>00189 00190     <span class="comment">//Append payload</span>00191     <span class="keywordflow">if</span>( <a class="code" href="AVRGSM__api_8c.html#a9">API_check_acknowledge</a>() &gt; 0 )                             <span class="comment">//Wait for acknowledge = "&gt; "</span>00192     {00193       <a class="code" href="AVRGSM__com_8c.html#a13">COM_rx_reset</a>( );                                            <span class="comment">//Clear rx_buff</span>00194       <a class="code" href="AVRGSM__com_8h.html#a11">COM_setSearchString</a>( OK_ );                                 <span class="comment">//Set "OK" to be search string</span>00195       <a class="code" href="AVRGSM__com_8h.html#a15">COM_putsf</a>( PDU_HEADER );00196       <a class="code" href="AVRGSM__com_8h.html#a14">COM_puts</a>( payload_len_c );00197       <a class="code" href="AVRGSM__com_8h.html#a14">COM_puts</a>( msgbuff );00198       <a class="code" href="AVRGSM__com_8h.html#a12">COM_putchar</a>( 26 );00199       <a class="code" href="AVRGSM__com_8c.html#a14">COM_rx_on</a>( );                                               <span class="comment">//Receiver on</span>00200 00201       <span class="keywordflow">if</span>( <a class="code" href="AVRGSM__api_8c.html#a9">API_check_acknowledge</a>() &gt; 0 )                           <span class="comment">//Acknowledge = OK</span>00202       {00203         <span class="keywordflow">return</span> 1;00204       }00205 00206       <span class="keywordflow">else</span>                                                        <span class="comment">//Acknowledge != OK</span>00207       {00208         <span class="keywordflow">return</span> -2;00209       }00210 00211     }00212 00213     <span class="keywordflow">else</span>                                                          <span class="comment">//Acknowledge != "&gt; "</span>00214     {00215         <span class="keywordflow">return</span> -1;00216     }00217   }00218 }</div></pre><p>Here is the call graph for this function:<p><center><img src="AVRGSM__api_8c_a12_cgraph.png" border="0" usemap="#AVRGSM__api_8c_a12_cgraph_map" alt=""></center><map name="AVRGSM__api_8c_a12_cgraph_map"><area href="AVRGSM__api_8c.html#a9" shape="rect" coords="163,7,334,33" alt=""><area href="AVRGSM__com_8c.html#a13" shape="rect" coords="383,57,492,84" alt=""><area href="AVRGSM__com_8h.html#a13" shape="rect" coords="184,108,312,135" alt=""><area href="AVRGSM__com_8h.html#a12" shape="rect" coords="386,184,490,211" alt=""><area href="AVRGSM__com_8h.html#a14" shape="rect" coords="206,209,291,236" alt=""><area href="AVRGSM__com_8h.html#a15" shape="rect" coords="203,260,294,287" alt=""><area href="AVRGSM__com_8c.html#a14" shape="rect" coords="202,311,295,337" alt=""><area href="AVRGSM__com_8h.html#a11" shape="rect" coords="171,361,326,388" alt=""><area href="AVRGSM__zip_8h.html#a3" shape="rect" coords="195,412,302,439" alt=""><area href="AVRGSM__zip_8h.html#a7" shape="rect" coords="212,463,284,489" alt=""><area href="AVRGSM__com_8c.html#a15" shape="rect" coords="391,7,484,33" alt=""></map>    </td>  </tr></table><hr><h2>Variable Documentation</h2><a class="anchor" name="a5" doxytag="AVRGSM_api.c::AT_CMGD" ></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"> const unsigned char __flash <a class="el" href="AVRGSM__api_8c.html#a5">AT_CMGD</a>[] = "AT+CMGD="          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Delete message at index. <p><p>Definition at line <a class="el" href="AVRGSM__api_8c-source.html#l00048">48</a> of file <a class="el" href="AVRGSM__api_8c-source.html">AVRGSM_api.c</a>.<p>Referenced by <a class="el" href="AVRGSM__api_8c-source.html#l00125">API_deletemsg()</a>.    </td>  </tr></table><a class="anchor" name="a6" doxytag="AVRGSM_api.c::AT_CMGR" ></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"> const unsigned char __flash <a class="el" href="AVRGSM__api_8c.html#a6">AT_CMGR</a>[] = "AT+CMGR="          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Read from index. <p><p>Definition at line <a class="el" href="AVRGSM__api_8c-source.html#l00049">49</a> of file <a class="el" href="AVRGSM__api_8c-source.html">AVRGSM_api.c</a>.

⌨️ 快捷键说明

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