lbs/lbsclient/src/ctlbsclientserver.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2006-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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file CT_LbsClientServer.cpp
       
    15 // This is the class implementation for the LBS Client Test Server
       
    16 // 
       
    17 //
       
    18 
       
    19 // User includes
       
    20 #include "ctlbsclientserver.h"
       
    21 
       
    22 // System includes
       
    23 #include <e32std.h>
       
    24 #include <rsshared.h>
       
    25 
       
    26 // Header files of LBS Client API Test Steps
       
    27 #include "ctlbsstepconfighybridmodule.h"
       
    28 #include "ctlbsclientstepsrvconnectclose.h"
       
    29 #include "ctlbsclientstepnotifyposupdate.h"
       
    30 #include "ctlbsclientstepcellbasednpud.h"
       
    31 #include "ctlbsclientstepopenclose.h"
       
    32 #include "ctlbsclientstepsrvversion.h"
       
    33 #include "ctlbsclientstepmodselect.h"
       
    34 #include "ctlbsclientstepmodinfo.h"
       
    35 #include "ctlbsclientsteplastknownpos.h"
       
    36 #include "ctlbsclientstepmultireq.h"
       
    37 #include "ctlbsclientstepmodstatus.h"
       
    38 #include "ctlbsclientstepupdateoptions.h"
       
    39 #include "ctlbsclientstepassistance.h"
       
    40 #include "ctlbsclientsteppartialupdate.h"
       
    41 #include "ctlbsclientsteptracking.h"
       
    42 #include "ctlbsclientstepignoreaccurracysetting.h"
       
    43 #include "ctlbsclientstepignoreaccurracysettingtracking.h"
       
    44 #include "ctlbsclientstep_reset_assistance.h"
       
    45 
       
    46 /**
       
    47   MainL()
       
    48   Description :		This is the main function which installs the 
       
    49 					active scheduler and creates an object of the Email server
       
    50   @internalTechnology
       
    51   @param  none
       
    52   @return none
       
    53   @pre    None
       
    54   @post   None
       
    55 */
       
    56 LOCAL_C void MainL()
       
    57 	{
       
    58 	__UHEAP_MARK;
       
    59 	CActiveScheduler* sched = new (ELeave) CActiveScheduler;
       
    60 	CleanupStack::PushL(sched);
       
    61 	CActiveScheduler::Install(sched);
       
    62 
       
    63 	__UHEAP_MARK;
       
    64 	// this registers the server with the active scheduler and calls SetActive
       
    65 	CT_LbsClientServer* server = CT_LbsClientServer::NewL();
       
    66 
       
    67 	// signal to the client that we are ready by
       
    68 	// rendevousing process
       
    69 	RProcess::Rendezvous(KErrNone);
       
    70 
       
    71 	// run the active scheduler
       
    72 	sched->Start();
       
    73 
       
    74 	// clean up
       
    75 	delete server;
       
    76 	
       
    77 	__UHEAP_MARKEND;
       
    78 	
       
    79 	CleanupStack::PopAndDestroy(sched);
       
    80 	__UHEAP_MARKEND;
       
    81 	}
       
    82 
       
    83 
       
    84 
       
    85 
       
    86 /**
       
    87   E32Main()
       
    88   Description :	It is the entry point 
       
    89   @internalTechnology
       
    90   @param  none
       
    91   @return Returns the error code
       
    92   @pre    None
       
    93   @post   None
       
    94 */
       
    95 GLDEF_C TInt E32Main()
       
    96 	{
       
    97 	__UHEAP_MARK;
       
    98 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    99 	if(cleanup == NULL)
       
   100 		{
       
   101 		return KErrNoMemory;
       
   102 		}
       
   103 
       
   104 	TRAPD(err, MainL());
       
   105 
       
   106 	delete cleanup;
       
   107 	__UHEAP_MARKEND;
       
   108 
       
   109 	return err;
       
   110 	}
       
   111     
       
   112 
       
   113 
       
   114 /**
       
   115   NewL()
       
   116   Constructs a CT_LbsClientServer object.
       
   117   Uses two phase construction and leaves nothing on the CleanupStack.
       
   118   @internalTechnology
       
   119   @param  none
       
   120   @return Created object of type CT_LbsClientServer
       
   121   @pre    None
       
   122   @post   None
       
   123 */
       
   124 CT_LbsClientServer* CT_LbsClientServer::NewL()
       
   125 	{
       
   126 	CT_LbsClientServer*server = new(ELeave) CT_LbsClientServer();
       
   127 	CleanupStack::PushL(server);
       
   128 	server->ConstructL(KLbsClientTestServer);
       
   129 	CleanupStack::Pop(server);
       
   130 	return server;
       
   131 	}
       
   132 
       
   133 
       
   134 CT_LbsClientServer::~CT_LbsClientServer()
       
   135 	{
       
   136 	// DELETE EVERYTHIGN THAT IS ALLOCATED IN THE ConstructL(!)
       
   137 	delete iSharedData;
       
   138 	iSharedData = NULL;
       
   139 	}
       
   140 	
       
   141 	
       
   142 /**
       
   143   Function : CT_LbsClientServer
       
   144   Description : Constructor
       
   145   @internalTechnology
       
   146   @param :
       
   147   @return : N/A
       
   148   @precondition : none
       
   149   @postcondition : none
       
   150 */
       
   151 CT_LbsClientServer::CT_LbsClientServer()
       
   152 	{
       
   153 	}
       
   154 
       
   155 /**
       
   156   Function : ConstructL
       
   157   Description : 
       
   158   @internalTechnology
       
   159   @param :
       
   160   @return : N/A
       
   161   @precondition : none
       
   162   @postcondition : none
       
   163 */
       
   164 void CT_LbsClientServer::ConstructL(const TDesC& aName)
       
   165 	{
       
   166 	CT_LbsServer::ConstructL(aName);
       
   167 	
       
   168 	iSharedData = CT_LbsSharedData::NewL();
       
   169 	}
       
   170 
       
   171 	
       
   172 /**
       
   173   Function : CreateTestStep
       
   174   Description : Creates a test step based on the step name read from the script file
       
   175   @internalTechnology
       
   176   @param : aStepName   The step name which needs to be created
       
   177   @return : Created object of type CTestStep
       
   178   @precondition : none
       
   179   @postcondition : none
       
   180 */
       
   181 CTestStep* CT_LbsClientServer::CreateTestStep(const TDesC& aStepName)
       
   182 	{
       
   183 	// NULL if insufficient memory. This suits the API.
       
   184 
       
   185 	// Test case test steps, each test step supports one or more test cases.
       
   186 	if(aStepName == KLbsStep_ConfigHybridModule)	
       
   187 		{
       
   188 		return CT_LbsStep_ConfigHybridModule::New(*this);
       
   189 		}	
       
   190 
       
   191 	if(aStepName == KLbsClientStep_SrvConnectClose)		
       
   192 		{
       
   193 		return CT_LbsClientStep_SrvConnectClose::New(*this);
       
   194 		}
       
   195 		
       
   196 	if(aStepName == KLbsClientStep_OpenClose)		
       
   197 		{
       
   198 		return CT_LbsClientStep_OpenClose::New(*this);
       
   199 		}
       
   200 					
       
   201 	if(aStepName == KLbsClientStep_SrvVersion)		
       
   202 		{
       
   203 		return CT_LbsClientStep_SrvVersion::New(*this);
       
   204 		}		
       
   205 		
       
   206 	if(aStepName == KLbsClientStep_NotifyPosUpdate)	
       
   207 		{
       
   208 		return CT_LbsClientStep_NotifyPosUpdate::New(*this);
       
   209 		}
       
   210 		
       
   211 	if(aStepName == KLbsClientStep_CellBasedNotifyPosUpdate)	
       
   212 		{
       
   213 		return CT_LbsClientStep_CellBasedNotifyPosUpdate::New(*this);
       
   214 		}		
       
   215 
       
   216 	if(aStepName == KLbsClientStep_ModSelect)	
       
   217 		{
       
   218 		return CT_LbsClientStep_ModSelect::New(*this);
       
   219 		}
       
   220 
       
   221 	if(aStepName == KLbsClientStep_ModInfo)	
       
   222 		{
       
   223 		return CT_LbsClientStep_ModInfo::New(*this);
       
   224 		}
       
   225 
       
   226 	if(aStepName == KLbsClientStep_LastKnownPos)	
       
   227 		{
       
   228 		return CT_LbsClientStep_LastKnownPos::New(*this);
       
   229 		}
       
   230 		
       
   231 	if(aStepName == KLbsClientStep_MultiReq)	
       
   232 		{
       
   233 		return CT_LbsClientStep_MultiReq::New(*this);
       
   234 		}
       
   235 		
       
   236 	if(aStepName == KLbsClientStep_ModStatus)	
       
   237 		{
       
   238 		return CT_LbsClientStep_ModStat::New(*this);
       
   239 		}
       
   240 
       
   241 	if(aStepName == KLbsClientStep_UpdateOptions)	
       
   242 		{
       
   243 		return CT_LbsClientStep_UpdateOptions::New(*this);
       
   244 		}		
       
   245     
       
   246     if(aStepName == KLbsClientStep_Assistance)	
       
   247 		{
       
   248 		return CT_LbsClientStep_Assistance::New(*this);
       
   249 		}
       
   250 
       
   251     if(aStepName == KLbsClientStep_PartialUpdate)	
       
   252 		{
       
   253 		return CT_LbsClientStep_PartialUpdate::New(*this);
       
   254 		}
       
   255     if(aStepName == KLbsClientStep_IgnoreAccuracySetting)
       
   256     	{
       
   257     	return CT_LbsClientStep_IgnoreAccuracySetting::New(*this);
       
   258     	}
       
   259     if(aStepName == KLbsClientStep_IgnoreAccuracySettingTracking)
       
   260     	{
       
   261     	return CT_LbsClientStep_IgnoreAccuracySettingTracking::New(*this);
       
   262     	}
       
   263 
       
   264 	if (aStepName == KLbsClientStep_Tracking)
       
   265 		{
       
   266 		return CT_LbsClientStep_Tracking::New(*this);
       
   267 		}
       
   268 
       
   269 	if (aStepName == KLbsClientStep_Tracking)
       
   270 		{
       
   271 		return CT_LbsClientStep_Tracking::New(*this);
       
   272 		}
       
   273 
       
   274 	if (aStepName == KLbsClientStep_ResetAssistance)
       
   275 		{
       
   276 		return CT_LbsClientStep_ResetAssistance::New(*this);
       
   277 		}
       
   278 
       
   279 	// Let base class handle any common test steps - will return NULL if test step is not supported.
       
   280 	return CT_LbsServer::CreateTestStep(aStepName);
       
   281 	}