locationmgmt/agpslocationmgr/test/te_man/src/man4Step.cpp
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Example CTestStep derived implementation
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file man4Step.cpp
       
    20 */
       
    21 
       
    22 
       
    23 #include "man4Step.h"
       
    24 #include "Te_manSuiteDefs.h"
       
    25 #include "LbsInternalInterface.h"
       
    26 #include <lbs/lbsassistancealmanac.h>
       
    27 #include <lbs/lbsassistancereferencetime.h>
       
    28 #include <lbs/lbsassistanceaquisitionassistance.h>
       
    29 #include <lbs/lbsextendedsatellite.h>
       
    30 #include "cprocesslaunch.h"
       
    31 
       
    32 #include "lbsnetinternalapi.h"
       
    33 //#include "lbsassistancedatacacheapi.h"
       
    34 #include "LbsInternalInterface.h"
       
    35 
       
    36 //-----------------------------------------------------------------------------------------
       
    37 const TTimeIntervalMicroSeconds32 KNoModuleMsgTimeout = 5000000;//5s
       
    38 const TTimeIntervalMicroSeconds32 KNoLocUpdTimeout    = 5000000;//5s
       
    39 const TTimeIntervalMicroSeconds32 KFutureReqDelay     = 10000000;//10s
       
    40 
       
    41 #if defined(__GCCXML__) || defined(__GCC__)
       
    42 const TInt64 KLbsTestMaxFixTime	= 0x7FFFFFFFFFFFFFFFLL;	// GCC-XML expects LL appended to this long type
       
    43 #else
       
    44 const TInt64 KLbsTestMaxFixTime	= 0x7FFFFFFFFFFFFFFF;	// Setting Max Fix time for test 
       
    45 #endif
       
    46 
       
    47 const TLbsNetSessionCompleteAgpsMsg KSessionCompleteKErrBusy(KDummySessionId, KErrServerBusy);
       
    48 const TLbsNetSessionCompleteAgpsMsg KSessionCompleteKErrHighPrior(KDummySessionId, KErrPositionHighPriorityReceive);
       
    49 const TLbsNetSessionCompleteAgpsMsg KSessionCompleteKErrGeneral(KDummySessionId, KErrGeneral);
       
    50 const TLbsNetSessionCompleteAgpsMsg KSessionCompleteKErrTimedOut(KDummySessionId, KErrTimedOut);
       
    51 const TLbsNetAssistanceDataResponseMsg KAssistanceDataResponseErrNotFound(0, KErrNotFound);
       
    52 
       
    53 TRequestStatus status;
       
    54 TRequestStatus moduleMsgStatus;
       
    55 TLbsPositionUpdateRequest LowAccurRequest;
       
    56 TLbsPositionUpdateRequest HighAccurRequest;
       
    57 TLbsPositionUpdateRequest absurdMaxFixTimeRequest;
       
    58 TLbsPositionUpdateRequest TrackingNewClientRequest;
       
    59 TLbsPositionUpdateRequestStatus StatusTrackingOffRequest;
       
    60 TLbsPositionUpdateRequestStatus StatusTrackingOnRequest;
       
    61 TLbsPositionUpdateRequestCancel CancelTrackingOffRequest;
       
    62 TLbsPositionUpdateRequestCancel CancelTrackingOnRequest;
       
    63 
       
    64 //-----------------------------------------------------------------------------------------
       
    65 Cman4Step::~Cman4Step()
       
    66 	{
       
    67 	//TInt test = 6;
       
    68 	}
       
    69 
       
    70 Cman4Step::Cman4Step()
       
    71 	{
       
    72 	SetTestStepName(Kman4Step);
       
    73 	}
       
    74 
       
    75 TVerdict Cman4Step::doTestStepPreambleL()
       
    76 /**
       
    77  * @return - TVerdict code
       
    78  * Override of base class virtual
       
    79  */
       
    80 	{
       
    81 	SetupNGInterface();
       
    82 	
       
    83 	// Open interfaces
       
    84 	INFO_PRINTF1(_L("Openning Interfaces"));
       
    85 	//iADCache.OpenL();
       
    86 	//CleanupClosePushL(iADCache);
       
    87 	
       
    88 	iMSInt.OpenL(KLbsGpsLocManagerUid);
       
    89 	CleanupClosePushL(iMSInt);
       
    90 
       
    91 	iLSInt.OpenL(KChannelArray[0]);
       
    92 	CleanupClosePushL(iLSInt);
       
    93 	
       
    94 	iNRHInt.OpenL(KChannelArray[2]);
       
    95 	CleanupClosePushL(iNRHInt);
       
    96 	
       
    97 	iLocUpdInt.OpenL(KLbsGpsLocManagerUid);
       
    98 	CleanupClosePushL(iLocUpdInt);
       
    99 	
       
   100 	iModuleInt.OpenL();
       
   101 	CleanupClosePushL(iModuleInt);
       
   102 	
       
   103 	// Subscribe to the property where the test GPS module reads the desired error code for
       
   104 	// the location update
       
   105 	const TInt KTestLocSourceVal= 0x1028226E;// Secure ID of the test AGPS Manager
       
   106 	const TUid KTestLocSourceUid= {KTestLocSourceVal};
       
   107 	const TInt KUpdateCodePropertyKey = 0x11110100;
       
   108 	User::LeaveIfError(iUpdateCodeProperty.Attach(KTestLocSourceUid, 
       
   109                                              KUpdateCodePropertyKey));
       
   110 	const TInt KUpdateFixTimePropertyKey = 0x11110101;
       
   111 	User::LeaveIfError(iUpdateFixTimeProperty.Attach(KTestLocSourceUid, 
       
   112                                              KUpdateFixTimePropertyKey));
       
   113 
       
   114 		
       
   115 	CleanupStack::Pop(5);
       
   116 	INFO_PRINTF1(_L("Openning Interfaces OK"));
       
   117 
       
   118 	SetTestStepResult(EPass);
       
   119 	return TestStepResult();
       
   120 	}
       
   121 
       
   122 
       
   123 TVerdict Cman4Step::doTestStepL()
       
   124 /**
       
   125  * @return - TVerdict code
       
   126  * Override of base class pure virtual
       
   127  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
   128  * not leave. That being the case, the current test result value will be EPass.
       
   129  */
       
   130 	{
       
   131 	
       
   132 	// Add this 'TerminalBased' Request Method to the Low/HighAccurRequest
       
   133 	// to ensure that when the NRH issues either request it will get an
       
   134 	// update with conflict flag set to zero. 
       
   135 	TLbsNetPosRequestMethodInt methods;
       
   136 	TLbsNetPosMethodInt posMethods[1];
       
   137 	posMethods[0].SetPosMethod(KLbsRootUid, (TPositionModuleInfo::ETechnologyTerminal|TPositionModuleInfo::ETechnologyAssisted));
       
   138 	//posMethods[1].SetPosMethod(KLbsRootUid, (TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted));
       
   139 	methods.SetPosMethods(posMethods, 1);
       
   140 	
       
   141 	
       
   142 	LowAccurRequest.NewClient()  = EFalse;
       
   143 	LowAccurRequest.Tracking()   = EFalse;
       
   144 	LowAccurRequest.RequestQuality().SetMaxFixTime(5000000);
       
   145 	LowAccurRequest.RequestQuality().SetMinHorizontalAccuracy(100);
       
   146 	LowAccurRequest.RequestQuality().SetMinVerticalAccuracy(100);
       
   147 	LowAccurRequest.RequestMethod() = methods;
       
   148 	LowAccurRequest.TargetTime() = 0;
       
   149 
       
   150 	HighAccurRequest.NewClient()  = EFalse;
       
   151 	HighAccurRequest.Tracking()   = EFalse;
       
   152 	HighAccurRequest.RequestQuality().SetMaxFixTime(5000000);
       
   153 	HighAccurRequest.RequestQuality().SetMinHorizontalAccuracy(1);
       
   154 	HighAccurRequest.RequestQuality().SetMinVerticalAccuracy(1);
       
   155 	HighAccurRequest.TargetTime() = 0;
       
   156 	HighAccurRequest.RequestMethod() = methods;
       
   157 
       
   158 	
       
   159 	absurdMaxFixTimeRequest.NewClient()  = EFalse;
       
   160 	absurdMaxFixTimeRequest.Tracking()   = EFalse;
       
   161 	absurdMaxFixTimeRequest.RequestQuality().SetMaxFixTime(KLbsTestMaxFixTime);
       
   162 	absurdMaxFixTimeRequest.RequestQuality().SetMinHorizontalAccuracy(100);
       
   163 	absurdMaxFixTimeRequest.RequestQuality().SetMinVerticalAccuracy(100);
       
   164 	absurdMaxFixTimeRequest.TargetTime() = 0;
       
   165 	absurdMaxFixTimeRequest.RequestMethod() = methods;
       
   166 	
       
   167 	TrackingNewClientRequest = LowAccurRequest;
       
   168 	TrackingNewClientRequest.NewClient()  = ETrue;
       
   169 	TrackingNewClientRequest.Tracking()   = ETrue;
       
   170 	
       
   171 	StatusTrackingOffRequest.Tracking()   = EFalse;
       
   172 	StatusTrackingOnRequest.Tracking()   = ETrue;
       
   173 
       
   174 	CancelTrackingOffRequest.Tracking()   = EFalse;
       
   175 	CancelTrackingOnRequest.Tracking()   = ETrue;
       
   176 
       
   177 	//------------------------------------------------------------------------------------------------	
       
   178 	SetTestStepResult(EPass);
       
   179 	iUpdateCodeProperty.Set(KErrNone);
       
   180 	
       
   181 	//------------------------------------------------------------------------------------------------	
       
   182 
       
   183 	INFO_PRINTF1(_L("Test0 - manager sends tracking status on then off"));
       
   184 	// Location request from LS. Tracking and NewClient flags check
       
   185 	iLocUpdInt.NotifyPositionUpdate(status);
       
   186 	TrackingNewClientRequest.TargetTime().UniversalTime();
       
   187 
       
   188 
       
   189 	TTime start;
       
   190 	start.UniversalTime(); 	// actually, timeout starts when NPUD is completed - so this 
       
   191 							// is a little arlier than that
       
   192 							
       
   193 	iLSInt.SetPositionUpdateRequest(TrackingNewClientRequest);
       
   194 
       
   195 	// Wait for advice and Self Loc Request. Send error.
       
   196 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest, ETrue);
       
   197 	WaitAndValidateLocUpd(status);
       
   198 
       
   199 	SendNgMsg(KSessionCompleteKErrNone);
       
   200 
       
   201 	INFO_PRINTF1(_L("Test 0 - Wait for Tracking to be set to Off"));
       
   202 	// now wait for tracking off after and not before 
       
   203 	// the timeout period (hardwired in agps manager to 30s 
       
   204 
       
   205 
       
   206    	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, EFalse);
       
   207 	TTime end;
       
   208 	end.UniversalTime();
       
   209 
       
   210 	TTimeIntervalMicroSeconds diff = 0;
       
   211 	diff = end.Int64()-start.Int64();
       
   212 	
       
   213 	if ( (diff < 30*1000*1000) || (diff > 35*1000*1000)) // approx!
       
   214 		{
       
   215 		SetTestStepResult(EFail);
       
   216 		ERR_PRINTF1(_L(" <font color=FF0000><b>incorrect tracking timeout.</b></font>"));
       
   217 		}
       
   218 		
       
   219 	//------------------------------------------------------------------------------------------------	
       
   220 	INFO_PRINTF1(_L("Test 1 - Location request from LS"));
       
   221 	iModuleInt.Subscribe(moduleMsgStatus);
       
   222 	iLocUpdInt.NotifyPositionUpdate(status);
       
   223 	LowAccurRequest.TargetTime().UniversalTime();
       
   224 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   225 	
       
   226 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   227 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   228 	WaitAndValidateLocUpd(status);
       
   229 	SendNgMsg(KSessionCompleteKErrNone);
       
   230 
       
   231 	//------------------------------------------------------------------------------------------------	
       
   232 	INFO_PRINTF1(_L("Test 2 - Location request from NRH"));
       
   233 	iModuleInt.Subscribe(moduleMsgStatus);
       
   234 	iLocUpdInt.NotifyPositionUpdate(status);
       
   235 	LowAccurRequest.TargetTime().UniversalTime();
       
   236 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   237 	
       
   238 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   239 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   240 	WaitAndValidateLocUpd(status);
       
   241 			
       
   242 
       
   243 	//------------------------------------------------------------------------------------------------	
       
   244 	INFO_PRINTF1(_L("Test 2a - Location request from NRH followed by a Cancel"));
       
   245 	LowAccurRequest.TargetTime().UniversalTime();
       
   246 
       
   247 	iModuleInt.Subscribe(moduleMsgStatus);
       
   248 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   249 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   250 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   251 
       
   252 	iModuleInt.Subscribe(moduleMsgStatus);
       
   253 	iNRHInt.SetPositionUpdateRequest(CancelTrackingOffRequest);// Tracking flag not used by this interface
       
   254 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgCancelLocationRequest);
       
   255 	//------------------------------------------------------------------------------------------------	
       
   256 	INFO_PRINTF1(_L("Test 3 - Location requests from LS followed by NRH. Same time window."));
       
   257 	iModuleInt.Subscribe(moduleMsgStatus);
       
   258 	iLocUpdInt.NotifyPositionUpdate(status);
       
   259 	LowAccurRequest.TargetTime().UniversalTime();
       
   260 	
       
   261 	LowAccurRequest.RequestQuality().SetMaxFixTime(10000000);
       
   262 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   263 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   264 
       
   265 	User::After(300000);	//0.3s
       
   266 	LowAccurRequest.RequestQuality().SetMaxFixTime(5000000);
       
   267 	LowAccurRequest.TargetTime().UniversalTime();
       
   268 	
       
   269 	iModuleInt.Subscribe(moduleMsgStatus);
       
   270 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   271 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   272 
       
   273 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   274 	WaitAndValidateLocUpd(status);
       
   275 	// Validate the target time in the combined request.
       
   276 	// In this case, should take NRH request time
       
   277 	if (iRcvdTargetTime != LowAccurRequest.TargetTime())
       
   278 		{
       
   279 		SetTestStepResult(EFail);
       
   280 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect target time.</b></font>"));
       
   281 		}
       
   282 	// Check fix time in combined request
       
   283 	// In this case, should be around 9.7 secs
       
   284 	if ((iRcvdFixTime > 9700000) || (iRcvdFixTime < 9500000))
       
   285 		{
       
   286 		SetTestStepResult(EFail);
       
   287 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect fix time.</b></font>"));
       
   288 		}
       
   289 
       
   290 	SendNgMsg(KSessionCompleteKErrNone);
       
   291 	
       
   292 	//------------------------------------------------------------------------------------------------	
       
   293 	INFO_PRINTF1(_L("Test 3a - Location requests from NRH followed by LS. Same time window."));
       
   294 	iModuleInt.Subscribe(moduleMsgStatus);
       
   295 	iLocUpdInt.NotifyPositionUpdate(status);
       
   296 	LowAccurRequest.TargetTime().UniversalTime();
       
   297 	TTime expectedTT(LowAccurRequest.TargetTime());
       
   298 
       
   299 	LowAccurRequest.RequestQuality().SetMaxFixTime(10000000);
       
   300 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   301 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   302 
       
   303 	User::After(300000);	//0.3s
       
   304 	LowAccurRequest.RequestQuality().SetMaxFixTime(5000000);
       
   305 	LowAccurRequest.TargetTime().UniversalTime();
       
   306 	iModuleInt.Subscribe(moduleMsgStatus);
       
   307 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   308 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   309 
       
   310 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   311 	WaitAndValidateLocUpd(status);
       
   312 	if (iRcvdTargetTime != expectedTT)
       
   313 		{
       
   314 		SetTestStepResult(EFail);
       
   315 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect target time.</b></font>"));
       
   316 		}
       
   317 	// Check fix time in combined request
       
   318 	// In this case, should be around 9.7 secs
       
   319 	if ((iRcvdFixTime > 9700000) || (iRcvdFixTime < 9500000))
       
   320 		{
       
   321 		SetTestStepResult(EFail);
       
   322 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect fix time.</b></font>"));
       
   323 		}
       
   324 
       
   325 	SendNgMsg(KSessionCompleteKErrNone);
       
   326 	
       
   327 	//------------------------------------------------------------------------------------------------	
       
   328 	INFO_PRINTF1(_L("Test 3b - Immediate Location requests from LS followed by NRH. Same time window."));
       
   329 	iModuleInt.Subscribe(moduleMsgStatus);
       
   330 	iLocUpdInt.NotifyPositionUpdate(status);
       
   331 	LowAccurRequest.TargetTime() = 0;
       
   332 
       
   333 	LowAccurRequest.RequestQuality().SetMaxFixTime(10000000);
       
   334 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   335 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   336 
       
   337 	User::After(300000);	//0.3s
       
   338 	LowAccurRequest.RequestQuality().SetMaxFixTime(5000000);
       
   339 	iModuleInt.Subscribe(moduleMsgStatus);
       
   340 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   341 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   342 
       
   343 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   344 	WaitAndValidateLocUpd(status);
       
   345 	if (iRcvdTargetTime != 0)
       
   346 		{
       
   347 		SetTestStepResult(EFail);
       
   348 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect target time.</b></font>"));
       
   349 		}
       
   350 	// Check fix time in combined request
       
   351 	// In this case, should be around 9.7 secs
       
   352 	if ((iRcvdFixTime > 9700000) || (iRcvdFixTime < 9500000))
       
   353 		{
       
   354 		SetTestStepResult(EFail);
       
   355 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect fix time.</b></font>"));
       
   356 		}
       
   357 
       
   358 	SendNgMsg(KSessionCompleteKErrNone);
       
   359 	
       
   360 	//------------------------------------------------------------------------------------------------	
       
   361 	INFO_PRINTF1(_L("Test 3c - Location requests from LS followed by immediate NRH request. Same time window."));
       
   362 	iModuleInt.Subscribe(moduleMsgStatus);
       
   363 	iLocUpdInt.NotifyPositionUpdate(status);
       
   364 	LowAccurRequest.TargetTime().UniversalTime();
       
   365 	
       
   366 	LowAccurRequest.RequestQuality().SetMaxFixTime(10000000);
       
   367 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   368 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   369 
       
   370 	User::After(300000);	//0.3s
       
   371 	LowAccurRequest.RequestQuality().SetMaxFixTime(5000000);
       
   372 	LowAccurRequest.TargetTime() = 0;
       
   373 	iModuleInt.Subscribe(moduleMsgStatus);
       
   374 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   375 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   376 
       
   377 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   378 	WaitAndValidateLocUpd(status);
       
   379 	if (iRcvdTargetTime != 0)
       
   380 		{
       
   381 		SetTestStepResult(EFail);
       
   382 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect target time.</b></font>"));
       
   383 		}
       
   384 	// Check fix time in combined request
       
   385 	// In this case, should be around 9.7 secs
       
   386 	if ((iRcvdFixTime > 9700000) || (iRcvdFixTime < 9500000))
       
   387 		{
       
   388 		SetTestStepResult(EFail);
       
   389 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect fix time.</b></font>"));
       
   390 		}
       
   391 
       
   392 	SendNgMsg(KSessionCompleteKErrNone);
       
   393 	
       
   394 	//------------------------------------------------------------------------------------------------	
       
   395 	INFO_PRINTF1(_L("Test 3d - Location requests from NRH (immediate) followed by LS. Same time window."));
       
   396 	iModuleInt.Subscribe(moduleMsgStatus);
       
   397 	iLocUpdInt.NotifyPositionUpdate(status);
       
   398 
       
   399 	LowAccurRequest.TargetTime() = 0;
       
   400 	LowAccurRequest.RequestQuality().SetMaxFixTime(10000000);
       
   401 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   402 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   403 
       
   404 	User::After(300000);	//0.3s
       
   405 	LowAccurRequest.RequestQuality().SetMaxFixTime(5000000);
       
   406 	LowAccurRequest.TargetTime().UniversalTime();
       
   407 	iModuleInt.Subscribe(moduleMsgStatus);
       
   408 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   409 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   410 
       
   411 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   412 	WaitAndValidateLocUpd(status);
       
   413 	if (iRcvdTargetTime != 0)
       
   414 		{
       
   415 		SetTestStepResult(EFail);
       
   416 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect target time.</b></font>"));
       
   417 		}
       
   418 	// Check fix time in combined request
       
   419 	// In this case, should be around 9.7 secs
       
   420 	if ((iRcvdFixTime > 9700000) || (iRcvdFixTime < 9500000))
       
   421 		{
       
   422 		SetTestStepResult(EFail);
       
   423 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect fix time.</b></font>"));
       
   424 		}
       
   425 
       
   426 	SendNgMsg(KSessionCompleteKErrNone);
       
   427 	
       
   428 	//------------------------------------------------------------------------------------------------	
       
   429 	INFO_PRINTF1(_L("Test 3e - LS Req followed by timed out NRH req. Same time window."));
       
   430 	// Tests that fix time gets updated correctly
       
   431 	// This test uses a very short fix time for the NRH request.
       
   432 	// This is to allow it to time-out before the test gps module returns
       
   433 	// a location update (which is done after a 0.5 second timeout)
       
   434 	// Could have increased the timeout used by the test gps module
       
   435 	// but that would have meant the whole test takes way too long to run
       
   436 	iModuleInt.Subscribe(moduleMsgStatus);
       
   437 	iLocUpdInt.NotifyPositionUpdate(status);
       
   438 	LowAccurRequest.TargetTime().UniversalTime();
       
   439 	expectedTT = LowAccurRequest.TargetTime();
       
   440 	LowAccurRequest.RequestQuality().SetMaxFixTime(3000000);//3 secs
       
   441 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   442 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   443 
       
   444 	User::After(300000); // 0.3s
       
   445 	LowAccurRequest.TargetTime() = 0;//Immediate request
       
   446 	LowAccurRequest.RequestQuality().SetMaxFixTime(200000);//0.2s
       
   447 	iModuleInt.Subscribe(moduleMsgStatus);
       
   448 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   449 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   450 	// Allow time for combined request to be issued
       
   451 	User::After(100000);//0.1s
       
   452 	// Check fix time in combined request
       
   453 	// In this case, should be around 2.7 secs
       
   454 	iUpdateFixTimeProperty.Get(iRcvdFixTime);
       
   455 	if ((iRcvdFixTime > 2700000) || (iRcvdFixTime < 2500000))
       
   456 		{
       
   457 		SetTestStepResult(EFail);
       
   458 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect fix time.</b></font>"));
       
   459 		}
       
   460 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   461 	// Should now get an update based on the original LS request
       
   462 	// because the NRH request has timed out
       
   463 	WaitAndValidateLocUpd(status);
       
   464 	if (iRcvdTargetTime != expectedTT)
       
   465 		{
       
   466 		SetTestStepResult(EFail);
       
   467 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect target time.</b></font>"));
       
   468 		}
       
   469 	// Check fix time in combined request
       
   470 	// In this case, should be around 2.5 secs
       
   471 	if ((iRcvdFixTime > 2500000) || (iRcvdFixTime < 2300000))
       
   472 		{
       
   473 		SetTestStepResult(EFail);
       
   474 		ERR_PRINTF1(_L(" <font color=FF0000><b>Incorrect fix time.</b></font>"));
       
   475 		}
       
   476 
       
   477 	SendNgMsg(KSessionCompleteKErrNone);
       
   478 	
       
   479 	//------------------------------------------------------------------------------------------------	
       
   480 	INFO_PRINTF1(_L("Test 4 - Location requests from LS. Cancel to the NG due to a timeout"));
       
   481 	iModuleInt.Subscribe(moduleMsgStatus);
       
   482 	iLocUpdInt.NotifyPositionUpdate(status);
       
   483 	HighAccurRequest.TargetTime().UniversalTime();
       
   484 	iLSInt.SetPositionUpdateRequest(HighAccurRequest);
       
   485 
       
   486 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   487 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationCancel);// Cancel due to a timeout
       
   488 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   489 	
       
   490 	iModuleInt.Subscribe(moduleMsgStatus);
       
   491 	WaitNoModuleMsg(moduleMsgStatus);
       
   492 	WaitAndValidateLocUpd(status); // The low accuracy location update
       
   493 	
       
   494 	SendNgMsg(KSessionCompleteKErrTimedOut);
       
   495 	
       
   496 	//------------------------------------------------------------------------------------------------	
       
   497 	INFO_PRINTF1(_L("Test 5 - Location requests from NRH. No cancel due to a timeout"));
       
   498 	iModuleInt.Subscribe(moduleMsgStatus);
       
   499 	iLocUpdInt.NotifyPositionUpdate(status);
       
   500 	HighAccurRequest.TargetTime().UniversalTime();
       
   501 	iNRHInt.SetPositionUpdateRequest(HighAccurRequest);
       
   502 	
       
   503 	// We do not expect the Assistance Data Cancel
       
   504 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   505 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   506 
       
   507 	iModuleInt.Subscribe(moduleMsgStatus);
       
   508 	WaitNoModuleMsg(moduleMsgStatus);
       
   509 	WaitAndValidateLocUpd(status); // The low accuracy location update
       
   510 
       
   511 	//------------------------------------------------------------------------------------------------	
       
   512 	INFO_PRINTF1(_L("Test 6 - Location requests from LS followed by NRH. Different time windows."));
       
   513 	iLocUpdInt.NotifyPositionUpdate(status);
       
   514 	LowAccurRequest.TargetTime().UniversalTime();
       
   515 	LowAccurRequest.TargetTime() += static_cast<TTimeIntervalSeconds>(10);
       
   516 	LowAccurRequest.RequestQuality().SetMaxFixTime(5000000);
       
   517 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   518 	LowAccurRequest.TargetTime().UniversalTime();
       
   519 //	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   520 
       
   521 	// First time window - NRH request, but LS request is active as well
       
   522 	// so we expect ESelfLocationRequest rather than EAssistanceDataRequest
       
   523 	
       
   524 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   525 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   526 
       
   527 	// Combined request sent to GPS module that requests assistance data again
       
   528 	// (our test module follows that with a notify position update)
       
   529 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   530 	WaitAndValidateLocUpd(status);
       
   531 	
       
   532 	// The update has satisfied the NRH but not the LS whose target time is
       
   533 	// in the future. Therefore a new request is sent to the module with
       
   534 	// just LS requirements. We expect to continue the ongoing
       
   535 	// Self Location session and receive EAssistanceDataRequest
       
   536 	// rather than ESelfLocationRequest.
       
   537 	iLocUpdInt.NotifyPositionUpdate(status);
       
   538 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   539 	//Location Update for the LS Request
       
   540 	WaitAndValidateLocUpd(status);
       
   541 	
       
   542 
       
   543 	SendNgMsg(KSessionCompleteKErrNone);
       
   544 
       
   545 	//------------------------------------------------------------------------------------------------	
       
   546 	INFO_PRINTF1(_L("Test 7 - Location requests from NRH followed by LS. Different time windows."));
       
   547 	// Expected message flow as in test 6
       
   548 	iLocUpdInt.NotifyPositionUpdate(status);
       
   549 	LowAccurRequest.TargetTime().UniversalTime();
       
   550 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   551 	LowAccurRequest.TargetTime() += static_cast<TTimeIntervalSeconds>(10);
       
   552 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   553 	
       
   554 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   555 	WaitAndValidateLocUpd(status);
       
   556 	
       
   557 	iLocUpdInt.NotifyPositionUpdate(status);
       
   558 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   559 	WaitAndValidateLocUpd(status);
       
   560 	SendNgMsg(KSessionCompleteKErrNone);		
       
   561 
       
   562 	//------------------------------------------------------------------------------------------------	
       
   563 	INFO_PRINTF1(_L("Test 8 - Location requests from LS. Session Complete before Location Update."));
       
   564 	iLocUpdInt.NotifyPositionUpdate(status);
       
   565 	LowAccurRequest.TargetTime().UniversalTime();
       
   566 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   567 	
       
   568 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   569 	SendNgMsg(KSessionCompleteKErrNone);
       
   570 	WaitAndValidateLocUpd(status);	
       
   571 	
       
   572 	//------------------------------------------------------------------------------------------------	
       
   573 	INFO_PRINTF1(_L("Test 9 - Location requests from LS. Session Complete after Location Update."));
       
   574 	iLocUpdInt.NotifyPositionUpdate(status);
       
   575 	LowAccurRequest.TargetTime().UniversalTime();
       
   576 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   577 	
       
   578 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   579 	WaitAndValidateLocUpd(status);
       
   580 	SendNgMsg(KSessionCompleteKErrNone);
       
   581 
       
   582 	//------------------------------------------------------------------------------------------------	
       
   583 	INFO_PRINTF1(_L("Test 10 - Location requests from LS. Session Complete(KErrServerBusy)"));
       
   584 	iModuleInt.Subscribe(moduleMsgStatus);
       
   585 	iLocUpdInt.NotifyPositionUpdate(status);
       
   586 	LowAccurRequest.TargetTime().UniversalTime();
       
   587 	LowAccurRequest.TargetTime() += static_cast<TTimeIntervalSeconds>(2);
       
   588 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   589 
       
   590 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   591 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   592 	
       
   593 	iModuleInt.Subscribe(moduleMsgStatus);
       
   594 	SendNgMsg(KSessionCompleteKErrBusy);
       
   595 	
       
   596 	// The error goes to the LS and a Cancel to the AGPS Module
       
   597 	WaitAndValidateLocUpd(status, KErrServerBusy, ETrue);
       
   598 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgCancelLocationRequest);
       
   599 
       
   600 	//------------------------------------------------------------------------------------------------	
       
   601 	INFO_PRINTF1(_L("Test 11 - Location requests from LS. Session Complete(KErrPositionHighPriorityReceive)"));
       
   602 	iModuleInt.Subscribe(moduleMsgStatus);
       
   603 	iLocUpdInt.NotifyPositionUpdate(status);
       
   604 	LowAccurRequest.TargetTime().UniversalTime();
       
   605 	LowAccurRequest.TargetTime() += static_cast<TTimeIntervalSeconds>(5);
       
   606 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   607 
       
   608 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   609 	iModuleInt.Subscribe(moduleMsgStatus);
       
   610 
       
   611 	SendNgMsg(KSessionCompleteKErrHighPrior);
       
   612 	WaitAndValidateLocUpd(status, KErrPositionHighPriorityReceive, ETrue);
       
   613 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgCancelLocationRequest);
       
   614 
       
   615 
       
   616 	//------------------------------------------------------------------------------------------------	
       
   617 	INFO_PRINTF1(_L("Test 11a - Location requests from LS. Session Complete(KErrGeneral). Not a special error."));
       
   618 	iModuleInt.Subscribe(moduleMsgStatus);
       
   619 	iLocUpdInt.NotifyPositionUpdate(status);
       
   620 	LowAccurRequest.TargetTime().UniversalTime();
       
   621 	LowAccurRequest.TargetTime() += static_cast<TTimeIntervalSeconds>(5);
       
   622 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   623 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   624 	iModuleInt.Subscribe(moduleMsgStatus);
       
   625 	
       
   626 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   627 
       
   628 	SendNgMsg(KSessionCompleteKErrGeneral);
       
   629 	WaitAndValidateLocUpd(status);
       
   630 	WaitNoModuleMsg(moduleMsgStatus);// Make sure KErrGeneral does not calcel the location request
       
   631 
       
   632 	//------------------------------------------------------------------------------------------------	
       
   633 	INFO_PRINTF1(_L("Test 12 - Location requests from LS followed by NRH. Different time windows. Session Complete(KErrPositionHighPriorityReceive) before Self Location Request"));
       
   634 	iModuleInt.Subscribe(moduleMsgStatus);
       
   635 	iLocUpdInt.NotifyPositionUpdate(status);
       
   636 	// LS request
       
   637 	LowAccurRequest.TargetTime().UniversalTime();
       
   638 	LowAccurRequest.TargetTime() += static_cast<TTimeIntervalSeconds>(10);
       
   639 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   640 
       
   641 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   642 	iModuleInt.Subscribe(moduleMsgStatus);
       
   643 
       
   644 	// Wait for advice and send error.
       
   645 	SendNgMsg(KSessionCompleteKErrHighPrior);
       
   646 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgCancelLocationRequest);	
       
   647 	iModuleInt.Subscribe(moduleMsgStatus);
       
   648 		
       
   649 	// Expect the error to be published
       
   650 	WaitAndValidateLocUpd(status, KErrPositionHighPriorityReceive, ETrue);
       
   651 
       
   652 	// Send NRH request
       
   653 	LowAccurRequest.TargetTime().UniversalTime();
       
   654 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   655 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   656 
       
   657 	// Process the NRH request
       
   658 	iLocUpdInt.NotifyPositionUpdate(status);
       
   659 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   660 	WaitAndValidateLocUpd(status);
       
   661 
       
   662 	//------------------------------------------------------------------------------------------------	
       
   663 	INFO_PRINTF1(_L("Test 13 - Location requests from LS followed by NRH. Different time windows. Session Complete(KErrServerBusy) after Self Location Request"));
       
   664 	iModuleInt.Subscribe(moduleMsgStatus);
       
   665 	iLocUpdInt.NotifyPositionUpdate(status);
       
   666 	// LS request
       
   667 	LowAccurRequest.TargetTime().UniversalTime();
       
   668 	LowAccurRequest.TargetTime() += static_cast<TTimeIntervalSeconds>(10);
       
   669 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   670 
       
   671 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   672 	iModuleInt.Subscribe(moduleMsgStatus);
       
   673 
       
   674 	// Wait for advice and Self Loc Request. Send error.
       
   675 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   676 
       
   677 	SendNgMsg(KSessionCompleteKErrBusy);
       
   678 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgCancelLocationRequest);	
       
   679 	iModuleInt.Subscribe(moduleMsgStatus);
       
   680 		
       
   681 	// Expect the error to be published
       
   682 	WaitAndValidateLocUpd(status, KErrServerBusy, ETrue);
       
   683 
       
   684 	// Send NRH request
       
   685 	LowAccurRequest.TargetTime().UniversalTime();
       
   686 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   687 	
       
   688 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   689 	
       
   690 	// Process the NRH request
       
   691 	iLocUpdInt.NotifyPositionUpdate(status);
       
   692 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   693 	WaitAndValidateLocUpd(status);
       
   694 
       
   695 
       
   696 	//------------------------------------------------------------------------------------------------	
       
   697 	INFO_PRINTF1(_L("Test 13a - Location requests from LS followed by NRH. Different time windows. Session Complete(KErrServerBusy) after Self Location Request. Race condition."));
       
   698 	// NRH request gets to AGPS Manager before session complete.
       
   699 	iModuleInt.Subscribe(moduleMsgStatus);
       
   700 	iLocUpdInt.NotifyPositionUpdate(status);
       
   701 	// LS request
       
   702 	LowAccurRequest.TargetTime().UniversalTime();
       
   703 	LowAccurRequest.TargetTime() += static_cast<TTimeIntervalSeconds>(10);
       
   704 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   705 	
       
   706 	// Wait for advice and Self Loc Request. Send error.
       
   707 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   708 	iModuleInt.Subscribe(moduleMsgStatus);
       
   709 
       
   710 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   711 	
       
   712 	// Send NRH request
       
   713 	LowAccurRequest.TargetTime().UniversalTime();
       
   714 	iNRHInt.SetPositionUpdateRequest(LowAccurRequest);
       
   715 	
       
   716 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   717 	iModuleInt.Subscribe(moduleMsgStatus);
       
   718 
       
   719 	SendNgMsg(KSessionCompleteKErrBusy);
       
   720 	
       
   721 	// The Server busy cancels SL req, but we still have the NRH req.
       
   722 	// Because of that we expect a new Loc Req instead of a Cancel
       
   723 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   724 	
       
   725 	// Expect the error to be published
       
   726 	WaitAndValidateLocUpd(status, KErrServerBusy, ETrue);
       
   727 	
       
   728 	// Process the NRH request
       
   729 	iLocUpdInt.NotifyPositionUpdate(status);
       
   730 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   731 	WaitAndValidateLocUpd(status);
       
   732 
       
   733 	//------------------------------------------------------------------------------------------------	
       
   734 	INFO_PRINTF1(_L("Test 14 - Location requests from LS. Tracking and NewClient flags check."));
       
   735 	iLocUpdInt.NotifyPositionUpdate(status);
       
   736 	TrackingNewClientRequest.TargetTime().UniversalTime();
       
   737 	iLSInt.SetPositionUpdateRequest(TrackingNewClientRequest);
       
   738 
       
   739 	// Wait for advice and Self Loc Request. Send error.
       
   740 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, ETrue);
       
   741 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest, ETrue);
       
   742 	WaitAndValidateLocUpd(status);
       
   743 	SendNgMsg(KSessionCompleteKErrNone);
       
   744 	
       
   745 	//------------------------------------------------------------------------------------------------	
       
   746 	INFO_PRINTF1(_L("Test 15 - Tracking On/Off using Status message."));
       
   747 	
       
   748 	iLSInt.SetPositionUpdateRequest(StatusTrackingOffRequest);
       
   749 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, EFalse);
       
   750 	
       
   751 	iLSInt.SetPositionUpdateRequest(StatusTrackingOnRequest);
       
   752 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, ETrue);
       
   753 
       
   754 	//------------------------------------------------------------------------------------------------	
       
   755 	INFO_PRINTF1(_L("Test 16 - Tracking On/Off using Cancel message."));
       
   756 	
       
   757 	iLSInt.SetPositionUpdateRequest(CancelTrackingOffRequest);
       
   758 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, EFalse);
       
   759 	
       
   760 	iLSInt.SetPositionUpdateRequest(CancelTrackingOnRequest);
       
   761 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, ETrue);
       
   762 
       
   763 	//------------------------------------------------------------------------------------------------	
       
   764 	INFO_PRINTF1(_L("Test 17 - Location requests from LS followed by Cancel before Self Location Request"));
       
   765 	iModuleInt.Subscribe(moduleMsgStatus);
       
   766 	LowAccurRequest.TargetTime().UniversalTime();
       
   767 	LowAccurRequest.TargetTime() += static_cast<TTimeIntervalSeconds>(10);
       
   768 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   769 
       
   770 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   771 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice);
       
   772 	
       
   773 	iModuleInt.Subscribe(moduleMsgStatus);
       
   774 	iLSInt.SetPositionUpdateRequest(CancelTrackingOffRequest);
       
   775 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgCancelLocationRequest);
       
   776 	
       
   777 	//------------------------------------------------------------------------------------------------	
       
   778 	INFO_PRINTF1(_L("Test 18 - Location requests from LS followed by Cancel after Self Location Request"));
       
   779 	iModuleInt.Subscribe(moduleMsgStatus);
       
   780 	LowAccurRequest.TargetTime().UniversalTime();
       
   781 	LowAccurRequest.TargetTime() += static_cast<TTimeIntervalSeconds>(10);
       
   782 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   783 
       
   784 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   785 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   786 
       
   787 	iModuleInt.Subscribe(moduleMsgStatus);
       
   788 	iLSInt.SetPositionUpdateRequest(CancelTrackingOffRequest);
       
   789 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationCancel);
       
   790 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgCancelLocationRequest);
       
   791 
       
   792 	//------------------------------------------------------------------------------------------------	
       
   793 	INFO_PRINTF1(_L("Test 19 - Status Trackin On msg. Tracking Off due to no Location Requests"));
       
   794 	iLSInt.SetPositionUpdateRequest(StatusTrackingOnRequest);
       
   795 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, ETrue);
       
   796 	
       
   797 	//Tracking off because we haven't sent any Loc Req
       
   798 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, EFalse);
       
   799 	
       
   800 	//------------------------------------------------------------------------------------------------	
       
   801 	INFO_PRINTF1(_L("Test 20 - LS Request with Tracking msg. Tracking Off due to no Location Requests"));
       
   802 	iLocUpdInt.NotifyPositionUpdate(status);
       
   803 	TrackingNewClientRequest.TargetTime().UniversalTime();
       
   804 	iLSInt.SetPositionUpdateRequest(TrackingNewClientRequest);
       
   805 
       
   806 	// Wait for advice and Self Loc Request. Send error.
       
   807 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, ETrue);
       
   808 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest, ETrue);
       
   809 	WaitAndValidateLocUpd(status);
       
   810 	
       
   811 	//Tracking off because we haven't sent a new Loc Req
       
   812 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, EFalse);
       
   813 	SendNgMsg(KSessionCompleteKErrNone);
       
   814 	
       
   815 	//------------------------------------------------------------------------------------------------	
       
   816 	INFO_PRINTF1(_L("Test 21 - Location requests from LS and NRH followed by AssistanceDataEvent(KErrNotFound)."));
       
   817 	INFO_PRINTF1(_L("          LocationUpdate(KErrNotFound) expected. AGPS should internally invalidate all outstanding requests."));
       
   818 	iModuleInt.Subscribe(moduleMsgStatus);
       
   819 	iLocUpdInt.NotifyPositionUpdate(status);
       
   820 	HighAccurRequest.TargetTime().UniversalTime();
       
   821 	iLSInt.SetPositionUpdateRequest(HighAccurRequest);
       
   822 	
       
   823 	INFO_PRINTF1(_L("          LS -> AGPS Manager. High Accuracy Request. Target Time: now."));
       
   824 	
       
   825 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   826 	iModuleInt.Subscribe(moduleMsgStatus);
       
   827 	
       
   828 	HighAccurRequest.TargetTime().UniversalTime();
       
   829 	iNRHInt.SetPositionUpdateRequest(HighAccurRequest);
       
   830 	
       
   831 	INFO_PRINTF1(_L("          NRH -> AGPS Manager. High Accuracy Request. Target Time: now."));
       
   832 	
       
   833 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   834 	iModuleInt.Subscribe(moduleMsgStatus);
       
   835 	
       
   836 	INFO_PRINTF1(_L("          AGPS Manager -> Network Gateway. Self Location Request."));
       
   837 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   838 	
       
   839 	// Set the error code that should be returned in the locationUpdate
       
   840 	iUpdateCodeProperty.Set(KErrNotFound);
       
   841 	
       
   842 	INFO_PRINTF1(_L("          Network Gateway -> AGPS Manager. Response: KAssistanceDataResponseErrNotFound"));
       
   843 	SendNgMsg(KAssistanceDataResponseErrNotFound);
       
   844 
       
   845 	INFO_PRINTF1(_L("          AGPS Manager -> Test GPS Integration Module. AssistanceDataEvent"));
       
   846 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgAssistanceDataEvent);
       
   847 	iModuleInt.Subscribe(moduleMsgStatus);
       
   848 	
       
   849 	INFO_PRINTF1(_L("Test GPS Integration Module -> AGPS Manager. Location Update with KErrNotFound"));
       
   850 	
       
   851 	WaitAndValidateLocUpd(status, KErrNotFound);
       
   852 		
       
   853 	// Test that the recent location update invalidated all requests in the AGPS Manager
       
   854 	// If it did, then the following call should cause explicit Cancel to be sent to the
       
   855 	// AGPS Module.
       
   856 	iLSInt.SetPositionUpdateRequest(CancelTrackingOffRequest);
       
   857 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgCancelLocationRequest);
       
   858 	iModuleInt.Subscribe(moduleMsgStatus);
       
   859 	
       
   860 	WaitNoModuleMsg(moduleMsgStatus);
       
   861 	iUpdateCodeProperty.Set(KErrNone);
       
   862 
       
   863 	
       
   864 	//------------------------------------------------------------------------------------------------	
       
   865 	INFO_PRINTF1(_L("Test 21a - Location requests from LS and NRH followed by AssistanceDataEvent(KErrNotFound)."));
       
   866 	INFO_PRINTF1(_L("           LocationUpdate(KErrNotFound) expected. AGPS should internally invalidate all outstanding requests."));
       
   867 	// It is like test 21, just we send a Cancel using the NRH channel
       
   868 	iModuleInt.Subscribe(moduleMsgStatus);
       
   869 	iLocUpdInt.NotifyPositionUpdate(status);
       
   870 	HighAccurRequest.TargetTime().UniversalTime();
       
   871 	iLSInt.SetPositionUpdateRequest(HighAccurRequest);
       
   872 	
       
   873 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   874 	iModuleInt.Subscribe(moduleMsgStatus);
       
   875 	
       
   876 	iNRHInt.SetPositionUpdateRequest(HighAccurRequest);
       
   877 	
       
   878 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   879 	iModuleInt.Subscribe(moduleMsgStatus);
       
   880 	
       
   881 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   882 	// Set the error code that should be returned in the locationUpdate
       
   883 	iUpdateCodeProperty.Set(KErrNotFound);
       
   884 	SendNgMsg(KAssistanceDataResponseErrNotFound);
       
   885 
       
   886 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgAssistanceDataEvent);
       
   887 	iModuleInt.Subscribe(moduleMsgStatus);
       
   888 	
       
   889 	WaitAndValidateLocUpd(status, KErrNotFound);
       
   890 		
       
   891 	// Test that the recent location update invalidated all requests in the AGPS Manager
       
   892 	// If it did, then the following call should cause explicit Cancel to be sent to the
       
   893 	// AGPS Mdoule.
       
   894 	iNRHInt.SetPositionUpdateRequest(CancelTrackingOffRequest);
       
   895 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgCancelLocationRequest);
       
   896 	iModuleInt.Subscribe(moduleMsgStatus);
       
   897 	
       
   898 	WaitNoModuleMsg(moduleMsgStatus);
       
   899 	SendNgMsg(KSessionCompleteKErrNone);
       
   900 	iUpdateCodeProperty.Set(KErrNone);
       
   901 	
       
   902 	//------------------------------------------------------------------------------------------------	
       
   903 	INFO_PRINTF1(_L("Test 22 - Two back-to-back location requests from LS (only one SessionComplete). SelfLoc and AsistData requests expected"));
       
   904 	iModuleInt.Subscribe(moduleMsgStatus);
       
   905 	iLocUpdInt.NotifyPositionUpdate(status);
       
   906 	LowAccurRequest.TargetTime().UniversalTime();
       
   907 	
       
   908 	// 1st req
       
   909 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   910 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   911 	iModuleInt.Subscribe(moduleMsgStatus);
       
   912 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   913 	
       
   914 	// 2nd req
       
   915 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   916 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   917 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   918 	
       
   919 	WaitAndValidateLocUpd(status);
       
   920 	SendNgMsg(KSessionCompleteKErrNone);
       
   921 
       
   922 
       
   923 	//------------------------------------------------------------------------------------------------	
       
   924 	INFO_PRINTF1(_L("Test 22a - Two location requests from LS (only one SessionComplete). SelfLoc and AsistData requests expected"));
       
   925 	iModuleInt.Subscribe(moduleMsgStatus);
       
   926 	iLocUpdInt.NotifyPositionUpdate(status);
       
   927 	
       
   928 	// 1st req
       
   929 	LowAccurRequest.TargetTime().UniversalTime();
       
   930 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   931 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   932 	iModuleInt.Subscribe(moduleMsgStatus);
       
   933 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
   934 	
       
   935 	WaitAndValidateLocUpd(status);
       
   936 	iLocUpdInt.NotifyPositionUpdate(status);
       
   937 	
       
   938 	// 2nd req
       
   939 	LowAccurRequest.TargetTime().UniversalTime();
       
   940 	iLSInt.SetPositionUpdateRequest(LowAccurRequest);
       
   941 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   942 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
       
   943 	
       
   944 	WaitAndValidateLocUpd(status);
       
   945 	SendNgMsg(KSessionCompleteKErrNone);
       
   946 
       
   947 
       
   948 	//------------------------------------------------------------------------------------------------	
       
   949 	INFO_PRINTF1(_L("Test 23 - Two back-to-back New Client location requests from LS (only one SessionComplete). Two SelfLocs expected"));
       
   950 	iModuleInt.Subscribe(moduleMsgStatus);
       
   951 	iLocUpdInt.NotifyPositionUpdate(status);
       
   952 	TrackingNewClientRequest.TargetTime().UniversalTime();
       
   953 	
       
   954 	// 1st req
       
   955 	iLSInt.SetPositionUpdateRequest(TrackingNewClientRequest);
       
   956 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, ETrue);
       
   957 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   958 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest, ETrue);
       
   959 	iModuleInt.Subscribe(moduleMsgStatus);
       
   960 	
       
   961 	// 2nd req
       
   962 	iLSInt.SetPositionUpdateRequest(TrackingNewClientRequest);
       
   963 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   964 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest, ETrue);
       
   965 	
       
   966 	WaitAndValidateLocUpd(status);
       
   967 	SendNgMsg(KSessionCompleteKErrNone);
       
   968 
       
   969 
       
   970 	//------------------------------------------------------------------------------------------------	
       
   971 	INFO_PRINTF1(_L("Test 23a - Two New Client location requests from LS (only one SessionComplete). Two SelfLocs expected"));
       
   972 	iModuleInt.Subscribe(moduleMsgStatus);
       
   973 	iLocUpdInt.NotifyPositionUpdate(status);
       
   974 
       
   975 	// 1st req
       
   976 	TrackingNewClientRequest.TargetTime().UniversalTime();
       
   977 	iLSInt.SetPositionUpdateRequest(TrackingNewClientRequest);
       
   978 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   979 	iModuleInt.Subscribe(moduleMsgStatus);
       
   980 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest, ETrue);
       
   981 	
       
   982 	WaitAndValidateLocUpd(status);
       
   983 	iLocUpdInt.NotifyPositionUpdate(status);
       
   984 	
       
   985 	// 2nd req
       
   986 	TrackingNewClientRequest.TargetTime().UniversalTime();
       
   987 	iLSInt.SetPositionUpdateRequest(TrackingNewClientRequest);
       
   988 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
   989 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest, ETrue);
       
   990 	
       
   991 	WaitAndValidateLocUpd(status);
       
   992 	SendNgMsg(KSessionCompleteKErrNone);
       
   993 
       
   994 	//------------------------------------------------------------------------------------------------
       
   995 	INFO_PRINTF1(_L("Test 24 - Location request from LS (absurd MaxFixTime)"));
       
   996 	iModuleInt.Subscribe(moduleMsgStatus);
       
   997 	iLocUpdInt.NotifyPositionUpdate(status);
       
   998 	absurdMaxFixTimeRequest.TargetTime().UniversalTime();
       
   999 	absurdMaxFixTimeRequest.TargetTime() = absurdMaxFixTimeRequest.TargetTime() + KFutureReqDelay;
       
  1000 	iLSInt.SetPositionUpdateRequest(absurdMaxFixTimeRequest);
       
  1001 	
       
  1002 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESystemStatusAdvice, EFalse);
       
  1003 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationRequest);
       
  1004 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgRequestLocationUpdate);
       
  1005 	iModuleInt.Subscribe(moduleMsgStatus);
       
  1006 	WaitAndValidateNoLocUpd(status);
       
  1007 	iLSInt.SetPositionUpdateRequest(CancelTrackingOffRequest);
       
  1008 	WaitAndValidateModuleMsg(moduleMsgStatus, RAgpsModuleTestChannel::ETestMsgCancelLocationRequest);
       
  1009 	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationCancel);
       
  1010 	SendNgMsg(KSessionCompleteKErrNone);
       
  1011 	//------------------------------------------------------------------------------------------------	
       
  1012 	iUpdateCodeProperty.Set(KErrNone);
       
  1013 	return TestStepResult();
       
  1014 	}
       
  1015 
       
  1016 
       
  1017 
       
  1018 TVerdict Cman4Step::doTestStepPostambleL()
       
  1019 /**
       
  1020  * @return - TVerdict code
       
  1021  * Override of base class virtual
       
  1022  */
       
  1023 	{
       
  1024 	CTe_manSuiteStepBase::doTestStepPostambleL();
       
  1025 	// Open interfaces
       
  1026 	INFO_PRINTF1(_L("Closing Interfaces"));
       
  1027 	//iADCache.Close();
       
  1028 	iMSInt.Close();;
       
  1029 	iLSInt.Close();
       
  1030 	iNRHInt.Close();
       
  1031 	iLocUpdInt.Close();
       
  1032 	iModuleInt.Close();
       
  1033 	iUpdateCodeProperty.Close();	
       
  1034 	iUpdateFixTimeProperty.Close();	
       
  1035 	INFO_PRINTF1(_L("Interfaces Closed OK"));
       
  1036 
       
  1037 	return TestStepResult();
       
  1038 	}
       
  1039 
       
  1040 //-----------------------------------------------------------------------------------------
       
  1041 void Cman4Step::WaitAndValidateLocUpd(TRequestStatus& aStatus, TInt aError, TBool aConflictControl)
       
  1042 	{
       
  1043 	User::WaitForRequest(aStatus);
       
  1044 	
       
  1045 	if (aStatus.Int() == KErrNone)	
       
  1046 		{
       
  1047 		INFO_PRINTF1(_L("   Location update received"));
       
  1048 		
       
  1049 		TPositionExtendedSatelliteInfo satInfo;
       
  1050 		TTime actualTime;
       
  1051 		TBool conflictControl;
       
  1052 		TInt err = iLocUpdInt.GetPositionInfo(conflictControl, &satInfo, sizeof(satInfo), iRcvdTargetTime, actualTime);
       
  1053 		INFO_PRINTF2(_L("      Exp error code: %d"), aError);
       
  1054 		INFO_PRINTF2(_L("      Rcv error code: %d"), err);
       
  1055 					
       
  1056 		if (aError != err)
       
  1057 			{
       
  1058 			SetTestStepResult(EFail);
       
  1059 			ERR_PRINTF1(_L("   <font color=FF0000><b>Actual location update error does not match the expected one.</b></font>"));
       
  1060 			}
       
  1061 			
       
  1062 		INFO_PRINTF2(_L("      Exp conflict control flag: %d"), aConflictControl);
       
  1063 		INFO_PRINTF2(_L("      Rcv conflict control flag: %d"), conflictControl);
       
  1064 					
       
  1065 		if (aConflictControl != conflictControl)
       
  1066 			{
       
  1067 			SetTestStepResult(EFail);
       
  1068 			ERR_PRINTF1(_L("   <font color=FF0000><b>Actual conflict control flag does not match the expected one.</b></font>"));
       
  1069 			}
       
  1070 
       
  1071 		iUpdateFixTimeProperty.Get(iRcvdFixTime);
       
  1072 		}
       
  1073 	else
       
  1074 		{
       
  1075 		SetTestStepResult(EFail);
       
  1076 		ERR_PRINTF2(_L("   <font color=FF0000><b>Location update status error: %d</b></font>"), aStatus.Int());
       
  1077 		}
       
  1078 	}
       
  1079 
       
  1080 
       
  1081 //-----------------------------------------------------------------------------------------
       
  1082 void Cman4Step::WaitAndValidateNoLocUpd(TRequestStatus& aStatus)
       
  1083 	{
       
  1084 	User::After(KNoLocUpdTimeout);
       
  1085 	
       
  1086 	if (aStatus.Int() != KRequestPending)	
       
  1087 		{
       
  1088 		ERR_PRINTF1(_L("   <font color=FF0000><b>Unexpected location update received</b></font>"));
       
  1089 		
       
  1090 		TPositionExtendedSatelliteInfo satInfo;
       
  1091 		TTime actualTime;
       
  1092 		TBool conflictControl;
       
  1093 		TInt err = iLocUpdInt.GetPositionInfo(conflictControl, &satInfo, sizeof(satInfo), iRcvdTargetTime, actualTime);
       
  1094 		INFO_PRINTF2(_L("      Rcv error code: %d"), err);
       
  1095 		INFO_PRINTF2(_L("      Rcv conflict control flag: %d"), conflictControl);
       
  1096 		SetTestStepResult(EFail);
       
  1097 		}
       
  1098 	else
       
  1099 		{
       
  1100 		INFO_PRINTF1(_L("   No location update received (as expected)"));
       
  1101 		iLocUpdInt.CancelNotifyPositionUpdate();
       
  1102 		User::WaitForRequest(aStatus);
       
  1103 		}
       
  1104 	}
       
  1105 
       
  1106 
       
  1107 //-----------------------------------------------------------------------------------------
       
  1108 void Cman4Step::WaitAndValidateModuleMsg(TRequestStatus& aStatus, const RAgpsModuleTestChannel::TTestMsgType& aMsg)
       
  1109 	{
       
  1110 	User::WaitForRequest(aStatus);
       
  1111 	
       
  1112 	if (aStatus.Int() == KErrNone)	
       
  1113 		{
       
  1114 		INFO_PRINTF1(_L("   Module message received"));
       
  1115 		
       
  1116 		RAgpsModuleTestChannel::TTestMsgType msg;
       
  1117 		TInt err = iModuleInt.GetMsg(msg);
       
  1118 		INFO_PRINTF2(_L("      Exp error code: %d"), KErrNone);
       
  1119 		INFO_PRINTF2(_L("      Rcv error code: %d"), err);
       
  1120 					
       
  1121 		if (KErrNone != err)
       
  1122 			{
       
  1123 			SetTestStepResult(EFail);
       
  1124 			ERR_PRINTF1(_L("   <font color=FF0000><b>Actual error code does not match the expected one.</b></font>"));
       
  1125 			}
       
  1126 			
       
  1127 		INFO_PRINTF2(_L("      Exp msg type: %d"), aMsg);
       
  1128 		INFO_PRINTF2(_L("      Rcv msg type: %d"), msg);
       
  1129 					
       
  1130 		if (msg != aMsg)
       
  1131 			{
       
  1132 			SetTestStepResult(EFail);
       
  1133 			ERR_PRINTF1(_L("   <font color=FF0000><b>Actual msg type does not match the expected one.</b></font>"));
       
  1134 			}
       
  1135 
       
  1136 		}
       
  1137 	else
       
  1138 		{
       
  1139 		SetTestStepResult(EFail);
       
  1140 		ERR_PRINTF2(_L("   <font color=FF0000><b>Status error: %d</b></font>"), aStatus.Int());
       
  1141 		}
       
  1142 	}
       
  1143 
       
  1144 
       
  1145 //-----------------------------------------------------------------------------------------
       
  1146 /** Make sure the module does not report any message */
       
  1147 void Cman4Step::WaitNoModuleMsg(TRequestStatus& aStatus)
       
  1148 	{
       
  1149 	User::After(KNoModuleMsgTimeout);
       
  1150 
       
  1151 	if (aStatus != KRequestPending)
       
  1152 		{
       
  1153 		ERR_PRINTF1(_L("   <font color=FF0000><b>Unexpected module message received</b></font>"));
       
  1154 		INFO_PRINTF2(_L("     Status error: %d"), aStatus.Int());
       
  1155 		
       
  1156 		RAgpsModuleTestChannel::TTestMsgType msg;
       
  1157 		TInt err = iModuleInt.GetMsg(msg);
       
  1158 		INFO_PRINTF2(_L("      Rcv error code: %d"), err);
       
  1159 		INFO_PRINTF2(_L("      Rcv msg type: %d"), msg);
       
  1160 		
       
  1161 		SetTestStepResult(EFail);		
       
  1162 		}
       
  1163 	else
       
  1164 		{
       
  1165 		INFO_PRINTF1(_L("   No Module msg received (as expected)"));
       
  1166 		iModuleInt.Cancel();
       
  1167 		User::WaitForRequest(aStatus);
       
  1168 		}
       
  1169 	}