telephonyserverplugins/multimodetsy/test/Te_LoopBack/Te_LoopbackTestServer.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "Te_LoopbackTestServer.h"
       
    17 
       
    18 #include "Te_LoopBackcrxmess.h"
       
    19 #include "Te_LoopBackCNoPduRxMess.h"
       
    20 #include "Te_LoopBackcsca.h"
       
    21 #include "Te_LoopBackctxmess.h"
       
    22 #include "Te_LoopBackcdatacall.h"
       
    23 #include "Te_LoopBackcoddinits.h"
       
    24 #include "Te_LoopBackcmessstor.h"
       
    25 #include "Te_Loopbackcfailinits.h"
       
    26 #include "Te_LoopBackcincall.h"
       
    27 #include "Te_LoopBackcsmscancel.h"
       
    28 #include "Te_LoopBackcshutdown.h"
       
    29 #include "Te_LoopBackCSmsdelete.h"
       
    30 #include "Te_LoopBackcssfax.h"
       
    31 #include "Te_LoopBackcdatacallcancel.h"
       
    32 #include "Te_Loopbackcfaxpremclose.h"
       
    33 #include "Te_LoopBackctwofaxrx.h"
       
    34 #include "Te_LoopBackcvoicecall.h"
       
    35 #include "Te_LoopBackCDataCallCallBack.h"
       
    36 #include "Te_LoopBackCDataCallRemoteHangupDial.h"
       
    37 #include "Te_LoopBackCDataCallRemoteTerm.h"
       
    38 #include "Te_LoopBackcphoneBook.h"
       
    39 #include "Te_LoopBackCNetwork.h"
       
    40 #include "Te_LoopBackCPhoneLine.h"
       
    41 #include "Te_LoopBackCCalls.h"
       
    42 #include "Te_LoopBackCNoCnmi.h"
       
    43 #include "Te_LoopBackcnocmgf.h"
       
    44 #include "Te_Loopbackcoomvoicecall.h"
       
    45 #include "Te_LoopBackCDataCallDiffParam.h"
       
    46 #include "Te_LoopBackCCbstParse.h"
       
    47 #include "Te_LoopBackCUnsolicited.h"
       
    48 #include "Te_LoopBackccgqreq_responses.h"
       
    49 
       
    50 _LIT(KServerName,"Te_Loopback");
       
    51 
       
    52 CLoopbackTestServer* CLoopbackTestServer::NewL()
       
    53 /**
       
    54  * @return - Instance of the test server
       
    55  * Same code for Secure and non-secure variants
       
    56  * Called inside the MainL() function to create and start the
       
    57  * CTestServer derived server.
       
    58  */
       
    59 	{
       
    60 	CLoopbackTestServer * testServer = new (ELeave) CLoopbackTestServer();
       
    61 	CleanupStack::PushL(testServer);
       
    62 
       
    63 	testServer->ConstructL(KServerName);
       
    64 	CleanupStack::Pop(testServer);
       
    65 	return testServer;
       
    66 	}
       
    67 
       
    68 LOCAL_C void MainL()
       
    69 /**
       
    70  * Secure variant
       
    71  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    72  */
       
    73 	{
       
    74    	TInt result = StartC32();
       
    75 	if (result != KErrNone  &&  result != KErrAlreadyExists)
       
    76 		{
       
    77 		User::Leave(result);
       
    78 		}
       
    79 
       
    80 	CActiveScheduler* sched=NULL;
       
    81 	sched=new(ELeave) CActiveScheduler;
       
    82 	CActiveScheduler::Install(sched);
       
    83 	CLoopbackTestServer* testServer = NULL;
       
    84 	
       
    85 	// Create the CTestServer derived server
       
    86 	TRAPD(err,testServer = CLoopbackTestServer::NewL());
       
    87 	if(!err)
       
    88 		{
       
    89 		// Sync with the client and enter the active scheduler
       
    90 		RProcess::Rendezvous(KErrNone);
       
    91 		sched->Start();
       
    92 		}
       
    93 	delete testServer;
       
    94 	delete sched;
       
    95 	}
       
    96 
       
    97 GLDEF_C TInt E32Main()
       
    98 /**
       
    99  * @return - Standard Epoc error code on process exit
       
   100  * Secure variant only
       
   101  * Process entry point. Called by client using RProcess API
       
   102  */
       
   103 	{
       
   104 	__UHEAP_MARK;
       
   105 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   106 	if(cleanup == NULL)
       
   107 		{
       
   108 		return KErrNoMemory;
       
   109 		}
       
   110 	TRAPD(err,MainL());
       
   111 	delete cleanup;
       
   112 	__UHEAP_MARKEND;
       
   113 	return err;
       
   114     }
       
   115 
       
   116 CTestStep* CLoopbackTestServer::CreateTestStep(const TDesC& aStepName)
       
   117 /**
       
   118  * @return - A CTestStep derived instance
       
   119  * Secure and non-secure variants
       
   120  * Implementation of CTestServer pure virtual
       
   121  */
       
   122 	{
       
   123 	CTestStep* testStep = NULL;
       
   124 	TInt varDelay;  // Variable Delay for EWait script, for scoping purposes
       
   125 
       
   126 	TRAPD(error,
       
   127 	    if(aStepName == _L("TestDriveRxMess"))
       
   128 	    	{
       
   129 	    	testStep = CTestDriveRxMess::NewL(ERxMessScript) ;
       
   130 			testStep->SetTestStepName(_L("TestDriveRxMess")) ;
       
   131 			}
       
   132 	    else if(aStepName == _L("TestDriveRxMessCmt"))
       
   133 	    	{
       
   134 	    	testStep = CTestDriveRxMessCmt::NewL(ERxMessCmtAndCmtiScript) ;
       
   135 			testStep->SetTestStepName(_L("TestDriveRxMessCmt")) ;
       
   136 	        }
       
   137 	    else if(aStepName == _L("TestDriveRxMessT28"))
       
   138 	    	{
       
   139 	    	testStep = CTestDriveRxMess::NewL(ERxMessEricssonT28Script) ;
       
   140 			testStep->SetTestStepName(_L("TestDriveRxMessT28")) ;
       
   141 	        }
       
   142 	    else if(aStepName == _L("TestDriveNotMess"))
       
   143 	    	{
       
   144 	    	testStep = CTestDriveNotMess::NewL(ERxMessScript) ;
       
   145 			testStep->SetTestStepName(_L("TestDriveNotMess")) ;
       
   146 	        }
       
   147 	    else if(aStepName == _L("TestDriveNotMessCmt"))
       
   148 	    	{
       
   149 	    	testStep = CTestDriveNotMessCmt::NewL(ERxMessCmtScript) ;
       
   150 			testStep->SetTestStepName(_L("TestDriveNotMessCmt")) ;
       
   151 	        }
       
   152 	    else if(aStepName == _L("TestDriveNoPduRxMess"))
       
   153 	    	{
       
   154 	    	testStep = CTestDriveNoPduRxMess::NewL(ENoPduRxMessScript) ;
       
   155 			testStep->SetTestStepName(_L("TestDriveNoPduRxMess")) ;
       
   156 	        }
       
   157 	    else if(aStepName == _L("TestDriveScaSimple"))
       
   158 	    	{
       
   159 	    	testStep = CTestDriveSca::NewL(EScaSimpleScript) ;
       
   160 			testStep->SetTestStepName(_L("TestDriveScaSimple")) ;
       
   161 	        }
       
   162 	    else if(aStepName == _L("TestDriveSca8210Style"))
       
   163 	    	{
       
   164 	    	testStep = CTestDriveSca::NewL(ESca8210StyleScript) ;
       
   165 			testStep->SetTestStepName(_L("TestDriveSca8210Style")) ;
       
   166 	        }
       
   167 	    else if(aStepName == _L("TestDriveTxMess"))
       
   168 	    	{
       
   169 	    	testStep = CTestDriveTxMess::NewL(ETxMessScript) ;
       
   170 			testStep->SetTestStepName(_L("TestDriveTxMess")) ;
       
   171 	        }
       
   172 	    else if(aStepName == _L("TestDriveTxNewStdMess"))
       
   173 	    	{
       
   174 	    	testStep = CTestDriveTxNewStdMess::NewL(ETxMessNewStdScript) ;
       
   175 			testStep->SetTestStepName(_L("TestDriveTxNewStdMess")) ;
       
   176 	        }
       
   177 	    else if(aStepName == _L("TestDriveT28TxNewStdMess"))
       
   178 	    	{
       
   179 	    	testStep = CTestDriveTxNewStdMess::NewL(ETxMessT28NewStdScript) ;
       
   180 			testStep->SetTestStepName(_L("TestDriveT28TxNewStdMess")) ;
       
   181 	        }
       
   182 	    else if(aStepName == _L("TestDriveTxWithScaComboNoprefixNodefNew"))
       
   183 	    	{
       
   184 	    	testStep = CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixNodefscaNew, EFalse, EFalse, ETrue) ;
       
   185 			testStep->SetTestStepName(_L("TestDriveTxWithScaComboNoprefixNodefNew")) ;
       
   186 	        }
       
   187 	    else if(aStepName == _L("TestDriveTxWithScaComboPrefixNodeNew"))
       
   188 	    	{
       
   189 	    	testStep = CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixNodefscaNew, ETrue, EFalse, ETrue) ;
       
   190 			testStep->SetTestStepName(_L("TestDriveTxWithScaComboPrefixNodeNew")) ;
       
   191 	        }
       
   192 	    else if(aStepName == _L("TestDriveTxWithScaComboNoprefixDefNew"))
       
   193 	    	{
       
   194 	    	testStep = CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixDefscaNew, EFalse, ETrue, ETrue) ;
       
   195 			testStep->SetTestStepName(_L("TestDriveTxWithScaComboNoprefixDefNew")) ;
       
   196 	        }
       
   197 	    else if(aStepName == _L("TestDriveTxWithScaComboPrefixDefNew"))
       
   198 	    	{
       
   199 	    	testStep = CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixDefscaNew, ETrue, ETrue, ETrue) ;
       
   200 			testStep->SetTestStepName(_L("TestDriveTxWithScaComboPrefixDefNew")) ;
       
   201 	        }
       
   202 	    else if(aStepName == _L("TestDriveTxWithScaComboNoprefixNodefscaOld"))
       
   203 	    	{
       
   204 	    	testStep = CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixNodefscaOld, EFalse, EFalse, EFalse) ;
       
   205 			testStep->SetTestStepName(_L("TestDriveTxWithScaComboNoprefixNodefscaOld")) ;
       
   206 	        }
       
   207 	    else if(aStepName == _L("TestDriveTxWithScaComboPrefixNodefscaOld"))
       
   208 	    	{
       
   209 	    	testStep = CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixNodefscaOld, ETrue, EFalse, EFalse) ;
       
   210 			testStep->SetTestStepName(_L("TestDriveTxWithScaComboPrefixNodefscaOld")) ;
       
   211 	        }
       
   212 	    else if(aStepName == _L("TestDriveTxWithScaComboNoprefixDefscaOld"))
       
   213 	    	{
       
   214 	    	testStep = CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixDefscaOld, EFalse, ETrue, EFalse) ;
       
   215 			testStep->SetTestStepName(_L("TestDriveTxWithScaComboNoprefixDefscaOld")) ;
       
   216 	        }
       
   217 	    else if(aStepName == _L("TestDriveTxWithScaComboPrefixDefscaOld"))
       
   218 	    	{
       
   219 	    	testStep = CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixDefscaOld, ETrue, ETrue, EFalse) ;
       
   220 			testStep->SetTestStepName(_L("TestDriveTxWithScaComboPrefixDefscaOld")) ;
       
   221 	        }
       
   222 	    else if(aStepName == _L("TestDriveTxRx"))
       
   223 	    	{
       
   224 	    	testStep = CTestDriveTxRx::NewL(ETxMessRxTxScriptA) ;
       
   225 			testStep->SetTestStepName(_L("TestDriveTxRx")) ;
       
   226 	        }
       
   227 	    else if(aStepName == _L("TestDriveDataCall"))
       
   228 	    	{
       
   229 	    	testStep = CTestDriveDataCall::NewL(EDataCallScript) ;
       
   230 			testStep->SetTestStepName(_L("TestDriveDataCall")) ;
       
   231 	        }
       
   232 	    else if(aStepName == _L("TestDriveDataCallErrorA"))
       
   233 	    	{
       
   234 	    	testStep = CTestDriveDataCall::NewL(EDataCallErrorAScript) ;
       
   235 			testStep->SetTestStepName(_L("TestDriveDataCallErrorA")) ;
       
   236 	        }
       
   237 	    else if(aStepName == _L("TestDriveOddInitAScript"))
       
   238 	    	{
       
   239 	    	testStep = CTestDriveOddInit::NewL(EOddInitAScript) ;
       
   240 			testStep->SetTestStepName(_L("TestDriveOddInitAScript")) ;
       
   241 	        }
       
   242 	    else if(aStepName == _L("TestDriveOddInitBScript"))
       
   243 	    	{
       
   244 	    	testStep = CTestDriveOddInit::NewL(EOddInitBScript) ;
       
   245 			testStep->SetTestStepName(_L("TestDriveOddInitBScript")) ;
       
   246 	        }
       
   247 	    else if(aStepName == _L("TestDriveOddInitCScript"))
       
   248 	    	{
       
   249 	    	testStep = CTestDriveOddInit::NewL(EOddInitCScript) ;
       
   250 			testStep->SetTestStepName(_L("TestDriveOddInitCScript")) ;
       
   251 	        }
       
   252 	    else if(aStepName == _L("TestDriveOddInitDScript"))
       
   253 	    	{
       
   254 	    	testStep = CTestDriveOddInit::NewL(EOddInitDScript) ;
       
   255 			testStep->SetTestStepName(_L("TestDriveOddInitDScript")) ;
       
   256 	        }
       
   257 	    else if(aStepName == _L("TestDriveOddInitEScript"))
       
   258 	    	{
       
   259 	    	testStep = CTestDriveOddInit::NewL(EOddInitEScript) ;
       
   260 			testStep->SetTestStepName(_L("TestDriveOddInitEScript")) ;
       
   261 	        }
       
   262 	    else if(aStepName == _L("TestDriveOddInitFScript"))
       
   263 	    	{
       
   264 	    	testStep = CTestDriveOddInit::NewL(EOddInitFScript) ;
       
   265 			testStep->SetTestStepName(_L("TestDriveOddInitFScript")) ;
       
   266 	        }
       
   267 	    else if(aStepName == _L("TestDriveOddInitGScript"))
       
   268 	    	{
       
   269 	    	testStep = CTestDriveOddInit::NewL(EOddInitGScript) ;
       
   270 			testStep->SetTestStepName(_L("TestDriveOddInitGScript")) ;
       
   271 	        }
       
   272 	    else if(aStepName == _L("TestDriveMessStorOldSmsStd"))
       
   273 	    	{
       
   274 	    	testStep = CTestDriveMessStor::NewL(EMessStorOldSmsStdScript) ;
       
   275 			testStep->SetTestStepName(_L("TestDriveMessStorOldSmsStd")) ;
       
   276 	        }
       
   277 	    else if(aStepName == _L("TestDriveMessStorNewSmsStd"))
       
   278 	    	{
       
   279 	    	testStep = CTestDriveMessStor::NewL(EMessStorNewSmsStdScript) ;
       
   280 			testStep->SetTestStepName(_L("TestDriveMessStorNewSmsStd")) ;
       
   281 	        }
       
   282 	    else if(aStepName == _L("TestDriveFailInit"))
       
   283 	    	{
       
   284 	    	testStep = CTestDriveFailInit::NewL(EFailInitAScript) ;
       
   285 			testStep->SetTestStepName(_L("TestDriveFailInit")) ;
       
   286 	        }
       
   287 	    else if(aStepName == _L("TestDriveInCallAScript"))
       
   288 	    	{
       
   289 	    	testStep = CTestDriveInCall::NewL(EInCallScriptA) ;
       
   290 			testStep->SetTestStepName(_L("TestDriveInCallAScript")) ;
       
   291 	        }
       
   292 	    else if(aStepName == _L("TestDriveInCallBScript"))
       
   293 	    	{
       
   294 	    	testStep = CTestDriveInCall::NewL(EInCallScriptB) ;
       
   295 			testStep->SetTestStepName(_L("TestDriveInCallBScript")) ;
       
   296 	        }
       
   297 	    else if(aStepName == _L("TestDriveSmsCancelCancelScript"))
       
   298 	    	{
       
   299 	    	testStep = CTestDriveSmsCancel::NewL(ESmsCancelScript) ;
       
   300 			testStep->SetTestStepName(_L("TestDriveSmsCancelCancelScript")) ;
       
   301 	        }
       
   302 	    else if(aStepName == _L("TestDriveSmsCancelCmtiScript"))
       
   303 	    	{
       
   304 	    	testStep = CTestDriveSmsCancel::NewL(ESmsCancelCmtiScript) ;
       
   305 			testStep->SetTestStepName(_L("TestDriveSmsCancelCmtiScript")) ;
       
   306 	        }
       
   307 	    else if(aStepName == _L("TestDriveShutdown"))
       
   308 	    	{
       
   309 	    	testStep = CTestDriveShutdown::NewL(EShutdownScript) ;
       
   310 			testStep->SetTestStepName(_L("TestDriveShutdown")) ;
       
   311 	        }
       
   312 	    else if(aStepName == _L("TestDriveShutdownA"))
       
   313 	    	{
       
   314 	    	testStep = CTestDriveShutdownA::NewL(EShutdownScriptA) ;
       
   315 			testStep->SetTestStepName(_L("TestDriveShutdownA")) ;
       
   316 	        }
       
   317 	    else if(aStepName == _L("TestDriveSmsDelete"))
       
   318 	    	{
       
   319 	    	testStep = CTestDriveSmsDelete::NewL(ESmsStorageDeleteScript) ;
       
   320 			testStep->SetTestStepName(_L("TestDriveSmsDelete")) ;
       
   321 	        }
       
   322 	    else if(aStepName == _L("TestDriveSsFax"))
       
   323 	    	{
       
   324 	    	testStep = CTestDriveSsFax::NewL(ESsFaxScriptA) ;
       
   325 			testStep->SetTestStepName(_L("TestDriveSsFax")) ;
       
   326 	        }
       
   327 	    else if(aStepName == _L("TestDriveSSData"))
       
   328 	    	{
       
   329 	    	testStep = CTestDriveSSData::NewL(ESsDataScriptA) ;
       
   330 			testStep->SetTestStepName(_L("TestDriveSSData")) ;
       
   331 	        }
       
   332 	    else if(aStepName == _L("TestDriveDataCallCancel"))
       
   333 	    	{
       
   334 	    	testStep = CTestDriveDataCallCancel::NewL(EDataCallCancelScript) ;
       
   335 			testStep->SetTestStepName(_L("TestDriveDataCallCancel")) ;
       
   336 	        }
       
   337 	    else if(aStepName == _L("TestDrivePremClose"))
       
   338 	    	{
       
   339 	    	testStep = CTestDrivePremClose::NewL(EFaxPremCloseScriptA) ;
       
   340 			testStep->SetTestStepName(_L("TestDrivePremClose")) ;
       
   341 	        }
       
   342 	    else if(aStepName == _L("TestDriveTwoFaxRx"))
       
   343 	    	{
       
   344 	    	testStep = CTestDriveTwoFaxRx::NewL(ETwoFaxRxScriptA) ;
       
   345 			testStep->SetTestStepName(_L("TestDriveTwoFaxRx")) ;
       
   346 	        }
       
   347 	    else if(aStepName == _L("TestDriveVoiceCall"))
       
   348 	    	{
       
   349 	    	testStep = CTestDriveVoiceCall::NewL(EVoiceCallScriptA) ;
       
   350 			testStep->SetTestStepName(_L("TestDriveVoiceCall")) ;
       
   351 	        }
       
   352 	    else if(aStepName == _L("TestDriveDataCallRemoteTerm"))
       
   353 	    	{
       
   354 	    	testStep = CTestDriveDataCallRemoteTerm::NewL(EDataCallRemoteTermScript) ;
       
   355 			testStep->SetTestStepName(_L("TestDriveDataCallRemoteTerm")) ;
       
   356 	        }
       
   357 	    else if(aStepName == _L("TestDriveDataCallCallBack"))
       
   358 	    	{
       
   359 			varDelay = KCallBackDefVarDelay;
       
   360 	    	testStep = CTestDriveDataCallCallBack::NewL(EDataCallCallBackScript, varDelay) ;
       
   361 			testStep->SetTestStepName(_L("TestDriveDataCallCallBack")) ;
       
   362 	        }
       
   363 	    else if(aStepName == _L("TestDriveRemoteHangupDial"))
       
   364 	    	{
       
   365 			varDelay = KHangupDialDefVarDelay;
       
   366 	    	testStep = CTestDriveRemoteHangupDial::NewL(EDataCallRemoteHangDialScript, varDelay) ;
       
   367 			testStep->SetTestStepName(_L("TestDriveRemoteHangupDial")) ;
       
   368 	        }
       
   369 	    else if(aStepName == _L("TestDrivePhoneBook"))
       
   370 	    	{
       
   371 	    	testStep = CTestDrivePhoneBook::NewL(EPhoneBookScript) ;
       
   372 			testStep->SetTestStepName(_L("TestDrivePhoneBook")) ;
       
   373 	        }
       
   374 	    else if(aStepName == _L("TestDriveNetworkRegistration"))
       
   375 	    	{
       
   376 	    	testStep = CTestDriveNetworkRegistration::NewL(ENetworkRegistrationScript) ;
       
   377 			testStep->SetTestStepName(_L("TestDriveNetworkRegistration")) ;
       
   378 	        }
       
   379 	    else if(aStepName == _L("TestDrivePhoneLine"))
       
   380 	    	{
       
   381 	    	testStep = CTestDrivePhoneLine::NewL(EPhoneLineScript) ;
       
   382 			testStep->SetTestStepName(_L("TestDrivePhoneLine")) ;
       
   383 	        }
       
   384 	    else if(aStepName == _L("TestDriveAllCalls"))
       
   385 	    	{
       
   386 	    	testStep = CTestDriveAllCalls::NewL(EAllCallsScript) ;
       
   387 			testStep->SetTestStepName(_L("TestDriveAllCalls")) ;
       
   388 	        }
       
   389 	    else if(aStepName == _L("TestDriveNoCnmi"))
       
   390 	    	{
       
   391 	    	testStep = CTestDriveNoCnmi::NewL(ENoCnmiScript) ;
       
   392 			testStep->SetTestStepName(_L("TestDriveNoCnmi")) ;
       
   393 	        }
       
   394 	    else if(aStepName == _L("TestDriveNoCmgf"))
       
   395 	    	{
       
   396 	    	testStep = CTestDriveNoCmgf::NewL(ENoCmgfScript) ;
       
   397 			testStep->SetTestStepName(_L("TestDriveNoCmgf")) ;
       
   398 	        }
       
   399 	    else if(aStepName == _L("TestDriveDataCallDiffParam"))
       
   400 	    	{
       
   401 	    	testStep = CTestDriveDataCallDiffParam::NewL(ECallDiffParamScript) ;
       
   402 			testStep->SetTestStepName(_L("TestDriveDataCallDiffParam")) ;
       
   403 	        }
       
   404 	    else if(aStepName == _L("TestDriveCbstParse"))
       
   405 	    	{
       
   406 	    	testStep = CTestDriveCbstParse::NewL(ECbstParseScript) ;
       
   407 			testStep->SetTestStepName(_L("TestDriveCbstParse")) ;
       
   408 	        }
       
   409 	    else if(aStepName == _L("TestDriveCGQREQResponses"))
       
   410 	    	{
       
   411 	    	testStep = CTestDriveCGQREQResponses::NewL(ECGQREQResponsesScript) ;
       
   412 			testStep->SetTestStepName(_L("TestDriveCGQREQResponses")) ;
       
   413 	        }
       
   414 	    else if(aStepName == _L("TestDriveUnsolicited"))
       
   415 	    	{
       
   416 	    	testStep = CTestDriveUnsolicited::NewL(EUnsolicitedScript) ;
       
   417 			testStep->SetTestStepName(_L("TestDriveUnsolicited")) ;
       
   418 	        }
       
   419 	    else if(aStepName == _L("TestDriveOOMVoiceCall"))
       
   420 	    	{
       
   421 	    	testStep = CTestDriveOOMVoiceCall::NewL(EOOMVoiceCall) ;
       
   422 			testStep->SetTestStepName(_L("TestDriveOOMVoiceCall")) ;
       
   423 	        }
       
   424 		) // End of TRAP
       
   425 	if (error==KErrNone)
       
   426 		return testStep;
       
   427 	else
       
   428 		return NULL;
       
   429 	}
       
   430 
       
   431 GLDEF_C void StartScriptL(TScriptList* aScriptNum, const TInt aVarDelay,TRequestStatus** aRestartReqStat)
       
   432 /**
       
   433  *	This method demultiplexes the script number enumeration (TScriptList), creates the
       
   434  *  appropriate instance of a script (CATScriptEng), then launches the script processing.  Any
       
   435  *  test in the TScriptList enumeration must be represented in this method.  An unsupported
       
   436  *  script number will result in this method leaving with KErrNotSupported.  Also,
       
   437  *  if any of the tests NewL functions fail, the same action will occur.  This method also
       
   438  *  starts the active scheduler which is created and installed in the Responder thread (which
       
   439  *  calls this method).
       
   440  *
       
   441  * @param		aScriptNum is a pointer to one of the values in the TScriptList enumeration.
       
   442  *				This pointer is initially passed during the thread creation.
       
   443  * @param		aVarDelay is an integer value to be used for the variable delay in an EWait
       
   444  *              script with an iParam value of -1.
       
   445  *				This pointer is initially passed during the thread creation.
       
   446  * @leave		This method can leave via the various test specific NewL functions.  Additionally,
       
   447  *				if an invalid test is specified or the return value after the active scheduler
       
   448  *				is started is not KErrNone.
       
   449  *
       
   450  */
       
   451  // Todo: Investigate test classes to see if they can be combined into a superclass for
       
   452  //       savings.  That is, many of test classes use the same NewL functions to create the
       
   453  //       CATScriptEng class to use when starting the script.
       
   454  	{
       
   455 	CATScriptEng* script=NULL;
       
   456 	TInt ReturnValue=KErrNone;
       
   457 	switch(*aScriptNum)
       
   458 		{
       
   459 	case ERxMessScript:
       
   460 		script=CTestRxMess::NewL(KRxMessScript);
       
   461 		break;
       
   462 
       
   463 	case ENoPduRxMessScript:
       
   464 		script=CTestNoPduRxMess::NewL(KNoPduRxMessScript);
       
   465 		break;
       
   466 
       
   467 	case ERxMessCmtScript:
       
   468 		script=CTestRxMess::NewL(KRxMessCmtScript);
       
   469 		break;
       
   470 
       
   471 	case ERxMessCmtAndCmtiScript:
       
   472 		script=CTestRxMess::NewL(KRxMessCmtAndCmtiScript);
       
   473 		break;
       
   474 
       
   475 	case ERxMessEricssonT28Script:
       
   476 		script=CTestRxMess::NewL(KRxMessEricssonT28Script);
       
   477 		break;
       
   478 
       
   479 	case EScaSimpleScript:
       
   480 		script=CTestTxMess::NewL(KScaSimpleScript);
       
   481 		break;
       
   482 
       
   483 	case ESca8210StyleScript:
       
   484 		script=CTestTxMess::NewL(KSca8210StyleScript);
       
   485 		break;
       
   486 
       
   487 	case ETxMessScript:
       
   488 		script=CTestTxMess::NewL(KTxMessScript);
       
   489 		break;
       
   490 
       
   491 	case ETxMessNewStdScript:
       
   492 		script=CTestTxMess::NewL(KTxMessNewStdScript);
       
   493 		break;
       
   494 
       
   495 	case ETxMessT28NewStdScript:
       
   496 		script=CTestTxMess::NewL(KTxMessT28NewStdScript);
       
   497 		break;
       
   498 
       
   499 	case ETxMessScriptNoprefixNodefscaNew:
       
   500 		script=CTestTxMess::NewL(KTxMessScriptNoprefixNodefscaNew);
       
   501 		break;
       
   502 
       
   503 	case ETxMessScriptPrefixNodefscaNew:
       
   504 		script=CTestTxMess::NewL(KTxMessScriptPrefixNodefscaNew);
       
   505 		break;
       
   506 
       
   507 	case ETxMessScriptNoprefixDefscaNew:
       
   508 		script=CTestTxMess::NewL(KTxMessScriptNoprefixDefscaNew);
       
   509 		break;
       
   510 
       
   511 	case ETxMessScriptPrefixDefscaNew:
       
   512 		script=CTestTxMess::NewL(KTxMessScriptPrefixDefscaNew);
       
   513 		break;
       
   514 
       
   515 	case ETxMessScriptNoprefixNodefscaOld:
       
   516 		script=CTestTxMess::NewL(KTxMessScriptNoprefixNodefscaOld);
       
   517 		break;
       
   518 
       
   519 	case ETxMessScriptPrefixNodefscaOld:
       
   520 		script=CTestTxMess::NewL(KTxMessScriptPrefixNodefscaOld);
       
   521 		break;
       
   522 
       
   523 	case ETxMessScriptNoprefixDefscaOld:
       
   524 		script=CTestTxMess::NewL(KTxMessScriptNoprefixDefscaOld);
       
   525 		break;
       
   526 
       
   527 	case ETxMessScriptPrefixDefscaOld:
       
   528 		script=CTestTxMess::NewL(KTxMessScriptPrefixDefscaOld);
       
   529 		break;
       
   530 
       
   531 	case EDataCallScript:
       
   532 		script=CTestDataCall::NewL(KDataCallScript);
       
   533 		break;
       
   534 
       
   535 	case EDataCallErrorAScript:
       
   536 		script=CTestDataCall::NewL(KDataCallErrorAScript);
       
   537 		break;
       
   538 
       
   539 	case EOddInitAScript:
       
   540 		script=CTestOddInit::NewL(KOddInitAScript);
       
   541 		break;
       
   542 
       
   543 	case EOddInitBScript:
       
   544 		script=CTestOddInit::NewL(KOddInitBScript);
       
   545 		break;
       
   546 
       
   547 	case EOddInitCScript:
       
   548 		script=CTestOddInit::NewL(KOddInitCScript);
       
   549 		break;
       
   550 
       
   551 	case EOddInitDScript:
       
   552 		script=CTestOddInit::NewL(KOddInitDScript);
       
   553 		break;
       
   554 
       
   555 	case EOddInitEScript:
       
   556 		script=CTestOddInit::NewL(KOddInitEScript);
       
   557 		break;
       
   558 
       
   559 	case EOddInitFScript:
       
   560 		script=CTestOddInit::NewL(KOddInitFScript);
       
   561 		break;
       
   562 
       
   563 	case EOddInitGScript:
       
   564 		script=CTestOddInit::NewL(KOddInitGScript);
       
   565 		break;
       
   566 
       
   567 	case EOddInitHScript:
       
   568 		script=CTestOddInit::NewL(KOddInitHScript);
       
   569 		break;
       
   570 	
       
   571 	case EOddInitIScript:
       
   572 		script=CTestOddInit::NewL(KOddInitIScript);
       
   573 		break;
       
   574 
       
   575 	case EMessStorOldSmsStdScript:
       
   576 		script=CTestMessStor::NewL(KMessStorOldSmsStdScript);
       
   577 		break;
       
   578 
       
   579 	case EMessStorNewSmsStdScript:
       
   580 		script=CTestMessStor::NewL(KMessStorNewSmsStdScript);
       
   581 		break;
       
   582 
       
   583 	case ETxMessRxTxScriptA:
       
   584 		script=CTestTxMess::NewL(KTxMessRxTxScriptA);
       
   585 		break;
       
   586 
       
   587 	case EFailInitAScript:
       
   588 		script=CTestFailInit::NewL(KFailInitAScript);
       
   589 		break;
       
   590 
       
   591 	case EInCallScriptA:
       
   592 		script=CTestInCall::NewL(KInCallScriptA);
       
   593 		break;
       
   594 
       
   595 	case EInCallScriptB:
       
   596 		script=CTestInCall::NewL(KInCallScriptB);
       
   597 		break;
       
   598 
       
   599 	case ESmsCancelScript:
       
   600 		script=CTestSmsCancel::NewL(KSmsCancelScript);
       
   601 		break;
       
   602 
       
   603 	case ESmsCancelCmtiScript:
       
   604 		script=CTestSmsCancel::NewL(KSmsCancelCmtiScript);
       
   605 		break;
       
   606 
       
   607 	case EShutdownScript:
       
   608 		script=CTestShutdown::NewL(KShutdownScript);
       
   609 		break;
       
   610 
       
   611 	case EShutdownScriptA:
       
   612 		script=CTestShutdown::NewL(KShutdownScriptA);
       
   613 		break;
       
   614 
       
   615 	case ESmsStorageDeleteScript:
       
   616 		script=CTestSmsDelMess::NewL(KDeleteSmsScript);
       
   617 		break;
       
   618 
       
   619 	case ESsFaxScriptA:
       
   620 		script=CTestSsFax::NewL(KSsFaxScriptA);
       
   621 		break;
       
   622 
       
   623 	case ESsDataScriptA:
       
   624 		script=CTestSSData::NewL(KSsDataScriptA);
       
   625 		break;
       
   626 
       
   627 	case EDataCallCancelScript:
       
   628 		script=CTestDataCallCancel::NewL(KDataCallCancelScript);
       
   629 		break;
       
   630 
       
   631 	case EFaxPremCloseScriptA:
       
   632 		script=CTestPremClose::NewL(KFaxPremCloseScriptA);
       
   633 		break;
       
   634 
       
   635 	case EFaxPremCloseScriptB:
       
   636 		script=CTestPremClose::NewL(KFaxPremCloseScriptB);
       
   637 		break;
       
   638 
       
   639 	case ETwoFaxRxScriptA:
       
   640 		script=CTestTwoFaxRx::NewL(KTwoFaxRxScriptA);
       
   641 		break;
       
   642 
       
   643 	case EVoiceCallScriptA:
       
   644 		script=CTestVoiceCall::NewL(KVoiceCallScriptA);
       
   645 		break;
       
   646 
       
   647 	case EDataCallRemoteTermScript:
       
   648 		script=CTestDataCallRemoteTerm::NewL(KDataCallRemoteTermScript);
       
   649 		break;
       
   650 
       
   651 	case EDataCallCallBackScript:
       
   652 		if(aVarDelay<=1)
       
   653 			script=CTestDataCallCallBack::NewL(KDataCallCallBackScriptOneSecond, aVarDelay);
       
   654 		else
       
   655 			script=CTestDataCallCallBack::NewL(KDataCallCallBackScriptMoreThanOneSecond, aVarDelay);
       
   656 		break;
       
   657 
       
   658 	case EDataCallRemoteHangDialScript:
       
   659 		script=CTestRemoteHangupDial::NewL(KDataCallRemoteHangDialScript, aVarDelay);
       
   660 		break;
       
   661 
       
   662 	case EPhoneBookScript:
       
   663 		script=CTestPhoneBook::NewL(KPhoneBookScript);
       
   664 		break;
       
   665 
       
   666 	case ENetworkRegistrationScript:
       
   667 		script=CTestNetworkRegistration::NewL(KNetworkRegistrationScript);
       
   668 		break;
       
   669 
       
   670 	case EPhoneLineScript:
       
   671 		script=CTestPhoneLine::NewL(KPhoneLineScript);
       
   672 		break;
       
   673 
       
   674 	case EAllCallsScript:
       
   675 		script=CTestAllCalls::NewL(KAllCallsScript);
       
   676 		break;
       
   677 
       
   678 	case ENoCnmiScript:
       
   679 		script=CTestNoCnmi::NewL(KNoCnmiScript);
       
   680 		break;
       
   681 
       
   682 	case ENoCmgfScript:
       
   683 		script=CTestNoCmgf::NewL(KNoCMGFScript);
       
   684 		break;
       
   685 
       
   686 	case EOOMVoiceCall:
       
   687 		script=CTestOOMVoiceCall::NewL(KOOMVoiceCallScriptA);
       
   688 		break;
       
   689 	
       
   690 	case ECGQREQResponsesScript:
       
   691 		script=CTestCGQREQResponses::NewL(KCGQREQResponsesScript);
       
   692 		break;
       
   693 
       
   694 	case ECallDiffParamScript:
       
   695 		script=CTestDataCallDiffParam::NewL(KCDataCallDiffParamScript);
       
   696 		break;
       
   697 
       
   698 	case ECbstParseScript:
       
   699 		script=CTestCbstParse::NewL(KCCbstParseScript);
       
   700 		break;
       
   701 
       
   702 	case EUnsolicitedScript:
       
   703 		script=CTestUnsolicited::NewL(KCUnsolicitedScript);
       
   704 		break;
       
   705 
       
   706 	default:
       
   707 		User::Leave(KErrNotSupported);
       
   708 		break;
       
   709 		}
       
   710 	CleanupStack::PushL(script);
       
   711 
       
   712 	if(script==NULL)
       
   713 		User::Leave(KErrNotSupported);
       
   714 
       
   715 	script->StartRestart(aRestartReqStat);
       
   716 	script->Start();
       
   717 
       
   718 	CActiveScheduler::Start();
       
   719 	ReturnValue = script->iReturnValue ; //get a result
       
   720 	if(ReturnValue!=KErrNone)
       
   721 		User::Leave(ReturnValue);
       
   722 	CleanupStack::PopAndDestroy(script);
       
   723 	}
       
   724 
       
   725 GLDEF_C TInt ResponderThread(TAny* aThreadData)
       
   726 //
       
   727 // Main Function
       
   728 //
       
   729 /**
       
   730  * This method is the entry point for the thread created when a test is run.  This thread
       
   731  * is created by CTestBase::StartEmulator.  This thread communicates with it's "parent" thread
       
   732  * via the active scheduler.  After creating and installing an active scheduler entry for
       
   733  * the "Responder Thread", a rendezvous is mase for thread synchronization purposes. 
       
   734  * After thread synchronization, the StartScriptL method is called to actually process
       
   735  * the script.
       
   736  *
       
   737  * @param	aThreadData is an any pointer used to pass in a pointer to the structure containing
       
   738  *			the enum indicating the actual script to be run by StartScriptL and the variable
       
   739  *			delay value to be used as the timeout by the script processing when the iParam value
       
   740  *			is set to -1 in a TScript script whose iCommand is an EWait.
       
   741  *
       
   742  * @return	The return value is determined by the StartScriptL function and the test script
       
   743  *			function itself.  It represents the value of the global ReturnValue at the end
       
   744  *			of the StartScriptL function.
       
   745  */
       
   746 	{
       
   747 
       
   748 	TThreadData  *pThreadData; // typed pointer to input parameter data
       
   749 	TThreadData   threadData;  // this Thread's storage for the script indicator and variable delay
       
   750 
       
   751 	// because "aThreadData" points to an automatic variable in another thread, this data
       
   752 	// ...must be copied into thread specific storage before the signal is given back from
       
   753 	// ...this function that the Responder Thread was created successfully.
       
   754 	pThreadData = (TThreadData *)aThreadData;
       
   755 	threadData.iScriptList    = pThreadData->iScriptList;
       
   756 	threadData.iVariableDelay = pThreadData->iVariableDelay;
       
   757 	threadData.iRestartReqStat = pThreadData->iRestartReqStat;
       
   758 
       
   759 	CTrapCleanup* cleanup;
       
   760 	if ((cleanup=CTrapCleanup::New())==NULL)
       
   761 		User::Panic(_L("GsmTsy Loopback Tester Fault"),KErrGeneral);
       
   762 
       
   763 	CActiveScheduler* activeScheduler=new CActiveScheduler();
       
   764 	if(activeScheduler==NULL)
       
   765 		return KErrNoMemory;
       
   766 	CActiveScheduler::Install(activeScheduler);
       
   767 	
       
   768 	// Complete all Rendezvous' with the current thread.
       
   769 	RThread::Rendezvous(KErrNone);
       
   770 	
       
   771 	TRAPD(r,StartScriptL(&(threadData.iScriptList), threadData.iVariableDelay,threadData.iRestartReqStat));
       
   772 
       
   773 	LOGDESTROY();
       
   774 
       
   775 	delete activeScheduler;
       
   776 	delete cleanup;
       
   777 	return r;
       
   778 	}