cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp
branchRCL_3
changeset 21 0ba996a9b75d
parent 16 95674584745d
child 24 269724087bed
equal deleted inserted replaced
20:eede1356aa52 21:0ba996a9b75d
    22 #include "cpincommandhandler.h"
    22 #include "cpincommandhandler.h"
    23 #include "cusdcommandhandler.h"
    23 #include "cusdcommandhandler.h"
    24 #include "cnumcommandhandler.h"
    24 #include "cnumcommandhandler.h"
    25 #include "cfuncommandhandler.h"
    25 #include "cfuncommandhandler.h"
    26 #include "cbccommandhandler.h"
    26 #include "cbccommandhandler.h"
       
    27 #ifdef PROTOCOL_TDSCDMA
       
    28 #include "hvercommandhandler.h"
       
    29 #include "cgsncommandhandler.h"
       
    30 #include "cgmrcommandhandler.h"
       
    31 #include "cgmicommandhandler.h"
       
    32 #include "cmgwcommandhandler.h"
       
    33 #include "cmgdcommandhandler.h"
       
    34 #include "telephonywrapper.h"
       
    35 #include "cgmmcommandhandler.h"
       
    36 #include "scpbrcommandhandler.h"
       
    37 #include "scpbwcommandhandler.h"
       
    38 #endif
       
    39 
    27 
    40 
    28 #include "atmisccmdpluginconsts.h"
    41 #include "atmisccmdpluginconsts.h"
       
    42 #include "cmserror.h"
    29 #include "debug.h"
    43 #include "debug.h"
    30 
    44 
    31 #include <EXTERROR.H>           // Additional RMobilePhone error code
    45 #include <exterror.h>           // Additional RMobilePhone error code
       
    46 #include <etelmmerr.h>          // ETelMM error code
       
    47 #include <gsmerror.h>           // GSM error code
    32 
    48 
    33 // +CME error code
    49 // +CME error code
       
    50 _LIT8(KCMEMemoryFailure, "+CME ERROR: 23\r\n"); // Memory failure.\r\n
    34 _LIT8(KCMEIncorrectPassword, "+CME ERROR: 16\r\n"); // Incorrect password.\r\n
    51 _LIT8(KCMEIncorrectPassword, "+CME ERROR: 16\r\n"); // Incorrect password.\r\n
    35 _LIT8(KCMEPUKRequired, "+CME ERROR: 12\r\n"); // PUK required.\r\n
    52 _LIT8(KCMEPUKRequired, "+CME ERROR: 12\r\n"); // PUK required.\r\n
    36 _LIT8(KCMENotAllowed, "+CME ERROR: 3\r\n"); // Operation not allowed.\r\n
    53 _LIT8(KCMENotAllowed, "+CME ERROR: 3\r\n"); // Operation not allowed.\r\n
    37 _LIT8(KCMEPhoneError, "+CME ERROR: 0\r\n"); // Phone failure.\r\n
    54 _LIT8(KCMEPhoneError, "+CME ERROR: 0\r\n"); // Phone failure.\r\n
    38 _LIT8(KCMEPhoneUnknown, "+CME ERROR: 100\r\n"); // unknown error
    55 _LIT8(KCMEPhoneUnknown, "+CME ERROR: 100\r\n"); // unknown error
       
    56 _LIT8(KCMESimNotInserted, "+CME ERROR: 10\r\n"); // SIM not inserted 
       
    57 _LIT8(KCMEMemoryFull, "+CME ERROR: 20\r\n"); // Memory full
       
    58 _LIT8(KCMEInvalidIndex, "+CME ERROR: 21\r\n"); // Invalid index 
       
    59 _LIT8(KCMENotFound, "+CME ERROR: 22\r\n"); // Not found 
       
    60 _LIT8(KCMEDialStringTooLong, "+CME ERROR: 26\r\n"); // Dial string too long 
       
    61 _LIT8(KCMETextStringTooLong, "+CME ERROR: 24\r\n"); // Text string too long 
       
    62 _LIT8(KCMEInvalidCharacters, "+CME ERROR: 27\r\n"); // Invalid characters in dial string
       
    63 
       
    64 
    39 
    65 
    40 const TInt KErrorReplyLength = 9;  // CR+LF+"ERROR"+CR+LF
    66 const TInt KErrorReplyLength = 9;  // CR+LF+"ERROR"+CR+LF
       
    67 const TInt KEditorReplyLength = 4;  // CR+LF+'>'+' '
    41 
    68 
    42 CATMiscCmdPlugin* CATMiscCmdPlugin::NewL()
    69 CATMiscCmdPlugin* CATMiscCmdPlugin::NewL()
    43     {
    70     {
    44     CATMiscCmdPlugin* self = new (ELeave) CATMiscCmdPlugin();
    71     CATMiscCmdPlugin* self = new (ELeave) CATMiscCmdPlugin();
    45     CleanupStack::PushL(self);
    72     CleanupStack::PushL(self);
    57     delete iCPINHandler;
    84     delete iCPINHandler;
    58     delete iCUSDHandler;
    85     delete iCUSDHandler;
    59     delete iCNUMHandler;
    86     delete iCNUMHandler;
    60     delete iCFUNHandler;
    87     delete iCFUNHandler;
    61     delete iCBCHandler;
    88     delete iCBCHandler;
    62     
    89 #ifdef PROTOCOL_TDSCDMA
       
    90 	delete iHVERHandler;
       
    91 	delete iCGSNHandler;
       
    92     delete iCGMRHandler;
       
    93     delete iCGMIHandler;
       
    94     delete iCMGWHandler;
       
    95     delete iCMGDHandler;
       
    96     delete iCGMMHandler;
       
    97 	delete iSCPBRHandler;
       
    98     delete iSCPBWHandler;
       
    99 #endif    
       
   100 	
    63     iPhone.Close();
   101     iPhone.Close();
    64     iTelServer.Close();
   102     iTelServer.Close();
    65 	}
   103 	}
    66 
   104 
    67 CATMiscCmdPlugin::CATMiscCmdPlugin() : 
   105 CATMiscCmdPlugin::CATMiscCmdPlugin() : 
    79     iCUSDHandler = CCUSDCommandHandler::NewL(this, iCommandParser, iPhone);
   117     iCUSDHandler = CCUSDCommandHandler::NewL(this, iCommandParser, iPhone);
    80     iCPINHandler = CCPINCommandHandler::NewL(this, iCommandParser, iPhone);
   118     iCPINHandler = CCPINCommandHandler::NewL(this, iCommandParser, iPhone);
    81     iCNUMHandler = CCNUMCommandHandler::NewL(this, iCommandParser, iPhone, iTelServer);
   119     iCNUMHandler = CCNUMCommandHandler::NewL(this, iCommandParser, iPhone, iTelServer);
    82     iCFUNHandler = CCFUNCommandHandler::NewL(this, iCommandParser, iPhone);
   120     iCFUNHandler = CCFUNCommandHandler::NewL(this, iCommandParser, iPhone);
    83     iCBCHandler = CCBCCommandHandler::NewL(this, iCommandParser, iPhone);
   121     iCBCHandler = CCBCCommandHandler::NewL(this, iCommandParser, iPhone);
       
   122     
       
   123 #ifdef PROTOCOL_TDSCDMA
       
   124 	iHVERHandler = CHVERCommandHandler::NewL(this, iCommandParser, iPhone);
       
   125     iCGSNHandler = CCGSNCommandHandler::NewL(this, iCommandParser, iPhone);
       
   126     iCGMRHandler = CCGMRCommandHandler::NewL(this, iCommandParser, iPhone);
       
   127     iCGMIHandler = CCGMICommandHandler::NewL(this, iCommandParser, iPhone);
       
   128     iCMGWHandler = CCMGWCommandHandler::NewL(this, iCommandParser, iPhone);
       
   129     iCMGDHandler = CCMGDCommandHandler::NewL(this, iCommandParser, iPhone); 
       
   130     iCGMMHandler = CCGMMCommandHandler::NewL(this, iCommandParser, iPhone);
       
   131 	iSCPBRHandler = CSCPBRCommandHandler::NewL(this, iCommandParser, iPhone);
       
   132     iSCPBWHandler = CSCPBWCommandHandler::NewL(this, iCommandParser, iPhone);
       
   133     
       
   134    
       
   135     // Get telephony information - Model, IMEI, Manufacturer
       
   136     CTelephonyWrapper* telephonyWrapper = CTelephonyWrapper::NewL();
       
   137     TInt result = telephonyWrapper->SynchronousGetPhoneId();
       
   138 
       
   139     if (KErrNone == result)
       
   140         {
       
   141         static_cast<CHVERCommandHandler*>(iHVERHandler)->SetHWVersion(telephonyWrapper->GetPhoneModel());
       
   142         static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetSerialNum(telephonyWrapper->GetPhoneSerialNum());
       
   143         static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetManufacturer(telephonyWrapper->GetPhoneManufacturer());
       
   144         static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetManufacturer(telephonyWrapper->GetPhoneManufacturer());
       
   145         static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetModelID(telephonyWrapper->GetPhoneModel());
       
   146         }
       
   147     else // The result is used to determine whether to display CME error or not
       
   148         {
       
   149         static_cast<CHVERCommandHandler*>(iHVERHandler)->SetTelephonyError(result);
       
   150         static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetTelephonyError(result);
       
   151         static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetTelephonyError(result);
       
   152         static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetTelephonyError(result);
       
   153         }
       
   154     delete telephonyWrapper;
       
   155 #endif    
       
   156     
    84     TRACE_FUNC_EXIT
   157     TRACE_FUNC_EXIT
    85    	}
   158    	}
    86 
   159 
    87 /**
   160 /**
    88  * @see CATExtPluginBase::ReportConnectionName
   161  * @see CATExtPluginBase::ReportConnectionName
   148             iCurrentHandler = iCBCHandler;
   221             iCurrentHandler = iCBCHandler;
   149             break;
   222             break;
   150             }
   223             }
   151         case (TAtCommandParser::ECmdAtCmee):
   224         case (TAtCommandParser::ECmdAtCmee):
   152             {
   225             {
       
   226             iCurrentHandler = NULL;	
       
   227             break;
       
   228 			}
       
   229 #ifdef PROTOCOL_TDSCDMA
       
   230         case (TAtCommandParser::ECmdAtHver):
       
   231             {
       
   232             iCurrentHandler = iHVERHandler;
       
   233             break;
       
   234             }
       
   235         case (TAtCommandParser::ECmdAtCgsn): // intentional fall through
       
   236         case (TAtCommandParser::ECmdAtGsn):
       
   237         case (TAtCommandParser::ECmdAtI1):
       
   238             {
       
   239             iCurrentHandler = iCGSNHandler;
       
   240             break;
       
   241             }
       
   242         case (TAtCommandParser::ECmdAtCgmr): // intentional fall through
       
   243         case (TAtCommandParser::ECmdAtGmr):
       
   244         case (TAtCommandParser::ECmdAtI2):
       
   245         case (TAtCommandParser::ECmdAtI4):
       
   246             {
       
   247             iCurrentHandler = iCGMRHandler;
       
   248             break;
       
   249             }
       
   250         case (TAtCommandParser::ECmdAtCgmi): // intentional fall through
       
   251         case (TAtCommandParser::ECmdAtGmi):
       
   252         case (TAtCommandParser::ECmdAtI):
       
   253         case (TAtCommandParser::ECmdAtI0):
       
   254             {
       
   255             iCurrentHandler = iCGMIHandler;
       
   256             break;
       
   257             }
       
   258         case (TAtCommandParser::ECmdAtCmgw):
       
   259             {
       
   260             iCurrentHandler = iCMGWHandler;
       
   261             break;
       
   262             }
       
   263 		case (TAtCommandParser::ECmdAtCmgd):
       
   264             {
       
   265             iCurrentHandler = iCMGDHandler;
       
   266             break;
       
   267             }
       
   268 		case (TAtCommandParser::ECmdAtCmgf):
       
   269             {
   153             iCurrentHandler = NULL;
   270             iCurrentHandler = NULL;
   154             break;
   271             break;
   155             }
   272             }
       
   273 		case (TAtCommandParser::ECmdAtCgmm): // intentional fall through
       
   274 		case (TAtCommandParser::ECmdAtGmm):
       
   275 		case (TAtCommandParser::ECmdAtI3):
       
   276             {
       
   277             iCurrentHandler = iCGMMHandler;
       
   278             break;
       
   279             }
       
   280 		case (TAtCommandParser::ECmdAtScpbr):
       
   281             {
       
   282             iCurrentHandler = iSCPBRHandler;
       
   283             break;
       
   284             }    
       
   285 		case (TAtCommandParser::ECmdAtScpbw):
       
   286             {
       
   287             iCurrentHandler = iSCPBWHandler;
       
   288             break;
       
   289             }
       
   290 #endif
   156         case (TAtCommandParser::EUnknown):
   291         case (TAtCommandParser::EUnknown):
   157         default:
   292         default:
   158             {
   293             {
   159             supported = EFalse;
   294             supported = EFalse;
   160             break;
   295             break;
   177 	if(iCommandParser.Command() == TAtCommandParser::ECmdAtCmee)
   312 	if(iCommandParser.Command() == TAtCommandParser::ECmdAtCmee)
   178 	    {
   313 	    {
   179         HandleCMEECommand();
   314         HandleCMEECommand();
   180         HandleCommandCompleted( KErrNone, EReplyTypeOk);
   315         HandleCommandCompleted( KErrNone, EReplyTypeOk);
   181 	    }
   316 	    }
       
   317 #ifdef PROTOCOL_TDSCDMA
       
   318 	else if (iCommandParser.Command() == TAtCommandParser::ECmdAtCmgf)
       
   319 	    {
       
   320         HandleCMGFCommand();
       
   321         HandleCommandCompleted( KErrNone, EReplyTypeOk);
       
   322 	    }
       
   323 #endif
   182 	else if (iCurrentHandler != NULL)
   324 	else if (iCurrentHandler != NULL)
   183 	    {
   325 	    {
   184 	    iHcCmd = &aCmd;
   326 	    iHcCmd = &aCmd;
   185 	    iHcReply = &aReply;
   327 	    iHcReply = &aReply;
   186 	    // No need to parse the command again as assumed that
   328 	    // No need to parse the command again as assumed that
   276  */
   418  */
   277 TInt CATMiscCmdPlugin::CreatePartOfReply( RBuf8& aBuffer )
   419 TInt CATMiscCmdPlugin::CreatePartOfReply( RBuf8& aBuffer )
   278     {
   420     {
   279     TRACE_FUNC_ENTRY
   421     TRACE_FUNC_ENTRY
   280     TInt ret = KErrNone;
   422     TInt ret = KErrNone;
   281     TInt partLength;
       
   282     if ( iReplyBuffer.Length() <= 0 )
   423     if ( iReplyBuffer.Length() <= 0 )
   283         {
   424         {
   284         ret = KErrGeneral;
   425         ret = KErrGeneral;
   285         }
   426         }
   286     else
   427     else
   287         {
   428         {
   288         partLength = NextReplyPartLength();
   429     	TInt partLength = NextReplyPartLength();
   289         if ( iReplyBuffer.Length() < partLength )
   430         if ( iReplyBuffer.Length() < partLength )
   290             {
   431             {
   291             ret =  KErrNotFound;
   432             ret =  KErrNotFound;
   292             }
   433             }
   293         }
   434         else if (ret == KErrNone)
       
   435 			{
       
   436 			aBuffer.Create( iReplyBuffer, partLength );
       
   437 			iReplyBuffer.Delete( 0, partLength );
       
   438 			if ( iReplyBuffer.Length() == 0 )
       
   439 				{
       
   440 				iReplyBuffer.Close();
       
   441 				}
       
   442 			}
       
   443         }
       
   444 
   294     Trace(KDebugPrintD, "ret: ", ret);
   445     Trace(KDebugPrintD, "ret: ", ret);
   295     if (ret == KErrNone)
       
   296         {
       
   297         aBuffer.Create( iReplyBuffer, partLength );
       
   298         iReplyBuffer.Delete( 0, partLength );
       
   299         if ( iReplyBuffer.Length() == 0 )
       
   300             {
       
   301             iReplyBuffer.Close();
       
   302             }
       
   303         }
       
   304 
       
   305     TRACE_FUNC_EXIT
   446     TRACE_FUNC_EXIT
   306     return ret;
   447     return ret;
   307     }
   448     }
   308 
   449 
   309 /**
   450 /**
   346     Trace(KDebugPrintD, "aReplyType: ", aReplyType);
   487     Trace(KDebugPrintD, "aReplyType: ", aReplyType);
   347     switch ( aReplyType )
   488     switch ( aReplyType )
   348         {
   489         {
   349         case EReplyTypeOther:
   490         case EReplyTypeOther:
   350             break;
   491             break;
       
   492 #ifdef PROTOCOL_TDSCDMA
       
   493         case EReplyTypeEditor:
       
   494             CreateEditModeBuffer( iReplyBuffer );
       
   495             break;
       
   496 #endif
   351         case EReplyTypeOk:
   497         case EReplyTypeOk:
   352             CreateOkOrErrorReply( iReplyBuffer, ETrue );
   498             CreateOkOrErrorReply( iReplyBuffer, ETrue );
   353             break;
   499             break;
   354         case EReplyTypeError:
   500         case EReplyTypeError:
   355             CreateOkOrErrorReply( iReplyBuffer, EFalse );
   501             CreateOkOrErrorReply( iReplyBuffer, EFalse );
   358             TRACE_FUNC_EXIT
   504             TRACE_FUNC_EXIT
   359             return KErrGeneral;
   505             return KErrGeneral;
   360         }
   506         }
   361     CreatePartOfReply( *iHcReply );
   507     CreatePartOfReply( *iHcReply );
   362     HandleCommandCompleted( KErrNone, aReplyType );
   508     HandleCommandCompleted( KErrNone, aReplyType );
   363     iHcCmd = NULL;
   509     if ( EReplyTypeEditor != aReplyType )
   364     iHcReply = NULL;
   510         {
   365     iCurrentHandler = NULL;
   511         iHcCmd = NULL;
       
   512         iHcReply = NULL;
       
   513         iCurrentHandler = NULL;
       
   514         }
   366     TRACE_FUNC_EXIT
   515     TRACE_FUNC_EXIT
   367     return KErrNone;
   516     return KErrNone;
   368     }
   517     }
   369 
   518 
   370 /**
   519 /**
   412     TRACE_FUNC_EXIT
   561     TRACE_FUNC_EXIT
   413     return KErrNone;
   562     return KErrNone;
   414     }
   563     }
   415 
   564 
   416 /**
   565 /**
       
   566  * @see MATMiscCmdPlugin::CreateEditModeBuffer
       
   567  */
       
   568 TInt CATMiscCmdPlugin::CreateEditModeBuffer( RBuf8& aReplyBuffer )
       
   569     {
       
   570     TRACE_FUNC_ENTRY
       
   571     _LIT8( KReplyPromptAndSpace, "> " );
       
   572     TBuf8<KEditorReplyLength> replyBuffer;
       
   573     replyBuffer.Append( iCarriageReturn );
       
   574     replyBuffer.Append( iLineFeed );
       
   575     replyBuffer.Append( KReplyPromptAndSpace );
       
   576 
       
   577     TInt err = aReplyBuffer.ReAlloc( aReplyBuffer.Length() + replyBuffer.Length() );
       
   578     if (KErrNone != err)
       
   579         {
       
   580         return err;
       
   581         }
       
   582     aReplyBuffer.Append( replyBuffer );
       
   583     TRACE_FUNC_EXIT
       
   584     return KErrNone;
       
   585     }
       
   586 
       
   587 /**
   417  * @see MATMiscCmdPlugin::GetCharacterValue
   588  * @see MATMiscCmdPlugin::GetCharacterValue
   418  */
   589  */
   419 TInt CATMiscCmdPlugin::GetCharacterValue( TCharacterTypes aCharType,
   590 TInt CATMiscCmdPlugin::GetCharacterValue( TCharacterTypes aCharType,
   420                                          TChar& aChar )
   591                                          TChar& aChar )
   421     {
   592     {
   499                 {
   670                 {
   500                 // not allowed with this sim
   671                 // not allowed with this sim
   501                 response.Append(KCMENotAllowed);
   672                 response.Append(KCMENotAllowed);
   502                 break;
   673                 break;
   503                 }
   674                 }
       
   675 			case KErrGsmMMImeiNotAccepted:
       
   676 	            {
       
   677 	            // Memory failure
       
   678 	            response.Append(KCMEMemoryFailure);
       
   679 	            break;
       
   680 	            }
   504             case KErrUnknown:
   681             case KErrUnknown:
       
   682             case KErrGsmSimServAnrFull:
   505                 {
   683                 {
   506                 // unknown error
   684                 // unknown error
   507                 response.Append(KCMEPhoneUnknown);
   685                 response.Append(KCMEPhoneUnknown);
   508                 break;
   686                 break;
   509                 }
   687                 }
       
   688             case KErrNotFound:
       
   689                 {
       
   690                 response.Append(KCMENotFound);
       
   691                 break;
       
   692                 }
       
   693             case KErrInUse:
       
   694             case KErrGsmMMServiceOptionTemporaryOutOfOrder:
       
   695                 {
       
   696                 // SIM not inserted
       
   697                 response.Append(KCMESimNotInserted);
       
   698                 break;
       
   699                 }
       
   700             case KErrArgument:
       
   701             case KErrGsm0707InvalidIndex:
       
   702             case KErrGsm0707NotFound:
       
   703                 {
       
   704                 // Invalid index
       
   705                 response.Append(KCMEInvalidIndex);
       
   706                 break;
       
   707                 }
       
   708             case KErrGsm0707TextStringTooLong:
       
   709                 {
       
   710                 // Text string too long
       
   711                 response.Append(KCMETextStringTooLong);
       
   712                 break;
       
   713                 }
       
   714             case KErrGsm0707DialStringTooLong:
       
   715                 {
       
   716                 // Dial string too long
       
   717                 response.Append(KCMEDialStringTooLong);
       
   718                 break;
       
   719                 }
       
   720             case KErrGsmCCUnassignedNumber:
       
   721             case KErrGsm0707InvalidCharsInDialString:
       
   722                 {
       
   723                 // Invalid characters in dial string
       
   724                 response.Append(KCMEInvalidCharacters);
       
   725                 break;
       
   726                 }
       
   727             case KErrMMEtelMaxReached:
       
   728                 {
       
   729                 // Memory full
       
   730                 response.Append(KCMEMemoryFull);
       
   731                 break;
       
   732                 }
   510             default:
   733             default:
   511                 {
   734                 {
   512                 response.Append(KCMEPhoneError);
   735                 response.Append(KCMEPhoneError);
   513                 break;
   736                 break;
   514                 }
   737                 }
   519     else
   742     else
   520         {
   743         {
   521         CreateReplyAndComplete( EReplyTypeError);
   744         CreateReplyAndComplete( EReplyTypeError);
   522         }
   745         }
   523 
   746 
       
   747     TRACE_FUNC_EXIT
       
   748     }
       
   749 
       
   750 void CATMiscCmdPlugin::CreateCMSReplyAndComplete(TInt aError)
       
   751     {
       
   752     TRACE_FUNC_ENTRY
       
   753     
       
   754     if(iQuietMode)
       
   755         {
       
   756         CreateReplyAndComplete(EReplyTypeError);
       
   757         }
       
   758     else 
       
   759         {
       
   760         // return error code to AT client
       
   761         RBuf8 response;
       
   762         if (KErrNone != response.Create(KDefaultCmdBufLength))
       
   763             {
       
   764             CreateReplyAndComplete(EReplyTypeError);
       
   765             return;
       
   766             }
       
   767        
       
   768         // return error code to AT client
       
   769         response.Append(KCRLF);
       
   770         response.Append(KCMSErr);
       
   771 
       
   772         switch(aError)
       
   773             {
       
   774             case KErrGsmSMSReserved:
       
   775                 {
       
   776                 // Other application cause SMS interface being reserved
       
   777                 response.AppendNum(EATCMSErr301);
       
   778                 break;
       
   779                 }
       
   780             case KErrGsmSMSInvalidPDUModeParameter:
       
   781                 {
       
   782                 // Under the mode of PDU, PDU parameter error 
       
   783                 response.AppendNum(EATCMSErr304);
       
   784                 break;
       
   785                 }
       
   786             case KErrGsm0707SimFailure:
       
   787             case KErrGsmMMServiceOptionTemporaryOutOfOrder:
       
   788                 {    
       
   789                 // SIM card not inserted
       
   790                 response.AppendNum(EATCMSErr310);
       
   791                 break;
       
   792                 }
       
   793             case KErrGsmSMSSimPin1Required:
       
   794                 {
       
   795                 // PIN request by SIM card
       
   796                 response.AppendNum(EATCMSErr311);
       
   797                 break;
       
   798                 }
       
   799             case KErrGsmSMSPhoneToSimLockRequired:
       
   800                 {
       
   801                 // PH-(U) SIM PIN request by SIM card
       
   802                 response.AppendNum(EATCMSErr312);
       
   803                 break;
       
   804                 }
       
   805             case KErrGsmSMSSimPuk1Required:
       
   806                 {
       
   807                 // PUK request by SIM card
       
   808                 response.AppendNum(EATCMSErr316);
       
   809                 break;
       
   810                 }
       
   811             case KErrGsmSMSMemoryFailure:
       
   812                 {
       
   813                 // Memory error
       
   814                 response.AppendNum(EATCMSErr320);
       
   815                 break;
       
   816                 }
       
   817             case KErrPathNotFound:
       
   818             case KErrGsmSMSInvalidMemoryIndex:
       
   819                 {
       
   820                 // Invalid Memory index number 
       
   821                 response.AppendNum(EATCMSErr321);
       
   822                 break;
       
   823                 }
       
   824             case KErrOverflow:
       
   825             case KErrGsmSMSMemoryFull:
       
   826                 {
       
   827                 // Memory is full
       
   828                 response.AppendNum(EATCMSErr322);
       
   829                 break;
       
   830                 }
       
   831             default:
       
   832 				{
       
   833 				response.AppendNum(EATCmsErrGeneral);
       
   834 				break;
       
   835 				}
       
   836             }
       
   837         CreateReplyAndComplete( EReplyTypeError, response );
       
   838         response.Close();
       
   839         }
       
   840     
   524     TRACE_FUNC_EXIT
   841     TRACE_FUNC_EXIT
   525     }
   842     }
   526 
   843 
   527 TInt CATMiscCmdPlugin::HandleUnsolicitedRequest(const TDesC8& aAT )
   844 TInt CATMiscCmdPlugin::HandleUnsolicitedRequest(const TDesC8& aAT )
   528     {
   845     {
   553             }
   870             }
   554         }
   871         }
   555     TRACE_FUNC_EXIT
   872     TRACE_FUNC_EXIT
   556     }
   873     }
   557 
   874 
       
   875 
       
   876 void CATMiscCmdPlugin::HandleCMGFCommand()
       
   877     {
       
   878     TRACE_FUNC_ENTRY
       
   879     
       
   880 #ifdef PROTOCOL_TDSCDMA    
       
   881     TAtCommandParser::TCommandHandlerType cmdHandlerType = iCommandParser.CommandHandlerType();
       
   882     
       
   883     if (cmdHandlerType == TAtCommandParser::ECmdHandlerTypeSet)
       
   884         {
       
   885         TInt msgFormat = 0;
       
   886         TInt ret = iCommandParser.NextIntParam(msgFormat);
       
   887         if(ret == KErrNone && iCMGWHandler)
       
   888             {
       
   889             static_cast<CCMGWCommandHandler*> (iCMGWHandler)->SetMessageFormat(msgFormat);
       
   890             }
       
   891         }
       
   892 #endif  
       
   893     
       
   894     TRACE_FUNC_EXIT
       
   895     }
       
   896   
       
   897 
   558 void CATMiscCmdPlugin::ConnectToEtelL(RTelServer& aTelServer, RMobilePhone& aPhone)
   898 void CATMiscCmdPlugin::ConnectToEtelL(RTelServer& aTelServer, RMobilePhone& aPhone)
   559     {
   899     {
   560     TRACE_FUNC_ENTRY
   900     TRACE_FUNC_ENTRY
   561     User::LeaveIfError(aTelServer.Connect());
   901     User::LeaveIfError(aTelServer.Connect());
   562 
   902 
   569         {
   909         {
   570         User::Leave(KErrNotFound);
   910         User::Leave(KErrNotFound);
   571         }
   911         }
   572     User::LeaveIfError(aTelServer.GetPhoneInfo(0, info));
   912     User::LeaveIfError(aTelServer.GetPhoneInfo(0, info));
   573     User::LeaveIfError(aPhone.Open(aTelServer, info.iName));
   913     User::LeaveIfError(aPhone.Open(aTelServer, info.iName));
   574     TRACE_FUNC_EXIT
   914     
   575     }
   915     if (iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)!=KErrNone)
   576 
   916         {
       
   917         User::LeaveIfError(iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorBasic));
       
   918         }
       
   919 
       
   920     TRACE_FUNC_EXIT
       
   921     }
       
   922