00001
00022
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
00047 length = 0;
00048
00049 length =
COM_trim( );
00050 temp =
COM_gets( );
00051
00052
for( i = 0; ( i < length ) && ( *temp++ !=
',' ); i++)
00053 {
00054 ;
00055 }
00056
00057
00058
if( i >= length )
00059 {
00060
return 0;
00061 }
00062
00063
else
00064 {
00065
return ZIP_atoi( temp );
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();
00088 in_handle =
COM_gets( );
00089
00090 in_handle += 2;
00091
00092
for( i = 0; ( i < len ) && ( *in_handle++ !=
'\n' ); i++)
00093 {
00094 ;
00095 }
00096
00097
00098
if( i >= len )
00099 {
00100 in_handle =
'\0';
00101
return in_handle;
00102 }
00103
00104
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;
00112
00113
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++;
00120 }
00121
00122 in_handle += 2 + field_length;
00123
00124 in_handle += 14 + 4;
00125
00126
return ( in_handle + 2 );
00127 }
00128 }