예제 #1
0
EXPORT_C TBool T_LbsUtils::Compare_ModuleStatus(TPositionModuleStatus& aModStatusSideA, TPositionModuleStatus& aModStatusSideB)
	{
	// Compare device status.
	if (aModStatusSideA.DeviceStatus() != aModStatusSideB.DeviceStatus())
		{
		return EFalse;
		}	

	//	Compare quality status.
	if (aModStatusSideA.DataQualityStatus() != aModStatusSideB.DataQualityStatus())
		{
		return EFalse;
		}	
		
	return TRUE;
	}
예제 #2
0
TVerdict Cman12Step::doTestStepL()
/**
 * @return - TVerdict code
 * 
 * This test checks that when the NRH requests a hybrid location update, a measurement update
 * is received (in addition to a location update).
 * The test also checks that when the NRH request is cancelled, the Integration Module is reconfigured
 * with the GPS Mode given by the corresponding admin setting and the location request is cancelled. 
 */
	{
	
	if (TestStepResult()==EPass)
		{
		INFO_PRINTF1(_L("Simulate NRH sending a 'hybrid' location request"));
		INFO_PRINTF1(_L("NRH sends location update request for NOW and  MaxFixTime=5s acc=0.1"));
			
		const RLbsPositionUpdateRequests::TChannelIdentifer KChannelIdentifierNRH = 
			{
				{KLbsGpsLocManagerUidValue},{KLbsNetRequestHandlerUidValue}
			};
		const RLbsPositionUpdateRequests::TChannelIdentifer KChannelIdentifierLocServer = 
			{
				{KLbsGpsLocManagerUidValue},{KLbsLocServerUidValue}
			};
			
	    RLbsPositionUpdateRequests posUpdateReqLocSrv;
		posUpdateReqLocSrv.OpenL(KChannelIdentifierLocServer);
		CleanupClosePushL(posUpdateReqLocSrv);
		
		RLbsPositionUpdateRequests posUpdateReqNRH;
		posUpdateReqNRH.OpenL(KChannelIdentifierNRH);
		CleanupClosePushL(posUpdateReqNRH);
		
		RLbsPositionUpdates posUpdates;
		posUpdates.OpenL(KLbsGpsLocManagerUid);
		CleanupClosePushL(posUpdates);
		TRequestStatus locStat;
		posUpdates.NotifyPositionUpdate(locStat);
		
		RLbsGpsMeasurementUpdates measurementUpdates;
		measurementUpdates.OpenL();
		CleanupClosePushL(measurementUpdates);
		TRequestStatus measurementStat;
		measurementUpdates.NotifyGpsMeasurementUpdate(measurementStat);
		
		RLbsModuleStatus modStatus;
		modStatus.OpenL(KLbsGpsLocManagerUid);
		CleanupClosePushL(modStatus);
		
		// Start the testcase with a cancel request both from the LocServer
		// and the NRH to ensure the test AGPS Manager starts from scratch
		// (previous testcases may not have cleaned up correctly)
		TLbsPositionUpdateRequestCancel cancel;
		
		User::LeaveIfError(posUpdateReqLocSrv.SetPositionUpdateRequest(cancel));
		User::LeaveIfError(posUpdateReqNRH.SetPositionUpdateRequest(cancel));
	//	WaitAndValidateNgMsg(TLbsNetInternalMsgBase::ESelfLocationCancel);
		User::After(1000000); // Allow one second for the cancel to take effect
		
		// Simulate what is done by NRH when it wants a hybrid location update
		TLbsPositionUpdateRequest locRequestNRH;
		TLbsLocRequestQualityInt qualityNRH;
		qualityNRH.SetMaxFixTime(5000000);
		qualityNRH.SetMinHorizontalAccuracy(0.5);
		qualityNRH.SetMinVerticalAccuracy(0.5);
    	locRequestNRH.RequestQuality() = qualityNRH;    	
   	 	TTime targetTime;
		targetTime.UniversalTime(); // Target time is now and try for 5 seconds
		locRequestNRH.TargetTime() = targetTime;
		// Make the request a 'hybrid' one
		TLbsNetPosRequestMethodInt methods;
		TLbsNetPosMethodInt posMethods[2];
		posMethods[0].SetPosMethod(KLbsRootUid, (TPositionModuleInfo::ETechnologyTerminal|TPositionModuleInfo::ETechnologyAssisted));
		posMethods[1].SetPosMethod(KLbsRootUid, (TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted));
		methods.SetPosMethods(posMethods, 2);
		locRequestNRH.RequestMethod() = methods;
		
		INFO_PRINTF1(_L("NRH sends a location request to integration module"));
		User::LeaveIfError(posUpdateReqNRH.SetPositionUpdateRequest(locRequestNRH));

		// Check first that the GPS Manager publishes a position update as provided
		// by the test integration module (the test version of the integration module
		// is hardwired to send a test TPositionExtendedSatelliteInfo)
		// 
		User::WaitForRequest(locStat);
		
		if(locStat.Int()!=KErrNone)
			User::Leave(KErrGeneral);
		
		TInt error = 1; // something other than KErrNone
		TTime actualTime = 0;
		targetTime = 0;

		TPositionExtendedSatelliteInfo satInfo;
		TBool conflictControl;
		error = posUpdates.GetPositionInfo(conflictControl, &satInfo, sizeof(satInfo),targetTime, actualTime);

		if(error!=KErrNone)
			User::Leave(KErrGeneral);
			
		if(targetTime!=locRequestNRH.TargetTime())
			User::Leave(KErrGeneral);

		if(satInfo.SatelliteTime()!=locRequestNRH.TargetTime())
			User::Leave(KErrGeneral);

		INFO_PRINTF1(_L("Test integration module correctly responds with location"));

	
		// Check that the GPS Manager publishes a measurement update as provided
		// by the test integration module (the test version of the integration module
		// is hardwired to send a measurement update with 1 measured data)
		//
		User::WaitForRequest(measurementStat);
		
		if(measurementStat.Int()!=KErrNone)
			User::Leave(KErrGeneral);
		
		error = 1; // something other than KErrNone
		actualTime = 0;

		TPositionGpsMeasurementInfo measurementUpdate;
		error = measurementUpdates.GetGpsMeasurementInfo(&measurementUpdate, sizeof(measurementUpdate), actualTime);
		
		
		if (measurementUpdate.NumMeasurements() != 1)
			User::Leave(KErrGeneral);
		
		if(error!=KErrNone)
			User::Leave(KErrGeneral);
		
		INFO_PRINTF1(_L("Test integration module correctly responds with measurement"));


		// The last part of the test consists of cancelling the request and check the results
		// The test GPS Module will show those results by changes to the module status (this wouldn't
		// happen in production code, it is just for testing). Set the module status to some initial values
		// before cancelling.
		TPositionModuleStatus moduleStatus;
		moduleStatus.SetDeviceStatus(TPositionModuleStatus::EDeviceReady);
		moduleStatus.SetDataQualityStatus(TPositionModuleStatus::EDataQualityNormal);

        TPositionModuleStatusEventBase::TModuleEvent occurredEvents = 
						TPositionModuleStatusEventBase::EEventDeviceStatus | TPositionModuleStatusEventBase::EEventDataQualityStatus;
		User::LeaveIfError(modStatus.SetModuleStatus(&moduleStatus,sizeof(moduleStatus),occurredEvents));
		User::After(1000000);
		
		// Cancel NRH's location update request.
		// The AGPS Manager should ask the Integration Module to:
		// 1.- Cancel the location request (because there is no outstanding request from the Location Server)
		// 2.- Configure GPS Mode as per Admin setting.
		//
		User::LeaveIfError(posUpdateReqNRH.SetPositionUpdateRequest(cancel));
		
		//...let the cancel message do its thing for a second
		User::After(1000000);
		
		occurredEvents = TPositionModuleStatusEventBase::EEventNone;
		User::LeaveIfError(modStatus.GetModuleStatus(&moduleStatus, sizeof(moduleStatus), occurredEvents));

		// Check that the cancellation has resulted in a call to CancelLocationRequest of the
		// integration module (hack: the test integration module switches the Data Quality Status
		// to EDataQualityPartial when CancelLocationRequest is called while in 'hybrid'mode)
		//
		if (moduleStatus.DataQualityStatus() != TPositionModuleStatus::EDataQualityPartial)
			{
			INFO_PRINTF1(_L("Incorrect DataQualityStatus: CancelLocationRequest has not been called."));
			User::Leave(KErrNotFound);
			}
		
		INFO_PRINTF1(_L("Test integration module correctly set TPositionModuleStatus::EDataQualityPartial"));
		
		// Check that the AGPS manager has reconfigured the Integration Module' GPS mode with the 
		// Admin setting after leaving the hybrid mode. (NOTE: for testing purposes, the test integration 
		// module changes the Device Status when it is configured with a new admin setting)
		//
		if(moduleStatus.DeviceStatus() == TPositionModuleStatus::EDeviceReady)
			{
			INFO_PRINTF1(_L("Incorrect DeviceStatus: GPS Mode hasn't changed."));
			User::Leave(KErrNotFound);
			}
		
		INFO_PRINTF1(_L("Checked that module status after cancelling is not EDeviceInitialising"));

		WaitAndValidateNgMsg(TLbsNetInternalMsgBase::EAssistanceDataRequest);
		
		SendNgMsg(KSessionCompleteKErrNone);

		CleanupStack::PopAndDestroy(&modStatus);
		CleanupStack::PopAndDestroy(&measurementUpdates);
		CleanupStack::PopAndDestroy(&posUpdates);
		CleanupStack::PopAndDestroy(&posUpdateReqNRH);
		CleanupStack::PopAndDestroy(&posUpdateReqLocSrv);

	 		//  **************   Block end ****************

		SetTestStepResult(EPass);
		}
	  return TestStepResult();
	}
void XQLocationPrivate::DeliverPositionServerResults(TPositionModuleStatus aModuleStatus)
{
    XQLocation::DeviceStatus st;

    switch (aModuleStatus.DeviceStatus()) {
        case TPositionModuleStatus::EDeviceError:
        	// This state is used to indicate that there are problems when using the device.
        	// For example, there may be hardware errors. It should not be confused with
        	// complete loss of data quality (see TDataQualityStatus), which indicates that
        	// the device is functioning correctly, but is currently unable to obtain position
        	// information. The error state is reported if the device cannot be successfully
        	// brought on line. For example, the positioning module may have been unable to
        	// communicate with the device or it is not responding as expected.

        	st = XQLocation::StatusError;
            break;
        case TPositionModuleStatus::EDeviceDisabled:
        	// Although the device may be working properly, it has been taken off line and is
        	// regarded as being unavailable to obtain position information. This is generally
        	// done by the user via the control panel. In this state, Mobile Location FW will
        	// not use the device.

        	st = XQLocation::StatusDisabled;
            break;
        case TPositionModuleStatus::EDeviceInactive:
        	// This state signifies that the device is not being used by Mobile Location FW.
        	// This typically occurs because there are no clients currently obtaining positions
        	// from it.

        	st = XQLocation::StatusInactive;
            break;
        case TPositionModuleStatus::EDeviceInitialising:
        	// This is a transient state. The device is being brought out of the Inactive state
        	// but has not reached either the Ready or Standby modes. The initializing state
        	// occurs when the positioning module is first selected to provide a client
        	// application with location information.

        	st = XQLocation::StatusInitialising;
            break;
        case TPositionModuleStatus::EDeviceStandBy:
        	// This state indicates that the device has entered the Sleep or Power save mode.
        	// This signifies that the device is online, but it is not actively retrieving
        	// position information. A device generally enters this mode when the next position
        	// update is not required for some time and it is more efficient to partially power
        	// down.
        	// Note: Not all positioning modules support this state, particularly when there is
        	//       external hardware. 

        	st = XQLocation::StatusStandBy;
            break;
        case TPositionModuleStatus::EDeviceReady:
        	// The positioning device is online and is ready to retrieve position information.

        	st = XQLocation::StatusReady;
            break;
        case TPositionModuleStatus::EDeviceActive:
        	// The positioning device is actively in the process of retrieving position
        	// information.
        	// Note: Not all positioning modules support this state, particularly when there is
        	//       external hardware. 

        	st = XQLocation::StatusActive;
            break;
        default:
        	// EDeviceUnknown
        	// This is not a valid state and must never be reported.
        	
        	st = XQLocation::StatusUnknown;
            break;
    }
    if (st != status || firstStatusUpdate) {
        status = st;
        emit ipParent->statusChanged(status);
    }

    XQLocation::DataQuality dq;
    switch (aModuleStatus.DataQualityStatus()) {
        case TPositionModuleStatus::EDataQualityLoss:
            // This state indicates that the accuracy and contents of the position information
        	// has been completely compromised. It is no longer possible to return any coherent
        	// data. This situation occurs if the device has lost track of all the transmitters
        	// (for example, satellites or base stations). It should be noted that although it
        	// is currently not possible to obtain position information, the device may still be
        	// functioning correctly. This state should not be confused with a device error
        	// (see TDeviceStatus above).
        	
        	dq = XQLocation::DataQualityLoss;
            break;
        case TPositionModuleStatus::EDataQualityPartial:
            // The state signifies that there has been a partial degradation in the available
        	// position information. In particular, it is not possible to provide the required
        	// (or expected) quality of information. This situation may occur if the device has
        	// lost track of one of the transmitters (for example, satellites or base stations).
        	
        	dq = XQLocation::DataQualityPartial;
            break;
        case TPositionModuleStatus::EDataQualityNormal:
            // The positioning device is functioning as expected.

        	dq = XQLocation::DataQualityNormal;
            break;
        default:
        	// EDataQualityUnknown
            // This is an unassigned valued. This state should only be reported during an event
        	// indicating that a positioning module has been removed.

        	dq = XQLocation::DataQualityUnknown;
            break;
    }
    if (dq != dataQuality || firstStatusUpdate) {
        dataQuality = dq;
        emit ipParent->dataQualityChanged(dataQuality);
    }

    firstStatusUpdate = false;
}