commsfwtools/preparedefaultcommsdatabase/te_commsdat/src/CCommsdatSuiteServer.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2004-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 /**
       
    21  @file CCommsdatSuiteServer.cpp
       
    22 */
       
    23 
       
    24 #include "CCommsdatSuiteServer.h"
       
    25 #include "step_001_01.h"
       
    26 #include "step_002_01.h"
       
    27 #include "step_003_01.h"
       
    28 #include "step_004_01.h"
       
    29 
       
    30 
       
    31 _LIT(KServerName,"CCommsdatSuite");
       
    32 CCommsdatSuite* CCommsdatSuite::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 	CCommsdatSuite * server = new (ELeave) CCommsdatSuite();
       
    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 	CCommsdatSuite* server = NULL;
       
    69 	// Create the CTestServer derived server
       
    70 	TRAPD(err,server = CCommsdatSuite::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* CCommsdatSuite::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 == _L("step_001_01"))
       
   114                             testStep = new CCommsDatTest001_01();
       
   115               else if(aStepName == _L("step_001_02"))
       
   116                             testStep = new CCommsDatTest001_02();
       
   117               else if(aStepName == _L("step_001_03"))
       
   118                             testStep = new CCommsDatTest001_03();
       
   119               else if(aStepName == _L("step_001_04"))
       
   120                             testStep = new CCommsDatTest001_04();
       
   121               else if(aStepName == _L("step_001_05"))
       
   122                             testStep = new CCommsDatTest001_05();
       
   123               else if(aStepName == _L("step_002_01"))
       
   124                             testStep = new CCommsDatTest002_01();
       
   125               else if(aStepName == _L("step_002_02"))
       
   126                             testStep = new CCommsDatTest002_02();
       
   127               else if(aStepName == _L("step_002_03"))
       
   128                             testStep = new CCommsDatTest002_03();
       
   129               else if(aStepName == _L("step_002_04"))
       
   130                             testStep = new CCommsDatTest002_04();
       
   131               else if(aStepName == _L("step_002_05"))
       
   132                             testStep = new CCommsDatTest002_05();
       
   133               else if(aStepName == _L("step_002_06"))
       
   134                             testStep = new CCommsDatTest002_06();
       
   135               else if(aStepName == _L("step_002_07"))
       
   136                             testStep = new CCommsDatTest002_07();
       
   137               else if(aStepName == _L("step_002_08"))
       
   138                             testStep = new CCommsDatTest002_08();
       
   139               else if(aStepName == _L("step_002_09"))
       
   140                             testStep = new CCommsDatTest002_09();
       
   141               else if(aStepName == _L("step_002_10"))
       
   142                             testStep = new CCommsDatTest002_10();
       
   143               else if(aStepName == _L("step_002_11"))
       
   144                             testStep = new CCommsDatTest002_11();
       
   145               else if(aStepName == _L("step_002_12"))
       
   146                             testStep = new CCommsDatTest002_12();
       
   147               else if(aStepName == _L("step_002_13"))
       
   148                             testStep = new CCommsDatTest002_13();
       
   149               else if(aStepName == _L("step_003_01"))
       
   150                             testStep = new CCommsDatTest003_01();
       
   151               else if(aStepName == _L("step_003_02"))
       
   152                             testStep = new CCommsDatTest003_02();
       
   153               else if(aStepName == _L("step_003_03"))
       
   154                             testStep = new CCommsDatTest003_03();
       
   155               else if(aStepName == _L("step_003_04"))
       
   156                             testStep = new CCommsDatTest003_04();
       
   157               else if(aStepName == _L("step_003_05"))
       
   158                             testStep = new CCommsDatTest003_05();
       
   159               else if(aStepName == _L("step_003_06"))
       
   160                             testStep = new CCommsDatTest003_06();
       
   161               else if(aStepName == _L("step_004_01"))
       
   162                             testStep = new CCommsDatTest004_01();
       
   163               
       
   164 	return testStep;
       
   165 	}