common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifyloginfo.cpp
changeset 748 e13acd883fbe
child 872 17498133d9ad
equal deleted inserted replaced
747:76f9aaeefbab 748:e13acd883fbe
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file ctlbsstepverifyloginfo.cpp
       
    15 // This is the class implementation for the log verification test step
       
    16 // 
       
    17 //
       
    18  
       
    19 #include "ctlbsstepverifyloginfo.h"
       
    20 
       
    21 _LIT(KLogType, "log_type");
       
    22 
       
    23 /**
       
    24 Public, non-leaving, static constructor
       
    25 */
       
    26 CT_LbsStep_VerifyLogInfo* CT_LbsStep_VerifyLogInfo::New(CT_LbsServer& aParent)
       
    27 	{
       
    28 	CT_LbsStep_VerifyLogInfo* self = NULL;
       
    29 	// Note the lack of ELeave.
       
    30 	// This means that having insufficient memory will return NULL;
       
    31 	TRAPD(err, self = NewL(aParent));
       
    32 	if(KErrNone != err)
       
    33 		{
       
    34 		self = NULL;
       
    35 		}
       
    36 	return self;
       
    37 	}
       
    38 /**
       
    39  * Static Constructor that may leave
       
    40  */
       
    41 CT_LbsStep_VerifyLogInfo* CT_LbsStep_VerifyLogInfo::NewL(CT_LbsServer& aParent)
       
    42 	{
       
    43 	CT_LbsStep_VerifyLogInfo* verifyLog = new(ELeave) CT_LbsStep_VerifyLogInfo(aParent);
       
    44 	CleanupStack::PushL(verifyLog);
       
    45 	verifyLog->ConstructL();
       
    46 	CleanupStack::Pop(verifyLog);
       
    47 
       
    48 	return verifyLog;
       
    49 	}
       
    50 /**
       
    51 2nd phase Constructor that may leave
       
    52 */
       
    53 void CT_LbsStep_VerifyLogInfo::ConstructL()
       
    54 	{
       
    55 
       
    56 	// Create everything for the right hand side of all compares
       
    57 	_LIT(KTheDest,"07712345678");
       
    58 	TPtrC theDest(KTheDest);
       
    59 	
       
    60 	iX3PLogIntiailisedFromValues = CLbsTransmitLocationLogEvent::NewL(TUid::Uid(0), NULL, theDest);
       
    61 	iSelfLocateLogIntiailisedFromValues = CLbsSelfLocateLogEvent::NewL(TUid::Uid(0), NULL);
       
    62 	iExternalLocateLogIntiailisedFromValues = CLbsExternalLocateLogEvent::NewL(TUid::Uid(0), NULL, NULL);
       
    63 	iNetworkLocateLogIntiailisedFromValues = CLbsNetworkLocateLogEvent::NewL(TUid::Uid(0), NULL);
       
    64 	iAssistanceDataLogIntiailisedFromValuesFirst = CLbsAssistanceDataLogEvent::NewL(0, 0);	
       
    65 	
       
    66 	//Setup other reference position
       
    67 	iRefPosTwo = new TPositionInfo();
       
    68 	TPosition refpos;
       
    69 	refpos.SetCoordinate(REFPOS_LAT, REFPOS_LONG, REFPOS_ALT);
       
    70 	refpos.SetAccuracy(REFPOS_HORZ_ACCURACY, REFPOS_VERT_ACCURACY);
       
    71 	refpos.SetCurrentTime();
       
    72 	iRefPosTwo->SetPosition(refpos);
       
    73 	
       
    74 	
       
    75 	// read logs using CLogViewEvent
       
    76 	TInt ErrorCode = itheFs.Connect();
       
    77 	if(ErrorCode)
       
    78 		{
       
    79 		INFO_PRINTF1(_L("\t Error: Open FileServer failed."));
       
    80 		SetTestStepResult(EFail);
       
    81 		}
       
    82 		
       
    83     iclient = CLogClient::NewL(itheFs, CActive::EPriorityStandard);
       
    84 	iview = CLogViewEvent::NewL(*iclient, CActive::EPriorityStandard);
       
    85 	
       
    86 	iActiveWaiter = CT_LbsAsyncWaiter::NewL();			// NEW iActiveWaiter
       
    87 	
       
    88 	}
       
    89 /**
       
    90  * Destructor
       
    91  */
       
    92 CT_LbsStep_VerifyLogInfo::~CT_LbsStep_VerifyLogInfo()
       
    93 	{
       
    94 	iview->Cancel();
       
    95 	iclient->Cancel();
       
    96 	delete iview;
       
    97 	delete iclient;
       
    98 	itheFs.Close();
       
    99 	delete iActiveWaiter;
       
   100 	// Delete everything for the right hand side of all compares
       
   101 	delete iRefPosTwo;
       
   102 	delete iSelfLocateLogIntiailisedFromValues;
       
   103 	delete iExternalLocateLogIntiailisedFromValues;
       
   104 	delete iNetworkLocateLogIntiailisedFromValues;
       
   105 	delete iAssistanceDataLogIntiailisedFromValuesFirst;
       
   106 	delete iX3PLogIntiailisedFromValues;
       
   107 
       
   108 	}
       
   109 
       
   110 
       
   111 /**
       
   112  * Constructor
       
   113  */
       
   114 CT_LbsStep_VerifyLogInfo::CT_LbsStep_VerifyLogInfo(CT_LbsServer& aParent) : CT_LbsStep(aParent)
       
   115 	{
       
   116 	SetTestStepName(KLbsStep_VerifyLogInfo);
       
   117 	}
       
   118 
       
   119 
       
   120 TVerdict CT_LbsStep_VerifyLogInfo::doTestStepPreambleL()
       
   121 	{
       
   122 
       
   123 	return TestStepResult();
       
   124 	}
       
   125 
       
   126 TVerdict CT_LbsStep_VerifyLogInfo::doTestStepPostambleL()
       
   127 	{
       
   128 
       
   129 	return TestStepResult();
       
   130 	}
       
   131 
       
   132 
       
   133 /**
       
   134  * @return - TVerdict code
       
   135  * Override of base class pure virtual
       
   136  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
   137  * not leave. That being the case, the current test result value will be EPass.
       
   138  */
       
   139 TVerdict CT_LbsStep_VerifyLogInfo::doTestStepL()
       
   140 	{
       
   141 	// Helper test step used to Verify the Position Information Array.
       
   142 	INFO_PRINTF1(_L(">>CT_LbsStep_VerifyLogInfo::doTestStepL()"));
       
   143 
       
   144 	if (TestStepResult() == EPass)
       
   145 		{
       
   146 		
       
   147 		// Left and right parameters of compare functions.
       
   148 		if (GetIntFromConfig(ConfigSection(), KLogType, iLogType))
       
   149 			{
       
   150 
       
   151 
       
   152 			if(iParent.iSharedData->iTestModuleInUse) 
       
   153 				{
       
   154 				iWhatAccuracyToUse = T_LbsUtils::EExactAccuracy;
       
   155 				}
       
   156 			else
       
   157 				{
       
   158 				iWhatAccuracyToUse = T_LbsUtils::ERoughAccuracy;
       
   159 				}
       
   160 				
       
   161 			InitialiseRHS();
       
   162 			
       
   163 			switch(iLogType)
       
   164 				{
       
   165 				case EAutonomousSelfLocateRequest: // Enum 0
       
   166 	        		{
       
   167 	        		AutonomousSelfLocateLogTest();
       
   168 	        		}
       
   169 				break;
       
   170 				
       
   171 				case EMOLRSelfLocateRequest: // Enum 1
       
   172 		        	{
       
   173 					MOLRSelfLocateRequest();
       
   174 		        	}
       
   175 		        break;
       
   176 				
       
   177 				case EMOLRCellBasedLocationRequest: // Enum 2
       
   178 					{
       
   179 					MOLRCellBasedLocationRequest();
       
   180 					}
       
   181 				break;
       
   182 				
       
   183 				case EMOLRTransmitTo3rdPartyLocationRequest: // Enum 3
       
   184 				    {
       
   185 					MOLRTransmitTo3rdPartyLocationRequest();
       
   186 				    }
       
   187 		       	break;
       
   188 		       	
       
   189 				case EMTLR: // Enum 4
       
   190 		       		{
       
   191 					MTLR();
       
   192 		       		}
       
   193 		       	break;
       
   194 		       				
       
   195 				case EMOLRTrackingLocationRequest: // Enum 5
       
   196 			       	{
       
   197 		       		MOLRTrackingLocationRequest();
       
   198 		       		}
       
   199 		       	break;
       
   200 				
       
   201 				case EAutonomousTrackingLocationRequest: // Enum 6
       
   202 		       		{
       
   203 		       		AutonomousTrackingLocationRequest();
       
   204 		       		}
       
   205 		       	break;
       
   206 							
       
   207 				default:
       
   208 					{
       
   209 					INFO_PRINTF1(_L("<FONT><B>Failed to match a test case Id.</B></FONT>"));
       
   210 					SetTestStepResult(EFail);				
       
   211 					}
       
   212 				break;
       
   213 				}// End of switch
       
   214 			
       
   215 			ClearLog();
       
   216 			}// End of GetIntFromConfig()...
       
   217 				
       
   218 		} // End of "If TestStepResult..."
       
   219 
       
   220 
       
   221 	INFO_PRINTF1(_L("&lt;&lt;CT_LbsStep_VerifyLogInfo::doTestStepL()"));
       
   222 
       
   223 	return TestStepResult();
       
   224 	}
       
   225 TVerdict CT_LbsStep_VerifyLogInfo::ReadFromLogL(TInt aUidForTheLogType)
       
   226 	{		
       
   227 
       
   228 	/**
       
   229 	 * Filter the type of log we are looking for based on UID 
       
   230 	 */
       
   231 	CLogFilter* filter = CLogFilter::NewL();			// NEW FILTER
       
   232 	CleanupStack::PushL(filter);
       
   233 	filter->SetEventType(TUid::Uid(aUidForTheLogType));
       
   234 	
       
   235 	/*
       
   236 	 * Obtain the last added event from LBS logger 		
       
   237 	 */
       
   238 	TBool res = iview->SetFilterL(*filter, iActiveWaiter->iStatus);
       
   239 	if (res == EFail)
       
   240 		{
       
   241 		INFO_PRINTF1(_L("\t Error: Set filter failed."));
       
   242 		return EFail;
       
   243 		}
       
   244 
       
   245 	iActiveWaiter->StartAndWait();
       
   246 	if (iActiveWaiter->iStatus != KErrNone)
       
   247 		{
       
   248 		INFO_PRINTF1(_L("\t Error: Create Log iview failed."));
       
   249 		return EFail;
       
   250 		}
       
   251 
       
   252 	/* 
       
   253 	 * Count how many of these events there are and 
       
   254 	 * store each event in the relevant array 
       
   255 	 */	 
       
   256 	
       
   257 	TInt count = iview->CountL();
       
   258 	TLinearOrder<CLbsSelfLocateLogEvent> selfLocLogOrder(SelfLocateLogEventTimestampCompare);
       
   259 	for(int i=0 ; i<count ; i++)
       
   260 		{
       
   261 		// Start at first event to have occured...
       
   262 		if(i==0 && count > 0)
       
   263 			{
       
   264 			// Get first event in order of occurance
       
   265 			if(!iview->LastL(iActiveWaiter->iStatus))
       
   266 				{
       
   267 				INFO_PRINTF2(_L("\t Error: Read last log failed with error %d."), iActiveWaiter->iStatus.Int());
       
   268 				return EFail;
       
   269 				}
       
   270 			}
       
   271 			
       
   272 		if(i>0 && i<count)
       
   273 			{
       
   274 			// Cancel outstanding request...
       
   275 			iActiveWaiter->Cancel();
       
   276 			iActiveWaiter->StartAndWait();
       
   277 			if (iActiveWaiter->iStatus != KErrNone)
       
   278 				{
       
   279 				INFO_PRINTF1(_L("\t Error: Failed to cancel outstanding request."));
       
   280 				return EFail;
       
   281 				}
       
   282 				
       
   283 			// Move onto the next event in order of occurance and store it in succession
       
   284 			if(!iview->PreviousL(iActiveWaiter->iStatus))
       
   285 				{
       
   286 				INFO_PRINTF2(_L("\t Error: Read previous log failed with error %d."), iActiveWaiter->iStatus.Int());
       
   287 				return EFail;	
       
   288 				}
       
   289 			}
       
   290 
       
   291 		CLogEvent* logEvent = CLogEvent::NewL();		// NEW LOGEVENT
       
   292 		CleanupStack::PushL(logEvent);
       
   293 		logEvent->CopyL(iview->Event());
       
   294 		
       
   295 		// Pass ownership to the relevant array
       
   296 		switch(aUidForTheLogType) 
       
   297 		{
       
   298 		case KLogLbsSelfLocateEventType:
       
   299 			{
       
   300 			RPointerArray<CLbsSelfLocateLogEvent>& logInfoArr = iParent.iSharedData->iSelfLocateLogInfoArr;	
       
   301 			CLbsSelfLocateLogEvent* selfLocateEv = static_cast<CLbsSelfLocateLogEvent*>(CLbsLogEvent::NewL(*logEvent));
       
   302 			CleanupStack::PushL(selfLocateEv);
       
   303 			// SelfLoc Log events seem to be returned out of order, so wee need to sort them
       
   304 			logInfoArr.InsertInOrder(selfLocateEv, selfLocLogOrder);
       
   305 			CleanupStack::Pop(selfLocateEv);
       
   306 			}
       
   307 			break;
       
   308 
       
   309 		case KLogLbsNetworkLocateEventType:
       
   310 			{
       
   311 			RPointerArray<CLbsNetworkLocateLogEvent>& logInfoArr = iParent.iSharedData->iNetworkLocateLogInfoArr;	
       
   312 			CLbsNetworkLocateLogEvent* networkLocateEv = static_cast<CLbsNetworkLocateLogEvent*>(CLbsLogEvent::NewL(*logEvent));
       
   313 			CleanupStack::PushL(networkLocateEv);
       
   314 			logInfoArr.AppendL(networkLocateEv); // Store it in the array
       
   315 			CleanupStack::Pop(networkLocateEv);			}
       
   316 			break;
       
   317 
       
   318 		case KLogLbsExternalLocateEventType:
       
   319 			{
       
   320 			RPointerArray<CLbsExternalLocateLogEvent>& logInfoArr = iParent.iSharedData->iExternalLocateLogInfoArr;			
       
   321 			CLbsExternalLocateLogEvent* externalLocateEv = static_cast<CLbsExternalLocateLogEvent*>(CLbsLogEvent::NewL(*logEvent));
       
   322 			CleanupStack::PushL(externalLocateEv);
       
   323 			logInfoArr.AppendL(externalLocateEv); // Store it in the array
       
   324 			CleanupStack::Pop(externalLocateEv);
       
   325 			}
       
   326 		break;
       
   327 
       
   328 		case KLogLbsTransmitLocationEventType:
       
   329 			{
       
   330 			RPointerArray<CLbsTransmitLocationLogEvent>& logInfoArr = iParent.iSharedData->iX3PLocateLogInfoArr;			
       
   331 			CLbsTransmitLocationLogEvent* x3pLocateEv = static_cast<CLbsTransmitLocationLogEvent*>(CLbsLogEvent::NewL(*logEvent));
       
   332 			CleanupStack::PushL(x3pLocateEv);
       
   333 			logInfoArr.AppendL(x3pLocateEv); // Store it in the array
       
   334 			CleanupStack::Pop(x3pLocateEv);
       
   335 			}
       
   336 		break;
       
   337 
       
   338 		case KLogLbsAssistanceDataEventType:
       
   339 			{
       
   340 			RPointerArray<CLbsAssistanceDataLogEvent>& logInfoArr = iParent.iSharedData->iAssistanceDataLogInfoArr;	
       
   341 			CLbsAssistanceDataLogEvent* assistanceLogEv = static_cast<CLbsAssistanceDataLogEvent*>(CLbsLogEvent::NewL(*logEvent));
       
   342 			CleanupStack::PushL(assistanceLogEv);
       
   343 			logInfoArr.AppendL(assistanceLogEv); // Store it in the array
       
   344 			CleanupStack::Pop(assistanceLogEv);
       
   345 			}
       
   346 		break;	
       
   347 
       
   348 		default:
       
   349 			{
       
   350 			INFO_PRINTF1(_L("\t Error: Couldnt match UID to a testable logtype."));
       
   351 			i = count; // Force loop exit
       
   352 			SetTestStepResult(EFail);
       
   353 			}		
       
   354 		}
       
   355 		
       
   356 		// Cleanup scoped variables
       
   357 		CleanupStack::PopAndDestroy(logEvent);
       
   358 		}// End of for loop
       
   359 		
       
   360 		// Cancel outstanding request...
       
   361 		iActiveWaiter->Cancel();
       
   362 		iActiveWaiter->StartAndWait();
       
   363 		if (iActiveWaiter->iStatus != KErrNone)
       
   364 			{
       
   365 			INFO_PRINTF1(_L("\t Error: Failed to cancel any outstanding requests."));
       
   366 			return EFail;
       
   367 			}
       
   368 
       
   369 	// Cleanup local variables
       
   370 	CleanupStack::PopAndDestroy(filter);
       
   371 				
       
   372 	return EPass;	
       
   373 	}
       
   374 	
       
   375 void CT_LbsStep_VerifyLogInfo::SelfLocateLogTest()
       
   376 	{
       
   377 
       
   378 	INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *"));
       
   379 	INFO_PRINTF1(_L("SelfLocateLogTest>>"));
       
   380 	TVerdict res;
       
   381 	TBool compareResult;
       
   382 	
       
   383 	//	Empty SharedData values between update options tests
       
   384 	iParent.iSharedData->iSelfLocateLogInfoArr.Reset();
       
   385 			
       
   386 	// reads all self-locate log entries into iSelfLocateLogInfoArr:
       
   387 	res = ReadFromLogL(KLogLbsSelfLocateEventType);
       
   388 	
       
   389 	if (res == EFail) // if readfromlog fails...
       
   390 		{
       
   391 		INFO_PRINTF1(_L("<FONT><b>SelfLocateRequest > ReadFromLog Failed</b></font>"));
       
   392 		SetTestStepResult(EFail);
       
   393 		}
       
   394 	else
       
   395 		{
       
   396 				
       
   397 		// Compare DB log event and expected log event
       
   398 		INFO_PRINTF1(_L("SelfLocateRequest > About to compare..."));
       
   399 		
       
   400 	
       
   401 		RPointerArray<CLbsSelfLocateLogEvent>& logInfoArr = iParent.iSharedData->iSelfLocateLogInfoArr;
       
   402 		
       
   403 		TInt sizeOfArray = logInfoArr.Count();
       
   404 		
       
   405 		if(	((sizeOfArray != 2) && (iLogType == EAutonomousTrackingLocationRequest)) ||
       
   406 			((sizeOfArray != 3) && (iLogType == EMOLRTrackingLocationRequest))
       
   407 			)
       
   408 			{
       
   409 			INFO_PRINTF2(_L("<FONT><b>Update Log test failed, there were %d Self Locate events</b></font>"),sizeOfArray);
       
   410 			SetTestStepResult(EFail);
       
   411 			}
       
   412 		else
       
   413 			{
       
   414 			//	Change reference location to be expected value
       
   415 			TPositionInfo* posInfoSecond = new TPositionInfo();
       
   416 			SecondPositionFromArray(posInfoSecond);
       
   417 			
       
   418 			for(TInt i = 0 ; i < sizeOfArray ; i++)
       
   419 				{
       
   420 				// note that events are in reverse order, therefore the reference position is last rather than first of 2
       
   421 				if(iLogType == EMOLRTrackingLocationRequest && i == 2)
       
   422 					{
       
   423 					iSelfLocateLogIntiailisedFromValues->SetPositionInfo(posInfoSecond);		
       
   424 					}
       
   425 				
       
   426 			
       
   427 				if(iLogType == EMOLRSelfLocateRequest && i == 1)
       
   428 					{
       
   429 					iSelfLocateLogIntiailisedFromValues->SetPositionInfo(posInfoSecond);
       
   430 					}
       
   431 				
       
   432 				compareResult = iUtils.Compare_SelfLocateLog(	*(reinterpret_cast<CLbsSelfLocateLogEvent*>(logInfoArr[i])) , 
       
   433 																*iSelfLocateLogIntiailisedFromValues
       
   434 															);	
       
   435 				if(!compareResult)
       
   436 					{
       
   437 					INFO_PRINTF2(_L("<FONT><b>SelfLocateRequest > compare returns false for element %d...</b></font>"),i);
       
   438 					SetTestStepResult(EFail);
       
   439 					}
       
   440 				else
       
   441 					{
       
   442 					INFO_PRINTF1(_L("SelfLocateRequest > compare returns true..."));
       
   443 					}
       
   444 				}
       
   445 				
       
   446 			delete posInfoSecond;
       
   447 		
       
   448 			}
       
   449 		}
       
   450 	
       
   451 	INFO_PRINTF1(_L("SelfLocateLogTest<<"));
       
   452 	INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *"));
       
   453 	}
       
   454 
       
   455 
       
   456 void CT_LbsStep_VerifyLogInfo::NetworkLocateLogTest()
       
   457 	{
       
   458 	INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *"));
       
   459 	INFO_PRINTF1(_L("NetworkLocateLogTest>>"));
       
   460 	TVerdict res;
       
   461 	TBool compareResult;
       
   462 
       
   463 	res = ReadFromLogL(KLogLbsNetworkLocateEventType);
       
   464 	
       
   465 	if (res == EFail) // if readfromlog fails...
       
   466 		{
       
   467 		INFO_PRINTF1(_L("<FONT><b>NetworkLocateRequest > Readfrom log failed</b></font>"));
       
   468 		SetTestStepResult(EFail);
       
   469 		}
       
   470 	else
       
   471 		{
       
   472 		// Compare DB log event and expected log event
       
   473 		INFO_PRINTF1(_L("NetworkSelfLocateRequest > About to compare..."));
       
   474 		
       
   475 		RPointerArray<CLbsNetworkLocateLogEvent>& logInfoArr = iParent.iSharedData->iNetworkLocateLogInfoArr;
       
   476 		
       
   477 		TInt sizeOfArray = logInfoArr.Count();
       
   478 		
       
   479 		
       
   480 		for(TInt i = 0 ; i < sizeOfArray ; i++)
       
   481 			{
       
   482 			
       
   483 			compareResult = iUtils.Compare_NetworkLocateLog(	*(reinterpret_cast<CLbsNetworkLocateLogEvent*>(logInfoArr[i])) , 
       
   484 																*iNetworkLocateLogIntiailisedFromValues
       
   485 														);	
       
   486 			if(!compareResult)
       
   487 				{
       
   488 				INFO_PRINTF2(_L("<FONT><b>NetworkLocateRequest > compare returns false for element %d...</b></font>"),i);
       
   489 				SetTestStepResult(EFail);
       
   490 				}
       
   491 			else
       
   492 				{
       
   493 				INFO_PRINTF1(_L("NetworkLocateRequest > compare returns true..."));
       
   494 				}	
       
   495 			}
       
   496 
       
   497 		}
       
   498 		
       
   499 	INFO_PRINTF1(_L("NetworkLocateLogTest<<"));
       
   500 	INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *"));
       
   501 	}
       
   502 
       
   503 void CT_LbsStep_VerifyLogInfo::ExternalLocateLogTest()
       
   504 	{
       
   505 
       
   506 	INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *"));
       
   507 	INFO_PRINTF1(_L("ExternalLocateLogTest>>"));
       
   508 	TVerdict res;
       
   509 	TBool compareResult;
       
   510 	
       
   511 	res = ReadFromLogL(KLogLbsExternalLocateEventType);
       
   512 	
       
   513 	if (res == EFail) // if readfromlog fails...
       
   514 		{
       
   515 		INFO_PRINTF1(_L("<FONT><b>ExternalLocateRequest > ReadFromLog Failed</b></font>"));
       
   516 		SetTestStepResult(EFail);
       
   517 		}
       
   518 	else
       
   519 		{
       
   520 		// Compare DB log event and expected log event
       
   521 		INFO_PRINTF1(_L("NetworkSelfLocateRequest > About to compare..."));
       
   522 
       
   523 		RPointerArray<CLbsExternalLocateLogEvent>& logInfoArr = iParent.iSharedData->iExternalLocateLogInfoArr;
       
   524 		
       
   525 		TInt sizeOfArray = logInfoArr.Count();
       
   526 		TPositionInfo* posInfoSecond = new TPositionInfo();
       
   527 		TPositionInfo* commonPosinfo = CommonPositionInfo();
       
   528 		for(TInt i = 0 ; i < sizeOfArray ; i++)
       
   529 			{			
       
   530 			if(iLogType==EMOLRTrackingLocationRequest && i%2==1)
       
   531 				{
       
   532 				TInt gatewayId = 271064388;	//	KLbsGpsLocManagerUidValue	
       
   533 				TUid gatewayUid = TUid::Uid(gatewayId);
       
   534 				iExternalLocateLogIntiailisedFromValues->SetRequestOriginator(gatewayUid);
       
   535 							
       
   536 				TLbsRequestOutcome tweakedOutcome = ELbsRequestOutcomeInconclusive;
       
   537 				iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(tweakedOutcome); 	
       
   538 
       
   539 				SecondPositionFromArray(posInfoSecond);
       
   540 				iExternalLocateLogIntiailisedFromValues->SetReferenceLocation(posInfoSecond);
       
   541 				iExternalLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo);
       
   542 				}
       
   543 
       
   544 			// logtype 5
       
   545 			if(iLogType==EMOLRTrackingLocationRequest && i%2==0)
       
   546 				{
       
   547 				TInt gatewayId = 271064388;	//	KLbsGpsLocManagerUidValueS	
       
   548 				TUid gatewayUid = TUid::Uid(gatewayId);
       
   549 				iExternalLocateLogIntiailisedFromValues->SetRequestOriginator(gatewayUid);
       
   550 				
       
   551 				//	Change outcome to expected value			
       
   552 				TLbsRequestOutcome tweakedOutcome = ELbsRequestOutcomeSuccess;
       
   553 				iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(tweakedOutcome);
       
   554 				
       
   555 				//	Change reference location to be expected value
       
   556 				// Set the reference position, which also be used for any required verification.
       
   557 				TPosition refPos;
       
   558 				TPositionInfo* posInfo = new TPositionInfo();
       
   559 				refPos.SetCoordinate(REFPOS_LAT_OTHER, REFPOS_LONG_OTHER, REFPOS_ALT_OTHER);
       
   560 				refPos.SetAccuracy(REFPOS_HORZ_ACCURACY_OTHER, REFPOS_VERT_ACCURACY_OTHER);
       
   561 				refPos.SetCurrentTime();
       
   562 				static_cast<TPositionInfo*>(posInfo)->SetPosition(refPos);
       
   563 
       
   564 				iExternalLocateLogIntiailisedFromValues->SetReferenceLocation(posInfo);
       
   565 				delete posInfo;
       
   566 				}
       
   567 				
       
   568 			// logtype 1
       
   569 			if(iLogType==EMOLRSelfLocateRequest)
       
   570 			{
       
   571 				TInt locManagerId = 271064388;	//	KLbsGpsLocManagerUidValue
       
   572 				TUid locManagerUid = TUid::Uid(locManagerId);
       
   573 				iExternalLocateLogIntiailisedFromValues->SetRequestOriginator(locManagerUid);
       
   574 				
       
   575 				//	Change outcome to expected value			
       
   576 				TLbsRequestOutcome tweakedOutcome = ELbsRequestOutcomeSuccess;
       
   577 				iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(tweakedOutcome);
       
   578 
       
   579 				//	Expect position to be NULL for first event
       
   580 				//	Set expected outcome of second External event
       
   581 				if(i==1)
       
   582 					{
       
   583 					TLbsRequestOutcome tweakedOutcome = ELbsRequestOutcomeInconclusive;
       
   584 					iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(tweakedOutcome); 	
       
   585 					iExternalLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo);
       
   586 					iExternalLocateLogIntiailisedFromValues->SetReferenceLocation(iRefPosTwo);
       
   587 					}
       
   588 			}
       
   589 			
       
   590 			if(iLogType==EMOLRTransmitTo3rdPartyLocationRequest && i==1)
       
   591 				{
       
   592 				TLbsRequestOutcome tweakedOutcome = ELbsRequestOutcomeInconclusive;
       
   593 				iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(tweakedOutcome);
       
   594 				SecondPositionFromArray(posInfoSecond);
       
   595 				iExternalLocateLogIntiailisedFromValues->SetReferenceLocation(posInfoSecond);			 	
       
   596 				}
       
   597 				
       
   598 			if(iLogType==EMOLRTransmitTo3rdPartyLocationRequest && i==1)
       
   599 				{
       
   600 				iExternalLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo);
       
   601 				}
       
   602 
       
   603 				
       
   604 			if(iLogType == EMTLR)
       
   605 				{
       
   606 				iExternalLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo);
       
   607 				InitialiseRHSforMTLR();
       
   608 				}
       
   609 
       
   610 			
       
   611 			compareResult = iUtils.Compare_ExternalLocateLog(	*(reinterpret_cast<CLbsExternalLocateLogEvent*>(logInfoArr[i])) , 
       
   612 																*iExternalLocateLogIntiailisedFromValues
       
   613 															);	
       
   614 			if(!compareResult)
       
   615 				{
       
   616 				INFO_PRINTF2(_L("<FONT><b>ExternalLocateLog > compare returns false for element %d...</b></font>"),i);
       
   617 				SetTestStepResult(EFail);
       
   618 				}
       
   619 			else
       
   620 				{
       
   621 				INFO_PRINTF1(_L("ExternalLocateLog > compare returns true..."));
       
   622 				}
       
   623 			} // End for loop
       
   624 		delete commonPosinfo;
       
   625 		delete posInfoSecond;	
       
   626 		}
       
   627 		
       
   628 	INFO_PRINTF1(_L("ExternalLocateLogTest<<"));
       
   629 	INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *"));
       
   630 
       
   631 	}
       
   632 	
       
   633 void CT_LbsStep_VerifyLogInfo::X3PLocateLogTest()
       
   634 	{
       
   635 	INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *"));
       
   636 	INFO_PRINTF1(_L("X3PLocateLogTest>>"));
       
   637 	TVerdict res;
       
   638 	TBool compareResult;
       
   639 
       
   640 	res = ReadFromLogL(KLogLbsTransmitLocationEventType);
       
   641 	
       
   642 	if (res == EFail) // if readfromlog fails...
       
   643 		{
       
   644 		INFO_PRINTF1(_L("<FONT><b>X3PLocateRequest > ReadFromLog Failed</B></FONT>"));
       
   645 		SetTestStepResult(EFail);
       
   646 		}
       
   647 	else
       
   648 		{
       
   649 		// Compare DB log event and expected log event
       
   650 		INFO_PRINTF1(_L("X3PLocateLog > About to compare..."));
       
   651 		
       
   652 		RPointerArray<CLbsTransmitLocationLogEvent>& logInfoArr = iParent.iSharedData->iX3PLocateLogInfoArr;
       
   653 
       
   654 		TInt sizeOfArray = logInfoArr.Count();
       
   655 		
       
   656 		for(TInt i = 0 ; i < sizeOfArray ; i++)
       
   657 			{
       
   658 			compareResult = iUtils.Compare_TransmitLocationLog(	*(reinterpret_cast<CLbsTransmitLocationLogEvent*>(logInfoArr[i])) , 
       
   659 													*iX3PLogIntiailisedFromValues
       
   660 														);	
       
   661 			if(!compareResult)
       
   662 				{
       
   663 				INFO_PRINTF2(_L("<FONT><b>X3PLocateLogTest > compare returns false for element %d...</b></font>"),i);
       
   664 				SetTestStepResult(EFail);
       
   665 				}
       
   666 			else
       
   667 				{
       
   668 				INFO_PRINTF1(_L("X3PLocateLogTest > compare returns true..."));
       
   669 				}
       
   670 			}	
       
   671 		}
       
   672 
       
   673 	INFO_PRINTF1(_L("X3PLocateLogTest<<"));
       
   674 	INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *"));
       
   675 	}
       
   676 
       
   677 void CT_LbsStep_VerifyLogInfo::AssistanceDataLogTest()
       
   678 	{
       
   679 
       
   680 	INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *"));
       
   681 	INFO_PRINTF1(_L("AssistanceDataLogTest>>"));
       
   682 	TVerdict res;
       
   683 	TBool compareResult = ETrue;
       
   684 
       
   685 	res = ReadFromLogL(KLogLbsAssistanceDataEventType);
       
   686 	
       
   687 	if (res == EFail) // if readfromlog fails...
       
   688 		{
       
   689 		INFO_PRINTF1(_L("<FONT><b>AssistanceDataLog > ReadFromLog Failed</b></font>"));
       
   690 		SetTestStepResult(EFail);
       
   691 		}
       
   692 	else
       
   693 		{
       
   694 		// Compare DB log event and expected log event
       
   695 		INFO_PRINTF1(_L("AssistanceDataLog > About to compare..."));
       
   696 		
       
   697 		RPointerArray<CLbsAssistanceDataLogEvent>& logInfoArr = iParent.iSharedData->iAssistanceDataLogInfoArr;
       
   698 		
       
   699 		TInt sizeOfArray = logInfoArr.Count();
       
   700 		TPositionInfo* commonPosinfo = CommonPositionInfo();
       
   701 		for(TInt i = 0 ; i < sizeOfArray ; i++)
       
   702 			{
       
   703 		
       
   704 			if(	iLogType == EMOLRTrackingLocationRequest || 
       
   705 				iLogType ==EMOLRTransmitTo3rdPartyLocationRequest )
       
   706 				{
       
   707 				iAssistanceDataLogIntiailisedFromValuesFirst->SetRequestAssistanceDataType(0);	
       
   708 				}
       
   709 							
       
   710 			
       
   711 			/*
       
   712 		 	 *	If we run X3P log test on its own we get logs that are different than when its run 
       
   713 		 	 *	in sequence with other tests.
       
   714 			 */
       
   715 			if(sizeOfArray > 1 && iLogType ==EMOLRTransmitTo3rdPartyLocationRequest) 
       
   716 				{
       
   717 				if(i==1)
       
   718 					{
       
   719 					//	Second log has a mask of 0
       
   720 					iAssistanceDataLogIntiailisedFromValuesFirst->SetRequestAssistanceDataType(0);
       
   721 					compareResult = iUtils.Compare_AssistanceDataLog(	*(reinterpret_cast<CLbsAssistanceDataLogEvent*>(logInfoArr[i])) , 
       
   722 																		*iAssistanceDataLogIntiailisedFromValuesFirst
       
   723 																	);
       
   724 					}
       
   725 				else
       
   726 					{
       
   727 					iAssistanceDataLogIntiailisedFromValuesFirst->SetRequestAssistanceDataType(8);
       
   728 					compareResult = iUtils.Compare_AssistanceDataLog(	*(reinterpret_cast<CLbsAssistanceDataLogEvent*>(logInfoArr[i])) , 
       
   729 																		*iAssistanceDataLogIntiailisedFromValuesFirst
       
   730 																	);											
       
   731 					}	
       
   732 				} 
       
   733 
       
   734 			if(!compareResult)
       
   735 				{
       
   736 				INFO_PRINTF2(_L("<FONT><b>AssistanceDataLogTest > compare returns false for element %d...</b></FONT>"),i);
       
   737 				SetTestStepResult(EFail);
       
   738 				}
       
   739 			else
       
   740 				{
       
   741 				INFO_PRINTF1(_L("AssistanceDataLogTest > compare returns true..."));
       
   742 				}
       
   743 			}//	End of for loop
       
   744 			delete commonPosinfo;
       
   745 		}
       
   746 	
       
   747 	INFO_PRINTF1(_L("AssistanceDataLogTest<<"));
       
   748 	INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *"));
       
   749 	}
       
   750 
       
   751 
       
   752 
       
   753 // Top level functionality
       
   754 
       
   755 void CT_LbsStep_VerifyLogInfo::AutonomousSelfLocateLogTest()
       
   756 	{
       
   757 	SelfLocateLogTest();
       
   758 	}
       
   759 
       
   760 void CT_LbsStep_VerifyLogInfo::MOLRSelfLocateRequest() 	// ** Similar **
       
   761 	{
       
   762     ExternalLocateLogTest();
       
   763 	AssistanceDataLogTest();
       
   764 	SelfLocateLogTest();
       
   765 	}
       
   766 
       
   767 void CT_LbsStep_VerifyLogInfo::MOLRCellBasedLocationRequest()
       
   768 	{
       
   769 	NetworkLocateLogTest();
       
   770 	}
       
   771 
       
   772 void CT_LbsStep_VerifyLogInfo::MOLRTransmitTo3rdPartyLocationRequest()
       
   773 	{
       
   774 	AssistanceDataLogTest();
       
   775     ExternalLocateLogTest();
       
   776     X3PLocateLogTest();
       
   777 	}
       
   778 
       
   779 void CT_LbsStep_VerifyLogInfo::MTLR()	// ** Similar **
       
   780 	{
       
   781 	//	SelfLocateLogTest();
       
   782 	ExternalLocateLogTest();
       
   783 	AssistanceDataLogTest();
       
   784 	}
       
   785 
       
   786 void CT_LbsStep_VerifyLogInfo::MOLRTrackingLocationRequest()	// ** Similar **
       
   787 	{
       
   788 	SelfLocateLogTest();
       
   789 	AssistanceDataLogTest();
       
   790 	ExternalLocateLogTest();
       
   791     }
       
   792 
       
   793 void CT_LbsStep_VerifyLogInfo::AutonomousTrackingLocationRequest()
       
   794 	{
       
   795 	SelfLocateLogTest();
       
   796 	}
       
   797 
       
   798 
       
   799 
       
   800 
       
   801 void CT_LbsStep_VerifyLogInfo::InitialiseRHS()
       
   802 	{
       
   803 	//	Variables needed for all reads
       
   804 	//	CommonToAll
       
   805 	TBool direction; // Inbound or outbound
       
   806 	
       
   807 	// wont be filled in components ELbsRequestOutcomeSuccess/ELbsRequestOutcomeFailed/...Inconclusive etc
       
   808 	TLbsRequestOutcome theSelfLocateRequestOutcome;
       
   809 	TLbsRequestOutcome theX3PRequestOutcome;
       
   810 	TLbsRequestOutcome theExternalLocateRequestOutcome;
       
   811 	TLbsRequestOutcome theNetworkLocateRequestOutcome;
       
   812 	TLbsRequestOutcome theAssistanceDataRequestOutcome;
       
   813 
       
   814 	//	Common to 4/5 but not assistance
       
   815 	TInt theCost;	// not implemented
       
   816 
       
   817 	//	Common to 4/5 but not external
       
   818 	TUid theLocalAppUid; 	// work out from PID
       
   819 
       
   820 	//	Common only to External Locate
       
   821 	TInt theOriginator;	// From network gateway
       
   822 	TInt theSessionNum;	// TNetLocSessionID?
       
   823 	TInt theSessionOwner;	// TNetLocSessionID?
       
   824 	TInt theAction;		// Set within privacy request
       
   825 	TInt theAdvice;		// Set within privacy request
       
   826 	TPtrC theClientName;	// Set within privacy request
       
   827 	TPtrC theExternalId;	// Set within privacy request
       
   828 	TPtrC theRequestor;	// Set within privacy request
       
   829 	TInt theResult;		// ENum within privacy response
       
   830 
       
   831 	//	Common only to X3P Locate
       
   832 	TUid theX3PUid;	 	// work out from PID
       
   833 	
       
   834 	//	Common only to Assistance
       
   835 	TInt theFirstRequestMask;	// Set within GPSlocmanager	// Set within GPSlocmanager for wanted
       
   836 	TInt theReceiveMask;	// Set within GPSlocmanager	// Set within GPSlocmanager for recieved
       
   837 	
       
   838 
       
   839 	//	Specialised variables
       
   840 	theCost = 0;
       
   841 	theLocalAppUid = TUid::Uid(RProcess().SecureId()); // Get this from ProcessId each time
       
   842 	TInt testX3PserverId = 271065697;
       
   843 	theX3PUid = TUid::Uid(testX3PserverId);	//	Id of NRH
       
   844 	TInt locServerAppId = 271064387;
       
   845 	TUid locServerAppUid = TUid::Uid(locServerAppId);
       
   846 
       
   847 	direction = EFalse;
       
   848 		
       
   849 	theSelfLocateRequestOutcome = ELbsRequestOutcomeSuccess;	// or ELbsRequestOutcomeFailed or Inconclusive etc
       
   850 	theX3PRequestOutcome = ELbsRequestOutcomeSuccess;// Set it to this for X3P test
       
   851 	theExternalLocateRequestOutcome = ELbsRequestOutcomeSuccess;
       
   852 	theNetworkLocateRequestOutcome = ELbsRequestOutcomeSuccess;
       
   853 	theAssistanceDataRequestOutcome = ELbsRequestOutcomeInconclusive; // Set it to this for X3P test
       
   854 
       
   855 	TPositionInfo* commonPosinfo = CommonPositionInfo();
       
   856 	
       
   857 	
       
   858 	//	Set up relevant 5 Log variables for comparison using position info etc
       
   859 	//	SELF LOCATE LOG
       
   860 	iSelfLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo); 
       
   861 	iSelfLocateLogIntiailisedFromValues->SetDirection(direction);
       
   862 	iSelfLocateLogIntiailisedFromValues->SetLocalApp(theLocalAppUid);	// This apps UID
       
   863 	iSelfLocateLogIntiailisedFromValues->SetCostInformation(theCost); // set cost information if there are any;
       
   864 	iSelfLocateLogIntiailisedFromValues->SetRequestOutcome(theSelfLocateRequestOutcome); // by passing the location request outcome;	
       
   865 	
       
   866 	
       
   867 	//	EXTERNAL LOG
       
   868 	iExternalLocateLogIntiailisedFromValues->SetDirection(direction);
       
   869 	iExternalLocateLogIntiailisedFromValues->SetCostInformation(theCost);
       
   870 	iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(theExternalLocateRequestOutcome); // by passing the location request outcome;	
       
   871 	//	No local app id to set for external log
       
   872 	//	Common only to External Locate
       
   873 	theOriginator = 271064389;		//	From Network request handler
       
   874 	theSessionOwner = 0;	//	268440115 TNetLocSessionID?
       
   875 	theSessionNum = 0;	// TNetLocSessionID?
       
   876 	theAction = 0;		// Set within privacy request 0
       
   877 	theAdvice = 0;		// Set within privacy request 0 = ERequestAdviceNotUsed, 1 = ERequestActionAllow
       
   878 	
       
   879 	_LIT(KClientName,"");
       
   880 	_LIT(KRequestor,"");
       
   881 	_LIT(KExternalId,"");
       
   882 	theClientName.Set(KClientName);	// Set within privacy request
       
   883 	theRequestor.Set(KRequestor);	// Set within privacy request
       
   884 	theExternalId.Set(KExternalId);	// Set within privacy request
       
   885 	theResult = 0;		// ENum within privacy response, 1 = ERequestAccepted
       
   886 	
       
   887 	// set privacy request parameters
       
   888 	TLbsLoggingPrivacyRequestParams reqParams; 
       
   889 	TLbsNetSessionId sessionId(TUid::Uid(0), (TUint32)theSessionNum);
       
   890 	reqParams.iSessionId.SetSessionOwner(TUid::Uid(theSessionOwner));
       
   891 	reqParams.iSessionId.SetSessionNum(theSessionNum);
       
   892 	reqParams.iRequestPrivacy.SetRequestAction((TLbsNetPosRequestPrivacy::TLbsRequestAction)theAction);
       
   893 	reqParams.iRequestPrivacy.SetRequestAdvice((TLbsNetPosRequestPrivacy::TLbsRequestAdvice)theAdvice);
       
   894 	
       
   895 	TPtrC8 ptrReq((TUint8*)theRequestor.Ptr(), theRequestor.Size());			
       
   896 	TPtrC8 ptrClient((TUint8*)theClientName.Ptr(), theClientName.Size());			
       
   897 	TPtrC8 ptrId((TUint8*)theExternalId.Ptr(), theExternalId.Size());			
       
   898 	reqParams.iRequestInfo.SetRequesterId(reinterpret_cast<const TDesC8&>(ptrReq));
       
   899 	reqParams.iRequestInfo.SetClientName(reinterpret_cast<const TDesC8&>(ptrClient));
       
   900 	reqParams.iRequestInfo.SetClientExternalId(reinterpret_cast<const TDesC8&>(ptrId));
       
   901 
       
   902 	//	set privacy response parameters
       
   903 	TLbsLoggingPrivacyResponseParams respParams;
       
   904 	respParams.iSessionId.SetSessionOwner(TUid::Uid(0));
       
   905 	respParams.iSessionId.SetSessionNum(0);
       
   906 	respParams.iResult = static_cast<CLbsNetworkProtocolBase::TLbsPrivacyResponse>(theResult);
       
   907 
       
   908 	iExternalLocateLogIntiailisedFromValues->SetRequestOriginator(TUid::Uid(theOriginator));
       
   909 	iExternalLocateLogIntiailisedFromValues->SetPrivacyRequestParams(reqParams); // set privacy request parameters from request originator
       
   910 	iExternalLocateLogIntiailisedFromValues->SetPrivacyResponseParams(respParams); // set privacy response parameters from privacy controller
       
   911 	iExternalLocateLogIntiailisedFromValues->SetReferenceLocation(commonPosinfo);
       
   912 
       
   913 	
       
   914 	//	X3P LOG	
       
   915 	iX3PLogIntiailisedFromValues->SetPositionInfo(commonPosinfo); 
       
   916 	iX3PLogIntiailisedFromValues->SetDirection(direction);
       
   917 	iX3PLogIntiailisedFromValues->SetCostInformation(theCost); // set cost information if there are any;
       
   918 	iX3PLogIntiailisedFromValues->SetRequestOutcome(theX3PRequestOutcome); // by passing the location request outcome;	
       
   919 	//	X3P log only
       
   920 	iX3PLogIntiailisedFromValues->SetX3PApp(theX3PUid);	// This apps Uid
       
   921 
       
   922 	
       
   923 		
       
   924 	//	FIRST ASSISTANCE DATA LOG
       
   925 	iAssistanceDataLogIntiailisedFromValuesFirst->SetDirection(direction);
       
   926 	iAssistanceDataLogIntiailisedFromValuesFirst->SetRequestOutcome(theAssistanceDataRequestOutcome); // by passing the location request outcome;	
       
   927 	//	No cost to set for assistance log
       
   928 	//	Common only to Assistance
       
   929 	theFirstRequestMask = 8;	//	Set within GPSlocmanager for wanted (8 for first in array, 0 for second)
       
   930 	theReceiveMask = 8;	//	Set within GPSlocmanager for recieved
       
   931 	iAssistanceDataLogIntiailisedFromValuesFirst->SetRequestAssistanceDataType(theFirstRequestMask);
       
   932 	iAssistanceDataLogIntiailisedFromValuesFirst->SetReceiveAssistanceDataType(theReceiveMask);
       
   933 
       
   934 
       
   935 
       
   936 	//	NETWORK LOCATE LOG
       
   937 	commonPosinfo->SetModuleId(TUid::Uid(0));
       
   938 	
       
   939 	iNetworkLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo); 
       
   940 	iNetworkLocateLogIntiailisedFromValues->SetDirection(direction);
       
   941 	iNetworkLocateLogIntiailisedFromValues->SetCostInformation(theCost); // set cost information if there are any;
       
   942 	iNetworkLocateLogIntiailisedFromValues->SetRequestOutcome(theNetworkLocateRequestOutcome); // by passing the location request outcome;	
       
   943 	iNetworkLocateLogIntiailisedFromValues->SetLocalApp(locServerAppUid);	// This apps UID
       
   944 	
       
   945 	delete commonPosinfo;			
       
   946 	}
       
   947 	
       
   948 void CT_LbsStep_VerifyLogInfo::InitialiseRHSforMTLR()
       
   949 	{
       
   950 	//	For MTLR, most of the expected external logs values need to be completely different.
       
   951 
       
   952 	TInt theOriginator;	// From network gateway
       
   953 	TInt theSessionNum;	// TNetLocSessionID?
       
   954 	TInt theSessionOwner;	// TNetLocSessionID?
       
   955 	TInt theAction;		// Set within privacy request
       
   956 	TInt theAdvice;		// Set within privacy request
       
   957 	TPtrC8 theClientName;	// Set within privacy request
       
   958 	TPtrC8 theExternalId;	// Set within privacy request
       
   959 	TPtrC8 theRequestor;	// Set within privacy request
       
   960 	TInt theRequestResult;		// ENum within privacy response
       
   961 
       
   962 	theOriginator = 271064432;		//	From Protocol Module
       
   963 	theSessionOwner = 271064432;	//	Protocol Module
       
   964 	theSessionNum = 1;	// TNetLocSessionID?
       
   965 	theAction = 1;		// Set within privacy request 0
       
   966 	theAdvice = 1;		// Set within privacy request 0 = ERequestAdviceNotUsed, 1 = ERequestActionAllow
       
   967 	
       
   968 	_LIT8(KMTLRClientName,"MT-LR test client name");
       
   969 	_LIT8(KMTLRRequestor,"MT-LR test requester id");
       
   970 	_LIT8(KMTLRExternalId,"MT-LR test client external id");
       
   971 	theClientName.Set(KMTLRClientName);	// Set within privacy request
       
   972 	theRequestor.Set(KMTLRRequestor);	// Set within privacy request
       
   973 	theExternalId.Set(KMTLRExternalId);	// Set within privacy request
       
   974 	theRequestResult = 1;		// ENum within privacy response, 1 = ERequestAccepted
       
   975 
       
   976 
       
   977 	// set privacy request parameters
       
   978 	TLbsLoggingPrivacyRequestParams reqParams; 
       
   979 	TLbsNetSessionId sessionId(TUid::Uid(0), (TUint32)theSessionNum);
       
   980 	reqParams.iSessionId.SetSessionOwner(TUid::Uid(theSessionOwner));
       
   981 	reqParams.iSessionId.SetSessionNum(theSessionNum);
       
   982 	reqParams.iRequestPrivacy.SetRequestAction((TLbsNetPosRequestPrivacy::TLbsRequestAction)theAction);
       
   983 	reqParams.iRequestPrivacy.SetRequestAdvice((TLbsNetPosRequestPrivacy::TLbsRequestAdvice)theAdvice);
       
   984 	
       
   985 	TPtrC8 ptrReq((TUint8*)theRequestor.Ptr(), theRequestor.Size());			
       
   986 	TPtrC8 ptrClient((TUint8*)theClientName.Ptr(), theClientName.Size());			
       
   987 	TPtrC8 ptrId((TUint8*)theExternalId.Ptr(), theExternalId.Size());			
       
   988 	reqParams.iRequestInfo.SetRequesterId(reinterpret_cast<const TDesC8&>(ptrReq));
       
   989 	reqParams.iRequestInfo.SetClientName(reinterpret_cast<const TDesC8&>(ptrClient));
       
   990 	reqParams.iRequestInfo.SetClientExternalId(reinterpret_cast<const TDesC8&>(ptrId));
       
   991 
       
   992 	//	set privacy response parameters
       
   993 	TLbsLoggingPrivacyResponseParams respParams;
       
   994 	respParams.iSessionId.SetSessionOwner(TUid::Uid(theSessionOwner ));
       
   995 	respParams.iSessionId.SetSessionNum(theSessionNum );
       
   996 	respParams.iResult = static_cast<CLbsNetworkProtocolBase::TLbsPrivacyResponse>(theRequestResult);
       
   997 
       
   998 	iExternalLocateLogIntiailisedFromValues->SetRequestOriginator(TUid::Uid(theOriginator));
       
   999 	iExternalLocateLogIntiailisedFromValues->SetPrivacyRequestParams(reqParams); // set privacy request parameters from request originator
       
  1000 	iExternalLocateLogIntiailisedFromValues->SetPrivacyResponseParams(respParams); // set privacy response parameters from privacy controller
       
  1001 	}
       
  1002 	
       
  1003 void CT_LbsStep_VerifyLogInfo::ClearLog()
       
  1004  	{
       
  1005 	// Setup a time in the future, before which all events will be deleted
       
  1006  	_LIT(KDateCorrect1,"20900101:"); 
       
  1007  	TTime time;
       
  1008 	TBuf <10> theDate(KDateCorrect1);
       
  1009 	TInt err=time.Set(theDate); 
       
  1010 	
       
  1011 	// Ensure time has been set correctly
       
  1012 	if(err != KErrNone)
       
  1013 		{
       
  1014 		INFO_PRINTF1(_L("Failed to set time"));
       
  1015 		}
       
  1016 		
       
  1017 	if(err == KErrGeneral)
       
  1018 		{
       
  1019 		INFO_PRINTF1(_L("Time syntax is incorrect"));
       
  1020 		}
       
  1021 	
       
  1022 	// Set the filter to view ALL logs
       
  1023 	CLogFilter* filter = CLogFilter::NewL();			// NEW FILTER
       
  1024 	CleanupStack::PushL(filter);
       
  1025 	TBool res = iview->SetFilterL(*filter, iActiveWaiter->iStatus);
       
  1026 	if (res == EFalse)
       
  1027 		{
       
  1028 		INFO_PRINTF1(_L("\t No such events to filter in the view."));
       
  1029 		iclient->Cancel();
       
  1030 		}
       
  1031 	else
       
  1032 		{
       
  1033 		// else If there are logs, flush them
       
  1034 			
       
  1035 		// Cancel outstanding requests
       
  1036 		iclient->Cancel();	
       
  1037 		iActiveWaiter->StartAndWait();
       
  1038 		if (iActiveWaiter->iStatus != KErrNone)
       
  1039 			{
       
  1040 			INFO_PRINTF2(_L("\t Error: Cancel returned error %d."),iActiveWaiter->iStatus.Int());
       
  1041 			SetTestStepResult(EFail);
       
  1042 			}
       
  1043 
       
  1044 		// Clear ALL logs
       
  1045 		iclient->ClearLog(time, iActiveWaiter->iStatus);
       
  1046 		iActiveWaiter->StartAndWait();
       
  1047 		if (iActiveWaiter->iStatus != KErrNone)
       
  1048 			{
       
  1049 			INFO_PRINTF2(_L("\t Error: Clear log returned error %d."),iActiveWaiter->iStatus.Int());
       
  1050 			SetTestStepResult(EFail);
       
  1051 			}	
       
  1052 			
       
  1053 		//Confirm log is cleared
       
  1054 		if(iview->CountL() != 0)
       
  1055 			{
       
  1056 			INFO_PRINTF2(_L("<FONT><B>ERROR: Log still has %d entries</B></FONT>"),iview->CountL());
       
  1057 			SetTestStepResult(EFail);
       
  1058 			}
       
  1059 				
       
  1060 		}
       
  1061 	
       
  1062 	CleanupStack::PopAndDestroy(filter);	
       
  1063 
       
  1064 	}
       
  1065 void CT_LbsStep_VerifyLogInfo::SecondPositionFromArray(TPositionInfo* aPosInfoSecond)
       
  1066 {
       
  1067 
       
  1068 	//All this in TPosInfo Structure
       
  1069 	TUid theModuleId;	// use from VerifyLogInfo array
       
  1070 	TPositionModuleInfo::TTechnologyType theTechType;
       
  1071 	TPositionModeReason theModeReason;
       
  1072 	TReal32 theVerAccuracy;
       
  1073 	TReal32 theHorAccuracy;
       
  1074 	TReal64 theLat;
       
  1075 	TReal64 theLong;
       
  1076 	TReal theAltitude;
       
  1077 	
       
  1078 	//	Initialise variables from Verify array
       
  1079 	RPointerArray<TAny>& logInfoArr = iParent.iSharedData->iVerifyPosInfoArr;
       
  1080 	TPositionInfo* tPosInfo = (reinterpret_cast<TPositionInfo*>(logInfoArr[0]));
       
  1081 	TPosition tPos;
       
  1082 	tPosInfo->GetPosition(tPos);
       
  1083 		
       
  1084 	theModuleId = 		TUid::Uid(271064388); // 271064388;
       
  1085 	theTechType = 		tPosInfo->PositionMode();
       
  1086 	theModeReason = 	tPosInfo->PositionModeReason();
       
  1087 	theVerAccuracy = 	REFPOS_VERT_ACCURACY;	// For second x3p reference position comparison
       
  1088 	theHorAccuracy = 	REFPOS_HORZ_ACCURACY;	// For second x3p reference position comparison
       
  1089 	theLat = 			REFPOS_LAT;	// For second x3p reference position comparison
       
  1090 	theLong = 			REFPOS_LONG;	// For second x3p reference position comparison
       
  1091 	theAltitude = 		REFPOS_ALT;	// For second x3p reference position comparison
       
  1092 
       
  1093 
       
  1094 	//	Setup position information using intialised variables
       
  1095 	aPosInfoSecond->SetModuleId(theModuleId);
       
  1096 	aPosInfoSecond->SetUpdateType(EPositionUpdateGeneral);
       
  1097 	aPosInfoSecond->SetPositionMode((TPositionModuleInfo::TTechnologyType)theTechType);
       
  1098 	aPosInfoSecond->SetPositionModeReason((TPositionModeReason)theModeReason);
       
  1099 	TPosition position;
       
  1100 	position.SetCurrentTime();
       
  1101 	position.SetAccuracy(theHorAccuracy,theVerAccuracy);
       
  1102 	position.SetCoordinate(theLat,theLong, theAltitude);
       
  1103 	static_cast<TPositionInfo*>(aPosInfoSecond)->SetPosition(position);
       
  1104 }
       
  1105 
       
  1106 
       
  1107 TPositionInfo* CT_LbsStep_VerifyLogInfo::CommonPositionInfo()
       
  1108 {
       
  1109 	//All this in TPosInfo Structure
       
  1110 	TUid theModuleId;	// use from VerifyLogInfo array
       
  1111 	TPositionModuleInfo::TTechnologyType theTechType;
       
  1112 	TPositionModeReason theModeReason;
       
  1113 	TReal32 theVerAccuracy;
       
  1114 	TReal32 theHorAccuracy;
       
  1115 	TReal64 theLat;
       
  1116 	TReal64 theLong;
       
  1117 	TReal theAltitude;
       
  1118 
       
  1119 	//	All this in TPosInfo Structure use from VerifyLogInfo array
       
  1120 	RPointerArray<TAny>& logInfoArr = iParent.iSharedData->iVerifyPosInfoArr;
       
  1121 	
       
  1122 	//	Initialise variables from Verify array
       
  1123 	TPositionInfo* tPosInfo = (reinterpret_cast<TPositionInfo*>(logInfoArr[0]));
       
  1124 	TPosition tPos;
       
  1125 	tPosInfo->GetPosition(tPos);
       
  1126 		
       
  1127 	theModuleId = 		TUid::Uid(271064388); // 271064388;
       
  1128 	theTechType = 		tPosInfo->PositionMode();
       
  1129 	theModeReason = 	tPosInfo->PositionModeReason();
       
  1130 	theVerAccuracy = 	tPos.VerticalAccuracy();
       
  1131 	theHorAccuracy = 	tPos.HorizontalAccuracy();
       
  1132 	theLat = 			tPos.Latitude();
       
  1133 	theLong = 			tPos.Longitude();
       
  1134 	theAltitude = 		tPos.Altitude();
       
  1135 
       
  1136 
       
  1137 	//	Setup position information using intialised variables
       
  1138 	TPositionInfo* posInfo = new TPositionInfo();
       
  1139 	posInfo->SetModuleId(theModuleId);
       
  1140 	posInfo->SetUpdateType(EPositionUpdateGeneral);
       
  1141 	posInfo->SetPositionMode((TPositionModuleInfo::TTechnologyType)theTechType);
       
  1142 	posInfo->SetPositionModeReason((TPositionModeReason)theModeReason);
       
  1143 	TPosition position;
       
  1144 	position.SetCurrentTime();
       
  1145 	position.SetAccuracy(theHorAccuracy,theVerAccuracy);
       
  1146 	position.SetCoordinate(theLat,theLong, theAltitude);
       
  1147 	static_cast<TPositionInfo*>(posInfo)->SetPosition(position);
       
  1148 	
       
  1149 	return posInfo;
       
  1150 }
       
  1151 
       
  1152 /** Compares the timestamps of two log events
       
  1153  	returns 1 if the lhs is newer, -1 if the lhs is older or 0 if both are the same */
       
  1154 TInt CT_LbsStep_VerifyLogInfo::SelfLocateLogEventTimestampCompare(const CLbsSelfLocateLogEvent& aLog1,
       
  1155 														 const CLbsSelfLocateLogEvent& aLog2)
       
  1156 	{
       
  1157 	TPositionInfo* tPosInfo1 = static_cast<TPositionInfo*>(aLog1.PositionInfo());
       
  1158 	TPositionInfo* tPosInfo2 = static_cast<TPositionInfo*>(aLog2.PositionInfo());
       
  1159 	TPosition tPos1;
       
  1160 	TPosition tPos2;
       
  1161 	tPosInfo1->GetPosition(tPos1);
       
  1162 	tPosInfo2->GetPosition(tPos2);
       
  1163 	TInt64 t1 = tPos1.Time().Int64();
       
  1164 	TInt64 t2 = tPos2.Time().Int64();
       
  1165 	if(t1 < t2)
       
  1166 		{
       
  1167 		// lhs is Newer
       
  1168 		return 1;
       
  1169 		}
       
  1170 	else if(t1 > t2)
       
  1171 		{
       
  1172 		// lhs is Older
       
  1173 		return -1;
       
  1174 		}
       
  1175 	// the same
       
  1176 	return 0;
       
  1177 	}