lbstest/lbstestproduct/lbshybridmolr/src/ctlbshybridmolrserver.cpp
changeset 36 b47902b73a93
child 49 5f20f71a57a3
equal deleted inserted replaced
35:a2efdd544abf 36:b47902b73a93
       
     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 CTLbsHybridMTLRServer.cpp
       
    15 // This is the class implementation for the LBS Hybrid MOLR Test Server
       
    16 // 
       
    17 //
       
    18 
       
    19 // System includes
       
    20 #include <e32std.h>
       
    21 #include <rsshared.h>
       
    22 
       
    23 // User includes
       
    24 #include "ctlbshybridmolrserver.h"
       
    25 #include "ctlbsstepsetuproamselflocate.h"
       
    26 #include "ctlbsstepconfighybridmodule.h"
       
    27 
       
    28 #include "ctlbsuebasedmolrself.h"
       
    29 #include "ctlbsueassistedmolrselfgpslate.h"
       
    30 #include "ctlbsueassistedmolrselfgpsinaccurate.h"
       
    31 #include "ctlbsstepsetupprotocolstub.h"
       
    32 #include "ctlbshybridueassistedmolrgpsok.h"
       
    33 #include "ctlbsueassistedmolrselfgpsinaccuratetimeout.h"
       
    34 #include "ctlbsueassistedmolrselfgpslatefacilitytimeout.h"
       
    35 #include "ctlbsautonomousmolrfutile.h"
       
    36 #include "ctlbshybridmolrfutile.h"
       
    37 #include "ctlbshybriduebasedmolrpartial.h"
       
    38 #include "ctlbshybridueassistedmolrpartial.h"
       
    39 #include "ctlbshybridueassistedmolrclienttimeout.h"
       
    40 #include "ctlbshybridueassistedmolrtimeout.h"
       
    41 #include "ctlbsmolrgpsoptions.h"
       
    42 #include "ctlbshybridueassistedmolrnogpsupdate.h"
       
    43 #include "ctlbsptamolrpartialearlycomplete.h"
       
    44 #include "ctlbsmolrtracking.h"
       
    45 #include "ctlbsmolrresetassistance.h"
       
    46 #include "ctlbsuebasedmolrselfinternalvaluestest.h"
       
    47 #include "ctlbssuplmolrtbfutilesp.h"
       
    48 #include "ctlbsuebasedmolronesl.h"
       
    49 #include "ctlbsmolrerrorassistance.h"
       
    50 #include "ctlbshybridueassistednpudposstatus.h"
       
    51 
       
    52 /**
       
    53   NewL()
       
    54   Constructs a CT_LbsHybridMOLRServer object.
       
    55   Uses two phase construction and leaves nothing on the CleanupStack.
       
    56   @internalTechnology
       
    57   @param  none
       
    58   @return Created object of type CT_LbsClientServer
       
    59   @pre    None
       
    60   @post   None
       
    61 */
       
    62 CT_LbsHybridMOLRServer* CT_LbsHybridMOLRServer::NewL()
       
    63 	{
       
    64 	CT_LbsHybridMOLRServer*server = new(ELeave) CT_LbsHybridMOLRServer();
       
    65 	CleanupStack::PushL(server);
       
    66 	server->ConstructL(KLbsHybridMOLRTestServer);
       
    67 	CleanupStack::Pop(server);
       
    68 	return server;
       
    69 	}
       
    70 
       
    71 
       
    72 /**
       
    73   MainL()
       
    74   Description :		This is the main function which installs the 
       
    75 					active scheduler and creates a server
       
    76   @internalTechnology
       
    77   @param  none
       
    78   @return none
       
    79   @pre    None
       
    80   @post   None
       
    81 */
       
    82 LOCAL_C void MainL()
       
    83 	{
       
    84 	CActiveScheduler* sched = new (ELeave) CActiveScheduler;
       
    85 	CleanupStack::PushL(sched);
       
    86 	CActiveScheduler::Install(sched);
       
    87 
       
    88 	__UHEAP_MARK;
       
    89 	// this registers the server with the active scheduler and calls SetActive
       
    90 	CT_LbsHybridMOLRServer* server = CT_LbsHybridMOLRServer::NewL();
       
    91 
       
    92 	// signal to the client that we are ready by
       
    93 	// rendevousing process
       
    94 	RProcess::Rendezvous(KErrNone);
       
    95 
       
    96 	// run the active scheduler
       
    97 	sched->Start();
       
    98 
       
    99 	// clean up
       
   100 	delete server;
       
   101 	__UHEAP_MARKEND;
       
   102 	CleanupStack::PopAndDestroy(sched);
       
   103 	}
       
   104 
       
   105 
       
   106 
       
   107 
       
   108 /**
       
   109   E32Main()
       
   110   Description :	It is the entry point 
       
   111   @internalTechnology
       
   112   @param  none
       
   113   @return Returns the error code
       
   114   @pre    None
       
   115   @post   None
       
   116 */
       
   117 GLDEF_C TInt E32Main()
       
   118 	{
       
   119 	__UHEAP_MARK;
       
   120 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   121 	if(cleanup == NULL)
       
   122 		{
       
   123 		return KErrNoMemory;
       
   124 		}
       
   125 
       
   126 	TRAPD(err, MainL());
       
   127 
       
   128 	delete cleanup;
       
   129 	__UHEAP_MARKEND;
       
   130 
       
   131 	return err;
       
   132 	}
       
   133 
       
   134 
       
   135 CT_LbsHybridMOLRServer::~CT_LbsHybridMOLRServer()
       
   136 	{
       
   137 	}
       
   138 	
       
   139 	
       
   140 /**
       
   141   Function : CT_LbsHybridMOLRServer
       
   142   Description : Constructor
       
   143   @internalTechnology
       
   144   @param :
       
   145   @return : N/A
       
   146   @precondition : none
       
   147   @postcondition : none
       
   148 */
       
   149 CT_LbsHybridMOLRServer::CT_LbsHybridMOLRServer()
       
   150 	{
       
   151 	}
       
   152 
       
   153 /**
       
   154   Function : ConstructL
       
   155   Description : 
       
   156   @internalTechnology
       
   157   @param :
       
   158   @return : N/A
       
   159   @precondition : none
       
   160   @postcondition : none
       
   161 */
       
   162 void CT_LbsHybridMOLRServer::ConstructL(const TDesC& aName)
       
   163 	{
       
   164 	CT_LbsServer::ConstructL(aName);
       
   165 	
       
   166 	iSharedData = CT_LbsHybridMOLRSharedData::NewL();
       
   167 	}
       
   168 
       
   169 	
       
   170 /**
       
   171   Function : CreateTestStep
       
   172   Description : Creates a test step based on the step name read from the script file
       
   173   @internalTechnology
       
   174   @param : aStepName   The step name which needs to be created
       
   175   @return : Created object of type CTestStep
       
   176   @precondition : none
       
   177   @postcondition : none
       
   178 */
       
   179 CTestStep* CT_LbsHybridMOLRServer::CreateTestStep(const TDesC& aStepName)
       
   180 	{
       
   181 	// NULL if insufficient memory. This suits the API.
       
   182 
       
   183 	// Test case test steps, each test step supports one or more test cases.
       
   184 	if (aStepName == KLbsStep_SetupRoamSelfLocate)	
       
   185 		{
       
   186 		return CT_LbsStep_SetupRoamSelfLocate::New(*this);
       
   187 		}	
       
   188 	else if(aStepName == KLbsStep_SetupProtocolStub)	
       
   189 		{
       
   190 		return CT_LbsStep_SetupProtocolStub::New(*this);
       
   191 		}	
       
   192 	else if(aStepName == KLbsStep_ConfigHybridModule)	
       
   193 		{
       
   194 		return CT_LbsStep_ConfigHybridModule::New(*this);
       
   195 		}	
       
   196 
       
   197 	else if(aStepName == KLbsUEBasedMOLRSelf)	
       
   198 		{
       
   199 		return CT_LbsUEBasedMOLRSelf::New(*this);
       
   200 		}
       
   201 	else if (aStepName == KLbsUEAssistedMOLRSelfGPSLate)
       
   202 		{
       
   203 		return CT_LbsUEAssistedMOLRSelfGPSLate::New(*this);
       
   204 		}
       
   205 	else if (aStepName == KLbsUEAssistedMOLRSelfGPSInaccurate)
       
   206 		{
       
   207 		return CT_LbsUEAssistedMOLRSelfGPSInaccurate::New(*this);
       
   208 		}
       
   209 	else if(aStepName == KLbsUEAssistedMOLRSelfGPSInaccurateT)	
       
   210 		{
       
   211 		return CT_LbsUEAssistedMOLRSelfGPSInaccurateT::New(*this);
       
   212 		}
       
   213 
       
   214 	else if(aStepName == KLbsHybridUEAssistedMOLRGPSOk)	
       
   215 		{
       
   216 		return CT_LbsHybridUEAssistedMOLRGPSOk::New(*this);
       
   217 		}
       
   218 
       
   219 	else if (aStepName == KLbsAutonomousMOLRFutile)
       
   220 		{
       
   221 		return CT_LbsAutonomousMOLRFutile::New(*this);
       
   222 		}
       
   223 
       
   224 	else if (aStepName == KLbsHybridUEBasedMOLRPartial)
       
   225 		{
       
   226 		return CT_LbsHybridUEBasedMOLRPartial::New(*this);
       
   227 		}
       
   228 	else if (aStepName == KLbsHybridUEAssistedMOLRPartial)
       
   229 		{
       
   230 		return CT_LbsHybridUEAssistedMOLRPartial::New(*this);
       
   231 		}
       
   232 	else if (aStepName == KLbsUEAssistedMOLRSelfGPSLateFacTimeout)
       
   233 	    {
       
   234 		return CT_LbsUEAssistedMOLRSelfGPSLateFacTimeout::New(*this);
       
   235 	    }
       
   236 	else if (aStepName == KLbsHybridMOLRFutile)	
       
   237 		{
       
   238 		return CT_LbsHybridMOLRFutile::New(*this);		
       
   239 		}	
       
   240 	else if (aStepName == KLbsUEAssistedMOLRClientTimeout)
       
   241 		{
       
   242 		return CT_LbsUEAssistedMOLRClientTimeout::New(*this);		
       
   243 		}	
       
   244 	else if (aStepName == KLbsHybridUEAssistedMOLRTimeOut)
       
   245 		{
       
   246 		return CT_LbsHybridUEAssistedMOLRTimeOut::New(*this);
       
   247 		}
       
   248 	else if (aStepName == KLbsMolrGpsOptions)
       
   249 		{
       
   250 		return CT_LbsMolrGpsOptions::New(*this);
       
   251 		}
       
   252 	else if (aStepName == KLbsHybridUEAssistedMOLRNoGPSUpdate)
       
   253 		{
       
   254 		return CT_LbsHybridUEAssistedMOLRNoGPSUpdate::New(*this);
       
   255 		}
       
   256 	else if (aStepName == KLbsPTAMOLRPartialEarlyComplete)
       
   257 		{
       
   258 		return CT_LbsPTAMOLRPartialEarlyComplete::New(*this);
       
   259 		}
       
   260 	else if (aStepName == KLbsMolrTracking)
       
   261 		{
       
   262 		return CT_LbsMolrTracking::New(*this);
       
   263 		}
       
   264 	else if (aStepName == KLbsMolrResetAssistance)
       
   265 		{
       
   266 		return CT_LbsMolrResetAssistance::New(*this);
       
   267 		}
       
   268 	else if (aStepName == KLbsUEBasedMOLRSelfInternalValueTest)
       
   269 		{
       
   270 		return CT_LbsUEBasedMOLRSelfInternalValueTest::New(*this);
       
   271 		}
       
   272 	else if (aStepName == KLbsSuplMolrTbFutileSp)
       
   273 		{
       
   274 		return CT_LbsSuplMolrTbFutileSp::New(*this);
       
   275 		}
       
   276 	else if (aStepName == KLbsUEBasedMOLROneSL)
       
   277 		{
       
   278 		return CT_LbsUEBasedMOLROneSL::New(*this);
       
   279 		}
       
   280 	else if (aStepName == KLbsMOLRErrorAssistance)
       
   281 	    {
       
   282 	    return CT_LbsMolrErrorAssistance::New(*this);
       
   283 	    }
       
   284 	else if (aStepName == KLbsHybridUEAssistedNpudPosStatus)
       
   285 	    {
       
   286 	    return CT_LbsHybridUEAssistedNpudPosStatus::New(*this);
       
   287 	    }
       
   288 		
       
   289 	// Let base class handle any common test steps - will return NULL if test step is not supported.
       
   290 	return CT_LbsServer::CreateTestStep(aStepName);
       
   291 	}
       
   292