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);
	
    }
예제 #3
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);
		}
	}
예제 #4
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();
	}
예제 #5
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();
    }