genericservices/taskscheduler/Test/Testexecute/src/Te_floating_scheduleSuiteServer.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
       
    15 // in the process of the client. The client initialises the server by calling the
       
    16 // one and only ordinal.
       
    17 // 
       
    18 //
       
    19 
       
    20 #include "Te_floating_scheduleSuiteServer.h"
       
    21 #include "persist_hometimeStep.h"
       
    22 #include "persist_utcStep.h"
       
    23 #include "persist_mixedStep.h"
       
    24 #include "persist_hometime_floatStep.h"
       
    25 #include "transient_hometimeStep.h"
       
    26 #include "transient_utcStep.h"
       
    27 #include "transient_mixedStep.h"
       
    28 #include "transient_hometime_floatStep.h"
       
    29 #include "hometime_floatStep.h"
       
    30 #include "DEF061595_Step.h"
       
    31 
       
    32 _LIT(KServerName,"Te_floating_scheduleSuite");
       
    33 CTe_floating_scheduleSuite* CTe_floating_scheduleSuite::NewL()
       
    34 /**
       
    35  * @return - Instance of the test server
       
    36  * Same code for Secure and non-secure variants
       
    37  * Called inside the MainL() function to create and start the
       
    38  * CTestServer derived server.
       
    39  */
       
    40 	{
       
    41 	CTe_floating_scheduleSuite * server = new (ELeave) CTe_floating_scheduleSuite();
       
    42 	CleanupStack::PushL(server);
       
    43 	// CServer base class call which can be either StartL or ConstructL,
       
    44 	// the later will permit Server Logging.
       
    45 
       
    46 	server->StartL(KServerName);
       
    47 	//server->ConstructL(KServerName);
       
    48 	CleanupStack::Pop(server);
       
    49 	return server;
       
    50 	}
       
    51 
       
    52 
       
    53 // Secure variants much simpler
       
    54 // For EKA2, just an E32Main and a MainL()
       
    55 LOCAL_C void MainL()
       
    56 /**
       
    57  * Secure variant
       
    58  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    59  */
       
    60 	{
       
    61 	// Leave the hooks in for platform security
       
    62 #if (defined __DATA_CAGING__)
       
    63 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    64 	RProcess().DataCaging(RProcess::ESecureApiOn);
       
    65 #endif
       
    66 	CActiveScheduler* sched=NULL;
       
    67 	sched=new(ELeave) CActiveScheduler;
       
    68 	CActiveScheduler::Install(sched);
       
    69 	CTe_floating_scheduleSuite* server = NULL;
       
    70 	// Create the CTestServer derived server
       
    71 	TRAPD(err,server = CTe_floating_scheduleSuite::NewL());
       
    72 	if(!err)
       
    73 		{
       
    74 		// Sync with the client and enter the active scheduler
       
    75 		RProcess::Rendezvous(KErrNone);
       
    76 		sched->Start();
       
    77 		}
       
    78 	delete server;
       
    79 	delete sched;
       
    80 	}
       
    81 
       
    82 
       
    83 
       
    84 GLDEF_C TInt E32Main()
       
    85 /**
       
    86  * @return - Standard Epoc error code on process exit
       
    87  * Secure variant only
       
    88  * Process entry point. Called by client using RProcess API
       
    89  */
       
    90 	{
       
    91 	__UHEAP_MARK;
       
    92 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    93 	if(cleanup == NULL)
       
    94 		{
       
    95 		return KErrNoMemory;
       
    96 		}
       
    97 	TRAPD(err,MainL());
       
    98 	delete cleanup;
       
    99 	__UHEAP_MARKEND;
       
   100 	return err;
       
   101     }
       
   102 
       
   103 
       
   104 CTestStep* CTe_floating_scheduleSuite::CreateTestStep(const TDesC& aStepName)
       
   105 /**
       
   106  * @return - A CTestStep derived instance
       
   107  * Secure and non-secure variants
       
   108  * Implementation of CTestServer pure virtual
       
   109  */
       
   110 	{
       
   111 	CTestStep* testStep = NULL;
       
   112 	// They are created "just in time" when the worker thread is created
       
   113 	// More test steps can be added below 
       
   114               if(aStepName == Kpersist_hometimeStep)
       
   115                             testStep = new Cpersist_hometimeStep();
       
   116               else if(aStepName == Kpersist_utcStep)
       
   117                             testStep = new Cpersist_utcStep();
       
   118               else if(aStepName == Kpersist_mixedStep)
       
   119                             testStep = new Cpersist_mixedStep();
       
   120               else if(aStepName == Kpersist_hometime_floatStep)
       
   121                             testStep = new Cpersist_hometime_floatStep();
       
   122               else if(aStepName == Ktransient_hometimeStep)
       
   123                             testStep = new Ctransient_hometimeStep();
       
   124               else if(aStepName == Ktransient_utcStep)
       
   125                             testStep = new Ctransient_utcStep();
       
   126               else if(aStepName == Ktransient_mixedStep)
       
   127                             testStep = new Ctransient_mixedStep();
       
   128               else if(aStepName == Ktransient_hometime_floatStep)
       
   129                             testStep = new Ctransient_hometime_floatStep();
       
   130               else if(aStepName == Khometime_floatStep)
       
   131                             testStep = new Chometime_floatStep();
       
   132               else if(aStepName == KDEF061595_Step)
       
   133                             testStep = new CDEF061595_Step();
       
   134               
       
   135 	return testStep;
       
   136 	}