/**
GetLastPosition

@param aPos	container for the position being returned (with KErrNone return)	
@param aOldestValidTime	 the oldest valid time for a position being returned. If there is a valid position no older than this time, it should be returned.
@param aAllowPartial	whether partial updates should be considered
@return ETrue if the fix fulfills the requirements, 
*/
TBool CNETResponseHandler::GetLastPosition(TPositionInfoBase& aPos, TTime aOldestValidTime, TBool aAllowPartial)
	{
	TBool ret = EFalse;

	TTime actualTime;
	TPositionInfo posInfo;
 	TPosition pos;	 	
 	TInt err;
	
 	err = iNETDataBus->GetLastPositionInfo(posInfo, actualTime);
	if( err == KErrNone && actualTime >= aOldestValidTime)	// got a recent enough position
		{
		posInfo.GetPosition(pos);
		if(aAllowPartial || !Partial(pos))// complete enough
			{
			TRAPD(error, CopyPositionTypes(aPos, posInfo));
			if(!error)
				{
				ret = ETrue;
				}
			else
				{
				LBSLOG(ELogP1, "CNetResponseHandler::GetLastPosition() failed to copy position ");
				ret = EFalse;
				}			
			}
		}	
	return ret;
	}
Exemplo n.º 2
0
void CT_LbsPTBMTLRCancel::ProcessNetworkPositionUpdate(TUint /*aRequestId*/, const TPositionInfo& aPosInfo)
	{
	if(iState==EPrivacyCheckOk)
		{
		// check that it is the REF postion we are expecting!
		if (aPosInfo.PositionMode() == TPositionModuleInfo::ETechnologyNetwork)
			{
			TPosition getPos;
			aPosInfo.GetPosition(getPos);
			if (getPos.Longitude()==-0.096) // and others ...
				{
				iState=ERefLocReceived;
				}
			}
		INFO_PRINTF1(_L(">>CT_LbsPTBMTLRCancel::ProcessNetworkPositionUpdate(RefPosition)"));
		}
	ReturnToTestStep();
	}
void CT_LbsHybridUEAssistedMTLRTimeout::ProcessNetworkPositionUpdate(TUint /*aRequestId*/, const TPositionInfo& aPosInfo)
	{
	if(iState==EPrivacyCheckOk)
		{
		iState=ERefLocReceived;	
		INFO_PRINTF1(_L(">>CT_LbsHybridUEAssistedMTLRTimeout::ProcessNetworkPositionUpdate(RefPosition)"));
		}
	else if(iState==ERefLocReceived)
		{
		// Test for $update,1,2,51.5015,-0.105,50,2,3*
		TPosition getPos;
		aPosInfo.GetPosition(getPos);
		if(getPos.Latitude()==51.5015 && getPos.Longitude()==-0.105 && getPos.Altitude()==50 && getPos.HorizontalAccuracy()==2 && getPos.VerticalAccuracy()==3) 		
			{
			INFO_PRINTF1(_L(">>CT_LbsHybridUEAssistedMTLRTimeout::ProcessNetworkPositionUpdate(GpsPosition)"));
			iState=EGpsLocReceived;	
			}
		}
	ReturnToTestStep();
	}
EXPORT_C void MTe_LbsPsyStaticData::PrintPosInfo(const TPositionInfo& aPosInfo) const
	{	
	_LIT(KTimeFormat, "%H:%T:%S.%C");
	TBuf<100> cTimeStr;
	
	INFO_PRINTF2(_L("classSize=%d"), aPosInfo.PositionClassSize());
	INFO_PRINTF2(_L("classType=0x%x"), aPosInfo.PositionClassType());
	INFO_PRINTF2(_L("moduleId=0x%x"), aPosInfo.ModuleId());
	INFO_PRINTF2(_L("updateType=%d"), aPosInfo.UpdateType());
	INFO_PRINTF2(_L("positionMode=%d"), aPosInfo.PositionMode());
	INFO_PRINTF2(_L("positionModeReason=%d"), aPosInfo.PositionModeReason());
	
	TPosition pos;
	aPosInfo.GetPosition(pos);
	INFO_PRINTF2(_L("pos altitude=%f"), pos.Altitude());
	INFO_PRINTF2(_L("pos latitude=%f"), pos.Latitude());
	INFO_PRINTF2(_L("pos longitude=%f"), pos.Longitude());
	INFO_PRINTF2(_L("pos datum=0x%x"), pos.Datum());
	INFO_PRINTF2(_L("pos horAccuracy=%f"), pos.HorizontalAccuracy());
	INFO_PRINTF2(_L("pos verAccuracy=%f"), pos.VerticalAccuracy());
						
	TRAP_IGNORE(pos.Time().FormatL(cTimeStr, KTimeFormat);)
Exemplo n.º 5
0
/**
 *  Verifies that the supplied position is 'reasonable'
 *
 */
EXPORT_C TBool T_LbsUtils::Verify_PositionIsValid(TPositionInfo& aPosInfo)
	{
	TBool valid = TRUE;
	TPosition pos;
	TReal32 alt;
	TReal64 lat, longt;
	
	aPosInfo.GetPosition(pos);
	
	alt = pos.Altitude();
	lat = pos.Latitude();
	longt = pos.Longitude();
	
	// TO DO figure out what values are reasonable here (in Milton somewhere!?)
	// We could use the normal verify posinfo stuff, and check to see if the values are roughly equal.
	// Either update this func (add a parameter) or new func like the compare posinfo func we have
	if(alt == 0 || lat == 0 || longt == 0)
		{
		valid = FALSE;
		}
	
	
	return valid;
	}
/** Called at the end of the test to verify the correct position data has been returned to the
	client.
	
	Each test case SHOULD implement a version of this.
*/
void CT_LbsConflictStep_X3PMenuPush::VerifyPosInfos()
	{
	T_LbsUtils utils;
    RPointerArray<TAny>& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr;
	RPointerArray<TAny>& currPosInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
	TPositionInfo* currPosInfo;
	
	// Verify both the self locate and X3P MOLR position information.
	
	// Verify entry 0 for the self locate. We expect a position containing NaNs.
	currPosInfo = reinterpret_cast<TPositionInfo*>(currPosInfoArr[0]);
	TPosition pos;
	currPosInfo->GetPosition(pos);
	if (!Math::IsNaN(pos.Latitude()))
		{
		INFO_PRINTF1(_L("Failed test, Position does not contain NANs"));

		SetTestStepResult(EFail);
		}
	if (!Math::IsNaN(pos.Longitude()))
		{
		INFO_PRINTF1(_L("Failed test, Position does not contain NANs"));

		SetTestStepResult(EFail);
		}

	// Verify entry 1 for the X3P. We expect a real location value, compare using the data
	// sent to the test APGS module.
	TPositionInfo* verifyPosInfo = reinterpret_cast<TPositionInfo*>(verifyPosInfoArr[0]);
	currPosInfo = reinterpret_cast<TPositionInfo*>(currPosInfoArr[1]);
	if (!utils.Compare_PosInfo(*verifyPosInfo, *currPosInfo))
		{
		INFO_PRINTF1(_L("Failed test, X3P position incorrect."));
		SetTestStepResult(EFail);
		}
	}
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Our implementation only gets called if the base class doTestStepPreambleL() did
 * not leave. That being the case, the current test result value will be EPass.
 */
TVerdict CT_LbsClientStep_CellBasedNotifyPosUpdate::doTestStepL()
	{
	// Generic test step used to test the LBS Client Notify position update API.
	INFO_PRINTF1(_L("&gt;&gt;CT_LbsClientStep_CellBasedNotifyPosUpdate::doTestStepL()"));

	if (TestStepResult()==EPass)
		{
		iNetworkUnavailable = FALSE;
		iIsCancelTest = FALSE;
   		iCancel = FALSE;
		iCancelOnPosUpdate = FALSE;
		iCancelBeforePosUpdate = FALSE;
		iMultiReq = EFalse;
		iNumNPUDs = iParent.iSharedData->iVerifyPosInfoArr.Count(); // how many NPUDs to do
		
		// Expected callbacks flags
		iFlagsToHaltOn =	KLbsCallback_NetSim_Got_Connect | 	
							KLbsCallback_NetworkBasedLocation |
							KLbsCallback_Got_NotifyPositionUpdate;	// notifypositionupdate completed.
	
		
		TTimeIntervalMicroSeconds32 abortInterval;
		if(iParent.iSharedData->iTestModuleInUse)
			{
			abortInterval = KDefaultAbortTimerPeriod;
			}
		else
			{	
			abortInterval = KDefaultAbortTimerPeriod_real;
			}
		
		// Carryout unique test actions.
		TInt testCaseId;
		if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId))
			{
				switch (testCaseId)
				{												
				case 1:	// LBS-NotifyPosUpdateCellBased-0001 Request a cell-based location
					{
					// nothing to do 
					}
					break;
				
				case 2:	// LBS-NotifyPosUpdateCellBased-0002	Request a cell-based location and cancel before it completes
					{
					iCancel = ETrue;
					iFlagsToHaltOn =	KLbsCallback_NetSim_Got_Connect |
										KLbsCallback_Got_NotifyPositionUpdate;
					}
					break;
				
				case 3:	// LBS-NotifyPosUpdateCellBased-0003	Request a cell-based location, when network unavailable
					{
					iNetworkUnavailable = ETrue;

					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 	
									KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr | 
									KLbsCallback_Got_NotifyPositionUpdate;
					
					}
					break;
					
				case 4:	// LBS-NotifyPosUpdateCellBased-0004 multiple sequential npuds
					{
					iMultiReq = ETrue;
					}
					break;
					
				case 5:	// LBS-NotifyPosUpdateCellBased-0005	Request a cell-based location and attempt to cancel when the update is received
					{
					iCallbackFlags = 0;
					iCancelOnPosUpdate = ETrue;
					iFlagsToHaltOn =	KLbsCallback_NetSim_Got_Connect | 
										KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |
										KLbsCallback_Got_NotifyPositionUpdate;
					}
					break;
					
				case 6:	// LBS-NotifyPosUpdateCellBased-0006	Request a cell-based location and cancel before a position update is generated
					{
					iCancelBeforePosUpdate = ETrue;
					iFlagsToHaltOn =	KLbsCallback_NetSim_Got_Connect |
										KLbsCallback_Got_NotifyPositionUpdate;
					}
					
					break;			
	
				default:
					User::Panic(KLbsClientStepCellBasedNotifyPosUpdate, KErrUnknown);			
				}
			}
		else
			{
			User::Panic(KLbsClientStepCellBasedNotifyPosUpdate, KErrUnknown);
			}	
			
		iIsCancelTest = (iCancel || iCancelBeforePosUpdate || iCancelOnPosUpdate);	
		
		// Steps common to all tests:
		
		// Connect to net sim
		iNetSim.ConnectL(this);

	// Configure NetSim:	
		// Set reference location:
		RPointerArray<TAny>& srcPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr;
		TPositionInfo* srcPosInfo = reinterpret_cast<TPositionInfo*>(srcPosInfoArr[0]);
		TPosition srcPos;
		srcPosInfo->GetPosition(srcPos);
		if (!iNetSim.SetReferenceLocation(srcPos))
			{
			INFO_PRINTF1(_L("CT_LbsClientStep_CellBasedNotifyPosUpdate::doTestStepL() Failed: Can't set NetSim's reference location."));
			SetTestStepResult(EFail);
			}	
		
		// Set plugin to use for getting assistance data:
		TUid pluginUid;
		if(iParent.iSharedData->iTestModuleInUse)
			{
			pluginUid = TUid::Uid(KSimpleAssistanceDataProviderPluginUidValue);
			}
		else
			{
			pluginUid = TUid::Uid(KSuplAssistanceDataProviderPluginUidValue);
			}
		if (!iNetSim.SetAssistanceDataProvider(pluginUid))
			{
			INFO_PRINTF1(_L("Can't set NetSim's assistance data plugin uid."));
			SetTestStepResult(EFail);
			}
			
		// Kick off the keep alive timer - do last to ensure NetSim is ready otherwise the
		// timer callback may start a MO-LR if the NetSim connected too early.
		TTimeIntervalMicroSeconds32 interval(KLbsKeepAlivePeriod);

		iKeepAliveTimer->SetTimer(interval);

		// don't wait for TEF to timeout and abort
		iAbortTimer->SetTimer(abortInterval);

		// Kick off test.
		CActiveScheduler::Start();
			
		if(EDone != iState)
			{
			INFO_PRINTF2(_L("Failed test, finished in state %d"), iState);
			INFO_PRINTF3(_L("Callback flags currently set = 0x%x. Expecting 0x%x"), iCallbackFlags, iFlagsToHaltOn);
			SetTestStepResult(EFail);
			}
		else
			{
			INFO_PRINTF2(_L("Got all expected callbacks (0x%x)"), iCallbackFlags);			
			}
						
		iNetSim.Close();
			
		}
		
	INFO_PRINTF1(_L("&lt;&lt;CT_LbsClientStep_CellBasedNotifyPosUpdate::doTestStepL()"));

	return TestStepResult();
	}
//
// Performes the test by connecting to MLFW  
// (and makes a number of Location requests if aFullTest is true
//
void DoTestL(TBool aFullTest, TInt aNumberOfRuns, TInt *aResult)
    {
    RPositionServer	posServer;
	TInt errorCode = errorCode = posServer.Connect();

    if (errorCode != KErrNone)
        {
        *aResult = KErrCouldNotConnect;
        return;
        }
    CleanupClosePushL(posServer);

    RPositioner positioner;


    // Full test means requesting position updates
    if (aFullTest)
        {
        TPositionInfo positionInfo = TPositionInfo();
        const TInt32 KUidMultiPsy = 0x01010176;
        TUid uidMultiPsy;
        uidMultiPsy.iUid = KUidMultiPsy;
        errorCode = positioner.Open(posServer, uidMultiPsy);
        
        if (errorCode != KErrNone) 
        {
            *aResult = errorCode;
            return;
        }
        CleanupClosePushL(positioner);
        
        _LIT(KService ,"Service");
        errorCode = positioner.SetRequestor(CRequestor::ERequestorService,
            CRequestor::EFormatApplication, KService);
        
        if (errorCode != KErrNone)
        {
            *aResult = 1001;
            return;
        }
        
        TRequestStatus status;
        TLocality loca(TCoordinate(0,0,0),0);
        TPosition pos(loca, TTime(0));

        for (TInt i = 0; i < aNumberOfRuns; i++)
        {
            positionInfo.SetPosition(pos);
            positioner.NotifyPositionUpdate(positionInfo, status);
            User::WaitForRequest(status);
            TInt err = status.Int();
            if (err != KErrNone)
            {
                *aResult = err;
            }
            TPosition result;
            positionInfo.GetPosition(result);
            
            //sanity check
            if (result.Latitude() == pos.Latitude() ||
                result.Longitude() == pos.Longitude() ||
                result.Altitude() == pos.Altitude())
            {
                //_LIT(KErrorPositon, "ERROR:: The postion was not updated");
                errorCode = 1005;
            }   
        }
        positioner.Close();
        CleanupStack::PopAndDestroy(&positioner);
    }
    
    posServer.Close();
    CleanupStack::PopAndDestroy(&posServer);
    }
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Our implementation only gets called if the base class doTestStepPreambleL() did
 * not leave. That being the case, the current test result value will be EPass.
 */
TVerdict CT_LbsX3PStep_Cancel::doTestStepL()
	{
	// Generic test step used to test the LBS Client Notify position update API.
	INFO_PRINTF1(_L("&gt;&gt;CT_LbsX3PStep_Cancel::doTestStepL()"));

	if (TestStepResult() == EPass)
		{
		
		TInt err = KErrNone;
		RLbsTransmitPositionServer server;

		// Carry out common test actions (such as connecting to a server).

		User::LeaveIfError(server.Connect());
		CleanupClosePushL(server);

		INFO_PRINTF1(_L("server opened"));
	
		User::LeaveIfError(iTransmitPositioner.Open(server));
		CleanupClosePushL(iTransmitPositioner);

		// Create the active object to carry out the Transmit Position functionality.					
		iDoTransmitPosAO = CT_LbsX3PDoTransmitPos::NewL(this, iTransmitPositioner);
		
		//T_LbsUtils utils;
		//TModuleDataIn modDataIn; // Used to send test information to the test module.

	    iRefPosFlag = GetIntFromConfig(ConfigSection(), KLbsRefPos, iRefPosFlag);
	    

		// Carry out unique test actions.
		if (GetIntFromConfig(ConfigSection(), KTestCaseId, iTestCaseId))
			{
			switch (iTestCaseId)
				{
				// Test case LBS-X3P-Cancel-0001
				case 1:
					{
					//Try to cancel Transmition without X3P
					iTransmitPositioner.CancelTransmitPosition();  

					//Below code might not be needed...added as Netsim panics if I dont start scheduler
					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect;
					
					}
					break;
					
				// Test case LBS-X3P-Cancel-0002
				case 2:
					{
					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect| 
									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr |
									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
									 KLbsCallback_Got_NotifyDoTransmitPos;
					}
					break;
					
				// Test case LBS-X3P-Cancel-0003
				case 3:
					{
					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr |
									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
									 KLbsCallback_Got_NotifyDoTransmitPos;
					}
					break;
					
				// Test case LBS-X3P-Cancel-0004
				case 4:
					{
					//SetExtendedTimerInterval(30000000);
					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
									 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
									 KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |
									 KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult |
									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
									 KLbsCallback_Got_NotifyDoTransmitPos;
					}
					break;
					
				// Test case LBS-X3P-Cancel-0005
				case 5:
				case 6:
					{
					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
									 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
									 KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |
									 KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult |
									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
									 KLbsCallback_Got_NotifyDoTransmitPos;
					}
					break;
					
													
				// Test case LBS-X3P-Cancel-0007
				case 7:
					{
					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr |
									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0);

					//Not sure how we will get status in this case when the request is cancelled from Cancel() - TBD
					}
					break;

				
				// Test case LBS-X3P-Cancel-0009-0010
				case 8:
				case 9:
					{
					User::LeaveIfError(iTransmitPositioner2.Open(server));
					CleanupClosePushL(iTransmitPositioner2);

					// Create the active object to carry out the Transmit Position functionality.					
					iDoTransmitPosAO2 = CT_LbsX3PDoTransmitPos::NewL(this, iTransmitPositioner2);

					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
									 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
									 KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |								 
									 KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult |
									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
									 KLbsCallback_Got_NotifyDoTransmitPos;
					}
					break;


				case 10:
					{
					//Cancel at NotifyMeasurementReportRequestMoreAssitanceData

					//Configure gps-test-module to request for more assitance data.
					if(iParent.iSharedData->iTestModuleInUse)
						{
						T_LbsUtils utils;
						TModuleDataIn modDataIn; // Used to send test information to the test module.
						modDataIn.iRequestType = TModuleDataIn::EModuleRequestTestMode;
						modDataIn.iAssDataEventType = TModuleDataIn::EAssDataEventExpectSingle;
						modDataIn.iAssDataTestMode = TModuleDataIn::EModuleTestModeAssDataOn_SomeDataNotAvailable;
						
						utils.NotifyModuleOfConfigChangeL(modDataIn);
						}
						
					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
									 KLbsCallback_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData |
									 KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure |
									 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
									 KLbsCallback_Got_NotifyDoTransmitPos;
					}
					break;					
					
				case 11:
					{
					iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
									 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
									 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
									 KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |
									 KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult |
									 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
									 (iRefPosFlag? KLbsCallback_Got_NotifyDoTransmitReferencePos:0)|
									 KLbsCallback_Got_NotifyDoTransmitPos;
					}
					break;

				case 12:
					{
					
					//Note sure which callbacks would be needed - TBD
					if(iRefPosFlag)
						{
						iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
										 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
										 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
										 KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation |
										 KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult |
										 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
										 KLbsCallback_Got_NotifyDoTransmitPos;
						}
					else
						{
						INFO_PRINTF2(_L("This test case is invalid for this interface: Testcase ID-  %d"), iTestCaseId);
						ASSERT(FALSE);	
						}
					}
					break;

				case 13:
					{
					if(iRefPosFlag)
						{
						iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | 
										 KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr |
										 KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation |
										 KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure |
										 KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr|
										 KLbsCallback_Got_NotifyDoTransmitReferencePos|
										 KLbsCallback_Got_NotifyDoTransmitPos;
						}
					else
						{
						INFO_PRINTF2(_L("This test case is invalid for this interface: Testcase ID-  %d"), iTestCaseId);
						ASSERT(FALSE);	
						}
					}
					break;

				default:
					{
					INFO_PRINTF2(_L("Unrecognised test case id %d"), iTestCaseId);
					ASSERT(FALSE);	
					}					
				}
			}
		else
			{
			INFO_PRINTF1(_L("Error in reading config file"));
			ASSERT(FALSE);
			}

		RPointerArray<TAny>& srcPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr;
		TPositionInfo* srcPosInfo = reinterpret_cast<TPositionInfo*>(srcPosInfoArr[0]);
		TPosition srcPos;
		srcPosInfo->GetPosition(srcPos);

		// Conect to the NetSim.
		iNetSim.ConnectL(this); // Once we have connected, we will get NetSim callbacks.
		//iNetSim.SetStepMode(ETrue);

		// Set plugin to use.
		TUid pluginUid;
		if(iParent.iSharedData->iTestModuleInUse)
			{
			pluginUid = TUid::Uid(KSimpleAssistanceDataProviderPluginUidValue);
			}
		else
			{
			pluginUid = TUid::Uid(KSuplAssistanceDataProviderPluginUidValue);
			}
			
		if (!iNetSim.SetAssistanceDataProvider(pluginUid))
			{
			INFO_PRINTF1(_L("Failed test, can't set NetSim's assistance data plugin uid."));
			SetTestStepResult(EFail);
			iNetSim.Close();
			return TestStepResult();
			}

		if (!iNetSim.SetReferenceLocation(srcPos))
			{
				INFO_PRINTF1(_L("Failed test, can't set NetSim's reference location."));
				SetTestStepResult(EFail);
				iNetSim.Close();
				return TestStepResult();
			}	

		// Set the MaxFix time required by the network.
		TTimeIntervalMicroSeconds maxFixTime(150*1000000);
		TLbsNetPosRequestQuality netPosQuality;

		netPosQuality.SetMaxFixTime(maxFixTime);
		netPosQuality.SetMinHorizontalAccuracy(srcPos.HorizontalAccuracy());
		netPosQuality.SetMinVerticalAccuracy(srcPos.VerticalAccuracy());
		if (!iNetSim.SetQuality(netPosQuality))
			{
			INFO_PRINTF1(_L("Failed test, can't set NetSim's quality."));
			SetTestStepResult(EFail);
			iNetSim.Close();
			return TestStepResult();
			}
		
		//Timeout for Transmit Location
		TLbsTransmitPositionOptions transmitOptions;
		transmitOptions.SetTimeOut(120*1000000);
		iTransmitPositioner.SetTransmitOptions(transmitOptions);

		// Kick off the keep alive timer.
		TTimeIntervalMicroSeconds32 interval(KLbsKeepAlivePeriod);
		iKeepAliveTimer->SetTimer(interval);

		if(iTestCaseId == 3)
			{
			const TInt32 time=1000;
			iNetSim.SetResponseTime(time, ETrue);  //TBD
			}
		
		CActiveScheduler::Start();
		
		err = iStatus.Int();
		switch(iTestCaseId)
			{
			case 1:
			case 7:
				break;
				
			case 2:
			case 3:
			case 10:
			case 13:
				{
				if(KErrCancel != err)
					{
					INFO_PRINTF2(_L("<FONT><B>CancelTransmitPosition() should have returned KErrCancel, got %d</B></FONT>"), err);
					SetTestStepResult(EFail);	
					}
				}
				break;
			
			case 4:
				{
				if(KErrCancel == err && !(iCallbackFlags & KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure))
					{
					INFO_PRINTF2(_L("<FONT><B>Should have been completed with KErrCancel,  got %d</B></FONT>"), err);
					SetTestStepResult(EFail);	
					}
				}
				//not using break as want to go ahead with below check.
				
			case 5:
			case 6:				
			case 11:
			case 12: //TBD
     			// In testcases that cancel "late" in the X3P proceudure, cancellation may arrive to NRH before
				// or after the session has finished. Therefore the error code will sometimes be
				// KErrCancel (session cancelled) and other times KErrNone (nothing to cancel due to session complete).
				//
				{
				if(!(KErrCancel == err || KErrNone == err))
					{
					INFO_PRINTF2(_L("<FONT><B>CancelTransmitPosition() should have returned KErrCancel or KErrNone, got %d</B></FONT>"), err);
					SetTestStepResult(EFail);	
					}
				}
			break;
			
			case 8:
			case 9:
				{
				if(KErrNone != err)
					{
					INFO_PRINTF2(_L("<FONT><B>CancelTransmitPosition() should have returned KErrNone, got %d</B></FONT>"), err);
					SetTestStepResult(EFail);	
					}
				}
				break;
			
			default:
				{
				INFO_PRINTF2(_L("Unrecognised test case id %d"), iTestCaseId);
				ASSERT(FALSE);	
				}	
			}

		// Clean up.
		// Clear A-GPS timeout.
		//if(iParent.iSharedData->iTestModuleInUse)
		//	{
		//	modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut;
		//	modDataIn.iTimeOut = 0;
		//	utils.NotifyModuleOfConfigChangeL(modDataIn);
		//	}

		iNetSim.ClearAssistanceDataFilters();
		iNetSim.Close();  

		if(iTestCaseId == 8 || iTestCaseId == 9)
			{
			CleanupStack::PopAndDestroy(&iTransmitPositioner2);					
			}
		//CleanupStack::PopAndDestroy(iKeepAliveTimer);
		CleanupStack::PopAndDestroy(&iTransmitPositioner);					
		CleanupStack::PopAndDestroy(&server);	
		
		
		if(iTestCaseId==13) //Wait while all activities in the PM stop and not interfere with the remaining tests 
			{
			User::After(5000000);
			}
		}

	INFO_PRINTF1(_L("&lt;&lt;CT_LbsX3PStep_Cancel::doTestStepL()"));

	return TestStepResult();
	}
Exemplo n.º 10
0
/**
* Performes the test by connecting to MLFW and makes 50 Location request
*/
TInt DoTestL()
{
    TBuf<40> traceFile = GenerateFileNameForTraceL();

    RFs fileserver;
    RFile file;
    User::LeaveIfError(fileserver.Connect());
    CleanupClosePushL(fileserver);
    User::LeaveIfError(file.Open(fileserver, traceFile, EFileWrite));
    CleanupClosePushL(file);
    _LIT(KClientStarted, "Client Started");
    TraceL(KClientStarted, file);

    const TInt32 KUidMultiPsy = 0x01010176;
    TUid uidMultiPsy;
    uidMultiPsy.iUid = KUidMultiPsy;
    SetupPsyL(uidMultiPsy);

    _LIT(KMultiPsySetup, "MultiPsy set up");
    TraceL(KMultiPsySetup, file);

    TInt numberOfRuns = 50;

    RPositionServer	posServer;
    CleanupClosePushL(posServer);
    RPositioner positioner;
    CleanupClosePushL(positioner);
    TPositionInfo positionInfo = TPositionInfo();

    _LIT(KConnectErr, "ERROR: Error when connecing to EPos server,  %d");
    TInt err = posServer.Connect();
    AssertTrueL(err == KErrNone, KConnectErr, err, file);

    _LIT(KOpenErr, "ERROR: Error when opening positioner,  %d");
    err = positioner.Open(posServer, uidMultiPsy);
    AssertTrueL(err == KErrNone, KOpenErr, err, file);

    _LIT(KService ,"Service");
    err = positioner.SetRequestor(CRequestor::ERequestorService,
                                  CRequestor::EFormatApplication, KService);
    _LIT(KRequestor, "ERROR: Not possible to set requestor");
    AssertTrueL(err == KErrNone, KRequestor, err, file);

    TTime now, startTime;
    TTimeIntervalMicroSeconds requestTime;
    TRequestStatus status;
    TInt64 reqTime;
    TCoordinate corr(0,0,0);
    TLocality loca(corr,0);
    TPosition pos(loca, TTime(0));
    TBool success = ETrue;
    _LIT(KStartingRequests, "Starting requests");
    TraceL(KStartingRequests, file);

    for (TInt i = 0; i < numberOfRuns; i++)
    {
        startTime.UniversalTime();
        positionInfo.SetPosition(pos);
        positioner.NotifyPositionUpdate(positionInfo, status);
        User::WaitForRequest(status);
        err = status.Int();
        if (err != KErrNone)
        {
            success=EFalse;
        }
        now.UniversalTime();
        requestTime = now.MicroSecondsFrom(startTime);
        _LIT(KError, "Request time, %d µs. Error code from Notify = %d");
        TBuf<100> buf;
        reqTime = requestTime.Int64();
        buf.Format(KError, reqTime, err);
        TraceL(buf, file);
        TPosition result;
        positionInfo.GetPosition(result);
        // Sanity check
        if (result.Latitude() == pos.Latitude() ||
                result.Longitude() == pos.Longitude() ||
                result.Altitude() == pos.Altitude())
        {
            success = EFalse;
            _LIT(KErrorPositon, "ERROR:: The postion was not updated");
            TraceL(KErrorPositon, file);
        }
    }

    CleanupStack::PopAndDestroy(&positioner);
    CleanupStack::PopAndDestroy(&posServer);

    if (success)
    {
        _LIT(KOk, "SUCCESS");
        TraceL(KOk, file);
    }
    else
    {
        _LIT(KErr, "FAILED");
        TraceL(KErr, file);
    }

    CleanupStack::PopAndDestroy(&file);
    CleanupStack::PopAndDestroy(&fileserver);

    return (success) ? 0 : 1;
}
Exemplo n.º 11
0
void PsyUtils::TPositionInfo2QGeoPositionInfo(TPositionInfoBase &aPosInfoBase, QGeoPositionInfo& aQPosInfo)
{
    if (aPosInfoBase.PositionClassType() & EPositionInfoClass  ||
            aPosInfoBase.PositionClassType() & EPositionSatelliteInfoClass) {
        TPositionInfo *posInfo = static_cast<TPositionInfo*>(&aPosInfoBase);
        TPosition pos;
        QGeoCoordinate  coord;

        posInfo->GetPosition(pos);
        coord.setLatitude(pos.Latitude());
        coord.setLongitude(pos.Longitude());
        coord.setAltitude(pos.Altitude());

        //store the QGeoCoordinate values
        aQPosInfo.setCoordinate(coord);

        TDateTime datetime = pos.Time().DateTime();
        QDateTime dt(QDate(datetime.Year() , datetime.Month() + 1, datetime.Day() + 1),
                     QTime(datetime.Hour() , datetime.Minute(), datetime.Second(),
                           datetime.MicroSecond() / 1000),
                     Qt::UTC);

        //store the time stamp
        aQPosInfo.setTimestamp(dt);

        //store the horizontal accuracy
        aQPosInfo.setAttribute(QGeoPositionInfo::HorizontalAccuracy, pos.HorizontalAccuracy());

        //store the vertical accuracy
        aQPosInfo.setAttribute(QGeoPositionInfo::VerticalAccuracy, pos.VerticalAccuracy());

        if (aPosInfoBase.PositionClassType() & EPositionSatelliteInfoClass) {
            TCourse course;
            TPositionSatelliteInfo *satInfo = static_cast<TPositionSatelliteInfo*>(&aPosInfoBase);
            satInfo->GetCourse(course);
            aQPosInfo.setAttribute(QGeoPositionInfo::Direction, course.Heading());
            aQPosInfo.setAttribute(QGeoPositionInfo::GroundSpeed, course.Speed());
            aQPosInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, course.VerticalSpeed());
        }
    }

    if (aPosInfoBase.PositionClassType() & EPositionGenericInfoClass) {
        HPositionGenericInfo *genInfo = static_cast<HPositionGenericInfo*>(&aPosInfoBase);
        float val;
        //check for the horizontal speed
        if (genInfo->IsFieldAvailable(EPositionFieldHorizontalSpeed)) {
            genInfo->GetValue(EPositionFieldHorizontalSpeed, val);
            aQPosInfo.setAttribute(QGeoPositionInfo::GroundSpeed, val);
        }
        //check for the vertcal speed
        if (genInfo->IsFieldAvailable(EPositionFieldVerticalSpeed)) {
            genInfo->GetValue(EPositionFieldVerticalSpeed, val);
            aQPosInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, val);
        }

        //check for the magnetic variation
        if (genInfo->IsFieldAvailable(EPositionFieldMagneticCourseError)) {
            genInfo->GetValue(EPositionFieldMagneticCourseError, val);
            aQPosInfo.setAttribute(QGeoPositionInfo::MagneticVariation, val);
        }

        //check for the heading
        if (genInfo->IsFieldAvailable(EPositionFieldHeading)) {
            genInfo->GetValue(EPositionFieldHeading, val);
            aQPosInfo.setAttribute(QGeoPositionInfo::Direction, val);
        }
    }
}
Exemplo n.º 12
0
void CT_LbsClientPosTp2::CheckPositionInfoL(TPositionInfo& aInfo)
	{
	TPosition pos;
	aInfo.GetPosition(pos);
	CheckPositionL(pos);
	}