Main Page | Data Structures | File List | Data Fields | Globals

AVRGSM_FILES/AVRGSM_tools.c

Go to the documentation of this file.
00001 // This file has been prepared for Doxygen automatic documentation generation. 00022 //Include 00023 #include"AVRGSM_com.h" 00024 #include"AVRGSM_zip.h" 00025 #include"AVRGSM_tools.h" 00026 00027 00039 int TOOLS_decodeCMTI( void ) 00040 { 00041 00043 unsigned char *temp; 00044 int length, i; 00045 00046 //init 00047 length = 0; 00048 00049 length = COM_trim( ); //Trim off trailing OK\r\n 00050 temp = COM_gets( ); //Get rx_buff 00051 00052 for( i = 0; ( i < length ) && ( *temp++ != ',' ); i++) //Loop until we get a ',' 00053 { 00054 ; 00055 } 00056 00057 //Error 00058 if( i >= length ) 00059 { 00060 return 0; 00061 } 00062 00063 else 00064 { 00065 return ZIP_atoi( temp ); //Convert ascii int to integer 00066 } 00067 } 00068 00069 00080 unsigned char* TOOLS__decodeCMGR( int index ) 00081 { 00082 00084 unsigned char *in_handle; 00085 int i, len, field_length; 00086 00087 len = COM_trim(); //Trim off OK\r\n 00088 in_handle = COM_gets( ); //Get rx_buff 00089 00090 in_handle += 2; //Skip first \r\n 00091 00092 for( i = 0; ( i < len ) && ( *in_handle++ != '\n' ); i++) //Loop until we get '\n' 00093 { 00094 ; 00095 } 00096 00097 //Error 00098 if( i >= len ) 00099 { 00100 in_handle = '\0'; 00101 return in_handle; 00102 } 00103 00104 //Everything OK 00105 else 00106 { 00107 00108 field_length = 16 * ZIP_htoi( *in_handle++ ); 00109 field_length = ZIP_htoi( *in_handle++ ); 00110 00111 in_handle += 2*field_length + 2; //Skip Service center nmbr 00112 00113 //Find length of sender address 00114 field_length = 16 * ZIP_htoi( *in_handle++ ); 00115 field_length = ZIP_htoi( *in_handle++ ); 00116 00117 if( field_length%2 ) 00118 { 00119 field_length++; //Check for trailing F 00120 } 00121 00122 in_handle += 2 + field_length; //Skip fields in header 00123 00124 in_handle += 14 + 4; //Skip more fields...TP-PID, TP-DCS and TP-SCTS 00125 00126 return ( in_handle + 2 ); //Return correct pointer 00127 } 00128 }

Generated on Tue Nov 1 16:21:39 2005 for AVR323 Interfacing GSM modems by doxygen 1.3.7