cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp
branchRCL_3
changeset 16 95674584745d
parent 12 b23265fb36da
child 21 0ba996a9b75d
--- a/cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp	Tue May 25 12:53:11 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp	Wed Jun 09 09:52:54 2010 +0300
@@ -19,24 +19,23 @@
 #include <hash.h>
 
 #include "debug.h"
-
-
-// Max buffer length for an MD5 digest
-const TInt KSCPMaxHashLength( 32 );
-
+#include "atmisccmdpluginconsts.h"
 
 TAtCommandParser::TAtCommandParser()
     : iCmdType(EUnknown), iCmdHandlerType(ECmdHandlerTypeUndefined)  
     {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
     }
 
 TAtCommandParser::TAtCommandParser(const TDesC8& aCmd)
     : iCmdType(EUnknown), iCmdHandlerType(ECmdHandlerTypeUndefined)  
     {
+    TRACE_FUNC_ENTRY
     ParseAtCommand(aCmd);
+    TRACE_FUNC_EXIT
     }
 
-
 void TAtCommandParser::ParseAtCommand(const TDesC8& aCmd)
     {
     TRACE_FUNC_ENTRY
@@ -59,37 +58,42 @@
     _LIT8(KAtCpin, "AT+CPIN");
     _LIT8(KAtCusd, "AT+CUSD");
     _LIT8(KAtCnum, "AT+CNUM");
+    _LIT8(KAtCmee, "AT+CMEE");
     
     Trace(KDebugPrintS, "token: ", &token);
     // Determine the AT command type
-    if(!token.Compare(KAtCfun))
+    if(!token.CompareF(KAtCfun))
         {
         iCmdType = ECmdAtCfun;
         }
-    else if(!token.Compare(KAtCbc))
+    else if(!token.CompareF(KAtCbc))
         {
         iCmdType = ECmdAtCbc;
         }
-    else if(!token.Compare(KAtClck))
+    else if(!token.CompareF(KAtClck))
         {
         iCmdType = ECmdAtClck;
         }
-    else if(!token.Compare(KAtCpwd))
+    else if(!token.CompareF(KAtCpwd))
         {
         iCmdType = ECmdAtCpwd;
         }
-    else if(!token.Compare(KAtCpin))
+    else if(!token.CompareF(KAtCpin))
         {
         iCmdType = ECmdAtCpin;
         }
-    else if(!token.Compare(KAtCusd))
+    else if(!token.CompareF(KAtCusd))
         {
         iCmdType = ECmdAtCusd;
         }
-    else if(!token.Compare(KAtCnum))
+    else if(!token.CompareF(KAtCnum))
         {
         iCmdType = ECmdAtCnum;
         }
+    else if(!token.Compare(KAtCmee))
+        {
+        iCmdType = ECmdAtCmee;
+        }
     else
         {
         iCmdType = EUnknown;
@@ -128,11 +132,15 @@
 
 TAtCommandParser::TCommandType TAtCommandParser::Command() const
     {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
     return iCmdType;
     }
 
 TAtCommandParser::TCommandHandlerType TAtCommandParser::CommandHandlerType() const
     {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
     return iCmdHandlerType;
     }
 
@@ -166,25 +174,29 @@
     return retVal;
     }
 
-TPtrC8 TAtCommandParser::NextTextParam(TInt& aError)
+TInt TAtCommandParser::NextTextParam(TPtrC8& aParam)
     {
+    TRACE_FUNC_ENTRY
+    TInt ret = KErrNone;
     TPtrC8 param = NextParam();
     
-    if (param.Compare(KNullDesC8) == 0)
+    if (param.Length() == 0)
         {
-        aError = KErrNotFound;
-        return param; 
+        aParam.Set(NULL,0);
+        ret = KErrNotFound;
         }
-    
-    if(param.Length()<2 
-            || param[0] != '"'
+    else if(param.Length() < 2 || param[0] != '"'
             || param[param.Length()-1] != '"')
         {
-        aError = KErrArgument;
-        return param.Left(0);
+        aParam.Set(NULL,0);
+        ret = KErrArgument;
         }
-    aError = KErrNone;
-    return param.Mid(1, param.Length() - 2);
+    else
+        {
+        aParam.Set(param.Mid(1, param.Length() - 2));
+        }
+    TRACE_FUNC_EXIT
+    return ret;
     }
 
 TInt TAtCommandParser::NextIntParam(TInt& aValue)
@@ -192,7 +204,7 @@
     TRACE_FUNC_ENTRY
     TInt retVal =KErrNone;
     TPtrC8 param = NextParam();
-    if (param.Compare(KNullDesC8) == 0)
+    if (param.Length() == 0)
         {
         retVal = KErrNotFound;
         }