os/ossrv/genericservices/taskscheduler/Test/Testexecute/src/Te_floating_scheduleSuiteServer.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericservices/taskscheduler/Test/Testexecute/src/Te_floating_scheduleSuiteServer.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,136 @@
     1.4 +// Copyright (c) 2005-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 +#include "Te_floating_scheduleSuiteServer.h"
    1.24 +#include "persist_hometimeStep.h"
    1.25 +#include "persist_utcStep.h"
    1.26 +#include "persist_mixedStep.h"
    1.27 +#include "persist_hometime_floatStep.h"
    1.28 +#include "transient_hometimeStep.h"
    1.29 +#include "transient_utcStep.h"
    1.30 +#include "transient_mixedStep.h"
    1.31 +#include "transient_hometime_floatStep.h"
    1.32 +#include "hometime_floatStep.h"
    1.33 +#include "DEF061595_Step.h"
    1.34 +
    1.35 +_LIT(KServerName,"Te_floating_scheduleSuite");
    1.36 +CTe_floating_scheduleSuite* CTe_floating_scheduleSuite::NewL()
    1.37 +/**
    1.38 + * @return - Instance of the test server
    1.39 + * Same code for Secure and non-secure variants
    1.40 + * Called inside the MainL() function to create and start the
    1.41 + * CTestServer derived server.
    1.42 + */
    1.43 +	{
    1.44 +	CTe_floating_scheduleSuite * server = new (ELeave) CTe_floating_scheduleSuite();
    1.45 +	CleanupStack::PushL(server);
    1.46 +	// CServer base class call which can be either StartL or ConstructL,
    1.47 +	// the later will permit Server Logging.
    1.48 +
    1.49 +	server->StartL(KServerName);
    1.50 +	//server->ConstructL(KServerName);
    1.51 +	CleanupStack::Pop(server);
    1.52 +	return server;
    1.53 +	}
    1.54 +
    1.55 +
    1.56 +// Secure variants much simpler
    1.57 +// For EKA2, just an E32Main and a MainL()
    1.58 +LOCAL_C void MainL()
    1.59 +/**
    1.60 + * Secure variant
    1.61 + * Much simpler, uses the new Rendezvous() call to sync with the client
    1.62 + */
    1.63 +	{
    1.64 +	// Leave the hooks in for platform security
    1.65 +#if (defined __DATA_CAGING__)
    1.66 +	RProcess().DataCaging(RProcess::EDataCagingOn);
    1.67 +	RProcess().DataCaging(RProcess::ESecureApiOn);
    1.68 +#endif
    1.69 +	CActiveScheduler* sched=NULL;
    1.70 +	sched=new(ELeave) CActiveScheduler;
    1.71 +	CActiveScheduler::Install(sched);
    1.72 +	CTe_floating_scheduleSuite* server = NULL;
    1.73 +	// Create the CTestServer derived server
    1.74 +	TRAPD(err,server = CTe_floating_scheduleSuite::NewL());
    1.75 +	if(!err)
    1.76 +		{
    1.77 +		// Sync with the client and enter the active scheduler
    1.78 +		RProcess::Rendezvous(KErrNone);
    1.79 +		sched->Start();
    1.80 +		}
    1.81 +	delete server;
    1.82 +	delete sched;
    1.83 +	}
    1.84 +
    1.85 +
    1.86 +
    1.87 +GLDEF_C TInt E32Main()
    1.88 +/**
    1.89 + * @return - Standard Epoc error code on process exit
    1.90 + * Secure variant only
    1.91 + * Process entry point. Called by client using RProcess API
    1.92 + */
    1.93 +	{
    1.94 +	__UHEAP_MARK;
    1.95 +	CTrapCleanup* cleanup = CTrapCleanup::New();
    1.96 +	if(cleanup == NULL)
    1.97 +		{
    1.98 +		return KErrNoMemory;
    1.99 +		}
   1.100 +	TRAPD(err,MainL());
   1.101 +	delete cleanup;
   1.102 +	__UHEAP_MARKEND;
   1.103 +	return err;
   1.104 +    }
   1.105 +
   1.106 +
   1.107 +CTestStep* CTe_floating_scheduleSuite::CreateTestStep(const TDesC& aStepName)
   1.108 +/**
   1.109 + * @return - A CTestStep derived instance
   1.110 + * Secure and non-secure variants
   1.111 + * Implementation of CTestServer pure virtual
   1.112 + */
   1.113 +	{
   1.114 +	CTestStep* testStep = NULL;
   1.115 +	// They are created "just in time" when the worker thread is created
   1.116 +	// More test steps can be added below 
   1.117 +              if(aStepName == Kpersist_hometimeStep)
   1.118 +                            testStep = new Cpersist_hometimeStep();
   1.119 +              else if(aStepName == Kpersist_utcStep)
   1.120 +                            testStep = new Cpersist_utcStep();
   1.121 +              else if(aStepName == Kpersist_mixedStep)
   1.122 +                            testStep = new Cpersist_mixedStep();
   1.123 +              else if(aStepName == Kpersist_hometime_floatStep)
   1.124 +                            testStep = new Cpersist_hometime_floatStep();
   1.125 +              else if(aStepName == Ktransient_hometimeStep)
   1.126 +                            testStep = new Ctransient_hometimeStep();
   1.127 +              else if(aStepName == Ktransient_utcStep)
   1.128 +                            testStep = new Ctransient_utcStep();
   1.129 +              else if(aStepName == Ktransient_mixedStep)
   1.130 +                            testStep = new Ctransient_mixedStep();
   1.131 +              else if(aStepName == Ktransient_hometime_floatStep)
   1.132 +                            testStep = new Ctransient_hometime_floatStep();
   1.133 +              else if(aStepName == Khometime_floatStep)
   1.134 +                            testStep = new Chometime_floatStep();
   1.135 +              else if(aStepName == KDEF061595_Step)
   1.136 +                            testStep = new CDEF061595_Step();
   1.137 +              
   1.138 +	return testStep;
   1.139 +	}