os/persistentdata/loggingservices/rfilelogger/Logger/te_RFileLogger/src/Te_RFileLoggerSuiteServer.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/loggingservices/rfilelogger/Logger/te_RFileLogger/src/Te_RFileLoggerSuiteServer.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,116 @@
     1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
    1.18 +// in the process of the client. The client initialises the server by calling the
    1.19 +// one and only ordinal.
    1.20 +// 
    1.21 +//
    1.22 +
    1.23 +/**
    1.24 + @file Te_RFileLoggerSuiteServer.cpp
    1.25 +*/
    1.26 +
    1.27 +#include "Te_RFileLoggerSuiteServer.h"
    1.28 +#include "addfield_logStep.h"
    1.29 +#include "conn_closeStep.h"
    1.30 +
    1.31 +_LIT(KServerName,"Te_RFileLoggerSuite");
    1.32 +CTe_RFileLoggerSuite* CTe_RFileLoggerSuite::NewL()
    1.33 +/**
    1.34 + * @return - Instance of the test server
    1.35 + * Same code for Secure and non-secure variants
    1.36 + * Called inside the MainL() function to create and start the
    1.37 + * CTestServer derived server.
    1.38 + */
    1.39 +	{
    1.40 +	CTe_RFileLoggerSuite * server = new (ELeave) CTe_RFileLoggerSuite();
    1.41 +	CleanupStack::PushL(server);
    1.42 +	// CServer base class call which can be either StartL or ConstructL,
    1.43 +	// the later will permit Server Logging.
    1.44 +
    1.45 +	server->StartL(KServerName);
    1.46 +	//server->ConstructL(KServerName);
    1.47 +	CleanupStack::Pop(server);
    1.48 +	return server;
    1.49 +	}
    1.50 +
    1.51 +
    1.52 +// Secure variants much simpler
    1.53 +// For EKA2, just an E32Main and a MainL()
    1.54 +LOCAL_C void MainL()
    1.55 +/**
    1.56 + * Secure variant
    1.57 + * Much simpler, uses the new Rendezvous() call to sync with the client
    1.58 + */
    1.59 +	{
    1.60 +	// Leave the hooks in for platform security
    1.61 +#if (defined __DATA_CAGING__)
    1.62 +	RProcess().DataCaging(RProcess::EDataCagingOn);
    1.63 +	RProcess().DataCaging(RProcess::ESecureApiOn);
    1.64 +#endif
    1.65 +	CActiveScheduler* sched=NULL;
    1.66 +	sched=new(ELeave) CActiveScheduler;
    1.67 +	CActiveScheduler::Install(sched);
    1.68 +	CTe_RFileLoggerSuite* server = NULL;
    1.69 +	// Create the CTestServer derived server
    1.70 +	TRAPD(err,server = CTe_RFileLoggerSuite::NewL());
    1.71 +	if(!err)
    1.72 +		{
    1.73 +		// Sync with the client and enter the active scheduler
    1.74 +		RProcess::Rendezvous(KErrNone);
    1.75 +		sched->Start();
    1.76 +		}
    1.77 +	delete server;
    1.78 +	delete sched;
    1.79 +	}
    1.80 +
    1.81 +
    1.82 +
    1.83 +GLDEF_C TInt E32Main()
    1.84 +/**
    1.85 + * @return - Standard Epoc error code on process exit
    1.86 + * Secure variant only
    1.87 + * Process entry point. Called by client using RProcess API
    1.88 + */
    1.89 +	{
    1.90 +	__UHEAP_MARK;
    1.91 +	CTrapCleanup* cleanup = CTrapCleanup::New();
    1.92 +	if(cleanup == NULL)
    1.93 +		{
    1.94 +		return KErrNoMemory;
    1.95 +		}
    1.96 +	TRAP_IGNORE(MainL());
    1.97 +	delete cleanup;
    1.98 +	__UHEAP_MARKEND;
    1.99 +	return KErrNone;
   1.100 +    }
   1.101 +
   1.102 +
   1.103 +CTestStep* CTe_RFileLoggerSuite::CreateTestStep(const TDesC& aStepName)
   1.104 +/**
   1.105 + * @return - A CTestStep derived instance
   1.106 + * Secure and non-secure variants
   1.107 + * Implementation of CTestServer pure virtual
   1.108 + */
   1.109 +	{
   1.110 +	CTestStep* testStep = NULL;
   1.111 +	// They are created "just in time" when the worker thread is created
   1.112 +	// More test steps can be added below 
   1.113 +              if(aStepName == Kaddfield_logStep)
   1.114 +                            testStep = new Caddfield_logStep();
   1.115 +              else if(aStepName == Kconn_closeStep)
   1.116 +                            testStep = new Cconn_closeStep();
   1.117 +
   1.118 +	return testStep;
   1.119 +	}