lbstest/lbstestproduct/lbshybridmultiple/src/ctlbshybridmultipleserver.cpp
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 // Copyright (c) 2007-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 // @file CTLbsHybridMultipleServer.cpp
       
    15 // This is the class implementation for the LBS Hybrid Multiple Test Server
       
    16 // 
       
    17 //
       
    18 
       
    19 // System includes
       
    20 #include <e32std.h>
       
    21 #include <rsshared.h>
       
    22 
       
    23 // User includes
       
    24 #include "ctlbshybridmultipleserver.h"
       
    25 #include "ctlbsstepsetupprotocolstub.h"
       
    26 #include "ctlbsstepsetupmultipleprotocolstubs.h"
       
    27 #include "ctlbsstepconfighybridmodule.h"
       
    28 #include "ctlbsstepsetuproamselflocate.h"
       
    29 #include "ctlbshybridmultipletest.h"
       
    30 #include "ctlbsstepsetuppsy.h"
       
    31 
       
    32 /**
       
    33   MainL()
       
    34   Description :		This is the main function which installs the 
       
    35 					active scheduler and creates a server
       
    36   @internalTechnology
       
    37   @param  none
       
    38   @return none
       
    39   @pre    None
       
    40   @post   None
       
    41 */
       
    42 LOCAL_C void MainL()
       
    43 	{
       
    44 	CActiveScheduler* sched = new (ELeave) CActiveScheduler;
       
    45 	CleanupStack::PushL(sched);
       
    46 	CActiveScheduler::Install(sched);
       
    47 
       
    48 	__UHEAP_MARK;
       
    49 	// this registers the server with the active scheduler and calls SetActive
       
    50 	CT_LbsHybridMultipleServer* server = CT_LbsHybridMultipleServer::NewL();
       
    51 
       
    52 	// signal to the client that we are ready by
       
    53 	// rendevousing process
       
    54 	RProcess::Rendezvous(KErrNone);
       
    55 
       
    56 	// run the active scheduler
       
    57 	sched->Start();
       
    58 
       
    59 	// clean up
       
    60 	delete server;
       
    61 	__UHEAP_MARKEND;
       
    62 	CleanupStack::PopAndDestroy(sched);
       
    63 	}
       
    64 
       
    65 
       
    66 
       
    67 
       
    68 /**
       
    69   E32Main()
       
    70   Description :	It is the entry point 
       
    71   @internalTechnology
       
    72   @param  none
       
    73   @return Returns the error code
       
    74   @pre    None
       
    75   @post   None
       
    76 */
       
    77 GLDEF_C TInt E32Main()
       
    78 	{
       
    79 	__UHEAP_MARK;
       
    80 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    81 	if(cleanup == NULL)
       
    82 		{
       
    83 		return KErrNoMemory;
       
    84 		}
       
    85 
       
    86 	TRAPD(err, MainL());
       
    87 
       
    88 	delete cleanup;
       
    89 	__UHEAP_MARKEND;
       
    90 
       
    91 	return err;
       
    92 	}
       
    93     
       
    94 
       
    95 
       
    96 /**
       
    97   NewL()
       
    98   Constructs a CT_LbsHybridMultipleServer object.
       
    99   Uses two phase construction and leaves nothing on the CleanupStack.
       
   100   @internalTechnology
       
   101   @param  none
       
   102   @return Created object of type CT_LbsClientServer
       
   103   @pre    None
       
   104   @post   None
       
   105 */
       
   106 CT_LbsHybridMultipleServer* CT_LbsHybridMultipleServer::NewL()
       
   107 	{
       
   108 	CT_LbsHybridMultipleServer* server = new(ELeave) CT_LbsHybridMultipleServer();
       
   109 	CleanupStack::PushL(server);
       
   110 	server->ConstructL(KLbsHybridMultipleTestServer);
       
   111 	CleanupStack::Pop(server);
       
   112 	return server;
       
   113 	}
       
   114 
       
   115 
       
   116 CT_LbsHybridMultipleServer::~CT_LbsHybridMultipleServer()
       
   117 	{
       
   118 	}
       
   119 	
       
   120 	
       
   121 /**
       
   122   Function : CT_LbsHybridMultipleServer
       
   123   Description : Constructor
       
   124   @internalTechnology
       
   125   @param :
       
   126   @return : N/A
       
   127   @precondition : none
       
   128   @postcondition : none
       
   129 */
       
   130 CT_LbsHybridMultipleServer::CT_LbsHybridMultipleServer()
       
   131 	{
       
   132 	}
       
   133 
       
   134 /**
       
   135   Function : ConstructL
       
   136   Description : 
       
   137   @internalTechnology
       
   138   @param :
       
   139   @return : N/A
       
   140   @precondition : none
       
   141   @postcondition : none
       
   142 */
       
   143 void CT_LbsHybridMultipleServer::ConstructL(const TDesC& aName)
       
   144 	{
       
   145 	CT_LbsServer::ConstructL(aName);
       
   146 	
       
   147 	//iSharedData = CT_LbsHybridMTLRSharedData::NewL();
       
   148 	}
       
   149 
       
   150 	
       
   151 /**
       
   152   Function : CreateTestStep
       
   153   Description : Creates a test step based on the step name read from the script file
       
   154   @internalTechnology
       
   155   @param : aStepName   The step name which needs to be created
       
   156   @return : Created object of type CTestStep
       
   157   @precondition : none
       
   158   @postcondition : none
       
   159 */
       
   160 CTestStep* CT_LbsHybridMultipleServer::CreateTestStep(const TDesC& aStepName)
       
   161 	{
       
   162 	// NULL if insufficient memory. This suits the API.
       
   163 
       
   164 	// Test case test steps, each test step supports one or more test cases.
       
   165 	if(aStepName == KLbsStep_SetupProtocolStub)	
       
   166 		{
       
   167 		return CT_LbsStep_SetupProtocolStub::New(*this);
       
   168 		}
       
   169 	else if(aStepName == KLbsStep_SetupMultipleProtocolStubs)
       
   170 		{
       
   171 		return CT_LbsStep_SetupMultipleProtocolStubs::New(*this);
       
   172 		}
       
   173 	else if (aStepName == KLbsStep_SetupRoamSelfLocate)	
       
   174 		{
       
   175 		return CT_LbsStep_SetupRoamSelfLocate::New(*this);
       
   176 		}
       
   177 	else if(aStepName == KLbsStep_ConfigHybridModule)	
       
   178 		{
       
   179 		return CT_LbsStep_ConfigHybridModule::New(*this);
       
   180 		}	
       
   181 	else if (aStepName == KLbsHybridMultipleTest)
       
   182 		{
       
   183 		return CT_LbsHybridMultipleTest::New(*this);
       
   184 		}
       
   185 
       
   186 	// Let base class handle any common test steps - will return NULL if test step is not supported.
       
   187 	return CT_LbsServer::CreateTestStep(aStepName);
       
   188 	}