telephonyserverplugins/multimodetsy/test/Te_LoopBack/Te_LoopBackCCbstParse.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 // This file initiates the "Data Calls with diff params(speed)
       
    15 // The client (application) side must start the emulator and drive the ETel API.
       
    16 // The emulator side runs the designated script.
       
    17 // 
       
    18 //
       
    19 
       
    20 /**
       
    21  @file
       
    22  @note  There are mulitple classes implemented in this file.
       
    23  @note  These classes are CTestDriveCbstParse and CTestCbstParse.
       
    24 */
       
    25 
       
    26 
       
    27 #include <e32test.h>
       
    28 #include "Te_LoopBackSLOGGER.H"
       
    29 #include "Te_LoopBackCCbstParse.h"
       
    30 
       
    31 #include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint
       
    32 
       
    33 _LIT(KMmPhoneName,"GsmPhone1");
       
    34  
       
    35 
       
    36 //
       
    37 // Test-side class
       
    38 // With the assistance of the base class, this class must start the emulator
       
    39 // and drive the ETel API.
       
    40 //
       
    41 CTestDriveCbstParse* CTestDriveCbstParse::NewL(const TScriptList aScriptListEntry,
       
    42 															 TInt aVarDelay)
       
    43 /**
       
    44  * 2 Phase Constructor
       
    45  *
       
    46  * This method creates an instance of CTestDriveCbstParse.  The ConstructL for
       
    47  * for CTestDriveCbstParse is inherited from and implemented in CTestBase. The
       
    48  * ConstructL uses the CTestDriveCbstParse object to load ond open the two iPhone
       
    49  * objects, one from each server.
       
    50  *
       
    51  * @param aScriptListEntry: enum indicating which script to use for this test.
       
    52  * @param aVarDelay: integer indicating variable delay value, in seconds, to be used with an EWait script
       
    53  * @leave Leaves if a failure occurs during connect or open of the iPhone by ConstructL.
       
    54  * @return pointer to the instance of CTestDriveCbstParse.
       
    55  */
       
    56 	{
       
    57 	CTestDriveCbstParse* aA=new(ELeave) CTestDriveCbstParse(aScriptListEntry, aVarDelay);
       
    58 	CleanupStack::PushL(aA);
       
    59 	aA->ConstructL();
       
    60 	CleanupStack::Pop();
       
    61 	return aA;
       
    62 	}
       
    63 
       
    64 
       
    65 CTestDriveCbstParse::CTestDriveCbstParse(const TScriptList aScriptListEntry,
       
    66 													   TInt aVarDelay
       
    67 													  ) : iScriptListEntry(aScriptListEntry),
       
    68 													      iVarDelay(aVarDelay)
       
    69 /**
       
    70  * This method is the constructor for CTestDriveCbstParse.
       
    71  *
       
    72  * @param aScriptListEntry: enum indicating which script to use for this test.
       
    73  * @param aVarDelay: integer indicating variable delay value, in seconds, to be used with an EWait script
       
    74  * @note Initializes private data "aScriptListEntry" to received parameter.
       
    75  * @note Initializes private data "aVarDelay" to received parameter.
       
    76  */
       
    77 	{}
       
    78 
       
    79 TInt CTestDriveCbstParse::RunTestL()
       
    80 /**
       
    81  * This method is invoked to start a "Data Call answer and remote hang-up closely followed by
       
    82  * a dial" test.  This method sets the CTestBase current script to run and the CTestBase variable
       
    83  * delay value to use for an EWait
       
    84  * script and then starts the modem emulator side of the test.
       
    85  *
       
    86  * @return KErrNone when no error exists.
       
    87  * @return KErrAlreadyExists is returned if modem emulator exists and retry limit expires.
       
    88  * @return Variable depending on return value from test's DriveETelApiL method and thread monitoring.
       
    89  */
       
    90 	{
       
    91 	iCurrentScript=iScriptListEntry;
       
    92 	iVariableDelay=iVarDelay;
       
    93 	return StartEmulatorL();
       
    94 	}
       
    95 
       
    96 TInt CTestDriveCbstParse::DriveETelApiL()
       
    97 /**
       
    98  * This method contains the real meat of the 
       
    99  * @return KErrNone.
       
   100  */
       
   101 	{
       
   102 	INFO_PRINTF1(_L("Wrong CBST string +CBST:  \n")) ;
       
   103 	DriveTestL() ; 
       
   104 	INFO_PRINTF1(_L("Wrong CBST string +CBST: (3,4), \n")) ;
       
   105 	DriveTestL() ; 
       
   106 	INFO_PRINTF1(_L("Wrong CBST string +CBST: (3,4),(3),  \n")) ;
       
   107 	DriveTestL() ; 
       
   108 	INFO_PRINTF1(_L("Wrong speed string +CBST: (3,4, \n")) ;
       
   109 	DriveTestL() ;
       
   110 	INFO_PRINTF1(_L("Wrong name string +CBST: (3,4), (3\n ")) ;
       
   111 	DriveTestL() ; 
       
   112 	INFO_PRINTF1(_L("Wrong CE string+CBST: (3,4), (3,2), (1 \n")) ;
       
   113 	DriveTestL() ; 
       
   114 	return KErrNone;
       
   115 	}
       
   116 
       
   117 void CTestDriveCbstParse::DriveTestL()
       
   118 	{
       
   119 	// Open iPhone
       
   120 	iPhone3.Open(iServer,KMmPhoneName);
       
   121 	
       
   122 	TRequestStatus	reqStatus;
       
   123 	INFO_PRINTF1(_L("Initialising the Phone...\n"));
       
   124 
       
   125 	RMobilePhone::TMMTableSettings tableSettings;
       
   126 	tableSettings.iLocId=KInternetAccessPoint;
       
   127 	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
       
   128 	iPhone3.InitialiseMM(reqStatus , tableSettingsPckg); 	
       
   129 
       
   130 	User::WaitForRequest(reqStatus);
       
   131 
       
   132 	TESTL(reqStatus == KErrNone);
       
   133 	INFO_PRINTF1(_L("Attempting to force TSY into EPhoneNotInitialised state\n"));
       
   134 	TRequestStatus status(KErrNone);
       
   135 	RMobilePhone::TMobilePhoneNetworkInfoV1 networkInfo;
       
   136 	TPckg<RMobilePhone::TMobilePhoneNetworkInfoV1> networkInfoPckg(networkInfo);
       
   137 	RMobilePhone::TMobilePhoneLocationAreaV1 area;
       
   138 	iPhone3.GetCurrentNetwork(status,networkInfoPckg,area);
       
   139 	User::WaitForRequest(status);
       
   140 	TESTL(status==KErrTimedOut);
       
   141 	// Close iPhone
       
   142 	iPhone3.Close();		
       
   143 	}
       
   144 
       
   145 
       
   146 //
       
   147 // Emulator-side class
       
   148 // With the assistance of the base class, this class must run the designated script
       
   149 //
       
   150 CTestCbstParse* CTestCbstParse::NewL(const TScript* aScript)
       
   151 /**
       
   152  * 2 Phase Constructor
       
   153  *
       
   154  * This method creates an instance of CTestCbstParse.
       
   155  *
       
   156  * @param aScript: pointer to the specifics of the script to run.
       
   157  * @leave Leaves if out of memory when attempting to create.
       
   158  * @return pointer to the instance of CTestCbstParse.
       
   159  */
       
   160 	{
       
   161 	CTestCbstParse* aA=new(ELeave) CTestCbstParse(aScript);
       
   162 	CleanupStack::PushL(aA);
       
   163 	aA->ConstructL();
       
   164 	CleanupStack::Pop();
       
   165 	return aA;
       
   166 	}
       
   167 
       
   168 CTestCbstParse* CTestCbstParse::NewL(const TScript* aScript, const TInt aVarDelay)
       
   169 /**
       
   170  * 2 Phase Constructor
       
   171  *
       
   172  * This method creates an instance of CTestCbstParse.
       
   173  *
       
   174  * @param aScript: pointer to the specifics of the script to run.
       
   175  * @param aVarDelay: time delay
       
   176  * @leave Leaves if out of memory when attempting to create.
       
   177  * @return pointer to the instance of CTestCbstParse.
       
   178  */
       
   179 	{
       
   180 	CTestCbstParse* aA=new(ELeave) CTestCbstParse(aScript, aVarDelay);
       
   181 	CleanupStack::PushL(aA);
       
   182 	aA->ConstructL();
       
   183 	CleanupStack::Pop();
       
   184 	return aA;
       
   185 	}
       
   186 
       
   187 CTestCbstParse::CTestCbstParse(const TScript* aScript) : iScript(aScript)
       
   188 /**
       
   189  * This method is the constructor for CTestCbstParse.
       
   190  *
       
   191  * @param aScript: pointer to the specifics of the script to run.
       
   192  * @note Initializes private data "aScript" to received parameter.
       
   193  */
       
   194 	{}
       
   195 
       
   196 CTestCbstParse::CTestCbstParse(const TScript* aScript, const TInt aVarDelay) : CATScriptEng(aVarDelay), iScript(aScript)
       
   197 /**
       
   198  * This method is the constructor for CTestCbstParse.
       
   199  *
       
   200  * @param aScript: pointer to the specifics of the script to run.
       
   201  * @param aVarDelay: user specified time delay
       
   202  * @note Initializes private data "aScript" to received parameter.
       
   203  */
       
   204 	{}
       
   205 
       
   206 void CTestCbstParse::ConstructL()
       
   207 /**
       
   208  * This method is used to implement the 2 Phase Constructor for CTestCbstParse.
       
   209  * This method uses the CATBase ConstructL to configure the port to be used.
       
   210  *
       
   211  * @leave Leaves if CATBase leaves.
       
   212  */
       
   213 	{
       
   214 	CATScriptEng::ConstructL();
       
   215 	}
       
   216 
       
   217 TInt CTestCbstParse::Start()
       
   218 /**
       
   219  * This method is defined as a pure virtual function that must be implemented.
       
   220  * This method is currently not used by the Etel regression test harness.
       
   221  * Instead of using this method to start the scripts, the CTestTxMess::Start()
       
   222  * method is used to start the scripts.  The CTestTxMess::Start() is called by
       
   223  * the responder thread of the scripting engine to start the execution of the script.
       
   224  *
       
   225  * @return KErrNone.
       
   226  */
       
   227 	{
       
   228 	StartScript(iScript);
       
   229 	return KErrNone;
       
   230 	}
       
   231 
       
   232 void CTestCbstParse::SpecificAlgorithmL(TInt /* aParam */)
       
   233 /**
       
   234  * This method is defined as a pure virtual function that must be implemented.
       
   235  * This method is currently not used by the Etel regression test harness.
       
   236  * Instead of using this method to perform an algorithm specific to this test,
       
   237  * the CTestTxMess::SpecificAlgorithm() method is used.  The CTestTxMess::SpecificAlgorithm()
       
   238  * is called by the scripting engine to perform the test specific algorithm.
       
   239  */
       
   240 	{
       
   241     }
       
   242 
       
   243 void CTestCbstParse::Complete(TInt aError)
       
   244 /**
       
   245  * This method is defined as a pure virtual function that must be implemented.
       
   246  * This method is currently not used by the Etel regression test harness.
       
   247  * Instead of using this method to end the scripts, the CTestTxMess::Complete()
       
   248  * method is used to end the scripts.  The CTestTxMess::Complete() is called by
       
   249  * the scripting engine to end the execution of the script.
       
   250  */
       
   251 	{
       
   252 	iReturnValue=aError;
       
   253 	CActiveScheduler::Stop();
       
   254 	}
       
   255