📄 avrgsm__tools_8c-source.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_FILES/AVRGSM_tools.c Source File</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_tools.c</h1><a href="AVRGSM__tools_8c.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">// This file has been prepared for Doxygen automatic documentation generation.</span>00022 <span class="comment"></span><span class="comment">//Include</span>00023 <span class="preprocessor">#include"<a class="code" href="AVRGSM__com_8h.html">AVRGSM_com.h</a>"</span>00024 <span class="preprocessor">#include"<a class="code" href="AVRGSM__zip_8h.html">AVRGSM_zip.h</a>"</span>00025 <span class="preprocessor">#include"<a class="code" href="AVRGSM__tools_8h.html">AVRGSM_tools.h</a>"</span>00026 00027 <a name="l00039"></a><a class="code" href="AVRGSM__tools_8h.html#a0">00039</a> <span class="keywordtype">int</span> <a class="code" href="AVRGSM__tools_8c.html#a0">TOOLS_decodeCMTI</a>( <span class="keywordtype">void</span> )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 < length ) && ( *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 >= 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 }00068 00069 <a name="l00080"></a><a class="code" href="AVRGSM__tools_8h.html#a1">00080</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* <a class="code" href="AVRGSM__tools_8h.html#a1">TOOLS__decodeCMGR</a>( <span class="keywordtype">int</span> index )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 < len ) && ( *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 >= 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><hr size="1"><address style="align: right;"><small>Generated on Tue Nov 1 16:21:39 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 + -