Пример #1
0
void CLcfPsyDummy1::NotifyPositionUpdate(TPositionInfoBase& aPosInfo,
    TRequestStatus& aStatus)
    {
    iStatusPtr = &aStatus; // iStatusPtr is a TRequestStatus*

    // NotifyPositionUpdate must return quickly. It should
    // be implemented as asynchronous but since Example PSY
    // is very fast, we fetch the position synchronously.
    TRAPD(err, GetPositionInfoL(aPosInfo));

    // test call to all methods from CPositioner
    TPositionQuality quality;
    GetRequiredPositionQuality(quality);

    TBool partial = IsPartialUpdateAllowed();

    TTime maxAge;
    GetMaxAge(maxAge);

    TPositionModuleStatus status;
    status.SetDataQualityStatus(TPositionModuleStatus::EDataQualityNormal);
    MPositionerStatus* observer = PositionerStatus();
    observer->ReportStatus(status);

    if (err)
        {
        User::RequestComplete(iStatusPtr, err);
        }
    } 
void CTe_LbsModuleInfoStep::RunModuleStatusTestL(CTe_PsyPositioner& aPositioner, TInt aDeviceStatus,
		TInt aQualityStatus, TBool aExpectUpdate)
	{
	TPositionModuleStatus moduleStatus;
	// set initial dynamic module status and tell interested parties
	moduleStatus.SetDeviceStatus(aDeviceStatus);
	moduleStatus.SetDataQualityStatus(aQualityStatus);
	TPositionModuleStatusEventBase::TModuleEvent occurredEventsSinceLastSet = 
					TPositionModuleStatusEventBase::EEventDeviceStatus | 
					TPositionModuleStatusEventBase::EEventDataQualityStatus;
	CTe_PsyResponse* modStatUpdate = CTe_PsyResponse::IssueModuleStatusLC(moduleStatus,
				occurredEventsSinceLastSet);
		
	StartSchedulerWaitL(KUsualTimeout, 0);
	 
	if(aExpectUpdate)
		{
		aPositioner.CheckModuleStatusReceivedL(*modStatUpdate);
		}
	else
		{
		aPositioner.CheckModuleStatusNotReceivedL();
		}
		
	CleanupStack::PopAndDestroy(modStatUpdate);
	}
// Destructor
CT_LbsTestSingPsyRequestHandler::~CT_LbsTestSingPsyRequestHandler()
    {
    
    TPositionModuleStatus moduleStatus;
    moduleStatus.SetDeviceStatus(TPositionModuleStatus::EDeviceInactive);
	moduleStatus.SetDataQualityStatus(TPositionModuleStatus::EDataQualityUnknown);
	iPositionerStatus->ReportStatus(moduleStatus);
	
    }
Пример #4
0
TVerdict Cman3Step::doTestStepL()
/**
 * @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.
 */
	{
	  if (TestStepResult()==EPass)
		{
		
		// Start test version of AGPS manager and use a test version if integration module
		// The test version of AGPS manager is same as actual but does not use the
		// ECOM plugin interface.

 		// Now test power mode advice when sent within a LocRequest command
 
 		TLbsPositionUpdateRequestStatus request;
 		request.SetPowerAdvice(TLbsPositionUpdateRequestBase::EPowerAdviceOff);
 		RLbsPositionUpdateRequests posReqs;
 		posReqs.OpenL(KChannelArray[0]);
 		CleanupClosePushL(posReqs);

	    RLbsModuleStatus modStatus;
		modStatus.OpenL(KLbsGpsLocManagerUid);
		CleanupClosePushL(modStatus);
		TRequestStatus stat;
		modStatus.NotifyModuleStatusChange(stat);
		
 		User::LeaveIfError(posReqs.SetPositionUpdateRequest(request));

		User::WaitForRequest(stat);
		if(stat.Int()!=KErrNone) User::Leave(KErrGeneral);

		TPositionModuleStatus status;
		TPositionModuleStatusEventBase::TModuleEvent occurredEvents =
				TPositionModuleStatusEventBase::EEventNone;
		User::LeaveIfError(modStatus.GetModuleStatus(&status, sizeof(TPositionModuleStatus), occurredEvents));

 		if(status.DeviceStatus() != TPositionModuleStatus::EDeviceInactive)
			{
			User::Leave(KErrNotFound);
			}
 		INFO_PRINTF1(_L("Test integration module correctly responds with EDeviceStandBy"));
	
		SendNgMsg(KSessionCompleteKErrNone);
		CleanupStack::PopAndDestroy(&modStatus);
		CleanupStack::PopAndDestroy(&posReqs);
	 	
	 		//  **************   Block end ****************

		SetTestStepResult(EPass);
		}
	  return TestStepResult();
	}
Пример #5
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;
	}
void CAgpsModStatusHandler::RunL()
	{
	TInt status = iStatus.Int();
	
	// keep listening:
	iModStatusBus.NotifyModuleStatusChange(iStatus);
	SetActive(); 	
	
	if(status == KErrNone)
		{
		TPositionModuleStatus moduleStatus;

		TInt err = RLbsModuleStatus::GetModuleStatus(&moduleStatus, moduleStatus.PositionClassSize(), KLbsGpsLocManagerUid);
		if((err == KErrNone) && (iPositionerQ->Count()))
			{
	    	(iPositionerQ->Positioner(0)).ReportStatus(moduleStatus);
			}
    	}
	}
Пример #7
0
// don't think we need this...
EXPORT_C void T_LbsUtils::GetConfigured_ModuleStatusL(const TDesC& aConfigFileName, const TDesC& aConfigSection, TPositionModuleStatus& aModuleStatus, TBool& aDelayReportingModStatus)
	{
	// Use default values if file name not given.
	if (aConfigFileName.Length() == 0)
		{
		aModuleStatus.SetDeviceStatus(TPositionModuleStatus::EDeviceReady);
		aModuleStatus.SetDataQualityStatus(TPositionModuleStatus::EDataQualityNormal);
		aDelayReportingModStatus = EFalse;
		}
	else
		{
		CModuleStatusConfigReader* reader;
	
		reader = CModuleStatusConfigReader::NewL(aConfigFileName, aConfigSection, aModuleStatus, aDelayReportingModStatus);
		CleanupStack::PushL(reader);
				
		reader->ProcessL();
	
		CleanupStack::PopAndDestroy(reader);
		}
	}
Пример #8
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;
}
Пример #10
0
void CNetworkPsy2::TimerCompleted()
    {
    TPsyConfig& config(iPsyConfigArray[iCurrentIndex]);
    if(config.iType==TPsyConfig::EConfigLRResponse)
        {
        //If no pending LR, then just return
        if(!iRequestStatus)
            {
            return;
            }
            
        TInt err = config.iData.iLRConfig.iErr;
        //complete location request
        if(iPositionInfoBase->PositionClassType() & EPositionInfoClass)
            {
            //Set TPositionInfo
            TPosition pos;
            pos.SetCoordinate(
                config.iData.iLRConfig.iLat,
                config.iData.iLRConfig.iLon,
                config.iData.iLRConfig.iAlt);
                
            TPositionInfo* posInfo = reinterpret_cast<TPositionInfo*>(iPositionInfoBase);
            posInfo->SetPosition(pos);
            }
        if(iPositionInfoBase->PositionClassType() & EPositionGenericInfoClass)
            {
            //Set HGeneric Info
            HPositionGenericInfo* genInfo =
                static_cast<HPositionGenericInfo*>(iPositionInfoBase);
            if(genInfo->IsRequestedField(EPositionFieldNMEASentences))
                {
                genInfo->SetValue(EPositionFieldNMEASentences, TInt8(1));
                HBufC8* nmea = NULL;
                TRAP(err, nmea = HBufC8::NewL(config.iData.iLRConfig.iNmeaDataSize));
                if(KErrNone == err)
                	{
	                TPtr8 nmeaPtr(nmea->Des());
	                nmeaPtr.Fill('H', config.iData.iLRConfig.iNmeaDataSize);
	                err = genInfo->SetValue(EPositionFieldNMEASentences+1, *nmea);
                	}
                delete nmea;
                }
            }
        CompleteRequest(err);
        if(config.iData.iLRConfig.iNumOfResponse>1)
            {
            config.iData.iLRConfig.iNumOfResponse--;
            }
        else if(config.iData.iLRConfig.iNumOfResponse>0)
            {
            iCurrentIndex++;
            }
        else
            {
            //0 means forever response with this
            }
        }
    else //ECinfigModuleStatus
        {
        //Change module status
        TPositionModuleStatus modStatus;
        modStatus.SetDataQualityStatus(config.iData.iStatusConfig.iDataQuality);
        modStatus.SetDeviceStatus(config.iData.iStatusConfig.iDeviceStatus);
        MPositionerStatus* observer = PositionerStatus();
        observer->ReportStatus(modStatus);
        iCurrentIndex++;
        }
    iTimer->Cancel();
    
    if(iCurrentIndex>=iPsyConfigArray.Count())
        {
        //When all items are used, then clean the config items
        iPsyConfigArray.Reset();
        iCurrentIndex = 0;
        }
        
    StartTimerIfNeeded();
    }