localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp
branchRCL_3
changeset 37 7e0ecb5b116a
parent 20 2553637c2525
child 38 3dcb815346df
--- a/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp	Mon Jun 21 16:40:15 2010 +0300
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp	Thu Jul 15 19:38:28 2010 +0300
@@ -915,11 +915,14 @@
         iParseInfo.iLimit = cmdLength;
         }
     // Next create a new command
-    if ( !iDecodeInfo.iFirstDecode && !specialCmd )
+    if ( !iDecodeInfo.iFirstDecode )
         {
         _LIT( KAtMsg, "AT" );
         iDecodeInfo.iDecodeBuffer.Append( KAtMsg );
-        iParseInfo.iLimit += 2;  // Length of "AT"
+        if ( !specialCmd )  // Already added with CheckSpecialCommand()
+            {
+            iParseInfo.iLimit += 2;  // Length of "AT"
+            }
         // Note: The length of iDecodeBuffer is not exceeded here because "AT"
         // is added only for the second commands after that.
         }
@@ -1053,9 +1056,18 @@
                                              TInt& aEndIndex )
     {
     FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand()") ));
-    TBuf8<KDunInputBufLength> upperBuf;
+    TInt atMsgLen = 0;
     TInt newLength = iInputBuffer.Length() - aStartIndex;
-    upperBuf.Copy( &iInputBuffer[aStartIndex], newLength );
+    TBuf8<KDunInputBufLength> upperBuf;
+    if ( !iDecodeInfo.iFirstDecode )
+        {
+        // For cases such as "ATM1L3DT*99#" "DT" must have "AT"
+        _LIT8( KATMsg, "AT" );
+        upperBuf.Copy( KATMsg );
+        atMsgLen = 2;  // "AT"
+        newLength += atMsgLen;
+        }
+    upperBuf.Append( &iInputBuffer[aStartIndex], newLength );
     upperBuf.UpperCase();
     TInt i;
     TInt count = iSpecials.Count();
@@ -1077,7 +1089,7 @@
         if ( cmpResult == 0 )
             {
             iParseInfo.iLimit = specialLength;
-            aEndIndex = (origLength-1) + aStartIndex;
+            aEndIndex = (origLength-1) + aStartIndex - atMsgLen;
             FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand() complete") ));
             return ETrue;
             }