telephonyserverplugins/multimodetsy/test/TE_Voice/TE_VoiceServer.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
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 // Voice API Test server test code.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #include "TE_VoiceServer.h"
       
    23 #include "TE_Voice.h"
       
    24 
       
    25 /**
       
    26  *  Called inside the MainL() function to create and start the CTestServer
       
    27  *  derived server.
       
    28  *
       
    29  *  @return Instance of the test server
       
    30  */
       
    31 CVoiceTestServer* CVoiceTestServer::NewL()
       
    32 	{
       
    33 	CVoiceTestServer*  server = new(ELeave) CVoiceTestServer();
       
    34 	CleanupStack::PushL(server);
       
    35 	// CServer base class call
       
    36 	server->StartL(KServerName);
       
    37 	CleanupStack::Pop(server);
       
    38 	return server;
       
    39 	} // CVoiceTestIntServer::NewL
       
    40 
       
    41 /**
       
    42  *  Much simpler, uses the new Rendezvous() call to sync with the client.
       
    43  */
       
    44 LOCAL_C void MainL()
       
    45 	{
       
    46 	//
       
    47 	// Start an active scheduler...
       
    48 	//
       
    49 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
       
    50 	CleanupStack::PushL(scheduler);
       
    51 	CActiveScheduler::Install(scheduler);
       
    52 
       
    53 	//
       
    54 	// Create the CTestServer derived server...
       
    55 	//
       
    56 	CVoiceTestServer* server = NULL;
       
    57 
       
    58 	TRAPD(err, server = CVoiceTestServer::NewL());
       
    59 	if (err == KErrNone)
       
    60 		{
       
    61 		//
       
    62 		// Sync with the client and enter the active scheduler
       
    63 		//
       
    64 		RProcess::Rendezvous(KErrNone);
       
    65 		scheduler->Start();
       
    66 		}
       
    67 
       
    68 	//
       
    69 	// Clean up...
       
    70 	//
       
    71 	CleanupStack::Pop(scheduler);
       
    72 	delete server;
       
    73 	delete scheduler;
       
    74 	} // MainL
       
    75 /**
       
    76  *  @return Standard Epoc error code on exit.
       
    77  */
       
    78 GLDEF_C TInt E32Main()
       
    79 	{
       
    80 	
       
    81 	__UHEAP_MARK;
       
    82 	
       
    83 	CTrapCleanup*  cleanup = CTrapCleanup::New();
       
    84 
       
    85 	if (cleanup == NULL)
       
    86 		{
       
    87 		return KErrNoMemory;
       
    88 		}
       
    89 
       
    90 	TRAPD(err, MainL());
       
    91 
       
    92 	delete cleanup;
       
    93 
       
    94 	__UHEAP_MARKEND;
       
    95 
       
    96 	return err;
       
    97 	} // E32Main
       
    98 
       
    99 
       
   100 /**
       
   101  *  Implementation of CTestServer pure virtual.
       
   102  *
       
   103  *  @return A CTestStep derived instance.
       
   104  */
       
   105 CTestStep* CVoiceTestServer::CreateTestStep(const TDesC& aStepName)
       
   106 	{
       
   107 	CTestStep*  testStep = NULL;
       
   108 
       
   109     //
       
   110 	// Create the required test step...
       
   111 	//
       
   112 	if (aStepName == _L("TestLineInfo"))
       
   113 		{
       
   114 		testStep = new CTestLineInfo();
       
   115 		}
       
   116 	else if (aStepName == _L("TestPhoneInfo"))
       
   117 		{
       
   118 		testStep = new CTestPhoneInfo();
       
   119 		}
       
   120 	else if (aStepName == _L("TestLineStatusIncomingCall"))
       
   121 		{
       
   122 		testStep = new CTestLineStatusIncomingCall();
       
   123 		}
       
   124 	else if (aStepName == _L("TestLineStatusOutgoingCall"))
       
   125 		{
       
   126 		testStep = new CTestLineStatusOutgoingCall();
       
   127 		}
       
   128 	else if (aStepName == _L("TestLineCapabilities"))
       
   129 		{
       
   130 		testStep = new CTestLineCapabilities();
       
   131 		}
       
   132 	else if (aStepName == _L("TestLineNotificationsIncomingCall"))
       
   133 		{
       
   134 		testStep = new CTestLineNotificationsIncomingCall();
       
   135 		}
       
   136 	else if (aStepName == _L("TestLineNotificationsOutgoingCall"))
       
   137 		{
       
   138 		testStep = new CTestLineNotificationsOutgoingCall();
       
   139 		}
       
   140 	else if (aStepName == _L("TestLineCancels"))
       
   141 		{
       
   142 		testStep = new CTestLineCancels();
       
   143 		}
       
   144 	else if (aStepName == _L("TestCallInfo"))
       
   145 		{
       
   146 		testStep = new CTestCallInfo();
       
   147 		}
       
   148 	else if (aStepName == _L("TestCallNotificationsIncomingCall"))
       
   149 		{
       
   150 		testStep = new CTestCallNotificationsIncomingCall();
       
   151 		}
       
   152 	else if (aStepName == _L("TestCallNotificationsOutgoingCall"))
       
   153 		{
       
   154 		testStep = new CTestCallNotificationsOutgoingCall();
       
   155 		}
       
   156 	else if (aStepName == _L("TestCallStatusIncomingCall"))
       
   157 		{
       
   158 		testStep = new CTestCallStatusIncomingCall();
       
   159 		}
       
   160 	else if (aStepName == _L("TestCallStatusOutgoingCall"))
       
   161 		{
       
   162 		testStep = new CTestCallStatusOutgoingCall();
       
   163 		}
       
   164 	else if (aStepName == _L("TestCallCancels"))
       
   165 		{
       
   166 		testStep = new CTestCallCancels();
       
   167 		}
       
   168 	else if (aStepName == _L("TestMoreCallInfo"))
       
   169 		{
       
   170 		testStep = new CTestMoreCallInfo();
       
   171 		}
       
   172 	else if (aStepName == _L("TestCloseCallWhenActive"))
       
   173 		{
       
   174 		testStep = new CTestCloseCallWhenActive();
       
   175 		}
       
   176 	else if (aStepName == _L("TestCancelDialRequest"))
       
   177 		{
       
   178 		testStep = new CTestCancelDialRequest();
       
   179 		}
       
   180 
       
   181 		
       
   182 	return testStep;
       
   183 	} // CVoiceTestServer::CreateTestStep