telephonyserverplugins/simtsy/test/Te_SimSS/Te_SimSSTestServer.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 //
       
    15 
       
    16 #include "Te_SimSSTestServer.h"
       
    17 #include "Te_SimSS.h"
       
    18 
       
    19 _LIT(KServerName,"Te_SimSS");
       
    20 
       
    21 CSimSSTestServer* CSimSSTestServer::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 	CSimSSTestServer * testServer = new (ELeave) CSimSSTestServer();
       
    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 	CSimSSTestServer* testServer = NULL;
       
    55 	TRAPD(err,testServer = CSimSSTestServer::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* CSimSSTestServer::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 	CTestStep* testStep = NULL;
       
    93 
       
    94 	if(aStepName == _L("TestCallBarring"))
       
    95 		{
       
    96 		testStep = new CTestCallBarring();
       
    97 		}
       
    98 	else if (aStepName == _L("TestCallForwarding"))
       
    99 		{
       
   100 		testStep = new CTestCallForwarding();
       
   101 		}
       
   102 	else if (aStepName == _L("TestCallWaiting"))
       
   103 		{
       
   104 		testStep = new CTestCallWaiting();
       
   105 		}
       
   106 	else if (aStepName == _L("TestIdentityService"))
       
   107 		{
       
   108 		testStep = new CTestIdentityService();
       
   109 		}
       
   110 
       
   111 	return testStep;
       
   112 	}
       
   113 
       
   114 
       
   115 
       
   116