telephonyutils/telephonywatchers/Test/TE_TelWatchers/TE_TelWatchersIntServer.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2004-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 // Telephony Watchers Integration Test server test code.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #include "TE_TelWatchersIntServer.h"
       
    23 #include "TE_TelWatchersIntTest.h"
       
    24 #include "simtsy.h"
       
    25 
       
    26 
       
    27 _LIT(KServerName,"TE_TelWatchersInt");
       
    28 
       
    29 
       
    30 /**
       
    31  *  Called inside the MainL() function to create and start the CTestServer
       
    32  *  derived server.
       
    33  *
       
    34  *  @return Instance of the test server
       
    35  */
       
    36 CTelWatchersIntTestServer* CTelWatchersIntTestServer::NewL()
       
    37 	{
       
    38 	CTelWatchersIntTestServer*  server = new(ELeave) CTelWatchersIntTestServer();
       
    39 	CleanupStack::PushL(server);
       
    40 	// CServer base class call
       
    41 	server->StartL(KServerName);
       
    42 	CleanupStack::Pop(server);
       
    43 	return server;
       
    44 	} // CTelWatchersIntTestIntServer::NewL
       
    45 
       
    46 
       
    47 /**
       
    48  *  Much simpler, uses the new Rendezvous() call to sync with the client.
       
    49  */
       
    50 LOCAL_C void MainL()
       
    51 	{
       
    52 	//
       
    53 	// Start an active scheduler...
       
    54 	//
       
    55 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
       
    56 	CleanupStack::PushL(scheduler);
       
    57 	CActiveScheduler::Install(scheduler);
       
    58 
       
    59 	//
       
    60 	// Create the CTestServer derived server...
       
    61 	//
       
    62 	CTelWatchersIntTestServer* server = NULL;
       
    63 
       
    64 	TRAPD(err, server = CTelWatchersIntTestServer::NewL());
       
    65 	if (err == KErrNone)
       
    66 		{
       
    67 		//
       
    68 		// Sync with the client and enter the active scheduler
       
    69 		//
       
    70 		RProcess::Rendezvous(KErrNone);
       
    71 		scheduler->Start();
       
    72 		}
       
    73 
       
    74 	//
       
    75 	// Clean up...
       
    76 	//
       
    77 	CleanupStack::Pop(scheduler);
       
    78 	delete server;
       
    79 	delete scheduler;
       
    80 	} // MainL
       
    81 /**
       
    82  *  @return Standard Epoc error code on exit.
       
    83  */
       
    84 GLDEF_C TInt E32Main()
       
    85 	{
       
    86 	CTrapCleanup*  cleanup = CTrapCleanup::New();
       
    87 
       
    88 	if (cleanup == NULL)
       
    89 		{
       
    90 		return KErrNoMemory;
       
    91 		}
       
    92 
       
    93 	TRAP_IGNORE(MainL());
       
    94 
       
    95 	delete cleanup;
       
    96 
       
    97 	return KErrNone;
       
    98 	} // E32Main
       
    99 
       
   100 
       
   101 /**
       
   102  *  Implementation of CTestServer pure virtual.
       
   103  *
       
   104  *  @return A CTestStep derived instance.
       
   105  */
       
   106 CTestStep* CTelWatchersIntTestServer::CreateTestStep(const TDesC& aStepName)
       
   107 	{
       
   108 	CTestStep*  testStep = NULL;
       
   109 
       
   110     //
       
   111 	// Create the required test step...
       
   112 	//		
       
   113 	if (aStepName == _L("TestRetrieveSignalStrengthWithPublishSubscribe"))
       
   114 		{
       
   115 		testStep = new(ELeave) CTelWatchersIntTestRetrieveSignalStrengthWithPublishSubscribe();
       
   116 		}
       
   117 		
       
   118 	if (aStepName == _L("TestRetrieveChargerStatusWithPublishSubscribe"))
       
   119 		{
       
   120 		testStep = new(ELeave) CTelWatchersIntTestRetrieveChargerStatusWithPublishSubscribe();
       
   121 		}
       
   122 
       
   123 	if (aStepName == _L("TestNetworkStatusWithPublishSubscribe"))
       
   124 		{
       
   125 		testStep = new(ELeave) CTelWatchersIntTestNetworkStatusWithPublishSubscribe();
       
   126 		}
       
   127 
       
   128 	if (aStepName == _L("TestIncomingCallStatusWithPublishSubscribe"))
       
   129 		{
       
   130 		testStep = new(ELeave) CTelWatchersIntTestIncomingCallStatusWithPublishSubscribe();
       
   131 		}
       
   132 		
       
   133 	if (aStepName == _L("TestOutgoingCallStatusWithPublishSubscribe"))
       
   134 		{
       
   135 		testStep = new(ELeave) CTelWatchersIntTestOutgoingCallStatusWithPublishSubscribe();
       
   136 		}
       
   137 		
       
   138 	if (aStepName == _L("TestIndicatorKErrNotSupportedScenarioWithPublishSubscribe"))
       
   139 		{
       
   140 		testStep = new(ELeave) CTelWatchersIntTestIndicatorKErrNotSupportedScenarioWithPublishSubscribe();
       
   141 		}
       
   142 		
       
   143 	if (aStepName == _L("TestIndicatorKErrEtelModemNotDetectedScenarioWithPublishSubscribe"))
       
   144 		{
       
   145 		testStep = new(ELeave) CTelWatchersIntTestIndicatorKErrEtelModemNotDetectedScenarioWithPublishSubscribe();
       
   146 		}
       
   147 
       
   148 	return testStep;
       
   149 	} // CTelWatchersIntTestServer::CreateTestStep