telephonyserverplugins/simtsy/test/Te_SimVoice/Te_SimVoiceTestServer.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_SimVoiceTestServer.h"
       
    17 #include "Te_SimVoice.h"
       
    18 
       
    19 _LIT(KServerName,"Te_SimVoice");
       
    20 
       
    21 CSimVoiceTestServer* CSimVoiceTestServer::NewL()
       
    22 /**
       
    23  * @return - Instance of the test server
       
    24  * Same code for Secure and non-secure variants
       
    25  * Called inside the MainL() function to create and start the
       
    26  * CTestServer derived server.
       
    27  */
       
    28 	{
       
    29 	CSimVoiceTestServer * testServer = new (ELeave) CSimVoiceTestServer();
       
    30 	CleanupStack::PushL(testServer);
       
    31 
       
    32 	testServer->ConstructL(KServerName);
       
    33 	CleanupStack::Pop(testServer);
       
    34 	return testServer;
       
    35 	}
       
    36 
       
    37 LOCAL_C void MainL()
       
    38 /**
       
    39  * Secure variant
       
    40  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    41  */
       
    42 	{
       
    43    	TInt result = StartC32();
       
    44 	if (result != KErrNone  &&  result != KErrAlreadyExists)
       
    45 		{
       
    46 		User::Leave(result);
       
    47 		}
       
    48 
       
    49 	CActiveScheduler* sched=NULL;
       
    50 	sched=new(ELeave) CActiveScheduler;
       
    51 	CActiveScheduler::Install(sched);
       
    52 
       
    53 	// Create the CTestServer derived server
       
    54 	CSimVoiceTestServer* testServer = NULL;
       
    55 	TRAPD(err,testServer = CSimVoiceTestServer::NewL());
       
    56 	if(!err)
       
    57 		{
       
    58 		// Sync with the client and enter the active scheduler
       
    59 		RProcess::Rendezvous(KErrNone);
       
    60 		sched->Start();
       
    61 		}
       
    62 	delete testServer;
       
    63 	delete sched;
       
    64 	}
       
    65 
       
    66 GLDEF_C TInt E32Main()
       
    67 /**
       
    68  * @return - Standard Epoc error code on process exit
       
    69  * Secure variant only
       
    70  * Process entry point. Called by client using RProcess API
       
    71  */
       
    72 	{
       
    73 	__UHEAP_MARK;
       
    74 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    75 	if(cleanup == NULL)
       
    76 		{
       
    77 		return KErrNoMemory;
       
    78 		}
       
    79 	TRAPD(err,MainL());
       
    80 	delete cleanup;
       
    81 	__UHEAP_MARKEND;
       
    82 	return err;
       
    83 	}
       
    84 
       
    85 CTestStep* CSimVoiceTestServer::CreateTestStep(const TDesC& aStepName)
       
    86 /**
       
    87  * @return - A CTestStep derived instance
       
    88  * Secure and non-secure variants
       
    89  * Implementation of CTestServer pure virtual
       
    90  */
       
    91 	{
       
    92 	CSimVoiceTestStepBase* testStep = NULL;
       
    93 
       
    94 	if(aStepName == _L("TestLineStatusIncommingCall"))
       
    95 		{
       
    96 		testStep = new CTestLineStatusIncommingCall() ;
       
    97 		testStep->SetState(0);
       
    98  		}
       
    99 	else if(aStepName == _L("TestLineNotificationsIncommingCall"))
       
   100 		{
       
   101 		testStep = new CTestLineNotificationsIncommingCall() ;
       
   102 		testStep->SetState(10);
       
   103 		}
       
   104 	else if(aStepName == _L("TestCallNotificationsIncommingCall"))
       
   105 		{
       
   106 		testStep = new CTestCallNotificationsIncommingCall();
       
   107 		testStep->SetState(20);
       
   108 		}
       
   109 	else if(aStepName == _L("TestCallNotificationsOutgoingCall"))
       
   110 		{
       
   111 		testStep = new CTestCallNotificationsOutgoingCall();
       
   112 		testStep->SetState(30);
       
   113 		}
       
   114 	else if(aStepName == _L("TestLineNotificationsOutgoingCall"))
       
   115 		{
       
   116 		testStep = new CTestLineNotificationsOutgoingCall();
       
   117 		testStep->SetState(40);
       
   118 		}
       
   119 	else if(aStepName == _L("TestLineStatusOutgoingCall"))
       
   120 		{
       
   121 		testStep = new CTestLineStatusOutgoingCall() ;
       
   122 		testStep->SetState(50);
       
   123 		}
       
   124 	else if(aStepName == _L("TestCallStatusOutgoingCall"))
       
   125 		{
       
   126 		testStep = new CTestCallStatusOutgoingCall() ;
       
   127 		testStep->SetState(60);
       
   128 		}
       
   129 	else if(aStepName == _L("TestCallStatusIncommingCall"))
       
   130 		{
       
   131 		testStep = new CTestCallStatusIncommingCall() ;
       
   132 		testStep->SetState(70);
       
   133 		}
       
   134 	else if(aStepName == _L("TestLineInfo"))
       
   135 		{
       
   136 		testStep = new CTestLineInfo() ;
       
   137 		testStep->SetState(80);
       
   138     		}
       
   139 	else if(aStepName == _L("TestCallCancels"))
       
   140 		{
       
   141 		testStep = new CTestCallCancels() ;
       
   142 		testStep->SetState(90);
       
   143 		}
       
   144 	else if(aStepName == _L("TestLineCancels"))
       
   145 		{
       
   146 		testStep = new CTestLineCancels() ;
       
   147 		testStep->SetState(100);
       
   148 		}
       
   149 	else if(aStepName == _L("TestMoreCallInfo"))
       
   150 		{
       
   151 		testStep = new CTestMoreCallInfo() ;
       
   152 		testStep->SetState(110);
       
   153 		}
       
   154 	else if(aStepName == _L("TestCallInfo"))
       
   155 		{
       
   156 		testStep = new CTestCallInfo() ;
       
   157 		testStep->SetState(120);
       
   158 		}
       
   159 	else if(aStepName == _L("TestPhoneInfo"))
       
   160 		{
       
   161 		testStep = new CTestPhoneInfo() ;
       
   162 		testStep->SetState(130);
       
   163 		}
       
   164 	else if(aStepName == _L("TestDtmf"))
       
   165 		{
       
   166 		testStep = new CTestDtmf() ;
       
   167 		testStep->SetState(140);
       
   168 		}
       
   169 	else if(aStepName == _L("TestCallDuration"))
       
   170 		{
       
   171 		testStep = new CTestCallDuration() ;
       
   172 		testStep->SetState(150);
       
   173 		}
       
   174 	else if(aStepName == _L("TestRemoteHangup"))
       
   175 		{
       
   176 		testStep = new CTestRemoteHangup() ;
       
   177 		testStep->SetState(160);
       
   178 		}
       
   179 
       
   180 	return testStep;
       
   181 	}
       
   182 
       
   183 
       
   184 
       
   185