UCHAR CCH341PARDlg::mCharToBcd(UCHAR iChar) { UCHAR mBCD; if ( iChar >= '0' && iChar <= '9' ) mBCD = iChar -'0'; else if ( iChar >= 'A' && iChar <= 'F' ) mBCD = iChar - 'A' + 0x0a; else if ( iCha r >= 'a' && iChar <= 'f' ) mBCD = iChar - 'a' + 0x0a; else mBCD = 0x00; return( mBCD ); }
PUCHAR CCH341PARDlg::mStrtoVal(PUCHAR str, ULONG strlen) { ULONG i,j; ULONG len; UCHAR strRev[mMAX_BUFFER_LENGTH]; if( strlen % 2 != 0 ) { str[strlen] = 0; strlen += 1; } len = strlen / 2; for(i=0,j=0;j { strRev[j] = (UCHAR)((mCharToBcd(str[i])<<4) + mCharToBcd(str[i+1])); i++; } strRev[j]='\0'; memcpy( str,strRev,len); return str; } ULONG CCH341PARDlg::mStrToBcd(CString str) { char mlen,i=0; UCHAR iChar=0,Char[9]=""; UINT mBCD=0,de=1; mlen=strlen(str); memcpy(Char,str,mlen); for(i=mlen-1;i>=0;i--) { iChar=Char[i]; if ( iChar >= '0' && iChar <= '9' ) mBCD = mBCD+(iChar -'0')*de; else if ( iChar >= 'A' && iChar <= 'F' ) mBCD =mBCD+ (iChar - 'A' + 0x0a)*de; else if ( iChar >= 'a' && iChar <= 'f' ) mBCD =mBCD+ (iChar - 'a' + 0x0a)*de; else return(0); de*=16; } return(mBCD); },请问这三个函数做什么用的???