lbstest/lbstestproduct/lbsconflict/src/ctlbsconflictstepcanceltrackingconflict.cpp
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file ctlbsassdatastepcanceltrackingconflict.cpp
       
    15 // This is the class implementation for the Module Information Tests
       
    16 // EPOC includes.
       
    17 // 
       
    18 //
       
    19 
       
    20 // LBS includes. 
       
    21 #include <lbs.h>
       
    22 #include <lbs/lbsnetcommon.h>
       
    23 #include <lbssatellite.h>
       
    24 #include <lbs/lbsnetprotocolbase.h>
       
    25 #include <lbs/lbsassistancedatabuilderset.h>
       
    26 #include <e32math.h>
       
    27 
       
    28 // LBS test includes.
       
    29 #include "ctlbsconflictstepcanceltrackingconflict.h"
       
    30 #include <lbs/test/tlbsutils.h>
       
    31 
       
    32 
       
    33 /**	Test case development notes
       
    34 	===========================
       
    35 
       
    36 	It was decided to aid readablity each test class shall only support a single test case.
       
    37 	This canceltrackingconflict has been produced to show how a typical conflict test case should be coded.
       
    38 
       
    39 
       
    40 	Net Sim and Sequence Events
       
    41 	---------------------------
       
    42 	Every test case implementation will use the ctlbsconflictstep class which supports Net Sim
       
    43 	interactions and a way to ensure Net Sim events and client completion events have a occured
       
    44 	in the correct order. An array is used to hold the expected sequence event values, and a second
       
    45 	array contains the actual events produced during the test. Once the test moves into the EWaiting
       
    46 	state typically after all the client requests have been made, the event arrays are compared to
       
    47 	ensure the correct events were given.
       
    48 
       
    49 	To set the expected sequence events populate the array in the SetExpectedSeq() function.
       
    50 	
       
    51 
       
    52 	Async wappers
       
    53 	-------------
       
    54 	Each Lbs client async request is wappared in a active object class, to allow a number of
       
    55 	outstanding async requests during the test. Any async calls you wish to make should also
       
    56 	be wrapped in the same way, see CT_LbsDoX3P and CT_LbsDoPosUpdate for canceltrackingconflicts.
       
    57 	These classes are constructed in the test class ConstructL, and maybe started or cancelled
       
    58 	during the test at any point.
       
    59 	
       
    60 
       
    61 	Verify Position Information
       
    62 	---------------------------
       
    63 	A test should verify each client call which expected a location to be returned. The
       
    64 	location data should be validation to ensure it's correct. See VerifyPosInfos.
       
    65 */
       
    66 
       
    67 
       
    68 /**
       
    69 Static Constructor
       
    70 */
       
    71 CT_LbsConflictStep_canceltrackingconflict* CT_LbsConflictStep_canceltrackingconflict::New(CT_LbsConflictServer& aParent)
       
    72 	{
       
    73 	// Note the lack of ELeave.
       
    74 	// This means that having insufficient memory will return NULL;
       
    75 	CT_LbsConflictStep_canceltrackingconflict* testStep = new CT_LbsConflictStep_canceltrackingconflict(aParent);
       
    76 	if (testStep)
       
    77 		{
       
    78 		TInt err = KErrNone;
       
    79 
       
    80 		TRAP(err, testStep->ConstructL());
       
    81 		if (err)
       
    82 			{
       
    83 			delete testStep;
       
    84 			testStep = NULL;
       
    85 			}
       
    86 		}
       
    87 	return testStep;
       
    88 	}
       
    89 
       
    90 
       
    91 /**
       
    92  * Constructor
       
    93  */
       
    94 CT_LbsConflictStep_canceltrackingconflict::CT_LbsConflictStep_canceltrackingconflict(CT_LbsConflictServer& aParent) : CT_LbsConflictStep(aParent)
       
    95 	{
       
    96 	SetTestStepName(KLbsConflictStep_canceltrackingconflict);
       
    97 	}
       
    98 
       
    99 
       
   100 void CT_LbsConflictStep_canceltrackingconflict::ConstructL()
       
   101 	{
       
   102 	// Create the base class objects.
       
   103 	CT_LbsConflictStep::ConstructL();
       
   104 	
       
   105 	// Self locate async wrapper.
       
   106 	iDoPosUpdate = CT_LbsDoPosUpdate::NewL(this);
       
   107 
       
   108 	// X3P async wrapper.
       
   109 	iDoX3P = CT_LbsDoX3P::NewL(this);
       
   110 	}
       
   111 
       
   112 
       
   113 /**
       
   114  * Destructor
       
   115  */
       
   116 CT_LbsConflictStep_canceltrackingconflict::~CT_LbsConflictStep_canceltrackingconflict()
       
   117 	{
       
   118 	
       
   119 	iDoPosUpdate->Cancel();
       
   120 	delete iDoPosUpdate;
       
   121 
       
   122 	iDoX3P->Cancel();
       
   123 	delete iDoX3P;
       
   124 	}
       
   125 
       
   126 
       
   127 /** Called at the start of the test...
       
   128 
       
   129 	Each test case MUST implement this.
       
   130 
       
   131 	The table below describes the expected order that the callbacks should be called
       
   132 	during the test.
       
   133 	
       
   134 	Note that the tests deliberateley do NOT check the order that the client requests
       
   135 	are completed. This is because the delivery order is not guaranteed by LBS.
       
   136 	The tests will check that all client requests are completed with the correct error
       
   137 	code and position at the end of the test.
       
   138 */
       
   139 
       
   140 // Test 0013
       
   141 // here we do a tracking NPUD and wait for it to finish
       
   142 // Then we start a second NPUD in the  NotifyReleaseLcsMoLr callback
       
   143 // followed by  a X3P Push. Conflict!
       
   144 // When the first X3P completes (in the RunL()) we do a X3P (Timer) request.
       
   145 // The first NPUD and both X3P requests should complte  with KErrNone
       
   146 // The second NPUD should complete with KErrHighPriorityRec
       
   147 
       
   148 
       
   149 //!		Client:SetUpdateOptions(interval=4 seconds)			->LBS
       
   150 //!		Client:NotifyPositionUpdate								->LBS
       
   151 //!		Client:RunL(NotifyPositionUpdate(KErrNone))				<-LBS	// when it completes
       
   152 //!		Client:NotifyPositionUpdate								->LBS	// request now outstanding!
       
   153 //!		The next steps replaces original test 0009!	
       
   154 //!		Client:TransmitPosition(PUSH)							->LBS
       
   155 //!		Client:RunL(NotifyPositionUpdate(KErrHighPriorityRec))	<-LBS	// conflict! // this action causes end of tracking
       
   156 //!		Client:RunL(TransmitPosition(PUSH,pos,KErrNone))		->LBS	
       
   157 
       
   158 //!		Client:TransmitPosition(TIMER)							->LBS
       
   159 //!		Client:RunL(TransmitPosition(PUSH,pos,KErrNone))		->LBS	// checks that tracking is stopped
       
   160 
       
   161 //!
       
   162 void CT_LbsConflictStep_canceltrackingconflict::SetExpectedSeq()
       
   163 	{
       
   164 	// Self locate MOLR (iState = ERegPosUpdate)
       
   165 
       
   166 	SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyRegisterLcsMoLr);				// --> To Net
       
   167 	SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementControlLocation);	// <-- From Net
       
   168 	SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementReportLocation);	// --> To Net
       
   169 	SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult);		// <-- From Net
       
   170 	SetVerifySeqEvent(ESelf_MOLR_NetSim_Got_NotifyReleaseLcsMoLr);				// --> To Net
       
   171 	// above client request completes KErrNone
       
   172 	// in the ReleaseLcsMoLr call back do asecond tracking Self locate MOLR 
       
   173 	// note that the test integration module only dies a MoLr for the first request
       
   174 
       
   175 	// and then do a X3PPush in the above callback
       
   176 	// second NUPD should complete with KErrHighPriorityRec
       
   177 
       
   178 	// X3P Push (iState = EReqX3PPush) - NPUD above will complete with KErrHighPriorityRec
       
   179 	SetVerifySeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyRegisterLcsMoLr);				// --> To Net
       
   180 	SetVerifySeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyMeasurementControlLocation);	// <-- From Net
       
   181 	SetVerifySeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyMeasurementReportLocation);	// --> To Net
       
   182 	SetVerifySeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult);		// <-- From Net
       
   183 	SetVerifySeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyReleaseLcsMoLr);				// --> To Net
       
   184 	
       
   185 	// followed by a X3P Timer (after X3P Timer register iState = ERegX3PTimer),
       
   186 	// X3P(Timer) should be queued and handled after the X3P(Push)
       
   187 	SetVerifySeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyRegisterLcsMoLr);			// --> To Net	
       
   188 	SetVerifySeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementControlLocation);	// <-- From Net
       
   189 	SetVerifySeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportLocation);	// --> To Net
       
   190 	SetVerifySeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult);		// <-- From Net
       
   191 	SetVerifySeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyReleaseLcsMoLr);				// --> To Net
       
   192 	// both X3P's should complete with KerrNone
       
   193 
       
   194 	// (after X3P release iState = EWaiting).
       
   195 
       
   196 	SetVerifyAdhocEvent(EClient_Got_PosUpdate_Complete);
       
   197 	SetVerifyAdhocEvent(EClient_Got_X3P_Complete);
       
   198 	// We have 2 self locate requests and 2 x3p requests so must record them both
       
   199 	SetVerifyAdhocEvent(EClient_Got_PosUpdate_Complete);
       
   200 	SetVerifyAdhocEvent(EClient_Got_X3P_Complete);
       
   201 	
       
   202 	}
       
   203 
       
   204 
       
   205 
       
   206 /** Called at the end of the test to verify the correct position data has been returned to the
       
   207 	client.
       
   208 	
       
   209 	Each test case SHOULD implement a version of this.
       
   210 */
       
   211 void CT_LbsConflictStep_canceltrackingconflict::VerifyPosInfos()
       
   212 	{
       
   213 	T_LbsUtils utils;
       
   214     RPointerArray<TAny>& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr;
       
   215 	RPointerArray<TAny>& currPosInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
       
   216 	TPositionInfo* currPosInfo;
       
   217 	
       
   218 	// Verify the received self locate and X3P MOLR positions.
       
   219 	// position [0] is used to hold the first NPUD position result
       
   220 	// position [1] is used to hold the second NPUD position result
       
   221 	// position [2] is used to hold the X3P Push position result
       
   222 	// position [3] is used to hold the X3P Timer position result
       
   223 
       
   224 	// position [0] is used to hold the first NPUD position result
       
   225 	TPositionInfo* verifyPosInfo = reinterpret_cast<TPositionInfo*>(verifyPosInfoArr[0]);
       
   226 	currPosInfo = reinterpret_cast<TPositionInfo*>(currPosInfoArr[0]);
       
   227 	// It was a new client so verify got the reference position.
       
   228 	TPositionInfo verifyRefPosInfo;
       
   229 	
       
   230 	verifyRefPosInfo.SetPosition(iRefPos);
       
   231 	if (!utils.Compare_PosInfo(verifyRefPosInfo, *currPosInfo))
       
   232 		{
       
   233 		INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   234 		SetTestStepResult(EFail);
       
   235 		}
       
   236 
       
   237 	
       
   238 	// position [1] is used to hold the second NPUD position result
       
   239 	// We expect a position containing NaNs.
       
   240 	currPosInfo = reinterpret_cast<TPositionInfo*>(currPosInfoArr[1]);
       
   241 	TPosition pos;
       
   242 	currPosInfo->GetPosition(pos);
       
   243 	if (!Math::IsNaN(pos.Latitude()))
       
   244 		{
       
   245 		INFO_PRINTF1(_L("Failed test, Second NPUD Position does not contain NANs"));
       
   246 		INFO_PRINTF1(_L("It should have been completed with KErrHighPriorityRec"));
       
   247 
       
   248 		SetTestStepResult(EFail);
       
   249 		}
       
   250 	if (!Math::IsNaN(pos.Longitude()))
       
   251 		{
       
   252 		INFO_PRINTF1(_L("Failed test, Second NPUD Position does not contain NANs"));
       
   253 		INFO_PRINTF1(_L("It should have been completed with KErrHighPriorityRec"));
       
   254 
       
   255 		SetTestStepResult(EFail);
       
   256 		}
       
   257 
       
   258 	// position [2] is used to hold the X3P Push position result
       
   259 	currPosInfo = reinterpret_cast<TPositionInfo*>(currPosInfoArr[2]);
       
   260 	if (!utils.Compare_PosInfo(*verifyPosInfo, *currPosInfo))
       
   261 		{
       
   262 		INFO_PRINTF1(_L("Failed test, X3P Push position incorrect."));
       
   263 		SetTestStepResult(EFail);
       
   264 		}
       
   265 		
       
   266 	// position [3] is used to hold the X3P Timer position result
       
   267 	currPosInfo = reinterpret_cast<TPositionInfo*>(currPosInfoArr[3]);
       
   268 	if (!utils.Compare_PosInfo(*verifyPosInfo, *currPosInfo))
       
   269 		{
       
   270 		INFO_PRINTF1(_L("Failed test, X3P Timerposition incorrect."));
       
   271 		SetTestStepResult(EFail);
       
   272 		}
       
   273 	}
       
   274 
       
   275 
       
   276 /** A standard TEF test case doTestStepL, this SHOULD only support a single test case.
       
   277 
       
   278 	Typically the function will look much like this.
       
   279  */
       
   280 TVerdict CT_LbsConflictStep_canceltrackingconflict::doTestStepL()
       
   281 	{
       
   282 	// Generic test step used to test the LBS Client Notify position update API.
       
   283 	INFO_PRINTF1(_L("&gt;&gt;CT_LbsConflictStep_canceltrackingconflict::doTestStepL()"));
       
   284 
       
   285 	if (TestStepResult() == EPass)
       
   286 		{		
       
   287 		// Setup the expected sequence events for the test.
       
   288 		SetExpectedSeq();
       
   289 				
       
   290 		// Open and setup net sim.
       
   291 		OpenNetSim(this);
       
   292 
       
   293 		// Kick off the test abort and keep alive timers.
       
   294 		TTimeIntervalMicroSeconds32 abortInterval(KLbsAbortPeriod);
       
   295 		TTimeIntervalMicroSeconds32 keepAliveInterval(KLbsKeepAlivePeriod);
       
   296 
       
   297 		iAbortTimer->SetTimer(abortInterval);
       
   298 		iKeepAliveTimer->SetTimer(keepAliveInterval);
       
   299 
       
   300 		// Kick off test.
       
   301 		CActiveScheduler::Start();
       
   302 
       
   303 		// Verify location data.
       
   304 		VerifyPosInfos();
       
   305 
       
   306 		// Clean up.
       
   307 		CloseNetSim();
       
   308 		}
       
   309 
       
   310 	INFO_PRINTF1(_L("&lt;&lt;CT_LbsConflictStep_canceltrackingconflict::doTestStepL()"));
       
   311 
       
   312 	return TestStepResult();
       
   313 	}
       
   314 
       
   315 
       
   316 /** NetSim callbacks given for a MoLr, which we invoke as a result of the notify position update.
       
   317 */
       
   318 void CT_LbsConflictStep_canceltrackingconflict::Connected()
       
   319 	{
       
   320 	// Call base implementation.
       
   321 	CT_LbsConflictStep::Connected();
       
   322 	
       
   323 	// Kick off first pos update.
       
   324 	
       
   325 	// Create a posinfo and store in our shared array for later verification.
       
   326 	RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
       
   327 	TPositionInfo* posInfo = new(ELeave) TPositionInfo();
       
   328 
       
   329 	T_LbsUtils utils;
       
   330 	utils.ResetAndDestroy_PosInfoArr(posInfoArr);	// Clear previous entries before new entry is appended.
       
   331 
       
   332 	posInfoArr.Append(posInfo); // position [0] is used to hold the first NPUD postion result
       
   333 
       
   334 	// Kick off pos update.
       
   335 				
       
   336 	TPositionUpdateOptions tempOpts;
       
   337 				
       
   338 	// set a 4 second tracking interval to ensure the 2nd request doesn't 
       
   339 	// complete too quicky:
       
   340 	tempOpts.SetUpdateInterval(4*1000000);
       
   341 	tempOpts.SetUpdateTimeOut(2*1000000);
       
   342 
       
   343 	iDoPosUpdate->SetOptions(tempOpts);
       
   344 
       
   345  	INFO_PRINTF1(_L("Start first tracking NPUD"));
       
   346 	iDoPosUpdate->StartL(*posInfo);
       
   347 	iState = EReqPosUpdate;
       
   348 
       
   349 	}
       
   350 
       
   351 
       
   352 void CT_LbsConflictStep_canceltrackingconflict::Disconnected()
       
   353 	{
       
   354 	// Call base implementation.
       
   355 	CT_LbsConflictStep::Disconnected();
       
   356 	}
       
   357 
       
   358 
       
   359 void CT_LbsConflictStep_canceltrackingconflict::NotifyRegisterLcsMoLr(const TDesC& aData)
       
   360 	{
       
   361 	// Determine and record the sequence event. A blank aData indicates a self locate
       
   362 	// MOLR, otherwise we have a X3P MOLR. Also the current test state indicates which
       
   363 	// type MOLR is being carried out.
       
   364 	if (aData != KNullDesC)
       
   365 		{
       
   366 
       
   367 	 	if (iX3PPush)
       
   368 	 		{
       
   369 	 		INFO_PRINTF1(_L("Got - X3P MOLR PUSH- NetSim Notify Register Lcs MoLr - Event."));
       
   370 			SetCurrentSeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyRegisterLcsMoLr);
       
   371 
       
   372 	 		if (aData.Compare(KTransmitPushDestination))
       
   373 				{
       
   374 				INFO_PRINTF1(_L("Failed test, bad X3P register data."));
       
   375 				SetTestStepResult(EFail);
       
   376 				}
       
   377 		 	}
       
   378 		else
       
   379 			{
       
   380 			INFO_PRINTF1(_L("Got - X3P MOLR TIMER - NetSim Notify Register Lcs MoLr - Event."));
       
   381 			SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyRegisterLcsMoLr);
       
   382 
       
   383 			if (aData.Compare(KTransmitTimerDestination))
       
   384 				{
       
   385 				INFO_PRINTF1(_L("Failed test, bad X3P register data."));
       
   386 				SetTestStepResult(EFail);
       
   387 				}
       
   388 		
       
   389 			}
       
   390  	
       
   391 	
       
   392 		// Mark as started now it has, to ensure the self MOLR are not recorded incorrectly.
       
   393 		iState = EReqX3P;
       
   394 		}
       
   395 
       
   396 	else if ((aData == KNullDesC) && (iState == EReqPosUpdate))
       
   397 		{
       
   398 		INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Register Lcs MoLr - Event."));
       
   399 		SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyRegisterLcsMoLr);
       
   400 		}
       
   401 	
       
   402 	}
       
   403 
       
   404 
       
   405 void CT_LbsConflictStep_canceltrackingconflict::NotifyReleaseLcsMoLr(TInt aReason)
       
   406 	{
       
   407 	TInt expectedErr = KErrNone;
       
   408 
       
   409 	// Determine and set sequence event.
       
   410 	if (iKDoASecondNPUD)
       
   411 		{
       
   412 		iKDoASecondNPUD = EFalse;
       
   413 		
       
   414 		INFO_PRINTF1(_L("self MOLR - NetSim Notify Release Lcs MoLr - Event."));
       
   415 		SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyReleaseLcsMoLr);
       
   416 
       
   417 		// Create a posinfo and store in our shared array for later verification.
       
   418 		T_LbsUtils utils;
       
   419 		RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
       
   420 
       
   421 		TPositionInfo* posInfo = new(ELeave) TPositionInfo();
       
   422 		posInfoArr.Append(posInfo); // position [1] is used to hold the second NPUD postion result
       
   423 		INFO_PRINTF1(_L("Start a second tracking NPUD"));
       
   424 		iDoPosUpdate->StartL(*posInfo);
       
   425 		iState = EReqPosUpdate2;
       
   426 		
       
   427 		posInfo = new(ELeave) TPositionInfo();
       
   428 		posInfoArr.Append(posInfo); // position [2] is used to hold the X3P Push result
       
   429 			
       
   430 		// create a conflict by Starting  Push X3P.
       
   431 		TLbsTransmitPositionOptions transOpts;
       
   432 		
       
   433 		iDoX3P->SetOptions(transOpts);	// Set timeout value to 0, to disable the timeout.
       
   434 					
       
   435 		// now make a conflict occur by doing a high priority X3P
       
   436 		// the  outstanding NPUD should be completed with  KErrPositionHighPriorityReceive
       
   437 				
       
   438 		iKErrHighPriorityRecExpected = ETrue;
       
   439 
       
   440 		iState = EReqX3P;
       
   441 		iX3PPush = ETrue;
       
   442 		
       
   443 		INFO_PRINTF1(_L("Start X3P Push"));
       
   444 		iDoX3P->StartL(KTransmitPushDestination, KTransmitPushPriority, *posInfo);
       
   445 
       
   446 		iDoAX3PTimer = ETrue;	// when PUSH X3P completes
       
   447 		
       
   448 		}
       
   449 
       
   450 	else
       
   451 	if (iState == EReqPosUpdate)
       
   452 		{
       
   453 		INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Release Lcs MoLr - Event."));
       
   454 		SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyReleaseLcsMoLr);
       
   455         expectedErr = KErrPositionHighPriorityReceive;
       
   456         }
       
   457 	else if(iState == EReqX3P)
       
   458 		{
       
   459 			if (iX3PPush)
       
   460 				{
       
   461 				INFO_PRINTF1(_L("Got - X3P PUSHMOLR - NetSim Notify Release Lcs MoLr - Event."));
       
   462 				SetCurrentSeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyReleaseLcsMoLr);
       
   463 				}
       
   464 			else
       
   465 				{
       
   466 				INFO_PRINTF1(_L("Got - X3P TIMER MOLR - NetSim Notify Release Lcs MoLr - Event."));
       
   467 				SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyReleaseLcsMoLr);
       
   468 				
       
   469 				// Now we have had the last callback
       
   470 				// but don't end the test until
       
   471 				// until/unless had 2nd NPUD has finshed
       
   472 				iHadLastCallBack = ETrue;
       
   473 				
       
   474 				if (!iKErrHighPriorityRecExpected)
       
   475 					{
       
   476 					iState = EWaiting;
       
   477 					}
       
   478 				}
       
   479 			
       
   480 			expectedErr = KErrNone;
       
   481 			iX3PPush = EFalse; // next is a X3P Timer! 
       
   482 
       
   483 		}
       
   484 	
       
   485 	// Verify reason code.
       
   486 	if (aReason != expectedErr)
       
   487 		{	
       
   488 		INFO_PRINTF2(_L("Failed test, bad release reason %d."), aReason);
       
   489 		SetTestStepResult(EFail);
       
   490 		}
       
   491 	}
       
   492 
       
   493 
       
   494 void CT_LbsConflictStep_canceltrackingconflict::NotifyMeasurementControlLocation(const TPositionInfo& aPosition, 
       
   495 															  const RLbsAssistanceDataBuilderSet& aData, 
       
   496 															  const TLbsNetPosRequestQuality& aQuality)
       
   497 	{
       
   498 	T_LbsUtils utils;	
       
   499 	TInt err;
       
   500 	
       
   501 
       
   502 
       
   503 	// Determine and record sequence event.
       
   504 	if (iState == EReqPosUpdate)
       
   505 		{
       
   506 		INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Measurement Control Location - Event."));
       
   507 		SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementControlLocation);
       
   508 		}
       
   509 		
       
   510 	else if(iState == EReqX3P)
       
   511 		{
       
   512 		if (iX3PPush)
       
   513 			{
       
   514 			INFO_PRINTF1(_L("Got - X3P MOLR PUSH- NetSim Notify Measurement Control Location - Event."));
       
   515 			SetCurrentSeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyMeasurementControlLocation);
       
   516 			}
       
   517 		else
       
   518 			{
       
   519 			INFO_PRINTF1(_L("Got - X3P MOLR TIMER- NetSim Notify Measurement Control Location - Event."));
       
   520 			SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementControlLocation);
       
   521 			}
       
   522 		}
       
   523 
       
   524 
       
   525 	// Verify the reference position.
       
   526 	TPositionInfo verifyRefPosInfo;
       
   527 	
       
   528 	verifyRefPosInfo.SetPosition(iRefPos);
       
   529 	if (!utils.Compare_PosInfo(verifyRefPosInfo, aPosition))
       
   530 		{
       
   531 		INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   532 		SetTestStepResult(EFail);
       
   533 		}
       
   534 
       
   535    
       
   536     // Verify the assistance data.	
       
   537 	RLbsAssistanceDataBuilderSet& data = const_cast<RLbsAssistanceDataBuilderSet&>(aData);
       
   538 	RUEPositioningGpsReferenceTimeBuilder* refTimeBuilder = NULL;
       
   539 	
       
   540 	data.GetDataBuilder(refTimeBuilder);
       
   541 
       
   542 	// Create a reader from the builder's data to allow us to verify the actual
       
   543 	// assistance data.
       
   544 	RUEPositioningGpsReferenceTimeReader refTimeReader;
       
   545 		
       
   546 	TRAP(err, refTimeReader.OpenL());
       
   547 	if (err == KErrNone)
       
   548 		{
       
   549 		refTimeReader.DataBuffer() = refTimeBuilder->DataBuffer();
       
   550 		
       
   551 		if (!utils.VerifySimpleAssistanceData(refTimeReader))
       
   552 			{
       
   553 			INFO_PRINTF1(_L("Failed test, assistance data incorrect."));
       
   554 			SetTestStepResult(EFail);
       
   555 			}
       
   556 		refTimeReader.Close();
       
   557 		}
       
   558 			
       
   559 	else
       
   560 		{
       
   561 		INFO_PRINTF2(_L("Failed test, assistance data reader err %d."), err);
       
   562 		SetTestStepResult(EFail);
       
   563 		}
       
   564 
       
   565 
       
   566 	// TODO: Check if we can verify aQuality in any way.
       
   567 	(void)aQuality;
       
   568 	}
       
   569 
       
   570 
       
   571 void CT_LbsConflictStep_canceltrackingconflict::NotifyReleaseLcsLocationNotification(const CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResult)
       
   572 	{
       
   573 	(void)aResult;
       
   574 
       
   575 	// Unexpected callback for this test, record the sequence event to fail test.
       
   576 	if (iState == EReqPosUpdate)
       
   577 		{
       
   578 		INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Release Lcs Location Notification - Event."));
       
   579 		SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyReleaseLcsLocationNotification);
       
   580 		}
       
   581 		
       
   582 	else
       
   583 		{
       
   584 		if (iX3PPush)
       
   585 			{
       
   586 			INFO_PRINTF1(_L("Got - X3P PUSH - NetSim Notify Release Lcs Location Notification - Event."));
       
   587 			}
       
   588 		else
       
   589 			{
       
   590 			INFO_PRINTF1(_L("Got - X3P TIMER - NetSim Notify Release Lcs Location Notification - Event."));
       
   591 			}
       
   592 		}
       
   593 	}
       
   594 
       
   595 
       
   596 void CT_LbsConflictStep_canceltrackingconflict::NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition)
       
   597 	{
       
   598 	if (iState == EReqPosUpdate)
       
   599 		{
       
   600 		INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Facility Lcs MoLr Result - Event."));
       
   601 		SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult);
       
   602 		}
       
   603 	else
       
   604 		{
       
   605 		if (iX3PPush)
       
   606 			{
       
   607 			INFO_PRINTF1(_L("Got - X3P MOLR PUSH- NetSim Notify Facility Lcs MoLr Result - Event."));
       
   608 			SetCurrentSeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult);
       
   609 			}
       
   610 		else
       
   611 			{
       
   612 			INFO_PRINTF1(_L("Got - X3P MOLR TIMER- NetSim Notify Facility Lcs MoLr Result - Event."));
       
   613 			SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyFacilityLcsMoLrResult);
       
   614 			}
       
   615 		
       
   616 		}
       
   617 
       
   618 	// Verify reason code..	
       
   619 	if (aReason != KErrNone)
       
   620 		{	
       
   621 		INFO_PRINTF2(_L("Failed test, bad release reason %d."), aReason);
       
   622 		SetTestStepResult(EFail);
       
   623 		}
       
   624 
       
   625 	// Verify the real position returned from the network, this will be the same position
       
   626 	// we sent to the network as the result of the MO-LR, thus use the entry given by
       
   627 	// the test module.
       
   628 	T_LbsUtils utils;
       
   629 	RPointerArray<TAny>& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr;
       
   630 	TPositionInfo* verifyRealPosInfo = reinterpret_cast<TPositionInfo*>(verifyPosInfoArr[0]);
       
   631 	
       
   632 	if (!utils.Compare_PosInfo(*verifyRealPosInfo, aPosition))
       
   633 		{
       
   634 		INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   635 		SetTestStepResult(EFail);
       
   636 	    } 
       
   637 	}
       
   638 
       
   639 
       
   640 void CT_LbsConflictStep_canceltrackingconflict::NotifyMeasurementReportLocation(const TPositionInfo& aPosition)
       
   641 	{	
       
   642 	// Determine and record sequence event.
       
   643 	if (iState == EReqPosUpdate)
       
   644 		{
       
   645 		INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Measurement Report - Event."));
       
   646 		SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementReportLocation);
       
   647 		}
       
   648 		
       
   649 	else if(iState == EReqX3P)
       
   650 		{
       
   651 		if (iX3PPush)
       
   652 			{
       
   653 			INFO_PRINTF1(_L("Got - X3P PUSH MOLR - NetSim Notify Measurement Report - Event."));
       
   654 			SetCurrentSeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyMeasurementReportLocation);
       
   655 			}
       
   656 		else
       
   657 			{
       
   658 			INFO_PRINTF1(_L("Got - X3P TIMER MOLR - NetSim Notify Measurement Report - Event."));
       
   659 			SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportLocation);
       
   660 			}
       
   661 		}
       
   662 
       
   663 		
       
   664 	// Verify the real position given to the network, this will be the same position
       
   665 	// returned as the result of the MO-LR, thus use the entry given by
       
   666 	// the test module.	
       
   667 	T_LbsUtils utils;
       
   668     RPointerArray<TAny>& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr;
       
   669 	TPositionInfo* verifyRealPosInfo = reinterpret_cast<TPositionInfo*>(verifyPosInfoArr[0]);
       
   670 	
       
   671 	if (!utils.Compare_PosInfo(*verifyRealPosInfo, aPosition))
       
   672 		{
       
   673 		INFO_PRINTF1(_L("Failed test, position incorrect."));
       
   674 		SetTestStepResult(EFail);
       
   675 		} 
       
   676     }
       
   677 
       
   678 
       
   679 void CT_LbsConflictStep_canceltrackingconflict::NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter)
       
   680 	{
       
   681 	(void)aFilter;
       
   682 
       
   683 	// Unexpected callback for this test, record the sequence event to fail test.
       
   684 	if (iState == EReqPosUpdate)
       
   685 		{
       
   686 		INFO_PRINTF1(_L("Got - Self MOLR - NetSim Notify Measurement Report Request More Assistance Data - Event."));
       
   687 		SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData);
       
   688 		}
       
   689 		
       
   690 	else
       
   691 		{
       
   692 		INFO_PRINTF1(_L("Got - X3P(PUSH) MOLR - NetSim Notify Measurement Report Request More Assistance Data - Event."));
       
   693 		SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData);
       
   694 		}
       
   695 	}
       
   696 
       
   697 
       
   698 void CT_LbsConflictStep_canceltrackingconflict::NotifyMeasurementReportControlFailure(TInt aReason)
       
   699 	{
       
   700 	// Unexpected callback for this test, record the sequence event to fail test.
       
   701 	if (iState == EReqPosUpdate)
       
   702 		{
       
   703 		INFO_PRINTF2(_L("Got - Self MOLR - Net Sim Notify Measurement Report Control Failure - Event. Reason = %d"), aReason);
       
   704 		SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure);
       
   705 		}
       
   706 		
       
   707 	else
       
   708 		{
       
   709 		INFO_PRINTF2(_L("Got - X3P MOLR(PUSH) - Net Sim Notify Measurement Report Control Failure - Event. Reason = %d"), aReason);
       
   710 		SetCurrentSeqEvent(EX3P_TIMER_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure);
       
   711 		}
       
   712 	}
       
   713 
       
   714 
       
   715 /**	Notify position update callback.
       
   716 
       
   717 	The notify position update has completed.
       
   718 */
       
   719 void CT_LbsConflictStep_canceltrackingconflict::MT_LbsDoPosUpdateCallback(TRequestStatus& aStatus)
       
   720 	{
       
   721 	INFO_PRINTF1(_L("Got - Client Notify Update Complete - Callback Event."));
       
   722 	SetCurrentSeqEvent(EClient_Got_PosUpdate_Complete);
       
   723 
       
   724 
       
   725 	if (iKErrHighPriorityRecExpected)
       
   726 		{
       
   727 		iKErrHighPriorityRecExpected = EFalse;
       
   728 		if (KErrPositionHighPriorityReceive == aStatus.Int())
       
   729 			{
       
   730 			INFO_PRINTF1(_L("KErrPositionHighPriorityReceive as expected"));
       
   731 			}
       
   732 		else
       
   733 			{
       
   734 			INFO_PRINTF2(_L("Failed test, expected pos update result KErrorHighPriorityReceived but got err = %d."), aStatus.Int());
       
   735 			SetTestStepResult(EFail);
       
   736 			}
       
   737 			
       
   738 		if (iHadLastCallBack)
       
   739 			{
       
   740 			iState = EWaiting; // all done, now check postions received
       
   741 			}
       
   742 		
       
   743 		}
       
   744 	
       
   745 
       
   746 	else if (iState == EReqPosUpdate)
       
   747 		{
       
   748 		// the first tracking NUPD has completed!
       
   749 
       
   750 		// in the ReleaseMoLr start a second NPUD
       
   751 		iKDoASecondNPUD = ETrue;
       
   752 	
       
   753 
       
   754 		}
       
   755 	}	
       
   756 	
       
   757 
       
   758 /** X3P transmit callback.
       
   759 
       
   760 	The X3P transmit request has completed.
       
   761 */	
       
   762 void CT_LbsConflictStep_canceltrackingconflict::MT_LbsDoX3PCallback(TInt aTransmitId, TRequestStatus& aStatus)
       
   763 	{
       
   764 	(void)aTransmitId;
       
   765 
       
   766 	INFO_PRINTF1(_L("Got - Client X3P Complete - Callback Event."));
       
   767 	SetCurrentSeqEvent(EClient_Got_X3P_Complete);
       
   768 	
       
   769 
       
   770 	if (KErrNone != aStatus.Int())
       
   771 		{
       
   772 		INFO_PRINTF2(_L("Failed test, X3P transmit request err = %d."), aStatus.Int());
       
   773 		SetTestStepResult(EFail);
       
   774 		INFO_PRINTF2(_L("Test Failed, err = %d."), aStatus.Int());
       
   775 
       
   776 		}
       
   777 	
       
   778 		
       
   779 	if (iDoAX3PTimer)
       
   780 		{
       
   781 		iDoAX3PTimer = EFalse;
       
   782 		T_LbsUtils utils;
       
   783 		RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
       
   784 
       
   785 		TPositionInfo* posInfo = new(ELeave) TPositionInfo();
       
   786 		posInfoArr.Append(posInfo); // position [3] is used to hold the X3P Timer result
       
   787 
       
   788 		iState = EReqX3P;
       
   789 		//iX3PPush = EFalse; // its a X3P Timer! 
       
   790 		
       
   791 		INFO_PRINTF1(_L("Start X3P Timer"));
       
   792 		iDoX3P->StartL(KTransmitTimerDestination, KTransmitTimerPriority, *posInfo);
       
   793 		}
       
   794 
       
   795 		
       
   796 	}
       
   797 		
       
   798