lbstest/lbstestproduct/lbsx3p/src/ctlbsx3pstepcancel.cpp
changeset 0 9cfd9a3ee49c
child 57 3267d9ea3e98
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 ctlbsx3pstepcancel.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/lbsx3p.h>
       
    23 
       
    24 // LBS test includes.
       
    25 #include <lbs/test/lbsnetsimtest.h>
       
    26 #include "ctlbsx3pstepcancel.h"
       
    27 #include <lbs/test/tlbsutils.h>
       
    28 
       
    29 //const TTimeIntervalMicroSeconds32 KExtendedTimerInterval = 60*1000000;	// 1 minute
       
    30 //const TInt KLbsTestModuleTimeOut = 50*1000000;
       
    31 //const TTimeIntervalMicroSeconds KLbsX3PTimeOut = 20*1000000;
       
    32 
       
    33 //const TInt KSimpleAssistanceDataProviderPluginUidValue = 0x10281D77;
       
    34 //const TInt KSuplAssistanceDataProviderPluginUidValue = 0x1028225B;
       
    35 //_LIT(KLbsRefPos, "RefPos");
       
    36 
       
    37 
       
    38 //TBool bConnected = EFalse; //To make sure that connected wouldnt get called twice - TBD
       
    39 /**
       
    40  * Destructor
       
    41  */
       
    42 CT_LbsX3PStep_Cancel::~CT_LbsX3PStep_Cancel()
       
    43 	{	
       
    44 	if(iDoTransmitPosAO != NULL)
       
    45 			delete iDoTransmitPosAO;
       
    46 	
       
    47 	if(iDoTransmitPosAO2 != NULL)
       
    48 			delete iDoTransmitPosAO2;
       
    49 	}
       
    50 
       
    51 /**
       
    52  * Constructor
       
    53  */
       
    54 CT_LbsX3PStep_Cancel::CT_LbsX3PStep_Cancel(CT_LbsX3PServer& aParent) : CT_LbsX3PStep(aParent)
       
    55 	{
       
    56 	SetTestStepName(KLbsX3PStep_Cancel);
       
    57 	//iCallbackFlags = 0;
       
    58 	}
       
    59 
       
    60 
       
    61 /**
       
    62 Static Constructor
       
    63 */
       
    64 CT_LbsX3PStep_Cancel* CT_LbsX3PStep_Cancel::New(CT_LbsX3PServer& aParent)
       
    65 	{
       
    66 	CT_LbsX3PStep_Cancel* testStep = new CT_LbsX3PStep_Cancel(aParent);
       
    67 	// Note the lack of ELeave.
       
    68 	// This means that having insufficient memory will return NULL;
       
    69 
       
    70 	if (testStep)
       
    71 		{
       
    72 		TInt err = KErrNone;
       
    73 
       
    74 		TRAP(err, testStep->ConstructL());
       
    75 		if (err)
       
    76 			{
       
    77 			delete testStep;
       
    78 			testStep = NULL;
       
    79 			}
       
    80 		}
       
    81 		
       
    82 	return testStep;
       
    83 	}
       
    84 
       
    85 void CT_LbsX3PStep_Cancel::ConstructL()
       
    86 	{
       
    87 		//Call the base class c'tor to create timer.
       
    88 		CT_LbsX3PStep::ConstructL();
       
    89 	}
       
    90 
       
    91 
       
    92 /**
       
    93  * @return - TVerdict code
       
    94  * Override of base class pure virtual
       
    95  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
    96  * not leave. That being the case, the current test result value will be EPass.
       
    97  */
       
    98 TVerdict CT_LbsX3PStep_Cancel::doTestStepL()
       
    99 	{
       
   100 	// Generic test step used to test the LBS Client Notify position update API.
       
   101 	INFO_PRINTF1(_L("&gt;&gt;CT_LbsX3PStep_Cancel::doTestStepL()"));
       
   102 
       
   103 	if (TestStepResult() == EPass)
       
   104 		{
       
   105 		
       
   106 		TInt err = KErrNone;
       
   107 		RLbsTransmitPositionServer server;
       
   108 
       
   109 		// Carry out common test actions (such as connecting to a server).
       
   110 
       
   111 		User::LeaveIfError(server.Connect());
       
   112 		CleanupClosePushL(server);
       
   113 
       
   114 		INFO_PRINTF1(_L("server opened"));
       
   115 	
       
   116 		User::LeaveIfError(iTransmitPositioner.Open(server));
       
   117 		CleanupClosePushL(iTransmitPositioner);
       
   118 
       
   119 		// Create the active object to carry out the Transmit Position functionality.					
       
   120 		iDoTransmitPosAO = CT_LbsX3PDoTransmitPos::NewL(this, iTransmitPositioner);
       
   121 		
       
   122 		//T_LbsUtils utils;
       
   123 		//TModuleDataIn modDataIn; // Used to send test information to the test module.
       
   124 
       
   125 	    iRefPosFlag = GetIntFromConfig(ConfigSection(), KLbsRefPos, iRefPosFlag);
       
   126 	    
       
   127 
       
   128 		// Carry out unique test actions.
       
   129 		if (GetIntFromConfig(ConfigSection(), KTestCaseId, iTestCaseId))
       
   130 			{
       
   131 			switch (iTestCaseId)
       
   132 				{
       
   133 				// Test case LBS-X3P-Cancel-0001
       
   134 				case 1:
       
   135 					{
       
   136 					//Try to cancel Transmition without X3P
       
   137 					iTransmitPositioner.CancelTransmitPosition();  
       
   138 
       
   139 					//Below code might not be needed...added as Netsim panics if I dont start scheduler
       
   140 					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect;
       
   141 					
       
   142 					}
       
   143 					break;
       
   144 					
       
   145 				// Test case LBS-X3P-Cancel-0002
       
   146 				case 2:
       
   147 					{
       
   148 					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect| 
       
   149 									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
       
   150 									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr |
       
   151 									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
       
   152 									 KLbsCallback_Got_NotifyDoTransmitPos;
       
   153 					}
       
   154 					break;
       
   155 					
       
   156 				// Test case LBS-X3P-Cancel-0003
       
   157 				case 3:
       
   158 					{
       
   159 					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
       
   160 									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
       
   161 									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr |
       
   162 									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
       
   163 									 KLbsCallback_Got_NotifyDoTransmitPos;
       
   164 					}
       
   165 					break;
       
   166 					
       
   167 				// Test case LBS-X3P-Cancel-0004
       
   168 				case 4:
       
   169 					{
       
   170 					//SetExtendedTimerInterval(30000000);
       
   171 					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
       
   172 									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
       
   173 									 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
       
   174 									 KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |
       
   175 									 KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult |
       
   176 									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
       
   177 									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
       
   178 									 KLbsCallback_Got_NotifyDoTransmitPos;
       
   179 					}
       
   180 					break;
       
   181 					
       
   182 				// Test case LBS-X3P-Cancel-0005
       
   183 				case 5:
       
   184 				case 6:
       
   185 					{
       
   186 					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
       
   187 									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
       
   188 									 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
       
   189 									 KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |
       
   190 									 KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult |
       
   191 									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
       
   192 									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
       
   193 									 KLbsCallback_Got_NotifyDoTransmitPos;
       
   194 					}
       
   195 					break;
       
   196 					
       
   197 													
       
   198 				// Test case LBS-X3P-Cancel-0007
       
   199 				case 7:
       
   200 					{
       
   201 					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
       
   202 									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
       
   203 									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr |
       
   204 									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0);
       
   205 
       
   206 					//Not sure how we will get status in this case when the request is cancelled from Cancel() - TBD
       
   207 					}
       
   208 					break;
       
   209 
       
   210 				
       
   211 				// Test case LBS-X3P-Cancel-0009-0010
       
   212 				case 8:
       
   213 				case 9:
       
   214 					{
       
   215 					User::LeaveIfError(iTransmitPositioner2.Open(server));
       
   216 					CleanupClosePushL(iTransmitPositioner2);
       
   217 
       
   218 					// Create the active object to carry out the Transmit Position functionality.					
       
   219 					iDoTransmitPosAO2 = CT_LbsX3PDoTransmitPos::NewL(this, iTransmitPositioner2);
       
   220 
       
   221 					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
       
   222 									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
       
   223 									 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
       
   224 									 KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |								 
       
   225 									 KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult |
       
   226 									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
       
   227 									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
       
   228 									 KLbsCallback_Got_NotifyDoTransmitPos;
       
   229 					}
       
   230 					break;
       
   231 
       
   232 
       
   233 				case 10:
       
   234 					{
       
   235 					//Cancel at NotifyMeasurementReportRequestMoreAssitanceData
       
   236 
       
   237 					//Configure gps-test-module to request for more assitance data.
       
   238 					if(iParent.iSharedData->iTestModuleInUse)
       
   239 						{
       
   240 						T_LbsUtils utils;
       
   241 						TModuleDataIn modDataIn; // Used to send test information to the test module.
       
   242 						modDataIn.iRequestType = TModuleDataIn::EModuleRequestTestMode;
       
   243 						modDataIn.iAssDataEventType = TModuleDataIn::EAssDataEventExpectSingle;
       
   244 						modDataIn.iAssDataTestMode = TModuleDataIn::EModuleTestModeAssDataOn_SomeDataNotAvailable;
       
   245 						
       
   246 						utils.NotifyModuleOfConfigChangeL(modDataIn);
       
   247 						}
       
   248 						
       
   249 					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
       
   250 									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
       
   251 									 KLbsCallback_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData |
       
   252 									 KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure |
       
   253 									 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
       
   254 									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
       
   255 									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
       
   256 									 KLbsCallback_Got_NotifyDoTransmitPos;
       
   257 					}
       
   258 					break;					
       
   259 					
       
   260 				case 11:
       
   261 					{
       
   262 					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
       
   263 									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
       
   264 									 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
       
   265 									 KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |
       
   266 									 KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult |
       
   267 									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
       
   268 									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
       
   269 									 KLbsCallback_Got_NotifyDoTransmitPos;
       
   270 					}
       
   271 					break;
       
   272 
       
   273 				case 12:
       
   274 					{
       
   275 					
       
   276 					//Note sure which callbacks would be needed - TBD
       
   277 					if(iRefPosFlag)
       
   278 						{
       
   279 						iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
       
   280 										 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
       
   281 										 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
       
   282 										 KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |
       
   283 										 KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult |
       
   284 										 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
       
   285 										 KLbsCallback_Got_NotifyDoTransmitPos;
       
   286 						}
       
   287 					else
       
   288 						{
       
   289 						INFO_PRINTF2(_L("This test case is invalid for this interface: Testcase ID-  %d"), iTestCaseId);
       
   290 						ASSERT(FALSE);	
       
   291 						}
       
   292 					}
       
   293 					break;
       
   294 
       
   295 				case 13:
       
   296 					{
       
   297 					if(iRefPosFlag)
       
   298 						{
       
   299 						iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
       
   300 										 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
       
   301 										 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
       
   302 										 KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure |
       
   303 										 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
       
   304 										 KLbsCallback_Got_NotifyDoTransmitReferencePos|
       
   305 										 KLbsCallback_Got_NotifyDoTransmitPos;
       
   306 						}
       
   307 					else
       
   308 						{
       
   309 						INFO_PRINTF2(_L("This test case is invalid for this interface: Testcase ID-  %d"), iTestCaseId);
       
   310 						ASSERT(FALSE);	
       
   311 						}
       
   312 					}
       
   313 					break;
       
   314 
       
   315 				default:
       
   316 					{
       
   317 					INFO_PRINTF2(_L("Unrecognised test case id %d"), iTestCaseId);
       
   318 					ASSERT(FALSE);	
       
   319 					}					
       
   320 				}
       
   321 			}
       
   322 		else
       
   323 			{
       
   324 			INFO_PRINTF1(_L("Error in reading config file"));
       
   325 			ASSERT(FALSE);
       
   326 			}
       
   327 
       
   328 		RPointerArray<TAny>& srcPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr;
       
   329 		TPositionInfo* srcPosInfo = reinterpret_cast<TPositionInfo*>(srcPosInfoArr[0]);
       
   330 		TPosition srcPos;
       
   331 		srcPosInfo->GetPosition(srcPos);
       
   332 
       
   333 		// Conect to the NetSim.
       
   334 		iNetSim.ConnectL(this); // Once we have connected, we will get NetSim callbacks.
       
   335 		//iNetSim.SetStepMode(ETrue);
       
   336 
       
   337 		// Set plugin to use.
       
   338 		TUid pluginUid;
       
   339 		if(iParent.iSharedData->iTestModuleInUse)
       
   340 			{
       
   341 			pluginUid = TUid::Uid(KSimpleAssistanceDataProviderPluginUidValue);
       
   342 			}
       
   343 		else
       
   344 			{
       
   345 			pluginUid = TUid::Uid(KSuplAssistanceDataProviderPluginUidValue);
       
   346 			}
       
   347 			
       
   348 		if (!iNetSim.SetAssistanceDataProvider(pluginUid))
       
   349 			{
       
   350 			INFO_PRINTF1(_L("Failed test, can't set NetSim's assistance data plugin uid."));
       
   351 			SetTestStepResult(EFail);
       
   352 			iNetSim.Close();
       
   353 			return TestStepResult();
       
   354 			}
       
   355 
       
   356 		if (!iNetSim.SetReferenceLocation(srcPos))
       
   357 			{
       
   358 				INFO_PRINTF1(_L("Failed test, can't set NetSim's reference location."));
       
   359 				SetTestStepResult(EFail);
       
   360 				iNetSim.Close();
       
   361 				return TestStepResult();
       
   362 			}	
       
   363 
       
   364 		// Set the MaxFix time required by the network.
       
   365 		TTimeIntervalMicroSeconds maxFixTime(150*1000000);
       
   366 		TLbsNetPosRequestQuality netPosQuality;
       
   367 
       
   368 		netPosQuality.SetMaxFixTime(maxFixTime);
       
   369 		netPosQuality.SetMinHorizontalAccuracy(srcPos.HorizontalAccuracy());
       
   370 		netPosQuality.SetMinVerticalAccuracy(srcPos.VerticalAccuracy());
       
   371 		if (!iNetSim.SetQuality(netPosQuality))
       
   372 			{
       
   373 			INFO_PRINTF1(_L("Failed test, can't set NetSim's quality."));
       
   374 			SetTestStepResult(EFail);
       
   375 			iNetSim.Close();
       
   376 			return TestStepResult();
       
   377 			}
       
   378 		
       
   379 		//Timeout for Transmit Location
       
   380 		TLbsTransmitPositionOptions transmitOptions;
       
   381 		transmitOptions.SetTimeOut(120*1000000);
       
   382 		iTransmitPositioner.SetTransmitOptions(transmitOptions);
       
   383 
       
   384 		// Kick off the keep alive timer.
       
   385 		TTimeIntervalMicroSeconds32 interval(KLbsKeepAlivePeriod);
       
   386 		iKeepAliveTimer->SetTimer(interval);
       
   387 
       
   388 		if(iTestCaseId == 3)
       
   389 			{
       
   390 			const TInt32 time=1000;
       
   391 			iNetSim.SetResponseTime(time, ETrue);  //TBD
       
   392 			}
       
   393 		
       
   394 		CActiveScheduler::Start();
       
   395 		
       
   396 		err = iStatus.Int();
       
   397 		switch(iTestCaseId)
       
   398 			{
       
   399 			case 1:
       
   400 			case 7:
       
   401 				break;
       
   402 				
       
   403 			case 2:
       
   404 			case 3:
       
   405 			case 10:
       
   406 			case 13:
       
   407 				{
       
   408 				if(KErrCancel != err)
       
   409 					{
       
   410 					INFO_PRINTF1(_L("<FONT><B>CancelTransmitPosition() should have returned KErrCancel</B></FONT>"));
       
   411 					SetTestStepResult(EFail);	
       
   412 					}
       
   413 				}
       
   414 				break;
       
   415 			
       
   416 			case 4:
       
   417 				{
       
   418 				if(KErrCancel == err && !(iCallbackFlags & KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure))
       
   419 					{
       
   420 					INFO_PRINTF1(_L("<FONT><B>Should have been completed with KErrCancel</B></FONT>"));
       
   421 					SetTestStepResult(EFail);	
       
   422 					}
       
   423 				}
       
   424 				//not using break as want to go ahead with below check.
       
   425 				
       
   426 			case 5:
       
   427 			case 11:
       
   428 			case 12: //TBD
       
   429      			// In testcases that cancel "late" in the X3P proceudure, cancellation may arrive to NRH before
       
   430 				// or after the session has finished. Therefore the error code will sometimes be
       
   431 				// KErrCancel (session cancelled) and other times KErrNone (nothing to cancel due to session complete).
       
   432 				//
       
   433 				{
       
   434 				if(!(KErrCancel == err || KErrNone == err))
       
   435 					{
       
   436 					INFO_PRINTF1(_L("<FONT><B>CancelTransmitPosition() should have returned KErrCancel or KErrNone</B></FONT>"));
       
   437 					SetTestStepResult(EFail);	
       
   438 					}
       
   439 				}
       
   440 			break;
       
   441 			
       
   442 			case 6:
       
   443 			case 8:
       
   444 			case 9:
       
   445 				{
       
   446 				if(KErrNone != err)
       
   447 					{
       
   448 					INFO_PRINTF1(_L("<FONT><B>CancelTransmitPosition() should have returned KErrNone</B></FONT>"));
       
   449 					SetTestStepResult(EFail);	
       
   450 					}
       
   451 				}
       
   452 				break;
       
   453 			
       
   454 			default:
       
   455 				{
       
   456 				INFO_PRINTF2(_L("Unrecognised test case id %d"), iTestCaseId);
       
   457 				ASSERT(FALSE);	
       
   458 				}	
       
   459 			}
       
   460 
       
   461 		// Clean up.
       
   462 		// Clear A-GPS timeout.
       
   463 		//if(iParent.iSharedData->iTestModuleInUse)
       
   464 		//	{
       
   465 		//	modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut;
       
   466 		//	modDataIn.iTimeOut = 0;
       
   467 		//	utils.NotifyModuleOfConfigChangeL(modDataIn);
       
   468 		//	}
       
   469 
       
   470 		iNetSim.ClearAssistanceDataFilters();
       
   471 		iNetSim.Close();  
       
   472 
       
   473 		if(iTestCaseId == 8 || iTestCaseId == 9)
       
   474 			{
       
   475 			CleanupStack::PopAndDestroy(&iTransmitPositioner2);					
       
   476 			}
       
   477 		//CleanupStack::PopAndDestroy(iKeepAliveTimer);
       
   478 		CleanupStack::PopAndDestroy(&iTransmitPositioner);					
       
   479 		CleanupStack::PopAndDestroy(&server);	
       
   480 		
       
   481 		
       
   482 		if(iTestCaseId==13) //Wait while all activities in the PM stop and not interfere with the remaining tests 
       
   483 			{
       
   484 			User::After(5000000);
       
   485 			}
       
   486 		}
       
   487 
       
   488 	INFO_PRINTF1(_L("&lt;&lt;CT_LbsX3PStep_Cancel::doTestStepL()"));
       
   489 
       
   490 	return TestStepResult();
       
   491 	}
       
   492 
       
   493 void CT_LbsX3PStep_Cancel::MT_LbsX3PDoRefPosCallback(const TRequestStatus& aStatus,const TPositionInfo& aRefPosInfo)
       
   494 	{
       
   495 	//(void)aStatus;
       
   496 	(void)aRefPosInfo;
       
   497 	
       
   498 	INFO_PRINTF2(_L("Got - Transmit Position Reference Postion - Callback Event:: Status=%d"), aStatus.Int());
       
   499 
       
   500 	//if(iTestCaseId !=4)
       
   501 		{
       
   502 		SetCallbackFlag(KLbsCallback_Got_NotifyDoTransmitReferencePos);	
       
   503 		}
       
   504 	
       
   505 	switch(iTestCaseId)
       
   506 		{
       
   507 		case 2:
       
   508 		case 3:
       
   509 		case 7:
       
   510 			{
       
   511 			if(aStatus != KErrCancel)
       
   512 				{
       
   513 				INFO_PRINTF1(_L("<FONT><B> MT_LbsX3PDoRefPosCallback should have been completed with KErrCancel</B></FONT>"));
       
   514 				SetTestStepResult(EFail);	
       
   515 				}
       
   516 			}
       
   517 			break;
       
   518 
       
   519 		case 4:
       
   520 			{
       
   521 			if(aStatus != KErrCancel && aStatus != KErrNone)
       
   522 				{
       
   523 				INFO_PRINTF1(_L("<FONT><B> MT_LbsX3PDoRefPosCallback should have been completed with KErrCancel</B></FONT>"));
       
   524 				SetTestStepResult(EFail);	
       
   525 				}
       
   526 			}
       
   527 			break;
       
   528 			
       
   529 		case 13:
       
   530 			{
       
   531 			iTransmitPositioner.CancelTransmitPosition();
       
   532 			}
       
   533 			break;
       
   534 			
       
   535 		default:
       
   536 			break;
       
   537 		}
       
   538 	}
       
   539 
       
   540 
       
   541 /**	Notify position update callback.
       
   542 	The notify position update as completed. We can mark as done in the callback flags.
       
   543 **/
       
   544 
       
   545 void CT_LbsX3PStep_Cancel::MT_LbsX3PDoTransmitPosCallback(TRequestStatus& aStatus, CT_LbsX3PDoTransmitPos* aDoTransmitPosAO)
       
   546 	{
       
   547 	(void)aDoTransmitPosAO;
       
   548 	INFO_PRINTF1(_L("Got - Transmit Position - Callback Event."));
       
   549 
       
   550 	//if(iTestCaseId == 18)
       
   551 	//	{
       
   552 	//	if(!(iCallbackFlags & KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation))
       
   553 	//		{
       
   554 	//		INFO_PRINTF1(_L("<FONT><B> TransmitPostion completed before </B></FONT>"));
       
   555 	//		SetTestStepResult(EFail);	
       
   556 	//		}
       
   557 	//	}
       
   558 
       
   559 	iStatus = aStatus;
       
   560 	SetCallbackFlag(KLbsCallback_Got_NotifyDoTransmitPos);
       
   561 	}	
       
   562 
       
   563 void CT_LbsX3PStep_Cancel::Connected()
       
   564 	{
       
   565 //	if(bConnected)
       
   566 //		return;
       
   567 	
       
   568 //	bConnected = ETrue;	//probably a hack
       
   569 	
       
   570 	CT_LbsNetSimStep::Connected();
       
   571 	
       
   572 	_LIT(KDestID, "07703125837");
       
   573 
       
   574 	TUint priority = X3P_PRIORITY_PUSH;
       
   575 	TPositionInfo* posInfo = NULL;;
       
   576 	RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
       
   577 	posInfo = new(ELeave) TPositionInfo();
       
   578 	
       
   579 	T_LbsUtils utils;
       
   580 	utils.ResetAndDestroy_PosInfoArr(posInfoArr);	// Clear previous entries before new entry is appended.
       
   581 	posInfoArr.Append(posInfo);
       
   582 
       
   583 	switch(iTestCaseId)
       
   584 		{
       
   585 		case 1:
       
   586 			//Do not start Transmit Position
       
   587 			break;
       
   588 		case 2:
       
   589 			{
       
   590 			// Request X3P
       
   591 			if(iRefPosFlag)
       
   592 				iDoTransmitPosAO->TransmitPositionReportingRefLoc( KDestID, priority, *posInfo);
       
   593 			else
       
   594 				iDoTransmitPosAO->TransmitPosition( KDestID, priority, *posInfo);
       
   595 			
       
   596 			//Is it good idea to wait for some time before starting cancel ....TBD
       
   597 			iTransmitPositioner.CancelTransmitPosition(); 
       
   598 			
       
   599 			break;
       
   600 			}
       
   601 		case 3:
       
   602 		case 4:
       
   603 		case 5:
       
   604 		case 6:
       
   605 		case 10:
       
   606 		case 11:
       
   607 			{
       
   608 			if(iRefPosFlag)
       
   609 				iDoTransmitPosAO->TransmitPositionReportingRefLoc( KDestID, priority, *posInfo);
       
   610 			else
       
   611 				iDoTransmitPosAO->TransmitPosition( KDestID, priority, *posInfo);
       
   612 			}
       
   613 			break;
       
   614 
       
   615 		case 7:
       
   616 			{
       
   617 			// Request X3P
       
   618 			if(iRefPosFlag)
       
   619 				iDoTransmitPosAO->TransmitPositionReportingRefLoc( KDestID, priority, *posInfo);
       
   620 			else
       
   621 				iDoTransmitPosAO->TransmitPosition( KDestID, priority, *posInfo);
       
   622 
       
   623 			//Cancel the active object instead of calling CancelTransmitPosition()
       
   624 			iDoTransmitPosAO->Cancel(); 
       
   625 			}
       
   626 			break;
       
   627 			
       
   628 		case 8:
       
   629 			{
       
   630 		
       
   631 			if(iRefPosFlag)
       
   632 				iDoTransmitPosAO->TransmitPositionReportingRefLoc( KDestID, priority, *posInfo);
       
   633 			else
       
   634 				iDoTransmitPosAO->TransmitPosition( KDestID, priority, *posInfo);
       
   635 			
       
   636 			//CancelTransmitPosition from different object
       
   637 			iTransmitPositioner2.CancelTransmitPosition(); 
       
   638 						
       
   639 			}
       
   640 			break;
       
   641 			
       
   642 		case 9:
       
   643 			{
       
   644 		
       
   645 			if(iRefPosFlag)
       
   646 				iDoTransmitPosAO->TransmitPositionReportingRefLoc( KDestID, priority, *posInfo);
       
   647 			else
       
   648 				iDoTransmitPosAO->TransmitPosition( KDestID, priority, *posInfo);
       
   649 			
       
   650 			//Cancel() the other TransmitPostion Active Object
       
   651 			iDoTransmitPosAO2->Cancel(); 
       
   652 			}
       
   653 			break;
       
   654 		
       
   655 		case 12:
       
   656 		case 13:
       
   657 			{
       
   658 			iDoTransmitPosAO->TransmitPositionReportingRefLoc( KDestID, priority, *posInfo);
       
   659 			}
       
   660 			break;
       
   661 					
       
   662 		default:
       
   663 			break;
       
   664 		}
       
   665 	}
       
   666 
       
   667 void CT_LbsX3PStep_Cancel::NotifyRegisterLcsMoLr(const TDesC& aData)
       
   668 	{
       
   669 	CT_LbsNetSimStep::NotifyRegisterLcsMoLr(aData);
       
   670 	
       
   671 	if(iTestCaseId==3)
       
   672 		{
       
   673 		iTransmitPositioner.CancelTransmitPosition();
       
   674 		}
       
   675 	else if(iTestCaseId == 12)
       
   676 		{
       
   677 		iDoTransmitPosAO->GetRefLocWaiter()->Cancel();
       
   678 		}
       
   679 	
       
   680 	//iNetSim.Next(KErrNone);
       
   681 	}
       
   682 
       
   683 void CT_LbsX3PStep_Cancel::NotifyMeasurementControlLocation(const TPositionInfo& aPosition, 
       
   684 													  const RLbsAssistanceDataBuilderSet& aData, 
       
   685 													  const TLbsNetPosRequestQuality& aQuality)
       
   686 	{
       
   687 	CT_LbsNetSimStep::NotifyMeasurementControlLocation(aPosition, aData, aQuality);
       
   688 	
       
   689 	//When we cancel the TransmitLocation request, it may happen that the ProcessAssistanceData request
       
   690 	//from a PM to the NG is sent before the cancel takes effect.
       
   691 	//If it happens we need to add KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation to iFlagsToHaltOn
       
   692 	//to avoid the test hanging.
       
   693 	if(iTestCaseId==2 || iTestCaseId==7)
       
   694 		{
       
   695 		iFlagsToHaltOn |= KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation;
       
   696 		}
       
   697 	
       
   698 	if(iTestCaseId==4)
       
   699 		{
       
   700 		iTransmitPositioner.CancelTransmitPosition();
       
   701 		}
       
   702 	//iNetSim.Next(KErrNone);
       
   703 	}
       
   704 
       
   705 void CT_LbsX3PStep_Cancel::NotifyMeasurementReportLocation(const TPositionInfo& aPosition)
       
   706 	{
       
   707 	CT_LbsNetSimStep::NotifyMeasurementReportLocation(aPosition);
       
   708 	
       
   709 	if(iTestCaseId==5)
       
   710 		{
       
   711 		iTransmitPositioner.CancelTransmitPosition();
       
   712 		}
       
   713 	
       
   714 	//iNetSim.Next(KErrNone);
       
   715 	}
       
   716 
       
   717 void CT_LbsX3PStep_Cancel::NotifyMeasurementReportControlFailure(TInt aReason)
       
   718 	{
       
   719 	CT_LbsNetSimStep::NotifyMeasurementReportControlFailure(aReason);
       
   720 	switch(iTestCaseId)
       
   721 		{
       
   722 		case 4:
       
   723 		//case 5:
       
   724 		//case 11:
       
   725 			{
       
   726 			iFlagsToHaltOn &=  ~KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation;
       
   727 			iFlagsToHaltOn &=  ~KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult;
       
   728 			iFlagsToHaltOn |=	KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure;
       
   729 
       
   730 			if(aReason != KErrCancel)
       
   731 				{
       
   732 				INFO_PRINTF1(_L("<FONT><B>Should have returned KErrCancel</B></FONT>"));
       
   733 				SetTestStepResult(EFail);	
       
   734 				}
       
   735 			}
       
   736 			break;
       
   737 		case 2:
       
   738 		case 7:	
       
   739 			iFlagsToHaltOn |=	KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure;
       
   740 			//break is ommited intentionally here
       
   741 		case 10:
       
   742 		case 13:
       
   743 			{
       
   744 			if(aReason != KErrCancel)
       
   745 				{
       
   746 				INFO_PRINTF1(_L("<FONT><B>Should have returned KErrCancel</B></FONT>"));
       
   747 				SetTestStepResult(EFail);	
       
   748 				}
       
   749 			}
       
   750 			break;
       
   751 		
       
   752 		default:
       
   753 			ASSERT(FALSE);
       
   754 			break;
       
   755 		}
       
   756 	//iNetSim.Next(KErrNone);
       
   757 	}
       
   758 
       
   759 
       
   760 void CT_LbsX3PStep_Cancel::NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition)
       
   761 {
       
   762 
       
   763 	CT_LbsNetSimStep::NotifyFacilityLcsMoLrResult(aReason,aPosition);
       
   764 
       
   765 	switch(iTestCaseId)
       
   766 	{
       
   767 		case 11:
       
   768 			iTransmitPositioner.CancelTransmitPosition();		
       
   769 			break;
       
   770 			
       
   771 		default:
       
   772 			break;
       
   773 	}
       
   774 
       
   775     //iNetSim.Next(KErrNone);
       
   776 }
       
   777 
       
   778 
       
   779 void CT_LbsX3PStep_Cancel::NotifyReleaseLcsMoLr(TInt aReason)
       
   780 	{
       
   781 	CT_LbsNetSimStep::NotifyReleaseLcsMoLr(aReason);
       
   782 	
       
   783 	switch(iTestCaseId)
       
   784 		{
       
   785 		case 2:
       
   786 		case 3:
       
   787 		//case 4:
       
   788 			{
       
   789 			if(aReason != KErrCancel)
       
   790 				{
       
   791 				INFO_PRINTF1(_L("<FONT><B>Should have returned KErrCancel</B></FONT>"));
       
   792 				SetTestStepResult(EFail);	
       
   793 				}
       
   794 			}
       
   795 			break;
       
   796 			
       
   797 		case 6:
       
   798 			// Add a very short delay here in order to ensure that the protocol module really has completed
       
   799 			// all the actions relating to the x3p operation.
       
   800 			User::After(100000);
       
   801 			iTransmitPositioner.CancelTransmitPosition();	
       
   802 			break;
       
   803 		
       
   804 		default:
       
   805 			break;
       
   806 		}
       
   807 	//iNetSim.Next(KErrNone);
       
   808 	}
       
   809 
       
   810 void CT_LbsX3PStep_Cancel::NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter)
       
   811 	{
       
   812 
       
   813 	switch (iTestCaseId)
       
   814 		{
       
   815 		case 10:
       
   816 			{
       
   817 			// Call base implementation.
       
   818 			CT_LbsNetSimStep::NotifyMeasurementReportRequestMoreAssistanceData(aFilter);
       
   819 			iTransmitPositioner.CancelTransmitPosition();	
       
   820 			// Add a short delay here in order to ensure that LBS has completed
       
   821 			// all the actions relating to the x3p cancel.			
       
   822 			User::After(500000);
       
   823 			}
       
   824 			break;
       
   825 	
       
   826 		default:
       
   827 		//Note: In the case of real GPS, this message could come at anytime.
       
   828 			if(iParent.iSharedData->iTestModuleInUse)
       
   829 				{
       
   830 				INFO_PRINTF2(_L("Failed test, got un-expected request for more assistance data with filter value = %d."), aFilter);
       
   831 				SetTestStepResult(EFail);
       
   832 				}
       
   833 			break;
       
   834 		}
       
   835 	//iNetSim.Next(KErrNone);
       
   836 	}