common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepmodselect.cpp
changeset 748 e13acd883fbe
child 872 17498133d9ad
equal deleted inserted replaced
747:76f9aaeefbab 748:e13acd883fbe
       
     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 ctlbsclientstepmodselect.cpp
       
    15 // This is the class implementation for the Module Selection Tests
       
    16 // 
       
    17 //
       
    18  
       
    19 #include "ctlbsclientstepmodselect.h"
       
    20 
       
    21 #include "tlbsutils.h"
       
    22 
       
    23 /**
       
    24  * Destructor
       
    25  */
       
    26 CT_LbsClientStep_ModSelect::~CT_LbsClientStep_ModSelect()
       
    27 	{
       
    28 	}
       
    29 
       
    30 
       
    31 /**
       
    32  * Constructor
       
    33  */
       
    34 CT_LbsClientStep_ModSelect::CT_LbsClientStep_ModSelect(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent)
       
    35 	{
       
    36 	iModuleId=TUid::Null();
       
    37 	SetTestStepName(KLbsClientStep_ModSelect);
       
    38 	}
       
    39 
       
    40 /**
       
    41 Static Constructor
       
    42 */
       
    43 CT_LbsClientStep_ModSelect* CT_LbsClientStep_ModSelect::New(CT_LbsClientServer& aParent)
       
    44 	{
       
    45 	return new CT_LbsClientStep_ModSelect(aParent);
       
    46 	// Note the lack of ELeave.
       
    47 	// This means that having insufficient memory will return NULL;
       
    48 	}
       
    49 
       
    50 
       
    51 /**
       
    52  * Verifies that the last position retrieved was from the a-gps module
       
    53  */
       
    54 TBool CT_LbsClientStep_ModSelect::VerifyLastModuleIdWasAGpsL()
       
    55 	{
       
    56 	TPositionInfo* posInfo = static_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[iParent.iSharedData->iCurrentPosInfoArr.Count()-1]);
       
    57 	TPositionModuleId checkModId = posInfo->ModuleId();
       
    58 	TPositionModuleId verifyModId;
       
    59 	
       
    60 	T_LbsUtils utils;
       
    61 	
       
    62 	verifyModId = utils.GetAGpsModuleIdL(iServer);
       
    63 	
       
    64 	if(checkModId == verifyModId)
       
    65 		{
       
    66 		INFO_PRINTF2(_L("Module IDs Match: Get AGPS Module Id %d"), checkModId.iUid);
       
    67 		return ETrue;
       
    68 		}
       
    69 	else
       
    70 		{
       
    71 		INFO_PRINTF3(_L("Module IDs Do Not Match: Expected %d, Receive %d"), verifyModId.iUid, checkModId.iUid);
       
    72 		return EFalse;
       
    73 		}	
       
    74 	}
       
    75 
       
    76 /**
       
    77  * Verifies that the last position retrieved was from the network module
       
    78  */
       
    79 TBool CT_LbsClientStep_ModSelect::VerifyLastModuleIdWasNetworkL()
       
    80 	{
       
    81 	TPositionInfo* posInfo = static_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[iParent.iSharedData->iCurrentPosInfoArr.Count()-1]);
       
    82 	TPositionModuleId checkModId = posInfo->ModuleId();
       
    83 	TPositionModuleId verifyModId;
       
    84 	
       
    85 	T_LbsUtils utils;
       
    86 	verifyModId = utils.GetNetworkModuleIdL(iServer);
       
    87 	
       
    88 	if(checkModId == verifyModId)
       
    89 		{
       
    90 		INFO_PRINTF2(_L("Module IDs Match: Get Network Module Id %d"), checkModId.iUid);
       
    91 		return ETrue;
       
    92 		}
       
    93 	else
       
    94 		{
       
    95 		INFO_PRINTF3(_L("Module IDs Do Not Match: Expected %d, Receive %d"), verifyModId, checkModId);
       
    96 		return EFalse;
       
    97 		}	
       
    98 	
       
    99 	}
       
   100 
       
   101 TInt CT_LbsClientStep_ModSelect::Blocking_NotifyUpdateL()
       
   102 	{
       
   103 	
       
   104 	TInt err;
       
   105 	
       
   106 	User::LeaveIfError(iPositioner.Open(iServer));
       
   107 	INFO_PRINTF1(_L("Opened RPositioner successfully with RPositionServer"));
       
   108 	CleanupClosePushL(iPositioner);
       
   109 
       
   110 	err = Blocking_NotifyUpdateCommonL();
       
   111 	
       
   112 	CleanupStack::PopAndDestroy(&iPositioner);
       
   113 	
       
   114 	return err;
       
   115 	}
       
   116 	
       
   117 TInt CT_LbsClientStep_ModSelect::Blocking_NotifyUpdateWithModuleIdL(TPositionModuleId aModuleId)
       
   118 	{	
       
   119 	TInt err;
       
   120 	
       
   121 	User::LeaveIfError(iPositioner.Open(iServer, aModuleId));
       
   122 	INFO_PRINTF1(_L("Opened RPositioner successfully with RPositionServer and TPositionModuleId"));
       
   123 	CleanupClosePushL(iPositioner);
       
   124 
       
   125 	err = Blocking_NotifyUpdateCommonL();
       
   126 	
       
   127 	CleanupStack::PopAndDestroy(&iPositioner);
       
   128 	
       
   129 	return err;
       
   130 	}
       
   131 
       
   132 
       
   133 /**
       
   134  *	Opens a subsession with the requested criteria and retrieves a location update 
       
   135  *  which it appends to the current array of positions
       
   136  */
       
   137 TInt CT_LbsClientStep_ModSelect::Blocking_NofifyUpdateWithCriteriaL(TPositionCriteria aCriteria)
       
   138 	{
       
   139 	TInt err;
       
   140 	
       
   141 	User::LeaveIfError(iPositioner.Open(iServer, aCriteria));
       
   142 	INFO_PRINTF1(_L("Opened RPositioner successfully with RPositionServer and TPositionCriteria"));
       
   143 	CleanupClosePushL(iPositioner);
       
   144 
       
   145 	err = Blocking_NotifyUpdateCommonL();
       
   146 	
       
   147 	CleanupStack::PopAndDestroy(&iPositioner);
       
   148 	
       
   149 	return err;
       
   150 	}
       
   151 
       
   152 
       
   153 TInt CT_LbsClientStep_ModSelect::Blocking_NotifyUpdateCommonL()
       
   154 	{
       
   155 	TInt err = KErrNone;
       
   156 	
       
   157 	// Create a posinfo and store in our shared array for later verification.
       
   158 	RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
       
   159 	TPositionInfo* posInfo = new(ELeave) TPositionInfo();
       
   160 	
       
   161 	T_LbsUtils utils;
       
   162 	utils.ResetAndDestroy_PosInfoArr(posInfoArr);	// Clear previous entries before new entry is appended.
       
   163 
       
   164 	posInfoArr.Append(posInfo);
       
   165 	
       
   166 	err = DoNotifyUpdateL(*posInfo);
       
   167 	
       
   168 	return err;	
       
   169 	}
       
   170 
       
   171 /**
       
   172  * Connect to netsim and set up reference position
       
   173  * return KErrNone if successful
       
   174  */
       
   175 TInt CT_LbsClientStep_ModSelect::SetupNetSimL()
       
   176 	{
       
   177 	TInt err = iNetSim.ConnectL(NULL); //connect to netsim but ingnore the callbacks
       
   178 	if (err != KErrNone)
       
   179 		{
       
   180 		INFO_PRINTF2(_L("Cannot connect to netsim, return with error %d"), err);	
       
   181 		return err;
       
   182 		}
       
   183 	else
       
   184 		{
       
   185 		//set up reference position
       
   186 		RPointerArray<TAny>& srcPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr;
       
   187 		TPositionInfo* srcPosInfo = reinterpret_cast<TPositionInfo*>(srcPosInfoArr[0]);
       
   188 		TPosition srcPos;
       
   189 		srcPosInfo->GetPosition(srcPos);
       
   190 		
       
   191 		if (!iNetSim.SetReferenceLocation(srcPos))
       
   192 			{
       
   193 			INFO_PRINTF1(_L("Test Failed: can't set NetSim's reference location."));
       
   194 			iNetSim.Close();
       
   195 			return KErrGeneral;
       
   196 			}
       
   197 		// Set plugin to use for getting assistance data:
       
   198 		TUid pluginUid;
       
   199 		if(iParent.iSharedData->iTestModuleInUse)
       
   200 			{
       
   201 			pluginUid = TUid::Uid(KSimpleAssistanceDataProviderPluginUidValue);
       
   202 			}
       
   203 		else
       
   204 			{
       
   205 			pluginUid = TUid::Uid(KSuplAssistanceDataProviderPluginUidValue);
       
   206 			}
       
   207 		if (!iNetSim.SetAssistanceDataProvider(pluginUid))
       
   208 			{
       
   209 			INFO_PRINTF1(_L("Test Failed: Can't set NetSim's assistance data plugin uid."));
       
   210 			SetTestStepResult(EFail);
       
   211 			iNetSim.Close();
       
   212 			return KErrGeneral;
       
   213 			}
       
   214 		}
       
   215 	return KErrNone;
       
   216 	}
       
   217 
       
   218 /**
       
   219  * do notify position update with required postion criteria and verify the position 
       
   220  * received is from expected module
       
   221  */	
       
   222 void CT_LbsClientStep_ModSelect::DoModuleSelectionL(TOpenSesstionMethod aMethod, TModuleType aModuleType)
       
   223 	{
       
   224 	TInt err = KErrNone;
       
   225 
       
   226 	//do netsim connection and configure reference position
       
   227 	err = SetupNetSimL();
       
   228 	if (err !=KErrNone)
       
   229 		{
       
   230 		SetTestStepResult(EFail);
       
   231 		return;
       
   232 		}
       
   233 
       
   234 	switch (aMethod)
       
   235 		{
       
   236 		case EWithCriteria:
       
   237 			err = Blocking_NofifyUpdateWithCriteriaL(iCriteria);
       
   238 			break;
       
   239 			
       
   240 		case EWithModuleId:
       
   241 			err = Blocking_NotifyUpdateWithModuleIdL(iModuleId);
       
   242 			break;
       
   243 			
       
   244 		case ENone:
       
   245 			err = Blocking_NotifyUpdateL();
       
   246 			break;
       
   247 			
       
   248 		default:
       
   249 			break;
       
   250 		}
       
   251 	
       
   252 	
       
   253 	if(KErrNone == err)
       
   254 		{
       
   255 		// Verify that the last position was 
       
   256 		// retrieved by the expected module: module ids not defined yet
       
   257 		switch (aModuleType)
       
   258 			{
       
   259 			case EAGPSModule:
       
   260 				if(!VerifyLastModuleIdWasAGpsL())
       
   261 					{
       
   262 					SetTestStepResult(EFail);
       
   263 					}
       
   264 			break;
       
   265 			
       
   266 			case ENetworkModule:
       
   267 				if (!VerifyLastModuleIdWasNetworkL())
       
   268 					{
       
   269 					SetTestStepResult(EFail);
       
   270 					break;
       
   271 					}
       
   272 			break;
       
   273 			
       
   274 			case ERandomModule:
       
   275 				if (!VerifyLastModuleIdWasNetworkL() && !VerifyLastModuleIdWasAGpsL())
       
   276 					{
       
   277 					SetTestStepResult(EFail);
       
   278 					}
       
   279 			break;
       
   280 			
       
   281 			default:
       
   282 			break;
       
   283 			}
       
   284 		
       
   285 		}
       
   286 	else
       
   287 		{
       
   288 		SetTestStepResult(EFail);
       
   289 		}
       
   290 
       
   291 	iNetSim.Close();
       
   292 	}
       
   293 
       
   294 /**
       
   295  * @return - TVerdict code
       
   296  * Override of base class pure virtual
       
   297  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
   298  * not leave. That being the case, the current test result value will be EPass.
       
   299  */
       
   300 TVerdict CT_LbsClientStep_ModSelect::doTestStepL()
       
   301 	{
       
   302 	// Generic test step used to test the LBS Client Notify position update API.
       
   303 	INFO_PRINTF1(_L("&gt;&gt;CT_LbsClientStep_ModSelect::doTestStepL()"));
       
   304 
       
   305 	if (TestStepResult()==EPass)
       
   306 		{
       
   307 
       
   308 		TInt err = KErrNone;
       
   309 		
       
   310 		// Connect to self locate server.
       
   311 		User::LeaveIfError(iServer.Connect());
       
   312 		CleanupClosePushL(iServer);
       
   313 		
       
   314 		//reset the default value
       
   315 		iCriteria.ClearCriteria();
       
   316 		iQuality = TPositionQuality();
       
   317 		iSelectOrder.ClearSelectionOrder(); 
       
   318 		
       
   319 		TInt testCaseId;
       
   320 		if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId))
       
   321 			{
       
   322 			switch (testCaseId)
       
   323 				{
       
   324 				case 01:	// test module selection by capabilities 
       
   325 							// LBS-Capability-0001
       
   326 					{
       
   327 					iCriteria.AddRequiredCapabilities(TPositionModuleInfo::ECapabilitySatellite);
       
   328 					DoModuleSelectionL(EWithCriteria, EAGPSModule);			
       
   329 					} 
       
   330 					break;
       
   331 
       
   332 				case 03:	// test module selection by unsupported capabilities 
       
   333 							// LBS-Capability-0003
       
   334 					{
       
   335 					// Set capabilities not supported by either (gps/network) module:
       
   336 					iCriteria.AddRequiredCapabilities(TPositionModuleInfo::ECapabilityMedia);
       
   337 					err = iPositioner.Open(iServer, iCriteria);
       
   338 					if(KErrNotFound != err)
       
   339 						{
       
   340 						INFO_PRINTF2(_L("Test failed: wrong error returned %d"), err);
       
   341 						SetTestStepResult(EFail);
       
   342 						if(KErrNone == err)
       
   343 							{
       
   344 							iPositioner.Close();
       
   345 							}						
       
   346 						}
       
   347 					
       
   348 					iCriteria.ClearCriteria();
       
   349 					User::LeaveIfError(iPositioner.Open(iServer, iCriteria));
       
   350 					iPositioner.Close();
       
   351 					}  
       
   352 					break;
       
   353 					
       
   354 				case 04: //required more than one capability
       
   355 						 //LBS-Capability-0004	
       
   356 					{
       
   357 					iCriteria.AddRequiredCapabilities(TPositionModuleInfo::ECapabilityHorizontal);
       
   358 					iCriteria.AddRequiredCapabilities(TPositionModuleInfo::ECapabilitySatellite);
       
   359 					DoModuleSelectionL(EWithCriteria, EAGPSModule);	
       
   360 					} 
       
   361 					break;
       
   362 					
       
   363 				case 11:	// test module selection by horizontal/vertical accuracy 
       
   364 							// LBS-Quality-0001
       
   365 					{
       
   366 					// set up the required accuracy
       
   367 					iQuality.SetHorizontalAccuracy(AGPS_MODINFO_HORIZONTAL_ACCURACY);
       
   368 					iQuality.SetVerticalAccuracy(AGPS_MODINFO_VERTICAL_ACCURACY);
       
   369 					
       
   370 					iCriteria.SetRequiredQuality(iQuality);
       
   371 					
       
   372 					DoModuleSelectionL(EWithCriteria, EAGPSModule);		
       
   373 					}
       
   374 					break;
       
   375 					
       
   376 				case 12:	// test module selection by time to first fix 
       
   377 							// LBS-Quality-0002
       
   378 					{
       
   379 					TTimeIntervalMicroSeconds timetofirstfix(NETWORK_MODINFO_TIME_TO_FIRST_FIX);
       
   380 					 
       
   381 					// set up the required TTFF
       
   382 					iQuality.SetTimeToFirstFix(timetofirstfix);
       
   383 					
       
   384 					iCriteria.SetRequiredQuality(iQuality);
       
   385 					
       
   386 					DoModuleSelectionL(EWithCriteria, ENetworkModule);		
       
   387 					}
       
   388 					break;
       
   389 					
       
   390 				case 13:	// test module selection by power consumption 
       
   391 							// LBS-Quality-0003
       
   392 					// this test case can only be run in test module
       
   393 					// in xtestmodule.ini powerconsumption need to be changed to 1
       
   394 					{
       
   395 					if (!iParent.iSharedData->iTestModuleInUse)
       
   396 						{
       
   397 						INFO_PRINTF1(_L("This test case can ONLY be run with Test A-GPS Module"));
       
   398 						User::Panic(_L("Client Module Selection"), 1);
       
   399 						}
       
   400 					iQuality.SetPowerConsumption(TPositionQuality::EPowerLow);
       
   401 					iCriteria.SetRequiredQuality(iQuality);	
       
   402 					
       
   403 					//because both modules have the same power consumption value
       
   404 					//agps module will be selected by default
       
   405 					DoModuleSelectionL(EWithCriteria, ENetworkModule);
       
   406 					}			
       
   407 					break;
       
   408 								
       
   409 				case 14:	// test module selection by cost limit 
       
   410 							// LBS-Quality-0004
       
   411 					{
       
   412 					iQuality.SetCostIndicator(AGPS_MODINFO_COST_INDICATOR);
       
   413 					iCriteria.SetRequiredQuality(iQuality);
       
   414 					
       
   415 					DoModuleSelectionL(EWithCriteria, EAGPSModule);	
       
   416 					}					
       
   417 					break;
       
   418 				
       
   419 				case 15: 	// setting a higher accuracy than all existing modules for module selection
       
   420 							// LBS-Quality-0005
       
   421 					{
       
   422 					//set an required horizontal accuracy as 1 meter
       
   423 					iQuality.SetHorizontalAccuracy(1); 	
       
   424 					iCriteria.SetRequiredQuality(iQuality);
       
   425 					err = iPositioner.Open(iServer, iCriteria);
       
   426 					if(KErrNotFound != err)
       
   427 						{
       
   428 						INFO_PRINTF2(_L("Test failed: wrong error returned %d"), err);
       
   429 						SetTestStepResult(EFail);
       
   430 						if(KErrNone == err)
       
   431 							{
       
   432 							iPositioner.Close();
       
   433 							}						
       
   434 						}
       
   435 					}
       
   436 					break;
       
   437 						
       
   438  				case 16:
       
   439  							// LBS-Quality-0006 - TTFF lower than module's and H-Acc lower (more accurate) than module's. Specified V-Acc is met by module.
       
   440  					{
       
   441  					//set required TTFF=20s, TTNF=1, H-Acc=10m, V-Acc=200m
       
   442  					iQuality.SetTimeToFirstFix(10000000);
       
   443  					iQuality.SetTimeToNextFix(1000000);
       
   444  					iQuality.SetHorizontalAccuracy(10); 
       
   445  					iQuality.SetVerticalAccuracy(200);
       
   446  										
       
   447  					iCriteria.SetRequiredQuality(iQuality);
       
   448  					err = iPositioner.Open(iServer, iCriteria);
       
   449  					if(KErrNotFound != err)
       
   450  						{
       
   451  						INFO_PRINTF2(_L("Test failed: wrong error returned %d"), err);
       
   452  						SetTestStepResult(EFail);
       
   453  						if(KErrNone == err)
       
   454  							{
       
   455  							iPositioner.Close();
       
   456  							}						
       
   457  						}
       
   458  					}
       
   459  					break;
       
   460  					
       
   461  				case 17:
       
   462  							// LBS-Quality-0007 - TTFF lower than module's and H-Acc/V-Acc lower than module's. Power and Cost match module's
       
   463  					{
       
   464  					//set required TTFF=20s, TTNF=1, H-Acc=10m, V-Acc=10m
       
   465  					iQuality.SetTimeToFirstFix(10000000);
       
   466  					iQuality.SetTimeToNextFix(1000000);
       
   467  					iQuality.SetHorizontalAccuracy(10); 
       
   468  					iQuality.SetVerticalAccuracy(10);
       
   469  					
       
   470  					iQuality.SetCostIndicator(TPositionQuality::ECostCharge);	
       
   471  					iQuality.SetPowerConsumption(TPositionQuality::EPowerMedium);
       
   472  					
       
   473  					iCriteria.SetRequiredQuality(iQuality);
       
   474  					err = iPositioner.Open(iServer, iCriteria);
       
   475  					if(KErrNotFound != err)
       
   476  						{
       
   477  						INFO_PRINTF2(_L("Test failed: wrong error returned %d"), err);
       
   478  						SetTestStepResult(EFail);
       
   479  						if(KErrNone == err)
       
   480  							{
       
   481  							iPositioner.Close();
       
   482  							}						
       
   483  						}
       
   484  					}
       
   485  					break;
       
   486 						
       
   487 				case 21:	// Request Location update with default request ordering 
       
   488 							// LBS-SelectionOrder-0001 
       
   489 					{
       
   490 					DoModuleSelectionL(ENone,EAGPSModule);					
       
   491 					}
       
   492 					break;
       
   493 						
       
   494 				case 22:	// Request location update with cost/time/accuracy/power mgmt in order of importance
       
   495 					{		// LBS-SelectionOrder-0002
       
   496 					User::LeaveIfError(iSelectOrder.SetOrderCostIndicator(TPositionSelectionOrder::EOrderVeryHigh));
       
   497 					User::LeaveIfError(iSelectOrder.SetOrderTimeToFirstFix(TPositionSelectionOrder::EOrderHigh));
       
   498 					User::LeaveIfError(iSelectOrder.SetOrderHorizontalAccuracy(TPositionSelectionOrder::EOrderFairlyHigh));
       
   499 					User::LeaveIfError(iSelectOrder.SetOrderPowerConsumption(TPositionSelectionOrder::EOrderMedium));
       
   500 					
       
   501 					iCriteria.SetSelectionOrder(iSelectOrder);
       
   502 					
       
   503 					DoModuleSelectionL(EWithCriteria, EAGPSModule);
       
   504 					}
       
   505 					break;
       
   506 							
       
   507 							// Test requires test A-GPS module to have accuracy of <100m. This must be better than Network Module.
       
   508 				case 32:	// Check that we can fall back on the selection order process (stage 3) when capabilities and qualities of both modules are equal.
       
   509 					{		// LBS-ModuleSelection-0002 
       
   510 					iQuality.SetHorizontalAccuracy(500);
       
   511 					iCriteria.SetRequiredQuality(iQuality);
       
   512 					
       
   513 					DoModuleSelectionL(EWithCriteria, EAGPSModule);
       
   514 					}
       
   515 					break;
       
   516 						
       
   517 							// Test requires test A-GPS module and Network Module to have equal horizontal accuracy
       
   518 				case 33:	// Check that we can ack on the Rpositioner Framework when both modules appear identical.
       
   519 					{		// LBS-ModuleSelection-0003
       
   520 					if (!iParent.iSharedData->iTestModuleInUse)
       
   521 						{
       
   522 						INFO_PRINTF1(_L("This test case can ONLY be run with Test A-GPS Module"));
       
   523 						User::Panic(_L("Client Module Selection"), 1);
       
   524 						}
       
   525 					iQuality.SetHorizontalAccuracy(100);
       
   526 					iCriteria.SetRequiredQuality(iQuality);
       
   527 					
       
   528 					User::LeaveIfError(iSelectOrder.SetOrderHorizontalAccuracy(TPositionSelectionOrder::EOrderVeryHigh));
       
   529 					iCriteria.SetSelectionOrder(iSelectOrder);
       
   530 					
       
   531 					DoModuleSelectionL(EWithCriteria, ERandomModule);			
       
   532 					}
       
   533 					break;
       
   534 						
       
   535 				case 34:	// Select default module on connecting to the RPositioner
       
   536 					{		// LBS-ModuleSelection-0004 
       
   537 					DoModuleSelectionL(EWithCriteria, EAGPSModule);
       
   538 					}
       
   539 					break;	
       
   540 					
       
   541 					
       
   542 				case 35:	// Select A-GPS module by its ID
       
   543 					{		// LBS-ModuleSelection-0005					
       
   544 					iModuleId.iUid = APGS_MODINFO_MODULE_ID;
       
   545 					DoModuleSelectionL(EWithModuleId, EAGPSModule);				
       
   546 					}
       
   547 					break;	
       
   548 					
       
   549 					
       
   550 				case 36: 	// Select Network module by its ID
       
   551 					{		// LBS-ModuleSelection-0006		
       
   552 					iModuleId.iUid = NETWORK_MODINFO_MODULE_ID;
       
   553 					DoModuleSelectionL(EWithModuleId, ENetworkModule);				
       
   554 					}
       
   555 					break;	
       
   556 					
       
   557 				case 37: // Test requires test A-GPS module and Network Module to have equal power consumption
       
   558 						 // when both modules match the iCriteria, check default module is used for position update
       
   559 						 // LBS-ModuleSelection-0007
       
   560 					{
       
   561 					iQuality.SetPowerConsumption(TPositionQuality::EPowerLow);
       
   562 					iCriteria.SetRequiredQuality(iQuality);
       
   563 					
       
   564 					User::LeaveIfError(iSelectOrder.SetOrderPowerConsumption(TPositionSelectionOrder::EOrderVeryHigh));
       
   565 					iCriteria.SetSelectionOrder(iSelectOrder);
       
   566 					
       
   567 					DoModuleSelectionL(EWithCriteria, ERandomModule);
       
   568 					}
       
   569 					break;
       
   570 					
       
   571 				case 38:
       
   572 						//LBS-ModuleSelection-0008
       
   573 					{
       
   574 					if (!iParent.iSharedData->iTestModuleInUse)
       
   575 						{
       
   576 						INFO_PRINTF1(_L("This test case can ONLY be run with Test A-GPS Module"));
       
   577 						User::Panic(_L("Client Module Selection"), 1);
       
   578 						}
       
   579 					iQuality.SetHorizontalAccuracy(100);
       
   580 					iCriteria.SetRequiredQuality(iQuality);
       
   581 					
       
   582 					User::LeaveIfError(iSelectOrder.SetOrderHorizontalAccuracy(TPositionSelectionOrder::EOrderVeryHigh));
       
   583 					User::LeaveIfError(iSelectOrder.SetOrderPowerConsumption(TPositionSelectionOrder::EOrderVeryHigh));
       
   584 					iCriteria.SetSelectionOrder(iSelectOrder);
       
   585 					
       
   586 					// Verify that the last position was retrieved by a-gps module, which has lower power consumption.
       
   587 					DoModuleSelectionL(EWithCriteria, ENetworkModule);
       
   588 					}
       
   589 					break;
       
   590 							
       
   591 				default:
       
   592 					{
       
   593 					INFO_PRINTF1(_L("Invalid Test Case"));
       
   594 					User::Leave(KErrArgument);
       
   595 					}	
       
   596 				}	
       
   597 			}	
       
   598 		CleanupStack::PopAndDestroy(&iServer);	
       
   599 		} // end if TestStepResult
       
   600 	INFO_PRINTF1(_L("&lt;&lt;CT_LbsClientStep_ModSelect::doTestStepL()"));
       
   601 
       
   602 	return TestStepResult();
       
   603 	}