telephonyutils/etel3rdpartyapi/Test/te_etelIsv/TE_EtelIsvserver.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2003-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 // TE_ETEL3RDPARTYSERVER.CPP
       
    15 // ETelISV test harness entry point.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21 */
       
    22 
       
    23 
       
    24 #include "TE_EtelIsvserver.h"
       
    25 #include "TE_EtelIsvPhoneSettings.h"
       
    26 #include "TE_EtelIsvNetworkInfo.h"
       
    27 #include "TE_EtelIsvLineInfo.h"
       
    28 #include "TE_EtelIsvSuppServices.h"
       
    29 #include "TE_EtelIsvCallFunc.h"
       
    30 #include "TE_EtelIsvNotifiers.h"
       
    31 #include "TE_EtelIsvStress.h"
       
    32 
       
    33 
       
    34 _LIT(KServerName,"TE_ETELISV1");
       
    35 
       
    36 
       
    37 CEtelIsvTestServer* CEtelIsvTestServer::NewL()
       
    38 /**
       
    39  * @return - Instance of the test server
       
    40  * Called inside the MainL() function to create and start the
       
    41  * CTestServer derived server.
       
    42  */
       
    43 	{
       
    44 	CEtelIsvTestServer * server = new (ELeave) CEtelIsvTestServer();
       
    45 	CleanupStack::PushL(server);
       
    46 	// CServer base class call
       
    47 	server->StartL(KServerName);
       
    48 	CleanupStack::Pop(server);
       
    49 	return server;
       
    50 	}
       
    51 
       
    52 LOCAL_C void MainL()
       
    53 /**
       
    54  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    55  */
       
    56 	{
       
    57 	StartC32();
       
    58 
       
    59 	CActiveScheduler* sched=NULL;
       
    60 	sched=new(ELeave) CActiveScheduler;
       
    61 	CActiveScheduler::Install(sched);
       
    62 	CEtelIsvTestServer* server = NULL;
       
    63 	// Create the CTestServer derived server
       
    64 	TRAPD(err,server = CEtelIsvTestServer::NewL());
       
    65 	if(!err)
       
    66 		{
       
    67 		// Sync with the client and enter the active scheduler
       
    68 		RProcess::Rendezvous(KErrNone);
       
    69 		sched->Start();
       
    70 		}
       
    71 	delete server;
       
    72 	delete sched;
       
    73 	}
       
    74 
       
    75 GLDEF_C TInt E32Main()
       
    76 /**
       
    77  * @return - Standard Epoc error code on exit
       
    78  */
       
    79 	{
       
    80 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    81 	if(cleanup == NULL)
       
    82 		{
       
    83 		return KErrNoMemory;
       
    84 		}
       
    85 	TRAP_IGNORE(MainL());
       
    86 	delete cleanup;
       
    87 	return KErrNone;
       
    88     }
       
    89 CTestStep* CEtelIsvTestServer::CreateTestStep(const TDesC& aStepName)
       
    90 /**
       
    91  * @return - A CTestStep derived instance
       
    92  * Implementation of CTestServer pure virtual
       
    93  */
       
    94 	{
       
    95 	CTestStep*  testStep(NULL);
       
    96 
       
    97 	//  Test for Phone settings support  //
       
    98 	if (aStepName == _L("TestGetPhoneId"))
       
    99 		{
       
   100 		testStep = new CTestGetPhoneId;
       
   101 		}
       
   102 	else if (aStepName == _L("TestGetPhoneIdError"))
       
   103 		{
       
   104 		testStep = new CTestGetPhoneIdError;
       
   105 		}
       
   106 	else if (aStepName == _L("TestGetSubscriberId"))
       
   107 		{
       
   108 		testStep = new CTestGetSubscriberId;
       
   109 		}
       
   110 	else if (aStepName == _L("TestGetSubscriberIdError"))
       
   111 		{
       
   112 		testStep = new CTestGetSubscriberIdError;
       
   113 		}
       
   114 	else if (aStepName == _L("TestFlightModeWithPublishSubscribe"))
       
   115 		{
       
   116 		testStep = new CTestFlightModeWithPublishSubscribe;
       
   117 		}
       
   118 	else if (aStepName == _L("TestGetIndicator"))
       
   119 		{
       
   120 		testStep = new CTestGetIndicator;
       
   121 		}
       
   122 	else if (aStepName == _L("TestGetBatteryInfo"))
       
   123 		{
       
   124 		testStep = new CTestGetBatteryInfo;
       
   125 		}
       
   126 	else if (aStepName == _L("TestGetSignalStrength"))
       
   127 		{
       
   128 		testStep = new CTestGetSignalStrength;
       
   129 		}
       
   130 	else if (aStepName == _L("TestGetLockInfo"))
       
   131 		{
       
   132 		testStep = new CTestGetLockInfo;
       
   133 		}
       
   134 	else if (aStepName == _L("TestSendDTMFTones"))
       
   135 		{
       
   136 		testStep = new CTestSendDTMFTones;
       
   137 		}
       
   138 	else if (aStepName == _L("TestPhoneFuncFlightModeOnWithPublishSubscribe"))
       
   139 		{
       
   140 		testStep = new CTestPhoneFuncFlightModeOnWithPublishSubscribe;	
       
   141 		}
       
   142 	//  Test for Network information support  //
       
   143 	else if (aStepName == _L("TestGetNetworkRegistrationStatus"))
       
   144 		{
       
   145 		testStep = new CTestGetNetworkRegistrationStatus;
       
   146 		}
       
   147 	else if (aStepName == _L("TestGetCurrentNetworkInfo"))
       
   148 		{
       
   149 		testStep = new CTestGetCurrentNetworkInfo;
       
   150 		}
       
   151 	else if (aStepName == _L("TestGetCurrentNetworkInfoEighteenChars"))
       
   152 		{
       
   153 		testStep = new CTestGetCurrentNetworkInfoEighteenChars;
       
   154 		}
       
   155 	else if (aStepName == _L("TestGetCurrentNetworkInfoEighteenCharsV2"))
       
   156 		{
       
   157 		testStep = new CTestGetCurrentNetworkInfoEighteenCharsV2;
       
   158 		}
       
   159 	else if (aStepName == _L("TestGetCurrentNetworkInfoTwentyThreeChars"))
       
   160 		{
       
   161 		testStep = new CTestGetCurrentNetworkInfoTwentyThreeChars;
       
   162 		}
       
   163 	else if (aStepName == _L("TestGetCurrentNetworkInfoTwentyThreeCharsV2"))
       
   164 		{
       
   165 		testStep = new CTestGetCurrentNetworkInfoTwentyThreeCharsV2;	
       
   166 		}
       
   167 	else if (aStepName == _L("TestGetCurrentNetworkName"))
       
   168 		{
       
   169 		testStep = new CTestGetCurrentNetworkName;
       
   170 		}
       
   171 	else if (aStepName == _L("TestGetOperatorName"))
       
   172 		{
       
   173 		testStep = new CTestGetOperatorName;
       
   174 		}
       
   175 	else if (aStepName == _L("TestNetworkFuncFlightModeOnWithPublishSubscribe"))
       
   176 		{
       
   177 		testStep = new CTestNetworkFuncFlightModeOnWithPublishSubscribe;
       
   178 		}
       
   179 	//  Test for line information functionality support  //
       
   180 	else if (aStepName == _L("TestGetLineStatus"))
       
   181 		{
       
   182 		testStep = new CTestGetLineStatus(iMTCallCount);
       
   183 		}
       
   184 	else if (aStepName == _L("TestLineFuncFlightModeOnWithPublishSubscribe"))
       
   185 		{
       
   186 		testStep = new CTestLineFuncFlightModeOnWithPublishSubscribe;
       
   187 		}
       
   188 	//  Test for call functionality support  //
       
   189 	else if (aStepName == _L("TestGetCallInfo"))
       
   190 		{
       
   191 		testStep = new CTestGetCallInfo;
       
   192 		}
       
   193 	else if (aStepName == _L("TestGetCallDynamicCaps"))
       
   194 		{
       
   195 		testStep = new CTestGetCallDynamicCaps;
       
   196 		}
       
   197 	else if (aStepName == _L("TestDialNewCall"))
       
   198 		{
       
   199 		testStep = new CTestDialNewCall;
       
   200 		}
       
   201 	else if (aStepName == _L("TestAnswerIncomingCall"))
       
   202 		{
       
   203 		testStep = new CTestAnswerIncomingCall(iMTCallCount);
       
   204 		}
       
   205 	else if (aStepName == _L("TestHold"))
       
   206 		{
       
   207 		testStep = new CTestHold;
       
   208 		}
       
   209 	else if (aStepName == _L("TestResume"))
       
   210 		{
       
   211 		testStep = new CTestResume;
       
   212 		}
       
   213 	else if (aStepName == _L("TestSwap"))
       
   214 		{
       
   215 		testStep = new CTestSwap;
       
   216 		}
       
   217 	else if (aStepName == _L("TestHoldResume2Calls"))
       
   218 		{
       
   219 		testStep = new CTestHoldResume2Calls;					
       
   220 		}
       
   221 	else if (aStepName == _L("TestHangup"))
       
   222 		{
       
   223 		testStep = new CTestHangup;	
       
   224 		}
       
   225 	else if (aStepName == _L("TestCallFuncFlightModeOnWithPublishSubscribe"))
       
   226 		{
       
   227 		testStep = new CTestCallFuncFlightModeOnWithPublishSubscribe(iMTCallCount);
       
   228 		}
       
   229 	else if (aStepName == _L("TestDeprecatedDataCallAPIs"))
       
   230 	    {
       
   231 		testStep = new CTestDeprecatedDataCallAPIs();
       
   232 		}
       
   233 	//  Test for supplementary services support  //
       
   234 	else if (aStepName == _L("TestGetSupplementaryServiceStatus"))
       
   235 		{
       
   236 		testStep = new CTestGetSupplementaryServiceStatus;
       
   237 		}
       
   238 	else if (aStepName == _L("TestGetIdentityService"))
       
   239 		{
       
   240 		testStep = new CTestGetIdentityServiceStatus;
       
   241 		}
       
   242 	else if (aStepName == _L("TestSuppServFuncFlightModeOnWithPublishSubscribe"))
       
   243 		{
       
   244 		testStep = new CTestSuppServFuncFlightModeOnWithPublishSubscribe;
       
   245 		}
       
   246 	// Test for notifiers support //
       
   247 	else if (aStepName == _L("TestRegisterForNotification"))
       
   248 		{
       
   249 		testStep = new CTestNotifyChange;
       
   250 		}
       
   251 	else if (aStepName == _L("TestRegisterForNotificationCancel"))
       
   252 		{
       
   253 		testStep = new CTestNotifyChangeCancel;
       
   254 		}
       
   255 	else if (aStepName == _L("TestCallAndNotify"))
       
   256 		{
       
   257 		testStep = new CTestCallAndNotify;
       
   258 		}
       
   259 	// Stress Test //
       
   260 	else if (aStepName == _L("TestStress"))
       
   261 		{
       
   262 		testStep = new CTestStress(iMTCallCount);
       
   263 		}
       
   264 	else if (aStepName == _L("TestFailedOpen"))
       
   265 		{
       
   266 		testStep = new CTestFailedOpen();
       
   267 		}
       
   268  	else if(aStepName == _L("TestGetLineStatusNoCaps"))
       
   269  		{
       
   270  		testStep = new CTestGetLineStatusNoCaps(iMTCallCount);			
       
   271  		}
       
   272 
       
   273 	//
       
   274 	// Set the test step name here to save code!!!
       
   275 	//
       
   276 	if (testStep != NULL)
       
   277 		{
       
   278 		testStep->SetTestStepName(aStepName);
       
   279 		}
       
   280 
       
   281 	return testStep;
       
   282 	}