localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp
branchRCL_3
changeset 37 7e0ecb5b116a
parent 20 2553637c2525
child 38 3dcb815346df
equal deleted inserted replaced
35:57266085a3a2 37:7e0ecb5b116a
   913     if ( iParseInfo.iLimit < 0 )
   913     if ( iParseInfo.iLimit < 0 )
   914         {
   914         {
   915         iParseInfo.iLimit = cmdLength;
   915         iParseInfo.iLimit = cmdLength;
   916         }
   916         }
   917     // Next create a new command
   917     // Next create a new command
   918     if ( !iDecodeInfo.iFirstDecode && !specialCmd )
   918     if ( !iDecodeInfo.iFirstDecode )
   919         {
   919         {
   920         _LIT( KAtMsg, "AT" );
   920         _LIT( KAtMsg, "AT" );
   921         iDecodeInfo.iDecodeBuffer.Append( KAtMsg );
   921         iDecodeInfo.iDecodeBuffer.Append( KAtMsg );
   922         iParseInfo.iLimit += 2;  // Length of "AT"
   922         if ( !specialCmd )  // Already added with CheckSpecialCommand()
       
   923             {
       
   924             iParseInfo.iLimit += 2;  // Length of "AT"
       
   925             }
   923         // Note: The length of iDecodeBuffer is not exceeded here because "AT"
   926         // Note: The length of iDecodeBuffer is not exceeded here because "AT"
   924         // is added only for the second commands after that.
   927         // is added only for the second commands after that.
   925         }
   928         }
   926     TPtrC8 decodedCmd = iInputBuffer.Mid( startIndex, cmdLength );
   929     TPtrC8 decodedCmd = iInputBuffer.Mid( startIndex, cmdLength );
   927     iDecodeInfo.iDecodeBuffer.Append( decodedCmd );
   930     iDecodeInfo.iDecodeBuffer.Append( decodedCmd );
  1051 //
  1054 //
  1052 TBool CDunAtCmdHandler::CheckSpecialCommand( TInt aStartIndex,
  1055 TBool CDunAtCmdHandler::CheckSpecialCommand( TInt aStartIndex,
  1053                                              TInt& aEndIndex )
  1056                                              TInt& aEndIndex )
  1054     {
  1057     {
  1055     FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand()") ));
  1058     FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand()") ));
       
  1059     TInt atMsgLen = 0;
       
  1060     TInt newLength = iInputBuffer.Length() - aStartIndex;
  1056     TBuf8<KDunInputBufLength> upperBuf;
  1061     TBuf8<KDunInputBufLength> upperBuf;
  1057     TInt newLength = iInputBuffer.Length() - aStartIndex;
  1062     if ( !iDecodeInfo.iFirstDecode )
  1058     upperBuf.Copy( &iInputBuffer[aStartIndex], newLength );
  1063         {
       
  1064         // For cases such as "ATM1L3DT*99#" "DT" must have "AT"
       
  1065         _LIT8( KATMsg, "AT" );
       
  1066         upperBuf.Copy( KATMsg );
       
  1067         atMsgLen = 2;  // "AT"
       
  1068         newLength += atMsgLen;
       
  1069         }
       
  1070     upperBuf.Append( &iInputBuffer[aStartIndex], newLength );
  1059     upperBuf.UpperCase();
  1071     upperBuf.UpperCase();
  1060     TInt i;
  1072     TInt i;
  1061     TInt count = iSpecials.Count();
  1073     TInt count = iSpecials.Count();
  1062     for ( i=0; i<count; i++ )
  1074     for ( i=0; i<count; i++ )
  1063         {
  1075         {
  1075         TInt cmpResult = upperBuf.Compare( *specialCmd );
  1087         TInt cmpResult = upperBuf.Compare( *specialCmd );
  1076         upperBuf.SetLength( origLength );
  1088         upperBuf.SetLength( origLength );
  1077         if ( cmpResult == 0 )
  1089         if ( cmpResult == 0 )
  1078             {
  1090             {
  1079             iParseInfo.iLimit = specialLength;
  1091             iParseInfo.iLimit = specialLength;
  1080             aEndIndex = (origLength-1) + aStartIndex;
  1092             aEndIndex = (origLength-1) + aStartIndex - atMsgLen;
  1081             FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand() complete") ));
  1093             FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand() complete") ));
  1082             return ETrue;
  1094             return ETrue;
  1083             }
  1095             }
  1084         }
  1096         }
  1085     FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand() (not found) complete") ));
  1097     FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand() (not found) complete") ));