installationservices/swidevicetools/test/tswiconsole/tswiconsoleserver.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * This file provides implementation for CTSwiConsoleServer
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <eikenv.h>
       
    22 
       
    23 #include "tswiconsoleserver.h"
       
    24 #include "tswiconsolestep.h"
       
    25 #include "tswiconsoleutilitystep.h"
       
    26 
       
    27 _LIT(KServerName,"tswiconsole");
       
    28 
       
    29 CTSwiConsoleServer* CTSwiConsoleServer::NewL()
       
    30 /**
       
    31  * @return - Instance of the test server
       
    32  * Called inside the MainL() function to create and start the
       
    33  * CTestServer derived server.
       
    34  */
       
    35 	{
       
    36 	CTSwiConsoleServer * server = new (ELeave) CTSwiConsoleServer();
       
    37 	CleanupStack::PushL(server);
       
    38 	
       
    39 	server-> ConstructL(KServerName);
       
    40 	CleanupStack::Pop(server);
       
    41 	return server;
       
    42 	}
       
    43 
       
    44 LOCAL_C void MainL()
       
    45 	{
       
    46 #if (defined __DATA_CAGING__)
       
    47 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    48 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    49 #endif
       
    50 	
       
    51 	CActiveScheduler* sched = new(ELeave) CActiveScheduler;
       
    52 	CActiveScheduler::Install(sched);
       
    53 	CTSwiConsoleServer* server = NULL;
       
    54 	// Create the CTestServer derived server
       
    55 	TRAPD(err,server = CTSwiConsoleServer::NewL());
       
    56 	if(KErrNone == err)
       
    57 		{
       
    58 		// Sync with the client and enter the active scheduler
       
    59 		RProcess::Rendezvous(KErrNone);
       
    60 		sched->Start();
       
    61 		}
       
    62 		
       
    63 	delete server;
       
    64 	delete sched;
       
    65 	}
       
    66 
       
    67 /**
       
    68  * @return - Standard Epoc error code on exit
       
    69  */
       
    70 GLDEF_C TInt E32Main()
       
    71 	{
       
    72 	__UHEAP_MARK;
       
    73 
       
    74 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    75 	TInt err = KErrNone;
       
    76 	if (cleanup)
       
    77 		{
       
    78 		TRAP(err, MainL());
       
    79 		delete cleanup;
       
    80 		}
       
    81 
       
    82 	__UHEAP_MARKEND;
       
    83 	return err;
       
    84 	}
       
    85 
       
    86 CTestStep* CTSwiConsoleServer::CreateTestStep(const TDesC& aStepName)
       
    87 /**
       
    88  * @return - A CTestStep derived instance
       
    89  * Implementation of CTestServer pure virtual
       
    90  */
       
    91 	{
       
    92 	CTestStep* testStep = NULL;
       
    93 
       
    94 	if(aStepName == KTSwiConsoleStep)
       
    95 		{
       
    96 		testStep = new CTSwiConsoleStep();
       
    97 		}
       
    98 	else if(aStepName == KTSwiConsoleUtilityStep)
       
    99 		{
       
   100 		testStep = new CTSwiConsoleUtilityStep();
       
   101 		}
       
   102 	
       
   103 	return testStep;
       
   104 	}
       
   105