lbs/lbsclient/src/ctlbsclientsteppartialupdate.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 ctlbsclientsteppartialupdate.cpp
       
    15 // This is the class implementation for the UpdateOptions Tests
       
    16 // 
       
    17 //
       
    18  
       
    19 #include "ctlbsclientsteppartialupdate.h"
       
    20 
       
    21 #include <lbs.h>
       
    22 #include <lbssatellite.h>
       
    23 
       
    24 #include "tlbsutils.h"
       
    25 #include "ctlbsasyncwaiter.h"
       
    26 
       
    27 #define EXPECTED_GPS_ACCURACY_HORIZONTAL 20
       
    28 #define EXPECTED_GPS_ACCURACY_VERTICAL 20
       
    29 
       
    30 #define KLbsKeepAlivePeriod 		10000
       
    31 
       
    32 #define REFPOS_LAT				2
       
    33 #define REFPOS_LONG				3
       
    34 #define REFPOS_ALT				10
       
    35 #define REFPOS_HORZ_ACCURACY	100
       
    36 #define REFPOS_VERT_ACCURACY	100
       
    37 
       
    38 #define REFPOS_HORZ_ACCURACY_BETTER	5
       
    39 #define REFPOS_VERT_ACCURACY_BETTER	5
       
    40 
       
    41 
       
    42 const TInt KTestAssistanceDataProviderPluginUidValue = 0x10281D77;
       
    43 const TInt KRealAssistanceDataProviderPluginUidValue = 0x1028225B;
       
    44 
       
    45 
       
    46 /**
       
    47  * Destructor
       
    48  */
       
    49 CT_LbsClientStep_PartialUpdate::~CT_LbsClientStep_PartialUpdate()
       
    50 	{
       
    51 	delete iDoPosUpdatePtr;
       
    52 	}
       
    53 
       
    54 
       
    55 /**
       
    56  * Constructor
       
    57  */
       
    58 CT_LbsClientStep_PartialUpdate::CT_LbsClientStep_PartialUpdate(CT_LbsClientServer& aParent) : CT_LbsNetSimStep(), iParent(aParent)
       
    59 	{
       
    60 	SetTestStepName(KLbsClientStep_PartialUpdate);
       
    61 	}
       
    62 
       
    63 
       
    64 /**
       
    65 Static Constructor
       
    66 */
       
    67 CT_LbsClientStep_PartialUpdate* CT_LbsClientStep_PartialUpdate::New(CT_LbsClientServer& aParent)
       
    68 	{
       
    69 	// Note the lack of ELeave.
       
    70 	// This means that having insufficient memory will return NULL;
       
    71 	CT_LbsClientStep_PartialUpdate* testStep = new CT_LbsClientStep_PartialUpdate(aParent);
       
    72 	if (testStep)
       
    73 		{
       
    74 		TInt err = KErrNone;
       
    75 
       
    76 		TRAP(err, testStep->ConstructL());
       
    77 		if (err)
       
    78 			{
       
    79 			delete testStep;
       
    80 			testStep = NULL;
       
    81 			}
       
    82 		}
       
    83 	return testStep;
       
    84 	}	
       
    85 	
       
    86 void CT_LbsClientStep_PartialUpdate::ConstructL()
       
    87 	{
       
    88 	// Create the base class objects.
       
    89     CT_LbsNetSimStep::ConstructL();
       
    90 	
       
    91 	// and the active object wrapper for the notify position update.
       
    92 	iDoPosUpdatePtr = CT_LbsDoPosUpdate::NewL(this, TPositionModuleInfo::ETechnologyTerminal);
       
    93 
       
    94 	}
       
    95 
       
    96 	
       
    97 /**
       
    98  * @return - TVerdict code
       
    99  * Override of base class pure virtual
       
   100  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
   101  * not leave. That being the case, the current test result value will be EPass.
       
   102  */
       
   103 TVerdict CT_LbsClientStep_PartialUpdate::doTestStepL()
       
   104 	{
       
   105 	// Generic test step used to test the LBS SetUpdateOptions API.
       
   106 	INFO_PRINTF1(_L("&gt;&gt;CT_LbsClientStep_PartialUpdate::doTestStepL()"));
       
   107 
       
   108 	if (TestStepResult()==EPass) 
       
   109 		{
       
   110 		TInt err = KErrNone;
       
   111 		iPosUpdateStatus = EPositionUpdateStart;
       
   112 		
       
   113 		//Configure partial Updates
       
   114 		TPositionUpdateOptions optsA;
       
   115 		optsA.SetAcceptPartialUpdates(ETrue);
       
   116 			
       
   117 		if(!optsA.AcceptPartialUpdates())
       
   118 			{
       
   119 			INFO_PRINTF1(_L("Partial Updates not set."));
       
   120 			SetTestStepResult(EFail);
       
   121 			}	
       
   122 		
       
   123 		err = iDoPosUpdatePtr->SetOptions(optsA);
       
   124 		User::LeaveIfError(err);
       
   125 		
       
   126 		CLbsAdmin* lbsAdminApi = CLbsAdmin::NewL();
       
   127 		CleanupStack::PushL(lbsAdminApi);
       
   128 
       
   129 		// Carryout unique test actions.
       
   130 		if (GetIntFromConfig(ConfigSection(), KTestCaseId, iTestCaseId))
       
   131 			{
       
   132 				switch (iTestCaseId)
       
   133 				{
       
   134 				// Test case LBS-Partial-Update-Options-0001
       
   135 				case 1:
       
   136 					{
       
   137 					CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsAutonomous;
       
   138 					lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode);
       
   139 
       
   140 					//Configure Partial Update to EFalse
       
   141 					TPositionUpdateOptions updOpts;
       
   142 					updOpts.SetUpdateTimeOut(10*1000000);
       
   143 					updOpts.SetAcceptPartialUpdates(EFalse);
       
   144 					if(EFalse != updOpts.AcceptPartialUpdates())
       
   145 						{
       
   146 						INFO_PRINTF1(_L("Partial Updates not set."));
       
   147 						SetTestStepResult(EFail);
       
   148 						}	
       
   149 					
       
   150 					err = iDoPosUpdatePtr->SetOptions(updOpts);
       
   151 					User::LeaveIfError(err);
       
   152 					
       
   153 					break;
       
   154 					}
       
   155 	
       
   156 				// Test case LBS-Partial-Update-Options-0002
       
   157 				case 2:
       
   158 				case 3:
       
   159 				case 4:
       
   160 				case 5:
       
   161 				case 6:
       
   162 				case 7:
       
   163 					{
       
   164 					CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsAutonomous;
       
   165 					lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode);
       
   166 
       
   167 					break;
       
   168 					}
       
   169 					
       
   170 				case 21:
       
   171 				case 22:
       
   172 				case 24:
       
   173 				case 25:
       
   174 				case 26:
       
   175 					{
       
   176 					CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsPreferTerminalBased;
       
   177 					lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode);
       
   178 
       
   179 					break;
       
   180 					}
       
   181 					
       
   182 				case 23:
       
   183 					{
       
   184 					CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsPreferTerminalBased;
       
   185 					lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode);
       
   186 
       
   187 					//Configure Partial Update to EFalse
       
   188 					TPositionUpdateOptions updOpts;
       
   189 					updOpts.SetAcceptPartialUpdates(EFalse);
       
   190 					if(EFalse != updOpts.AcceptPartialUpdates())
       
   191 						{
       
   192 						INFO_PRINTF1(_L("Partial Updates not set."));
       
   193 						SetTestStepResult(EFail);
       
   194 						}	
       
   195 					
       
   196 					err = iDoPosUpdatePtr->SetOptions(updOpts);
       
   197 					User::LeaveIfError(err);
       
   198 					
       
   199 					break;
       
   200 					}
       
   201 
       
   202 				case 27:
       
   203 				case 28:
       
   204 					{
       
   205 					//Tracking
       
   206 					CLbsAdmin::TGpsMode gpsMode;
       
   207 					if(iTestCaseId == 27)
       
   208 						{
       
   209 						gpsMode = CLbsAdmin::EGpsAutonomous;
       
   210 						}
       
   211 					else
       
   212 						{
       
   213 						gpsMode = CLbsAdmin::EGpsPreferTerminalBased;
       
   214 						}
       
   215 
       
   216 					lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode);
       
   217 
       
   218 					TPositionUpdateOptions updOpts;
       
   219 					updOpts.SetUpdateInterval(10*1000000); //Set Update Interval to 10 secs
       
   220 					updOpts.SetAcceptPartialUpdates(ETrue);
       
   221 					
       
   222 					err = iDoPosUpdatePtr->SetOptions(updOpts);
       
   223 					User::LeaveIfError(err);
       
   224 
       
   225 					break;
       
   226 					}
       
   227 
       
   228 				default:
       
   229 					User::Panic(KLbsClientStep_PartialUpdate, KErrUnknown);					
       
   230 						
       
   231 					}
       
   232 				}
       
   233 		
       
   234 		User::LeaveIfError(OpenNetSim());
       
   235 
       
   236 		// Kick off the test abort and keep alive timers.
       
   237 		TTimeIntervalMicroSeconds32 keepAliveInterval(KLbsKeepAlivePeriod);
       
   238 		iKeepAliveTimer->SetTimer(keepAliveInterval);
       
   239 
       
   240 		// Kick off test.
       
   241 		CActiveScheduler::Start();
       
   242 
       
   243 		// Verify location data.
       
   244 		VerifyPosInfos();
       
   245 
       
   246 		//Reset Test module timeout
       
   247 		TModuleDataIn modDataIn; 
       
   248 		modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut;
       
   249 		modDataIn.iTimeOut = 0;
       
   250 
       
   251 		T_LbsUtils utils;
       
   252 		utils.NotifyModuleOfConfigChangeL(modDataIn);
       
   253 
       
   254 		// Clean up.
       
   255 		CloseNetSim();
       
   256 		
       
   257 		CleanupStack::PopAndDestroy(lbsAdminApi);
       
   258 		}
       
   259 
       
   260 	INFO_PRINTF1(_L("&lt;&lt;CT_LbsClientStep_PartialUpdate::doTestStepL()"));
       
   261 
       
   262 	return TestStepResult();
       
   263 	}
       
   264 
       
   265 
       
   266 void CT_LbsClientStep_PartialUpdate::Connected()
       
   267 	{
       
   268 	// Call base implementation.
       
   269 	//CT_LbsNetSimStep::Connected();
       
   270 	
       
   271 	// Create a posinfo and store in our shared array for later verification.
       
   272 	T_LbsUtils utils;
       
   273 	RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
       
   274 	utils.ResetAndDestroy_PosInfoArr(posInfoArr);	// Clear previous entries before new entry is appended.
       
   275 
       
   276 	iPosInfoPtr1 = new(ELeave) TPositionInfo();
       
   277 	posInfoArr.Append(iPosInfoPtr1);
       
   278 	iPosInfoPtr2 = new(ELeave) TPositionInfo();
       
   279 	posInfoArr.Append(iPosInfoPtr2);
       
   280 
       
   281 	//For test case 22, Set Reference Position better than required position
       
   282 	if(iTestCaseId == 22)
       
   283 		{
       
   284 		// Set the reference position, which also be used for any required verification.
       
   285 		iRefPos.SetCoordinate(REFPOS_LAT, REFPOS_LONG, REFPOS_ALT);
       
   286 		iRefPos.SetAccuracy(REFPOS_HORZ_ACCURACY_BETTER, REFPOS_VERT_ACCURACY_BETTER);
       
   287 		iRefPos.SetCurrentTime();
       
   288 
       
   289 		if (!iNetSim.SetReferenceLocation(iRefPos))
       
   290 			{
       
   291 			INFO_PRINTF1(_L("Failed test, can't set NetSim's reference location."));
       
   292 			SetTestStepResult(EFail);
       
   293 			}	
       
   294 		}
       
   295 
       
   296 	// Kick off pos update.
       
   297 	iDoPosUpdatePtr->StartL(*iPosInfoPtr1);
       
   298 	}
       
   299 
       
   300 
       
   301 void CT_LbsClientStep_PartialUpdate::MT_LbsDoPosUpdateCallback(TRequestStatus& aStatus)
       
   302 	{
       
   303 	INFO_PRINTF1(_L("Got - Client Notify Update Complete - Callback Event."));
       
   304 	
       
   305 	T_LbsUtils utils;
       
   306 	TInt err = aStatus.Int();
       
   307 	
       
   308 	switch(iTestCaseId)
       
   309 		{
       
   310 		case 1:
       
   311 			{
       
   312 			if (KPositionQualityLoss != err)
       
   313 				{
       
   314 				SetTestStepResult(EFail);
       
   315 				}
       
   316 			
       
   317 			iState = EWaiting;
       
   318 			break;
       
   319 			}
       
   320 
       
   321 		case 2:
       
   322 		case 3:
       
   323 			{
       
   324 			if (KPositionPartialUpdate != err)
       
   325 				{
       
   326 				SetTestStepResult(EFail);
       
   327 				}	
       
   328 
       
   329 			if(iPosUpdateStatus != EPositionUpdateComplete)
       
   330 				{
       
   331 				// Kick off pos update.
       
   332 				iDoPosUpdatePtr->StartL(*iPosInfoPtr2);
       
   333 				iPosUpdateStatus = EPositionUpdateComplete;				
       
   334 				}
       
   335 			else
       
   336 				iState = EWaiting;
       
   337 			
       
   338 			break;
       
   339 			}
       
   340 
       
   341 		case 4:
       
   342 			{
       
   343 			if (KErrNone != err)
       
   344 				{
       
   345 				SetTestStepResult(EFail);
       
   346 				}	
       
   347 
       
   348 			if(iPosUpdateStatus != EPositionUpdateComplete)
       
   349 				{
       
   350 				// Kick off pos update.
       
   351 				iDoPosUpdatePtr->StartL(*iPosInfoPtr2);
       
   352 				iPosUpdateStatus = EPositionUpdateComplete;				
       
   353 				}
       
   354 			else
       
   355 				iState = EWaiting;
       
   356 
       
   357 			break;
       
   358 			}
       
   359 
       
   360 		case 5:
       
   361 		case 6:
       
   362 		
       
   363 		case 21:
       
   364 		case 22:
       
   365 			{
       
   366 			if(iPosUpdateStatus != EPositionUpdateComplete)
       
   367 				{
       
   368 				if(iTestCaseId == 5 || iTestCaseId == 21)
       
   369 					{
       
   370 					if (KPositionPartialUpdate != err)
       
   371 						{
       
   372 						SetTestStepResult(EFail);
       
   373 						}	
       
   374 					}
       
   375 				else
       
   376 					{
       
   377 					if (KErrNone != err)
       
   378 						{
       
   379 						SetTestStepResult(EFail);
       
   380 						}	
       
   381 					}
       
   382 				}
       
   383 			else
       
   384 				{
       
   385 				if (KPositionEarlyComplete != err)
       
   386 					{
       
   387 					SetTestStepResult(EFail);
       
   388 					}	
       
   389 				}
       
   390 
       
   391 			if(iPosUpdateStatus != EPositionUpdateComplete)
       
   392 				{
       
   393 				TModuleDataIn modDataIn; // Used to send test information to the test module.
       
   394 				modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut;
       
   395 				modDataIn.iTimeOut = 5*1000000;
       
   396 				
       
   397 				// Send timeout value to test module - will block.
       
   398 				utils.NotifyModuleOfConfigChangeL(modDataIn);
       
   399 
       
   400 				// Kick off pos update.
       
   401 				iDoPosUpdatePtr->StartL(*iPosInfoPtr2);
       
   402 
       
   403 				err = iDoPosUpdatePtr->CompleteRequest(EPositionerNotifyPositionUpdate);
       
   404 				if (err != KErrNone)
       
   405 					{
       
   406 					SetTestStepResult(EFail);
       
   407 					}	
       
   408 				
       
   409 				iPosUpdateStatus = EPositionUpdateComplete;				
       
   410 
       
   411 				}
       
   412 			else
       
   413 				{
       
   414 				//if(iTestCaseId == 5 || iTestCaseId == 6)
       
   415 					{
       
   416 					iState = EWaiting;	
       
   417 					}
       
   418 				}
       
   419 
       
   420 			break;
       
   421 			}
       
   422 			
       
   423 		case 7:
       
   424 			{
       
   425 			if(iPosUpdateStatus != EPositionUpdateComplete)
       
   426 				{
       
   427 				if (KPositionPartialUpdate != err)
       
   428 					{
       
   429 					SetTestStepResult(EFail);
       
   430 					}	
       
   431 					
       
   432 				// Kick off pos update.
       
   433 				iDoPosUpdatePtr->StartL(*iPosInfoPtr2);
       
   434 				iPosUpdateStatus = EPositionUpdateComplete;				
       
   435 				}
       
   436 			else
       
   437 				{
       
   438 				if (KErrNone != err)
       
   439 					{
       
   440 					SetTestStepResult(EFail);
       
   441 					}	
       
   442 					
       
   443 				err = iDoPosUpdatePtr->CompleteRequest(EPositionerNotifyPositionUpdate);
       
   444 				if (err != KErrNotFound)
       
   445 					{
       
   446 					SetTestStepResult(EFail);
       
   447 					}	
       
   448 				iState = EWaiting;	
       
   449 				}
       
   450 
       
   451 			break;
       
   452 			}			
       
   453 		
       
   454 		case 23:
       
   455 			{
       
   456 			if (KErrNone != err)
       
   457 				{
       
   458 				SetTestStepResult(EFail);
       
   459 				}	
       
   460 
       
   461 			break;
       
   462 			}
       
   463 
       
   464 		case 24:
       
   465 		case 27:
       
   466 			{
       
   467 			if(iPosUpdateStatus != EPositionUpdateComplete)
       
   468 				{
       
   469 				if (KPositionPartialUpdate != err)
       
   470 					{
       
   471 					SetTestStepResult(EFail);
       
   472 					}
       
   473 
       
   474 				if(iPosUpdateStatus == EPositionUpdateStart)
       
   475 					{
       
   476 					iDoPosUpdatePtr->StartL(*iPosInfoPtr2);
       
   477 					iPosUpdateStatus = EPositionUpdateContinue;
       
   478 					}
       
   479 				else
       
   480 					{
       
   481 					TModuleDataIn modDataIn; // Used to send test information to the test module.
       
   482 					modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut;
       
   483 					modDataIn.iTimeOut = 5*1000000;
       
   484 					
       
   485 					// Send timeout value to test module - will block.
       
   486 					utils.NotifyModuleOfConfigChangeL(modDataIn);
       
   487 
       
   488 					RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
       
   489 					TPositionInfo* posInfoPtr3;
       
   490 					posInfoPtr3 = new(ELeave) TPositionInfo();
       
   491 					posInfoArr.Append(posInfoPtr3);
       
   492 					
       
   493 					// Kick off pos update.
       
   494 					iDoPosUpdatePtr->StartL(*posInfoPtr3);
       
   495 
       
   496 					err = iDoPosUpdatePtr->CompleteRequest(EPositionerNotifyPositionUpdate);
       
   497 					if (err != KErrNone)
       
   498 						{
       
   499 						SetTestStepResult(EFail);
       
   500 						}	
       
   501 	
       
   502 					iPosUpdateStatus = EPositionUpdateComplete;				
       
   503 					}
       
   504 				}
       
   505 			else
       
   506 				{
       
   507 				if (KPositionEarlyComplete != err)
       
   508 					{
       
   509 					SetTestStepResult(EFail);
       
   510 					}	
       
   511 					
       
   512 				//if (iTestCaseId == 27)
       
   513 				//	{
       
   514 					iState = EWaiting;
       
   515 				//	}	
       
   516 				}
       
   517 
       
   518 			break;
       
   519 			}
       
   520 
       
   521 		case 25:
       
   522 		case 26:
       
   523 			{
       
   524 			if(iPosUpdateStatus != EPositionUpdateComplete)
       
   525 				{
       
   526 				if (KPositionPartialUpdate != err)
       
   527 					{
       
   528 					SetTestStepResult(EFail);
       
   529 					}
       
   530 
       
   531 				if(iPosUpdateStatus == EPositionUpdateStart)
       
   532 					{
       
   533 					iDoPosUpdatePtr->StartL(*iPosInfoPtr2);
       
   534 					iPosUpdateStatus = EPositionUpdateContinue;
       
   535 					}
       
   536 				else
       
   537 					{
       
   538 					RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
       
   539 					TPositionInfo* posInfoPtr3;
       
   540 					posInfoPtr3 = new(ELeave) TPositionInfo();
       
   541 					posInfoArr.Append(posInfoPtr3);
       
   542 					
       
   543 					// Kick off pos update.
       
   544 					iDoPosUpdatePtr->StartL(*posInfoPtr3);
       
   545 
       
   546 					iPosUpdateStatus = EPositionUpdateComplete;				
       
   547 					}
       
   548 				}
       
   549 			else
       
   550 				{
       
   551 				if (KPositionPartialUpdate != err && KPositionQualityLoss != err)
       
   552 					{
       
   553 					_LIT(KUnexpectedErrorWhilePartialUpdate, "Unexpected error returned: %d");
       
   554 					INFO_PRINTF2(KUnexpectedErrorWhilePartialUpdate, err);
       
   555 					SetTestStepResult(EFail);
       
   556 					}
       
   557 						
       
   558 				err = iDoPosUpdatePtr->CompleteRequest(EPositionerNotifyPositionUpdate);
       
   559 				if (err != KErrNotFound)
       
   560 					{
       
   561 					SetTestStepResult(EFail);
       
   562 					}	
       
   563 				
       
   564 				iState =EWaiting;
       
   565 				
       
   566 				TPositionInfo* curPosInfo = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[0]);
       
   567 				TPositionInfo* curPosInfo2 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[1]);
       
   568 				TPositionInfo* curPosInfo3 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[2]);
       
   569 				}
       
   570 
       
   571 			break;
       
   572 			}
       
   573 
       
   574 		case 28:
       
   575 			{
       
   576 			if(iPosUpdateStatus != EPositionUpdateComplete)
       
   577 				{
       
   578 				if (KPositionPartialUpdate != err)
       
   579 					{
       
   580 					SetTestStepResult(EFail);
       
   581 					}
       
   582 
       
   583 				if(iPosUpdateStatus == EPositionUpdateStart)
       
   584 					{
       
   585 					iDoPosUpdatePtr->StartL(*iPosInfoPtr2);
       
   586 					iPosUpdateStatus = EPositionUpdateContinue;
       
   587 					}
       
   588 				else
       
   589 					{
       
   590 					TModuleDataIn modDataIn; // Used to send test information to the test module.
       
   591 					modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut;
       
   592 					modDataIn.iTimeOut = 5*1000000;
       
   593 					
       
   594 					// Send timeout value to test module - will block.
       
   595 					utils.NotifyModuleOfConfigChangeL(modDataIn);
       
   596 
       
   597 					RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
       
   598 					TPositionInfo* posInfoPtr3;
       
   599 					posInfoPtr3 = new(ELeave) TPositionInfo();
       
   600 					posInfoArr.Append(posInfoPtr3);
       
   601 					
       
   602 					// Kick off pos update.
       
   603 					iDoPosUpdatePtr->StartL(*posInfoPtr3);
       
   604 
       
   605 					err = iDoPosUpdatePtr->CompleteRequest(EPositionerNotifyPositionUpdate);
       
   606 					if (err != KErrNone)
       
   607 						{
       
   608 						SetTestStepResult(EFail);
       
   609 						}	
       
   610 	
       
   611 					iPosUpdateStatus = EPositionUpdateComplete;				
       
   612 					}
       
   613 				}
       
   614 			else
       
   615 				{
       
   616 				if (KPositionEarlyComplete != err)
       
   617 					{
       
   618 					SetTestStepResult(EFail);
       
   619 					}
       
   620 				
       
   621 				iState = EWaiting;	
       
   622 				}
       
   623 
       
   624 			break;
       
   625 			}
       
   626 			
       
   627 		default:
       
   628 			break;
       
   629 		}
       
   630 	}	
       
   631 
       
   632 void CT_LbsClientStep_PartialUpdate::VerifyPosInfos()
       
   633 	{
       
   634 	T_LbsUtils utils;
       
   635 	T_LbsUtils::TComparisonAccuracyType accType;
       
   636 	
       
   637 	if(iParent.iSharedData->iTestModuleInUse) 
       
   638 		{
       
   639 		accType = T_LbsUtils::EExactAccuracy;
       
   640 		}
       
   641 	else
       
   642 		{
       
   643 		accType = T_LbsUtils::ERoughAccuracy;
       
   644 		}
       
   645 	
       
   646 	switch(iTestCaseId)
       
   647 		{
       
   648 		case 5:
       
   649 		case 6:
       
   650 			{
       
   651 			//Verify Position returned - It should be the position returned earlier
       
   652 			TPositionInfo* curPosInfoPtr1 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[0]);
       
   653 			TPositionInfo* curPosInfoPtr2 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[1]);
       
   654 			TPositionInfo* verPosInfoPtr = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iVerifyPosInfoArr[0]);
       
   655 
       
   656 			if (!utils.Compare_PosInfo(*curPosInfoPtr1, *verPosInfoPtr, accType))
       
   657 				{
       
   658 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   659 				SetTestStepResult(EFail);
       
   660 			    }
       
   661 
       
   662 			if (!utils.Compare_PosInfo(*curPosInfoPtr2, *verPosInfoPtr, accType))
       
   663 				{
       
   664 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   665 				SetTestStepResult(EFail);
       
   666 			    }
       
   667 			
       
   668 			break;
       
   669 			}
       
   670 			
       
   671 		case 7:
       
   672 			{
       
   673 			//Verify Position returned - It should be the position returned earlier
       
   674 			TPositionInfo* curPosInfoPtr1 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[0]);
       
   675 			TPositionInfo* curPosInfoPtr2 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[1]);
       
   676 
       
   677 			TPositionInfo* verPosInfoPtr1 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iVerifyPosInfoArr[0]);
       
   678 			TPositionInfo* verPosInfoPtr2 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iVerifyPosInfoArr[1]);
       
   679 
       
   680 			if (!utils.Compare_PosInfo(*curPosInfoPtr1, *verPosInfoPtr1, accType))
       
   681 				{
       
   682 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   683 				SetTestStepResult(EFail);
       
   684 			    }
       
   685 
       
   686 			if (!utils.Compare_PosInfo(*curPosInfoPtr2, *verPosInfoPtr2, accType))
       
   687 				{
       
   688 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   689 				SetTestStepResult(EFail);
       
   690 			    }
       
   691 
       
   692 			break;
       
   693 			}
       
   694 			
       
   695 		case 21:
       
   696 		case 22:
       
   697 			{
       
   698 			//Verify Position returned - It should be the position returned earlier
       
   699 			TPositionInfo* curPosInfoPtr1 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[0]);
       
   700 			TPositionInfo* curPosInfoPtr2 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[1]);
       
   701 
       
   702 			TPositionInfo refPosInfo;
       
   703 			refPosInfo.SetPosition(iRefPos);
       
   704 
       
   705 			if (!utils.Compare_PosInfo(*curPosInfoPtr1, refPosInfo, accType))
       
   706 				{
       
   707 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   708 				SetTestStepResult(EFail);
       
   709 			    }
       
   710 
       
   711 			if (!utils.Compare_PosInfo(*curPosInfoPtr2, refPosInfo, accType))
       
   712 				{
       
   713 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   714 				SetTestStepResult(EFail);
       
   715 			    }
       
   716 
       
   717 			break;
       
   718 			}
       
   719 
       
   720 		case 23:
       
   721 			{
       
   722 			//Verify Position returned - It should be the position returned earlier
       
   723 			TPositionInfo* curPosInfoPtr = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[0]);
       
   724 
       
   725 			TPositionInfo refPosInfo;
       
   726 			refPosInfo.SetPosition(iRefPos);
       
   727 
       
   728 			if (!utils.Compare_PosInfo(*curPosInfoPtr, refPosInfo, accType))
       
   729 				{
       
   730 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   731 				SetTestStepResult(EFail);
       
   732 			    }
       
   733 
       
   734 			break;
       
   735 			}
       
   736 		
       
   737 		case 24:
       
   738 		case 25:
       
   739 		case 26:
       
   740 		case 28:
       
   741 			{
       
   742 			//Verify Position returned - It should be the position returned earlier
       
   743 			TPositionInfo* curPosInfoPtr1 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[0]);
       
   744 			TPositionInfo* curPosInfoPtr2 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[1]);
       
   745 			TPositionInfo* curPosInfoPtr3 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[2]);
       
   746 
       
   747 			TPositionInfo* verPosInfoPtr1 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iVerifyPosInfoArr[0]);
       
   748 			TPositionInfo* verPosInfoPtr2 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iVerifyPosInfoArr[1]);
       
   749 
       
   750 			TPositionInfo refPosInfo;
       
   751 			refPosInfo.SetPosition(iRefPos);
       
   752 
       
   753 			if (!utils.Compare_PosInfo(*curPosInfoPtr1, refPosInfo, accType))
       
   754 				{
       
   755 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   756 				SetTestStepResult(EFail);
       
   757 			    }
       
   758 
       
   759 			if (!utils.Compare_PosInfo(*curPosInfoPtr2, *verPosInfoPtr1, accType))
       
   760 				{
       
   761 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   762 				SetTestStepResult(EFail);
       
   763 			    }
       
   764 
       
   765 			//if(iTestCaseId == 26 || iTestCaseId == 25)
       
   766 			//	{
       
   767 			//	if (!utils.Compare_PosInfo(*curPosInfoPtr3, *verPosInfoPtr2, accType))
       
   768 			//		{
       
   769 			//		INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   770 			//		SetTestStepResult(EFail);
       
   771 			//	    }
       
   772 			//	}
       
   773 			//else
       
   774 			//	{
       
   775 				if (!utils.Compare_PosInfo(*curPosInfoPtr3, *verPosInfoPtr1, accType))
       
   776 					{
       
   777 					INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   778 					SetTestStepResult(EFail);
       
   779 				    }
       
   780 			//	}
       
   781 			
       
   782 			break;
       
   783 			}
       
   784 
       
   785 		case 27:
       
   786 			{
       
   787 			//Verify Position returned - It should be the position returned earlier
       
   788 			TPositionInfo* curPosInfoPtr1 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[0]);
       
   789 			TPositionInfo* curPosInfoPtr2 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[1]);
       
   790 			TPositionInfo* curPosInfoPtr3 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iCurrentPosInfoArr[2]);
       
   791 
       
   792 			TPositionInfo* verPosInfoPtr1 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iVerifyPosInfoArr[0]);
       
   793 			TPositionInfo* verPosInfoPtr2 = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iVerifyPosInfoArr[1]);
       
   794 
       
   795 			if (!utils.Compare_PosInfo(*curPosInfoPtr1, *verPosInfoPtr1, accType))
       
   796 				{
       
   797 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   798 				SetTestStepResult(EFail);
       
   799 			    }
       
   800 
       
   801 			if (!utils.Compare_PosInfo(*curPosInfoPtr2, *verPosInfoPtr2, accType))
       
   802 				{
       
   803 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   804 				SetTestStepResult(EFail);
       
   805 			    }
       
   806 
       
   807 			if (!utils.Compare_PosInfo(*curPosInfoPtr3, *verPosInfoPtr2, accType))
       
   808 				{
       
   809 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   810 				SetTestStepResult(EFail);
       
   811 			    }
       
   812 			
       
   813 			break;
       
   814 			}
       
   815 		    
       
   816 		default:
       
   817 			break;
       
   818 		}
       
   819 	}
       
   820 
       
   821 
       
   822 void CT_LbsClientStep_PartialUpdate::NotifyRegisterLcsMoLr(const TDesC& aData)
       
   823 	{
       
   824 	(void)aData;
       
   825 	}
       
   826 
       
   827 void CT_LbsClientStep_PartialUpdate::NotifyMeasurementControlLocation(const TPositionInfo& aPosition, const RLbsAssistanceDataBuilderSet& aData, const TLbsNetPosRequestQuality& aQuality)
       
   828 	{
       
   829 	(void)aPosition;
       
   830 	(void)aData;
       
   831 	(void)aQuality;
       
   832 
       
   833 	}
       
   834 	
       
   835 void CT_LbsClientStep_PartialUpdate::NotifyMeasurementReportLocation(const TPositionInfo& aPosition)
       
   836 	{
       
   837 
       
   838 	T_LbsUtils utils;
       
   839 	T_LbsUtils::TComparisonAccuracyType accType;
       
   840 	if(iParent.iSharedData->iTestModuleInUse) 
       
   841 		{
       
   842 		accType = T_LbsUtils::EExactAccuracy;
       
   843 		}
       
   844 	else
       
   845 		{
       
   846 		accType = T_LbsUtils::ERoughAccuracy;
       
   847 		}
       
   848 	
       
   849 	switch(iTestCaseId)
       
   850 		{
       
   851 		case 21:
       
   852 		case 22:
       
   853 			{
       
   854 			TPositionInfo refPosInfo;
       
   855 			refPosInfo.SetPosition(iRefPos);
       
   856 			if (!utils.Compare_PosInfo(refPosInfo, aPosition, accType))
       
   857 				{
       
   858 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   859 				SetTestStepResult(EFail);
       
   860 			    } 
       
   861 			    
       
   862 			break;
       
   863 			}
       
   864 
       
   865 		case 24:
       
   866 		case 25:
       
   867 		case 28:
       
   868 			{
       
   869 			TPositionInfo* verPosInfoPtr = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iVerifyPosInfoArr[0]);
       
   870 
       
   871 			if (!utils.Compare_PosInfo(*verPosInfoPtr, aPosition, accType))
       
   872 				{
       
   873 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   874 				SetTestStepResult(EFail);
       
   875 			    } 
       
   876 			    
       
   877 			break;
       
   878 			}
       
   879 
       
   880 		/*case 25:
       
   881 			{
       
   882 			TPositionInfo* verPosInfoPtr = reinterpret_cast<TPositionInfo*>(iParent.iSharedData->iVerifyPosInfoArr[1]);
       
   883 
       
   884 			if (!utils.Compare_PosInfo(*verPosInfoPtr, aPosition, accType))
       
   885 				{
       
   886 				INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   887 				SetTestStepResult(EFail);
       
   888 			    } 
       
   889 			    
       
   890 			break;
       
   891 			}*/
       
   892 			
       
   893 		case 26:
       
   894 			{
       
   895 			//INFO_PRINTF1(_L("Position should not be sent to Network"));
       
   896 			//SetTestStepResult(EFail);
       
   897 		    
       
   898 		    break;
       
   899 		    }
       
   900 
       
   901 		default:
       
   902 			break;
       
   903 			
       
   904 		}
       
   905 	}
       
   906 
       
   907 void CT_LbsClientStep_PartialUpdate::NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition)
       
   908 	{
       
   909 	(void)aReason;
       
   910 	(void)aPosition;
       
   911 	}
       
   912 
       
   913 void CT_LbsClientStep_PartialUpdate::NotifyReleaseLcsMoLr(TInt aReason)
       
   914 	{
       
   915 	(void)aReason;
       
   916 	if(iTestCaseId == 23)
       
   917 		{
       
   918 		iState = EWaiting;
       
   919 		}
       
   920 	}
       
   921 
       
   922 
       
   923 TInt CT_LbsClientStep_PartialUpdate::OpenNetSim()
       
   924 	{
       
   925 	TInt err = KErrNone;
       
   926 	
       
   927 	//Connect to NetSim
       
   928 	err = iNetSim.ConnectL(this);
       
   929 	if (err)
       
   930 		{
       
   931 		SetTestStepResult(EFail);
       
   932 		return KErrGeneral;
       
   933 		}
       
   934 	
       
   935 	// Set the reference position, which also be used for any required verification.
       
   936 	iRefPos.SetCoordinate(REFPOS_LAT, REFPOS_LONG, REFPOS_ALT);
       
   937 	iRefPos.SetAccuracy(REFPOS_HORZ_ACCURACY, REFPOS_VERT_ACCURACY);
       
   938 	iRefPos.SetCurrentTime();
       
   939 
       
   940 	if (!iNetSim.SetReferenceLocation(iRefPos))
       
   941 		{
       
   942 		INFO_PRINTF1(_L("Failed test, can't set NetSim's reference location."));
       
   943 		SetTestStepResult(EFail);
       
   944 		iNetSim.Close();
       
   945 		return KErrGeneral;
       
   946 		}	
       
   947 
       
   948 	//Set the position quality required by the network.
       
   949 	TTimeIntervalMicroSeconds maxFixTime(60 * 1000000);
       
   950 
       
   951 	TLbsNetPosRequestQuality netPosQuality;
       
   952 	netPosQuality.SetMaxFixTime(maxFixTime);
       
   953 	netPosQuality.SetMinHorizontalAccuracy(iRefPos.HorizontalAccuracy());
       
   954 	netPosQuality.SetMinVerticalAccuracy(iRefPos.VerticalAccuracy());
       
   955 								
       
   956 	if (!iNetSim.SetQuality(netPosQuality))
       
   957 		{
       
   958 		INFO_PRINTF1(_L("Failed test, can't set NetSim's quality."));
       
   959 		SetTestStepResult(EFail);
       
   960 		iNetSim.Close();
       
   961 		return KErrGeneral;
       
   962 		}
       
   963 			
       
   964 	TUid pluginUid;		
       
   965 	if(iParent.iSharedData->iTestModuleInUse) 
       
   966 		{
       
   967 		// Set plugin to use.
       
   968 		pluginUid = TUid::Uid(KTestAssistanceDataProviderPluginUidValue);	
       
   969 		}
       
   970 	else
       
   971 		{
       
   972 		// Real AGPS Uid
       
   973 		pluginUid = TUid::Uid(KRealAssistanceDataProviderPluginUidValue);	
       
   974 		}
       
   975 
       
   976 	if (!iNetSim.SetAssistanceDataProvider(pluginUid))
       
   977 		{
       
   978 		INFO_PRINTF1(_L("Failed test, can't set NetSim's assistance data plugin uid."));
       
   979 		SetTestStepResult(EFail);
       
   980 		iNetSim.Close();
       
   981 		return KErrGeneral;
       
   982 		} 
       
   983 	
       
   984 	return KErrNone;
       
   985 	}
       
   986 
       
   987 void CT_LbsClientStep_PartialUpdate::CloseNetSim()
       
   988 	{
       
   989 	iNetSim.Close();
       
   990 	}