lbstest/lbstestproduct/lbshybridmolr/src/ctlbataearlycomplete.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 // This is the class implementation for the Hybrid MoLr Tests
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 // EPOC includes.
       
    20 #include <e32math.h>
       
    21 
       
    22 // LBS includes. 
       
    23 #include <lbssatellite.h>
       
    24 #include <lbs/lbsgpsmeasurement.h>
       
    25 #include <lbs/lbsnetprotocolbase.h>
       
    26 #include <lbs/lbsassistancedatabuilderset.h>
       
    27 #include <lbs/lbsloccommon.h>
       
    28 #include <lbs/lbsx3p.h>
       
    29 #include <lbs/lbsnetprotocolbase.h>
       
    30 #include <lbs/lbsadmin.h>
       
    31 
       
    32 // LBS test includes.
       
    33 #include "ctlbsuebasedmolrself.h"
       
    34 #include "ctlbataearlycomplete.h"
       
    35 #include <lbs/test/tlbsutils.h>
       
    36 #include "argutils.h"
       
    37 #include <lbs/test/activeyield.h>
       
    38 
       
    39 #include  "lbs/test/ctlbsagpshandler.h"
       
    40 
       
    41 /**
       
    42 Static Constructor
       
    43 */
       
    44 CT_LbsATAEarlyComplete* CT_LbsATAEarlyComplete::New(CT_LbsHybridMOLRServer& aParent)
       
    45 	{
       
    46 	// Note the lack of ELeave.
       
    47 	// This means that having insufficient memory will return NULL;
       
    48 	CT_LbsATAEarlyComplete* testStep = new CT_LbsATAEarlyComplete(aParent);
       
    49 	if (testStep)
       
    50 		{
       
    51 		TInt err = KErrNone;
       
    52 
       
    53 		TRAP(err, testStep->ConstructL());
       
    54 		if (err)
       
    55 			{
       
    56 			delete testStep;
       
    57 			testStep = NULL;
       
    58 			}
       
    59 		}
       
    60 	return testStep;
       
    61 	}
       
    62 
       
    63 
       
    64 /**
       
    65  * Constructor
       
    66  */
       
    67 CT_LbsATAEarlyComplete::CT_LbsATAEarlyComplete(CT_LbsHybridMOLRServer& aParent) : CT_LbsHybridMOLRStep(aParent)
       
    68 	{
       
    69 	SetTestStepName(KLbsATAEarlyComplete);
       
    70 	
       
    71 	iSessionId.SetSessionOwner(KRequestUid);
       
    72 	iSessionId.SetSessionNum(0x0001);
       
    73 		
       
    74 	iState = EInitializing;
       
    75 	}
       
    76 
       
    77 
       
    78 void CT_LbsATAEarlyComplete::ConstructL()
       
    79 	{
       
    80 	// Create the base class objects.
       
    81 	CT_LbsHybridMOLRStep::ConstructL();
       
    82 	}
       
    83 
       
    84 /**
       
    85  * Destructor
       
    86  */
       
    87 CT_LbsATAEarlyComplete::~CT_LbsATAEarlyComplete()
       
    88 	{
       
    89 	}
       
    90 
       
    91 
       
    92 /**
       
    93  * @return - TVerdict code
       
    94  * Override of base class virtual
       
    95  */
       
    96 TVerdict CT_LbsATAEarlyComplete::doTestStepPreambleL()
       
    97 	{
       
    98 	INFO_PRINTF1(_L("Test Preamble. CT_LbsATAEarlyComplete"));
       
    99 
       
   100 	// create the test channel handler
       
   101 	iAGpsHandler = CT_LbsAGpsHandler::NewL(this);
       
   102 	
       
   103 	SetTestStepResult(EPass);
       
   104 	return TestStepResult();
       
   105 	}
       
   106 /**
       
   107  * @return - TVerdict code
       
   108  * Override of base class virtual
       
   109  */
       
   110 TVerdict CT_LbsATAEarlyComplete::doTestStepPostambleL()
       
   111 	{
       
   112 	INFO_PRINTF1(_L("Test Postamble. CT_LbsATAEarlyComplete"));
       
   113 
       
   114 	delete iAGpsHandler;
       
   115 	iAGpsHandler = NULL;
       
   116 		
       
   117 	return TestStepResult();
       
   118 	}
       
   119 	
       
   120 
       
   121 TVerdict CT_LbsATAEarlyComplete::doTestStepL()
       
   122 	{
       
   123    	INFO_PRINTF1(_L("&lt;&lt;CT_LbsATAEarlyComplete::doTestStepL()"));
       
   124 
       
   125     INFO_PRINTF1(_L("CT_LbsATAEarlyComplete::doTestStepL()"));	
       
   126 	// Stop the test if the preable failed
       
   127 	TESTL(TestStepResult() == EPass);
       
   128 
       
   129 	INFO_PRINTF1(_L("&gt;&gt;CT_LbsStep_SetupRoamSelfLocate::doTestStepL()"));
       
   130    
       
   131    	CLbsAdmin* adminApi = CLbsAdmin::NewL();
       
   132    	CleanupStack::PushL(adminApi);
       
   133    	
       
   134    	// Switch on the self locate API when roaming.
       
   135    	CLbsAdmin::TSelfLocateService serviceSetting = CLbsAdmin::ESelfLocateUnknown;
       
   136    
       
   137    	TInt err = adminApi->Set(KLbsSettingRoamingSelfLocate, CLbsAdmin::ESelfLocateOn);
       
   138    	User::LeaveIfError(err);
       
   139    	err = adminApi->Get(KLbsSettingRoamingSelfLocate, serviceSetting);	
       
   140    	User::LeaveIfError(err);
       
   141    	
       
   142    	if(serviceSetting != CLbsAdmin::ESelfLocateOn)
       
   143    		{
       
   144    		INFO_PRINTF1(_L("Self locate API admin setting didn't work"));
       
   145    		SetTestStepResult(EFail);
       
   146    		}					
       
   147    	
       
   148    	// Set gps mode when roaming.
       
   149    	CLbsAdmin::TGpsMode gpsModeSetting = CLbsAdmin::EGpsModeUnknown;
       
   150    	
       
   151   	err = adminApi->Set(KLbsSettingRoamingGpsMode, CLbsAdmin::EGpsAlwaysTerminalAssisted);
       
   152    	User::LeaveIfError(err);
       
   153    	err = adminApi->Get(KLbsSettingRoamingGpsMode, gpsModeSetting);
       
   154    	User::LeaveIfError(err);
       
   155    	
       
   156  	if (gpsModeSetting != CLbsAdmin::EGpsAlwaysTerminalAssisted)
       
   157    		{
       
   158    		INFO_PRINTF1(_L("Gps mode admin setting didn't work"));
       
   159    		SetTestStepResult(EFail);
       
   160    		}
       
   161    		
       
   162 	CLbsAdmin::TSpecialFeature	ignoreAccuracy;
       
   163    	TInt err1 = adminApi->Get(KLbsSpecialFeatureIgnoreAccuracy, ignoreAccuracy);
       
   164 	if (err1 != KErrNone)
       
   165 		{
       
   166 	  	INFO_PRINTF1(_L("&lt;&lt KLbsSpecialFeatureIgnoreAccuracy is absent in admin;"));
       
   167 		}	
       
   168 		else
       
   169 		{
       
   170 	  	INFO_PRINTF2(_L("&lt;&lt KLbsSpecialFeatureIgnoreAccuracy is in admin and it's set to %d;"),ignoreAccuracy);
       
   171 		}	
       
   172 
       
   173   	//INFO_PRINTF1(_L("&lt;&lt Setting KLbsSpecialFeatureIgnoreAccuracy to OFF"));
       
   174 	//err = adminApi->Set(KLbsSpecialFeatureIgnoreAccuracy, CLbsAdmin::ESpecialFeatureOff;);
       
   175    		
       
   176    	CleanupStack::PopAndDestroy(adminApi);
       
   177    
       
   178    	// Allow the setting to be propagated
       
   179    	User::After(2*1000*1000);
       
   180    
       
   181 	const TInt KTimeOut = 60*1000*1000;
       
   182 
       
   183 	// Create Network Protocol Proxy
       
   184 	CNetProtocolProxy* proxy = CNetProtocolProxy::NewL();
       
   185 	CleanupStack::PushL(proxy);
       
   186 
       
   187 	// Recv --> GetCurrentCapabilitiesResponse.
       
   188 	// Soak up the Lbs System Status (produced by A-GPS Manager startup).}
       
   189 	TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgGetCurrentCapabilitiesResponse);
       
   190 	CLbsNetworkProtocolBase::TLbsSystemStatus status;
       
   191 	TInt cleanupCnt;
       
   192 	cleanupCnt = proxy->GetArgsLC(ENetMsgGetCurrentCapabilitiesResponse, &status);
       
   193 	TESTL(status == CLbsNetworkProtocolBase::ESystemStatusNone);
       
   194 	CleanupStack::PopAndDestroy(cleanupCnt);
       
   195 
       
   196 
       
   197 	// Setup location session and position watcher.
       
   198 	RPositionServer server;
       
   199 	TESTL(KErrNone == server.Connect());
       
   200 	CleanupClosePushL(server);	
       
   201 
       
   202 	RPositioner pos;
       
   203 	TESTL(KErrNone == pos.Open(server));
       
   204 	CleanupClosePushL(pos);
       
   205 
       
   206 	// Set the max fix time for the client request to ensure the location server does not complete the request too soon during the test.
       
   207 	TPositionUpdateOptions posOpts(TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(240000000));
       
   208 	pos.SetUpdateOptions(posOpts);
       
   209 	CPosServerWatcher *pWatch = CPosServerWatcher::NewLC(pos, *this);
       
   210 
       
   211 
       
   212 	// Client Send - a self-locate request.
       
   213 	pWatch->IssueNotifyPositionUpdate();
       
   214 
       
   215 
       
   216 	TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestSelfLocation);
       
   217 
       
   218 	// Process the response.
       
   219 	TLbsNetSessionId* 					sessionId = NULL;
       
   220 	TLbsNetPosRequestOptionsAssistance*	opts = NULL;
       
   221 	
       
   222 	cleanupCnt = proxy->GetArgsLC(ENetMsgRequestSelfLocation, &sessionId, &opts);
       
   223 
       
   224 	TBool qualitycheck = ArgUtils::CompareQuality(	opts, 
       
   225 													ETrue, 
       
   226 													KMinHorizontalAcc, 
       
   227 													KMinVerticalAcc, 
       
   228 													KMOLRFixTime,
       
   229 													0, 
       
   230 													EAssistanceDataReferenceTime, 
       
   231 													(TPositionModuleInfo::ETechnologyNetwork 
       
   232 													| TPositionModuleInfo::ETechnologyAssisted)
       
   233 												);
       
   234 		
       
   235 	TESTL(qualitycheck);
       
   236 	
       
   237 	iSessionId.SetSessionNum(sessionId->SessionNum());
       
   238 	iSessionId.SetSessionOwner(sessionId->SessionOwner());
       
   239 
       
   240 	CleanupStack::PopAndDestroy(cleanupCnt);
       
   241 	sessionId = NULL;
       
   242 	opts = NULL;	
       
   243 
       
   244 		
       
   245 	// Send <-- ProcessStatusUpdate.
       
   246 	MLbsNetworkProtocolObserver::TLbsNetProtocolService serviceMask = MLbsNetworkProtocolObserver::EServiceSelfLocation;
       
   247 	proxy->CallL(ENetMsgProcessStatusUpdate, &serviceMask);
       
   248 
       
   249 	// Send <-- ProcessAssistanceData.
       
   250 	TLbsAsistanceDataGroup			dataMask = EAssistanceDataReferenceTime;
       
   251 	RLbsAssistanceDataBuilderSet	data;
       
   252 	TInt							reason = KErrNone;
       
   253 	ArgUtils::PopulateLC(data);
       
   254 	proxy->CallL(ENetMsgProcessAssistanceData, &dataMask, &data, &reason);
       
   255 	CleanupStack::PopAndDestroy(); // data
       
   256 
       
   257 
       
   258 	// Send <-- ProcessLocationRequest.
       
   259 	TBool												emergency = EFalse;
       
   260 	MLbsNetworkProtocolObserver::TLbsNetProtocolService	service = MLbsNetworkProtocolObserver::EServiceSelfLocation;
       
   261 	TLbsNetPosRequestQuality							quality = ArgUtils::Quality();
       
   262 	TLbsNetPosRequestMethod								method = ArgUtils::RequestTAPMethod();
       
   263 	quality.SetMaxFixTime(ArgUtils::Alpha2());
       
   264 	proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);
       
   265 
       
   266 	// Now that the hybrid/alpha2 has been requested, record current time to verify alpha2 timer expires correctly.
       
   267 	TTime startTime;
       
   268 	startTime.HomeTime();
       
   269 
       
   270 
       
   271 	// Recv --> RequestAssistanceData.
       
   272 	TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
       
   273 	cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
       
   274 	TESTL(dataMask == EAssistanceDataNone);
       
   275 	CleanupStack::PopAndDestroy(cleanupCnt);
       
   276 
       
   277 	// Determine the value to take off the alpha2 value. This is required because we had to wait for the assistance data response.
       
   278 	TTimeIntervalMicroSeconds microseconds;
       
   279 	TTime stopTime;
       
   280 	stopTime.HomeTime();
       
   281 	microseconds = stopTime.MicroSecondsFrom(startTime); 
       
   282 	TInt64 timeElapsed = microseconds.Int64();
       
   283 
       
   284 
       
   285 	// Recv --> RespondLocationRequest.
       
   286 	// First ensure we don't recv response before Alpha2.
       
   287 	TInt delta = 2 * 1000 * 1000; // 2 secs.
       
   288 	TESTL(proxy->WaitForResponse(ArgUtils::Alpha2() - timeElapsed - delta) == ENetMsgTimeoutExpired);
       
   289 	
       
   290 	// Wait for and process the response.
       
   291 	TESTL(proxy->WaitForResponse(2 * delta) == ENetMsgRespondLocationRequest);
       
   292 
       
   293 	TPositionGpsMeasurementInfo* measurementInfo = NULL;
       
   294 	cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo);
       
   295 	TESTL(sessionId->SessionNum() == iSessionId.SessionNum());
       
   296 	TESTL(reason == KErrNone);
       
   297 	TESTL(measurementInfo->PositionClassType() == EPositionGpsMeasurementInfoClass);
       
   298 	
       
   299 	CleanupStack::PopAndDestroy(cleanupCnt);
       
   300 	sessionId = NULL;
       
   301 	measurementInfo = NULL;
       
   302 
       
   303 
       
   304 	// Recv -> RequestAssistanceData - we get an extra msg as the result of the A-GPS manager re-issueing a location request when it's
       
   305 	//									max fix time timer expries.
       
   306 	TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
       
   307 	cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
       
   308 	TESTL(dataMask == EAssistanceDataNone);
       
   309 	CleanupStack::PopAndDestroy(cleanupCnt);
       
   310 
       
   311 	const TInt t = 8 * 1000 * 1000; // 8 secs.
       
   312 	quality.SetMaxFixTime(t);
       
   313 	
       
   314 	
       
   315 	// Send <-- ProcessLocationUpdate - return network calculated pos.
       
   316 	TPositionInfo networkPosInfo = ArgUtils::MolrNetworkPositionInfo();
       
   317 	proxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &networkPosInfo);
       
   318 
       
   319 	// Client Recv: Second update position - This should return with KPositionEarlyComplete
       
   320 	CheckForObserverEventTestsL(KTimeOut, *this);
       
   321 
       
   322 	// Wait to ensure no additional responses turn up.
       
   323 	delta = 10 * 1000 * 1000;
       
   324 	TNetProtocolResponseType rtype = proxy->WaitForResponse(delta);
       
   325 	
       
   326 	if (rtype == ENetMsgTimeoutExpired)
       
   327 		{
       
   328 		INFO_PRINTF1(_L("No additional messages turned up"));
       
   329 	
       
   330  		}
       
   331 	else
       
   332 		{
       
   333 		INFO_PRINTF1(_L("Got unexpected messages"));
       
   334  		}
       
   335 		
       
   336 	TESTL(rtype == ENetMsgCancelSelfLocation); 
       
   337 
       
   338 	// Send <-- ProcessSessionComplete.
       
   339 	reason = KErrNone;
       
   340 	proxy->CallL(ENetMsgProcessSessionComplete, &iSessionId, &reason);
       
   341 
       
   342 
       
   343 	// Carryout unique test actions (the ALT sections - see sequence diagrams.
       
   344 	TInt testCaseId;
       
   345 	if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId))
       
   346 		{
       
   347 		switch (testCaseId)
       
   348 			{
       
   349 			// Test case Stop_OutsideMoLr
       
   350 			case 6:
       
   351 				{
       
   352 				User::After(2*1000*1000);
       
   353 				
       
   354 				iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_DisableReqAssistData, ETrue);
       
   355 
       
   356 				// Client Send: Notify Position Update
       
   357 				pWatch->IssueNotifyPositionUpdate();
       
   358 		
       
   359 				// now ensure that intgration moulde does NOT RequestAssistanceData
       
   360 				// and thus LBS will NOT send RequestSelfLopcation to protocol module
       
   361 				// and a MoLr will NOT be started 
       
   362 				
       
   363 	 			// Client Send: Complete Request
       
   364 				TESTL(pos.CompleteRequest(EPositionerNotifyPositionUpdate) == KErrNone);
       
   365 	
       
   366 				// Client Recv: Second update position - This should return with KPositionEarlyComplete
       
   367 				CheckForObserverEventTestsL(KTimeOut, *this);
       
   368 
       
   369 				TESTL(iState == EGotCompleteRequestPosition);
       
   370 				
       
   371 				}
       
   372 				break;
       
   373 					
       
   374 			// Test case Stop_InsideMoLr
       
   375 			case 5:
       
   376 				{
       
   377 				// Client Send: Notify Position Update
       
   378 
       
   379 				User::After(2*1000*1000);
       
   380 
       
   381 				pWatch->IssueNotifyPositionUpdate();
       
   382 
       
   383 				rtype = proxy->WaitForResponse(KTimeOut);
       
   384 				TESTL(rtype == ENetMsgRequestSelfLocation);
       
   385 
       
   386 				// Process the response.
       
   387 				sessionId = NULL;
       
   388 				opts = NULL;
       
   389 	
       
   390 				cleanupCnt = proxy->GetArgsLC(ENetMsgRequestSelfLocation, &sessionId, &opts);
       
   391 
       
   392 				qualitycheck = ArgUtils::CompareQuality(	opts, 
       
   393 											EFalse, 
       
   394 											KMinHorizontalAcc, 
       
   395 											KMinVerticalAcc, 
       
   396 											KMOLRFixTime,
       
   397 											0, 
       
   398 											EAssistanceDataNone, 
       
   399 											(TPositionModuleInfo::ETechnologyNetwork 
       
   400 											| TPositionModuleInfo::ETechnologyAssisted)
       
   401 										);
       
   402 		
       
   403 				TESTL(qualitycheck);
       
   404 	
       
   405 				iSessionId.SetSessionNum(sessionId->SessionNum());
       
   406 				iSessionId.SetSessionOwner(sessionId->SessionOwner());
       
   407 
       
   408 				CleanupStack::PopAndDestroy(cleanupCnt);
       
   409 				sessionId = NULL;
       
   410 				opts = NULL;	
       
   411 	
       
   412 
       
   413 				// Send <-- ProcessLocationRequest.
       
   414 				TBool	emergency = EFalse;
       
   415 				MLbsNetworkProtocolObserver::TLbsNetProtocolService	service = MLbsNetworkProtocolObserver::EServiceSelfLocation;
       
   416 				TLbsNetPosRequestQuality quality = ArgUtils::Quality();
       
   417 				TLbsNetPosRequestMethod method = ArgUtils::RequestTAPMethod();
       
   418 				quality.SetMaxFixTime(ArgUtils::Alpha2());
       
   419 				proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);
       
   420 
       
   421 				// Now that the hybrid/alpha2 has been requested, record current time to verify alpha2 timer expires correctly.
       
   422 				TTime startTime;
       
   423 				startTime.HomeTime();
       
   424 
       
   425 				// Recv --> RequestAssistanceData.
       
   426 				TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
       
   427 				cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
       
   428 				TESTL(dataMask == EAssistanceDataNone);
       
   429 				CleanupStack::PopAndDestroy(cleanupCnt);
       
   430 
       
   431     			//Client Send: CompleteRequest
       
   432 				TESTL(pos.CompleteRequest(EPositionerNotifyPositionUpdate) == KErrNone);
       
   433 	
       
   434 				// Client Recv: Second update position - This should return with KPositionEarlyComplete
       
   435 				CheckForObserverEventTestsL(KTimeOut, *this);
       
   436 
       
   437 				TESTL(iState == EDone);
       
   438 
       
   439 				// Wait for and process the response. Should be aRespondLocationRequest(KErrNone,FinalNetworkPosition)
       
   440 				rtype = proxy->WaitForResponse(KTimeOut);
       
   441 				TESTL(rtype == ENetMsgRespondLocationRequest);
       
   442 
       
   443 				sessionId = NULL;
       
   444 				TPositionInfo* positionInfo = NULL;
       
   445 			
       
   446 				cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &positionInfo);
       
   447 			
       
   448 				// Check the response.
       
   449 				TESTL(positionInfo->PositionClassType() == (EPositionInfoClass|EPositionCourseInfoClass|EPositionSatelliteInfoClass));
       
   450 				TESTL(sessionId->SessionNum() == iSessionId.SessionNum());
       
   451 				TESTL(reason == KErrNone);
       
   452 				CleanupStack::PopAndDestroy(cleanupCnt);
       
   453 
       
   454 				// Send <-- ProcessSessionComplete.
       
   455 				reason = KErrNone;
       
   456 				proxy->CallL(ENetMsgProcessSessionComplete, &iSessionId, &reason);	
       
   457 				}
       
   458 				break;
       
   459 			default:
       
   460 				{
       
   461 				User::Leave(KErrArgument);	
       
   462 				}
       
   463 				break;
       
   464 			}
       
   465 		}
       
   466 	else
       
   467 		{
       
   468 	INFO_PRINTF1(_L("<FONT><B>Failed to read from ini file correctly</B></FONT>"));
       
   469 	SetTestStepResult(EFail);
       
   470 		}
       
   471 
       
   472 	// Wait for 10 seconds to ensure no additional responses turn up.
       
   473 	delta = 10 * 1000 * 1000;
       
   474 	TNetProtocolResponseType mType = proxy->WaitForResponse(delta);
       
   475 	TESTL(mType == ENetMsgTimeoutExpired);
       
   476 	
       
   477 	// Done. Now cleanup...
       
   478 	CleanupStack::PopAndDestroy(pWatch);
       
   479 	CleanupStack::PopAndDestroy(); // pos
       
   480 	CleanupStack::PopAndDestroy(); // server	
       
   481 	CleanupStack::PopAndDestroy(proxy);
       
   482 		
       
   483 	return TestStepResult();
       
   484 	}
       
   485 
       
   486 
       
   487 
       
   488 // MPosServerObserver
       
   489 void CT_LbsATAEarlyComplete::OnGetLastKnownPosition(TInt32 /*aErr*/, const TPositionInfoBase& /*aPosInfo*/)
       
   490 	{
       
   491 	TEST(EFalse); // Shouldn't see this...
       
   492 	ReturnToTestStep();
       
   493 	}
       
   494 
       
   495 void CT_LbsATAEarlyComplete::OnNotifyPositionUpdate(TInt32 aErr, const TPositionInfoBase& aPosInfo)
       
   496 	{
       
   497 	// Verify position.
       
   498 
       
   499 	if (iState == EInitializing)
       
   500 		{
       
   501 		
       
   502 		INFO_PRINTF2(_L("OnNotifyPositionUpdate, Expecting KPositionQualityLoss and got err %d."), aErr);	
       
   503 
       
   504 		TEST(aErr == KPositionQualityLoss);
       
   505 		TInt testCaseId;
       
   506 		if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId))
       
   507 			{
       
   508 			T_LbsUtils utils;
       
   509 			TPositionInfo networkPosInfo = ArgUtils::MolrNetworkPositionInfo();
       
   510 		
       
   511 			TEST(utils.Compare_PosInfo(aPosInfo, networkPosInfo));
       
   512 			TEST(aPosInfo.PositionMode() == (TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted));
       
   513 			TEST(aPosInfo.PositionClassType() == EPositionInfoClass);
       
   514 				
       
   515 			TEST(aPosInfo.ModuleId() == TUid::Uid(0x10281D43)); // id of NetLocManager
       
   516 			}
       
   517 		iState = EGotCompleteRequestPosition;
       
   518 		}
       
   519 	else if (iState == EGotCompleteRequestPosition)
       
   520 		{
       
   521 		TEST(aErr == KPositionEarlyComplete);
       
   522 		T_LbsUtils utils;
       
   523 		TPositionInfo networkPosInfo = ArgUtils::MolrNetworkPositionInfo();
       
   524 		
       
   525 		TEST(utils.Compare_PosInfo(aPosInfo, networkPosInfo));
       
   526 		TEST(aPosInfo.PositionMode() == (TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted));
       
   527 		TEST(aPosInfo.PositionClassType() == EPositionInfoClass);
       
   528 			
       
   529 		TEST(aPosInfo.ModuleId() == TUid::Uid(0x10281D43)); // id of NetLocManager
       
   530 		
       
   531 		iState = EDone;
       
   532 		}
       
   533 	else if (iState == EDone)
       
   534 		{
       
   535 		// not used
       
   536 		}
       
   537 	else
       
   538 		{
       
   539 		TEST(EFalse);
       
   540 		}
       
   541 		
       
   542 
       
   543 		
       
   544 	ReturnToTestStep();
       
   545 	}
       
   546 
       
   547 // Response back from A-GPS hybrid module to notify the test it has got the timeout request.
       
   548 void CT_LbsATAEarlyComplete::ProcessAGpsResponseMessage(const TT_LbsAGpsResponseMsg::TModuleResponseType aResponse)
       
   549 	{
       
   550 	if (TT_LbsAGpsResponseMsg::EModuleResponseOk != aResponse)
       
   551 		{
       
   552 		// fail test could not config module!
       
   553 		INFO_PRINTF2(_L("Unable to configure hybrid module, err %d."), aResponse);	
       
   554 		SetTestStepResult(EFail);						
       
   555 		}
       
   556 		
       
   557 		// Return back to test.
       
   558 		CActiveScheduler::Stop();	
       
   559 	}