testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/te_rfileloggersuiteserver.cpp
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     1 /*
       
     2 * Copyright (c) 2005-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 "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 * for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
       
    16 * in the process of the client. The client initialises the server by calling the
       
    17 * one and only ordinal.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 /**
       
    24  @file Te_RFileLoggerSuiteServer.cpp
       
    25 */
       
    26 
       
    27 #include "te_rfileloggersuiteserver.h"
       
    28 #include "addfield_logstep.h"
       
    29 #include "conn_closestep.h"
       
    30 
       
    31 _LIT(KServerName,"Te_RFileLoggerSuite");
       
    32 CTe_RFileLoggerSuite* CTe_RFileLoggerSuite::NewL()
       
    33 /**
       
    34  * @return - Instance of the test server
       
    35  * Same code for Secure and non-secure variants
       
    36  * Called inside the MainL() function to create and start the
       
    37  * CTestServer derived server.
       
    38  */
       
    39 	{
       
    40 	CTe_RFileLoggerSuite * server = new (ELeave) CTe_RFileLoggerSuite();
       
    41 	CleanupStack::PushL(server);
       
    42 	// CServer base class call which can be either StartL or ConstructL,
       
    43 	// the later will permit Server Logging.
       
    44 
       
    45 	server->StartL(KServerName);
       
    46 	//server->ConstructL(KServerName);
       
    47 	CleanupStack::Pop(server);
       
    48 	return server;
       
    49 	}
       
    50 
       
    51 
       
    52 // Secure variants much simpler
       
    53 // For EKA2, just an E32Main and a MainL()
       
    54 LOCAL_C void MainL()
       
    55 /**
       
    56  * Secure variant
       
    57  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    58  */
       
    59 	{
       
    60 	// Leave the hooks in for platform security
       
    61 #if (defined __DATA_CAGING__)
       
    62 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    63 	RProcess().DataCaging(RProcess::ESecureApiOn);
       
    64 #endif
       
    65 	CActiveScheduler* sched=NULL;
       
    66 	sched=new(ELeave) CActiveScheduler;
       
    67 	CActiveScheduler::Install(sched);
       
    68 	CTe_RFileLoggerSuite* server = NULL;
       
    69 	// Create the CTestServer derived server
       
    70 	TRAPD(err,server = CTe_RFileLoggerSuite::NewL());
       
    71 	if(!err)
       
    72 		{
       
    73 		// Sync with the client and enter the active scheduler
       
    74 		RProcess::Rendezvous(KErrNone);
       
    75 		sched->Start();
       
    76 		}
       
    77 	delete server;
       
    78 	delete sched;
       
    79 	}
       
    80 
       
    81 
       
    82 
       
    83 GLDEF_C TInt E32Main()
       
    84 /**
       
    85  * @return - Standard Epoc error code on process exit
       
    86  * Secure variant only
       
    87  * Process entry point. Called by client using RProcess API
       
    88  */
       
    89 	{
       
    90 	__UHEAP_MARK;
       
    91 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    92 	if(cleanup == NULL)
       
    93 		{
       
    94 		return KErrNoMemory;
       
    95 		}
       
    96 	TRAPD(err,MainL());
       
    97 	delete cleanup;
       
    98 	__UHEAP_MARKEND;
       
    99 	return KErrNone;
       
   100     }
       
   101 
       
   102 
       
   103 CTestStep* CTe_RFileLoggerSuite::CreateTestStep(const TDesC& aStepName)
       
   104 /**
       
   105  * @return - A CTestStep derived instance
       
   106  * Secure and non-secure variants
       
   107  * Implementation of CTestServer pure virtual
       
   108  */
       
   109 	{
       
   110 	CTestStep* testStep = NULL;
       
   111 	// They are created "just in time" when the worker thread is created
       
   112 	// More test steps can be added below 
       
   113               if(aStepName == Kaddfield_logStep)
       
   114                             testStep = new Caddfield_logStep();
       
   115               else if(aStepName == Kconn_closeStep)
       
   116                             testStep = new Cconn_closeStep();
       
   117 
       
   118 	return testStep;
       
   119 	}