当前位置: 首页>>代码示例>>C++>>正文


C++ TPosition::Altitude方法代码示例

本文整理汇总了C++中TPosition::Altitude方法的典型用法代码示例。如果您正苦于以下问题:C++ TPosition::Altitude方法的具体用法?C++ TPosition::Altitude怎么用?C++ TPosition::Altitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TPosition的用法示例。


在下文中一共展示了TPosition::Altitude方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ComparePositions

void CTe_LbsLocationMonitorSuiteStepBase::ComparePositions(TPosition& aLeft, TPosition& aRight)
	{
	TEST(aLeft.HorizontalAccuracy() == aRight.HorizontalAccuracy());
	TEST(aLeft.VerticalAccuracy() == aRight.VerticalAccuracy());
	TEST(aLeft.Latitude() == aRight.Latitude());
	TEST(aLeft.Longitude() == aRight.Longitude());
	TEST(aLeft.Altitude() == aRight.Altitude());
		
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:9,代码来源:te_lbslocationmonitorsuitestepbase.cpp

示例2:

void CT_LbsClientPosTp2::CheckPositionL(TPosition& aPos)
	{
	if (aPos.Time() != TTime(KPositionTime) ||
		aPos.HorizontalAccuracy() != KHorizontalAcc ||
		aPos.VerticalAccuracy() != KVerticalAcc ||
		aPos.Latitude() != KLatitude ||
		aPos.Longitude() != KLongitude ||
		aPos.Altitude() != KAltitude)
		{
		_LIT(KErrPosition, "Wrong position returned");
		LogErrorAndLeaveL(KErrPosition);
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:13,代码来源:ctlbsclientpostp2.cpp

示例3: ProcessNetworkPositionUpdate

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();
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:20,代码来源:ctlbshybridueassistedmtlrtimeout.cpp

示例4: PrintPosInfo

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);)
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:22,代码来源:te_lbspsystaticdata.cpp

示例5: Verify_PositionIsValid

/**
 *  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;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:28,代码来源:tlbsutils.cpp

示例6: CheckPositionClearsL

// ---------------------------------------------------------
// CPosPSYClearPositionDataTest::CheckPositionClearsL
//
// (other items were commented in a header).
// ---------------------------------------------------------
// 
void CPosPSYClearPositionDataTest::CheckPositionClearsL(
	const TDesC& aPositionType)
    {
	TPosition position;
	iPosInfo->GetPosition(position);
    
	TBool allIsCleared = ETrue;

	if (position.Time() == KTime)
		{
		_LIT(KError, "Time not cleared for ");
		AddMessageL(KError, aPositionType, EErrorMessage);
		allIsCleared = EFalse;
		}
	if (!Math::IsNaN(position.HorizontalAccuracy()))
		{
		if (position.HorizontalAccuracy() == KHorizontalAccuracy)
			{
			_LIT(KError, "Horizontal Accuracy not cleared for ");
			AddMessageL(KError, aPositionType, EErrorMessage);
			allIsCleared = EFalse;
			}
		}
	if (!Math::IsNaN(position.VerticalAccuracy()))
		{
		if (position.VerticalAccuracy() == KVerticalAccuracy)
			{
			_LIT(KError, "Vertical Accuracy not cleared for ");
			AddMessageL(KError, aPositionType, EErrorMessage);
			allIsCleared = EFalse;
			}	
		}
	if (!Math::IsNaN(position.Latitude()))
		{
		if (position.Latitude() == KLatitude)
			{
			_LIT(KError, "Latitude not cleared for ");
			AddMessageL(KError, aPositionType, EErrorMessage);
			allIsCleared = EFalse;
			}
		}
	if (!Math::IsNaN(position.Longitude()))
		{
		if (position.Longitude() == KLongitude)
			{
			_LIT(KError, "Longitude not cleared for ");
			AddMessageL(KError, aPositionType, EErrorMessage);
			allIsCleared = EFalse;
			}
		}
	if (!Math::IsNaN(position.Altitude()))
		{
		if (position.Altitude() == KAltitude)
			{
			_LIT(KError, "Altitude not cleared for ");
			AddMessageL(KError, aPositionType, EErrorMessage);
			allIsCleared = EFalse;
			}
		}
	
	if (allIsCleared)
		{
		_LIT(KInfo, "All TPositionInfo fields were cleared for ");
		AddMessageL(KInfo, aPositionType, EInfoMessage);
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:72,代码来源:epos_cpospsyclearpositiondatatest.cpp

示例7: Compare_PosInfo

EXPORT_C TBool T_LbsUtils::Compare_PosInfo(const TPositionInfoBase& aPosInfoSideA, const TPositionInfoBase& aPosInfoSideB, TComparisonAccuracyType aCmpAccuracy)
	{
	// TODO compare base class items, such as module id, position mode, etc.

	TUint32 typeA = aPosInfoSideA.PositionClassType();
	TUint32 typeB = aPosInfoSideB.PositionClassType();
	
	// Compare TPositionInfo type items.
	if(typeA & typeB & EPositionInfoClass)
		{
		TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Both positions are of type EPositionInfoClass");
		const TPositionInfo& posInfoSideA = reinterpret_cast<const TPositionInfo&>(aPosInfoSideA);
		const TPositionInfo& posInfoSideB = reinterpret_cast<const TPositionInfo&>(aPosInfoSideB);
		
		TPosition posSideA;
		TPosition posSideB;
		posInfoSideA.GetPosition(posSideA);
		posInfoSideB.GetPosition(posSideB);

		// Carry out an exact check when comparing items.
		if (EExactAccuracy == aCmpAccuracy)
			{
			TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Comparing positions for exact match");
			// Compare latitude. 
			if (Math::IsNaN(posSideA.Latitude()) && Math::IsNaN(posSideB.Latitude()))
				;
			else if (posSideA.Latitude() != posSideB.Latitude())
				{
				TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!");
				TESTLOG3(ELogP1, "Latitudes %d and %d respectively", posSideA.Latitude(), posSideB.Latitude());
				return EFalse;
				}
			
			// Compare longitude.
			if (Math::IsNaN(posSideA.Longitude()) && Math::IsNaN(posSideB.Longitude()))
				;
			else if (posSideA.Longitude() != posSideB.Longitude())
				{
				TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!");
				TESTLOG3(ELogP1, "Longitudes %d and %d respectively", posSideA.Longitude(), posSideB.Longitude());
				return EFalse;
				}		
			
			// Compare altitude.
			if (Math::IsNaN(posSideA.Altitude()) && Math::IsNaN(posSideB.Altitude()))
				;
			else if (posSideA.Altitude() != posSideB.Altitude())
				{
				TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!");
				TESTLOG3(ELogP1, "Altitudes %d and %d respectively", posSideA.Altitude(), posSideB.Altitude());				
				return EFalse;
				}
			
			// Compare datum.
			if (posSideA.Datum() != posSideB.Datum())
				{
				TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!");
				TESTLOG3(ELogP1, "Datums %d and %d respectively", posSideA.Datum(), posSideB.Datum());				
				return EFalse;
				}				
			
			// Compare horizontal accuracy.
			if (Math::IsNaN(posSideA.HorizontalAccuracy()) && Math::IsNaN(posSideB.HorizontalAccuracy()))
				;
			else if (posSideA.HorizontalAccuracy() != posSideB.HorizontalAccuracy())
				{
				TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!");
				TESTLOG3(ELogP1, "Horizontal Accuracies %d and %d respectively", posSideA.HorizontalAccuracy(), posSideB.HorizontalAccuracy());				
				return EFalse;
				}		
			
			// Compare vertical accuracy.
			if (Math::IsNaN(posSideA.VerticalAccuracy()) && Math::IsNaN(posSideB.VerticalAccuracy()))
				;
			else if (posSideA.VerticalAccuracy() != posSideB.VerticalAccuracy())
				{
				TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!");
				TESTLOG3(ELogP1, "Vertical Accuracies %d and %d respectively", posSideA.VerticalAccuracy(), posSideB.VerticalAccuracy());				
				return EFalse;
				}		
			}
		else
			{
			// Check latitude + longitude using horz accuracy.
			TReal horzAct = posSideA.HorizontalAccuracy(); // Use the verify accuracy value (which is side A).
			TReal distance ;			
	
			TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Comparing positions for 'rough' match");			
		//	if(NAN != horzAct)
				{
				// The following is a temporary patch until TPositionInfo.Distance() is implemented:				
/* 
	from http://www.movable-type.co.uk/scripts/GIS-FAQ-5.1.html
	
	presuming a spherical Earth with radius R (see below), and the locations of the two points in spherical coordinates (longitude and latitude) are lon1,lat1 and lon2,lat2 then the

	Haversine Formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159):

	dlon = lon2 - lon1
	dlat = lat2 - lat1
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:tlbsutils.cpp

示例8: GetGPSBufferL

//HBufC8* CAgentPosition::GetGPSBufferL(TPosition pos)  // original MB
HBufC8* CAgentPosition::GetGPSBufferL(TPositionSatelliteInfo satPos)
	{
	/*
	 * If the number of satellites used to calculate the coordinates is < 4, we don't use
	 * the fix
	 */
	if(satPos.NumSatellitesUsed() < 4 )
		return HBufC8::NewL(0);
	
	CBufBase* buffer = CBufFlat::NewL(50);
	CleanupStack::PushL(buffer);
	TGPSInfo gpsInfo;
	
	// retrieve TPosition 
	TPosition pos;
	satPos.GetPosition(pos);
	
	// insert filetime timestamp
	TTime now;
	now.UniversalTime();
	//TInt64 filetime = GetFiletime(now);
	TInt64 filetime = TimeUtils::GetFiletime(now);
	gpsInfo.filetime.dwHighDateTime = (filetime >> 32);
	gpsInfo.filetime.dwLowDateTime = (filetime & 0xFFFFFFFF);
	
	gpsInfo.gps.FixType = GPS_FIX_3D;  // we are sure at least 4 satellites have been used
	
	// insert lat-long-alt-time
	gpsInfo.gps.dblLatitude = pos.Latitude();
	gpsInfo.gps.dblLongitude = pos.Longitude();
	gpsInfo.gps.flAltitudeWRTSeaLevel = pos.Altitude();
	gpsInfo.gps.stUTCTime = TSystemTime( pos.Time() );
	
	gpsInfo.gps.dwValidFields = (GPS_VALID_UTC_TIME | GPS_VALID_LATITUDE | GPS_VALID_LONGITUDE | GPS_VALID_ALTITUDE_WRT_SEA_LEVEL);
	
	gpsInfo.gps.dwSatelliteCount = satPos.NumSatellitesUsed();
	gpsInfo.gps.dwValidFields |= GPS_VALID_SATELLITE_COUNT;
	gpsInfo.gps.dwSatellitesInView = satPos.NumSatellitesInView();
	gpsInfo.gps.dwValidFields |= GPS_VALID_SATELLITES_IN_VIEW;
	gpsInfo.gps.flHorizontalDilutionOfPrecision = satPos.HorizontalDoP();
	gpsInfo.gps.dwValidFields |= GPS_VALID_HORIZONTAL_DILUTION_OF_PRECISION;
	gpsInfo.gps.flVerticalDilutionOfPrecision = satPos.VerticalDoP();
	gpsInfo.gps.dwValidFields |= GPS_VALID_VERTICAL_DILUTION_OF_PRECISION;
	
	TCourse course;
	satPos.GetCourse(course);
	gpsInfo.gps.flSpeed = course.Speed();
	gpsInfo.gps.dwValidFields |= GPS_VALID_SPEED;
	gpsInfo.gps.flHeading = course.Heading();
	gpsInfo.gps.dwValidFields |= GPS_VALID_HEADING;
	
	/*
	 * Additional data regarding the satellites can be obtained using the TSatelliteData structure.
	 * Example:
	 */
	/*
	TInt numSat = satPos.NumSatellitesInView();
	TInt err = KErrNone;
	for (int i=0; i<numSat; i++) {
		// Get satellite data
		TSatelliteData satData;
		err = satPos.GetSatelliteData(i,satData);
		if(err != KErrNone)
			{
				continue;
			}
		// Get info
		// See TSatelliteData definition for more methods.
		TReal32 azimuth = satData.Azimuth();
		TInt satSignalStrength = satData.SignalStrength();
	}*/
	
	
	TUint32 type = TYPE_GPS;
	buffer->InsertL(0, &type, sizeof(TUint32));
	buffer->InsertL(buffer->Size(), &gpsInfo, sizeof(TGPSInfo));
	HBufC8* result = buffer->Ptr(0).AllocL();
	CleanupStack::PopAndDestroy(buffer);
	
	return result;
	}
开发者ID:BwRy,项目名称:core-symbian,代码行数:82,代码来源:AgentPosition.cpp

示例9: DeliverPositionerResults

void XQLocationPrivate::DeliverPositionerResults(TPositionSatelliteInfo aPositionInfo)
{
    TPosition pos; 
    aPositionInfo.GetPosition(pos);
    
    // Handle speed reporting
    float speed = 0;
    if (speedAvailable) {
        // Positioning module is able to offer speed information
        TCourse course;
        aPositionInfo.GetCourse(course);
        speed = course.Speed();
        if (isnan(speed)) {
            speed = 0;
        }
    } else {
        // Positioning module does not offer speed information
        // => Speed is calculated using position information & timestamps
        TTime posTime;
        TTimeIntervalSeconds interval;
        for (int i = iPositions.Count()-1 ; i >= 0; i--) {
            if (pos.Time().SecondsFrom(iPositions[i].Time(),interval) == KErrNone) {
                if (interval.Int() > 10) {
                    pos.Speed(iPositions[i], speed);
                    break;
                }
            }
        }
        while (iPositions.Count() > 0) {
            if (pos.Time().SecondsFrom(iPositions[0].Time(),interval) == KErrNone) {
                if (interval.Int() > 60) {
                    iPositions.Remove(0);
                } else {
                    break;
                }
            }
        }
        if (iPositions.Count() > 0) {
    	    if (pos.Time().SecondsFrom(iPositions[iPositions.Count()-1].Time(),interval) == KErrNone) {
                if (interval.Int() > 1) {
                    iPositions.Append(pos);
                }
        	}
        } else {
            iPositions.Append(pos);
        }
        // Accept speed from range 0.01 m/s (0.036 km/h) to 200 m/s (720 km/h)  
        if (speed < 0.01 || speed > 200) {
            speed = 0;
        }
    }
    if (speed != iPreviousSpeed) {
        emit ipParent->speedChanged(speed);
    }
    iPreviousSpeed = speed;
    
    // Handle satellite information reporting
    if (satelliteInfoAvailable) {
        if (aPositionInfo.NumSatellitesInView() != iPreviousNumSatellitesInView) {
            emit ipParent->numberOfSatellitesInViewChanged(aPositionInfo.NumSatellitesInView());
        }
        iPreviousNumSatellitesInView = aPositionInfo.NumSatellitesInView(); 

		if (aPositionInfo.NumSatellitesUsed() != iPreviousNumSatellitesUsed) { 
            emit ipParent->numberOfSatellitesUsedChanged(aPositionInfo.NumSatellitesUsed());
        }
        iPreviousNumSatellitesUsed = aPositionInfo.NumSatellitesUsed();
    }
    
    // Handle position information reporting
    if (iPreviousPosition.Latitude() != pos.Latitude() ||
        iPreviousPosition.Longitude() != pos.Longitude() ||
        iPreviousPosition.Altitude() != pos.Altitude()) {
        if (!isnan(pos.Latitude()) || !isnan(pos.Longitude()) || !isnan(pos.Altitude())) {
            emit ipParent->locationChanged(pos.Latitude(),pos.Longitude(),pos.Altitude(),speed);
        }
        
        if (iPreviousPosition.Latitude() != pos.Latitude()) {
            if (!isnan(pos.Latitude())) {
                emit ipParent->latitudeChanged(pos.Latitude(),pos.HorizontalAccuracy());
            }
        }
        if (iPreviousPosition.Longitude() != pos.Longitude()) {
            if (!isnan(pos.Longitude())) {
                emit ipParent->longitudeChanged(pos.Longitude(),pos.HorizontalAccuracy());
            }
        }
        if (iPreviousPosition.Altitude() != pos.Altitude()) {
            if (!isnan(pos.Altitude())) {
                emit ipParent->altitudeChanged(pos.Altitude(),pos.VerticalAccuracy());
            }
        }
    }
    iPreviousPosition = pos;
    
    if (iSingleUpdate) {
        stopUpdates();
        iSingleUpdate = EFalse;
    }
}
开发者ID:barkermn01,项目名称:phonegap-symbian.qt-creator,代码行数:100,代码来源:xqlocation_s60_p.cpp

示例10: DoTestL

//
// 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);
    }
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:78,代码来源:ctlbsclientpostp208.cpp

示例11: CacheLookupL


//.........这里部分代码省略.........
        
        for (TInt j = 0; j < areaCount; j++)
            {   
            resolved = EFalse;
            TLbsAreaInfoClassType type = areaArray[j]->Type();
            TLbsLocMonitorAreaInfoGci areaInfoGci;
            switch(type)
                {
                case ELbsAreaGsmCellInfoClass:
                    {
                    CLbsGsmCellInfo* area = static_cast<CLbsGsmCellInfo*>(areaArray[j]);
                    areaInfoGci.iMcc = area->MobileCountryCode();
                    areaInfoGci.iMnc = area->MobileNetworkCode();
                    areaInfoGci.iLac = area->LocationAreaCode();
                    areaInfoGci.iCid = area->CellId();
                    areaInfoGci.iValidity = ETrue;
                    areaInfoGci.iIs3gNetworkMode = EFalse;
                    
                    resolved = ETrue;
                    break;
                    }

                case ELbsAreaWcmdaCellInfoClass :
                    {
                    CLbsWcdmaCellInfo* area = static_cast<CLbsWcdmaCellInfo*>(areaArray[j]);
                    areaInfoGci.iMcc = area->MobileCountryCode();
                    areaInfoGci.iMnc = area->MobileNetworkCode();
                    areaInfoGci.iLac = area->LocalAreaCode();
                    areaInfoGci.iCid = area->UniqueCellId();
                    areaInfoGci.iValidity = ETrue;
                    areaInfoGci.iIs3gNetworkMode = ETrue;
                    
                    resolved = ETrue;
                    break;
                    }

                default:
                    {
                    resolved = EFalse;
                    break;
                    }
                }
            
            if(resolved && !saved)
                {
                TPosition position;
                RPointerArray<TLbsLocMonitorAreaInfoBase> outArray;
                outArray.Append(&areaInfoGci);
                TPositionAreaExtendedInfo matchLevel; 
                matchLevel.SetArea(TPositionAreaInfo::EAreaUnknown);
                TRequestStatus status; 
                // Cache gets are fast and not really asynch, so no harm in blocking here
                TInt ret = iCache.GetPosition(position,outArray,matchLevel,status);
                if((ret == KErrNone) || (ret == KErrNotFound))
                    {
                    User::WaitForRequest(status);
                    }
                outArray.Reset();
                
                if((ret == KErrNone) && (matchLevel.Area()  >= TPositionAreaExtendedInfo::EAreaCity))
                    {
                    TLocality locality;
                    locality.SetCoordinate(position.Latitude(), position.Longitude(),
								position.Altitude());
                	TRealX nan;
                	nan.SetNaN();
                    locality.SetAccuracy(AccuracyFromMatchLevel(matchLevel.Area()), nan);
                    
                    CLbsPositionInfo* positionInfo = CLbsPositionInfo::NewL(locality);
                    CleanupStack::PushL(positionInfo);
                    iLocationInfoArray[i]->AddAreaInfoL(positionInfo);
                    CleanupStack::Pop(positionInfo);
                    saved = ETrue;
                    cacheLoads++;
                    }
                else if ((ret == KErrNone) && (matchLevel.Area()  > TPositionAreaExtendedInfo::EAreaUnknown))
                    {
                    // we also store partial matches in case they are better than the plugin response
                    partialLocality.SetCoordinate(position.Latitude(), position.Longitude(),
                                position.Altitude());
                    TRealX nan;
                    nan.SetNaN();
                    partialLocality.SetAccuracy(AccuracyFromMatchLevel(matchLevel.Area()), nan);
                    }

                }
            }
        if(!saved)
            {
            //copy into subset array, we couldn't solve this from cache
            iSubsetLocationInfoArray.AppendL(iLocationInfoArray[i]);
            
            iCachePartialResults.AppendL(partialLocality);
            }
        CleanupStack::PopAndDestroy(&areaArray);
        }
    // If we've loaded as many results from the cache as there are requests 
    // then we have fully satisfied the query
    return cacheLoads == infoCount;
    }
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:clbslocmonitorconversionhandler.cpp

示例12: DoTestL

/**
* 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);
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:ctlbsexeclient.cpp

示例13: dt

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);
        }
    }
}
开发者ID:RobinD42,项目名称:qt-mobility,代码行数:68,代码来源:symbian_lbsfacade.cpp

示例14: options


//.........这里部分代码省略.........
	TInt reason = KErrNone;
	iProxy->CallL(ENetMsgProcessAssistanceData, &dataRequestMask, &assistanceData, &reason);
	CleanupStack::PopAndDestroy(1); //assistanceData
// Assistance Data Notification End
	
// Network Location Request Start
	// ProcessLocationRequest()
	const TBool emergency(EFalse);
	TLbsNetPosRequestQuality quality = ArgUtils::QualityAlpha2(); 
	TLbsNetPosRequestMethod method   = ArgUtils::RequestHybridMethod();	
	iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);
// Network Location Request Stop

	//Start the timer
	TTime timerStart;
	timerStart.HomeTime();
	
	// RequestAssistanceData(0)
	TESTL(iProxy->WaitForResponse(KSmallTimeOut) == ENetMsgRequestAssistanceData); 
	TLbsAsistanceDataGroup dataGroup;
	cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataGroup);
	TESTL(dataGroup == EAssistanceDataNone);
	CleanupStack::PopAndDestroy(cleanupCnt);

	// now wait for either to complete - but we will expect only the asynchrous request
	// waiting for the REF position to complete with KErrNone
	User::WaitForRequest(refPosStatus, transPosStatus); 
	TESTL(refPosStatus==KErrNone);
	TESTL(transPosStatus.Int() == KRequestPending);
	
	//Find the time elapsed from timer
	TTimeIntervalMicroSeconds microseconds;
 	TTime timerStop;
 	timerStop.HomeTime();
 	microseconds = timerStop.MicroSecondsFrom(timerStart); 
	TInt64 timeElapsed = microseconds.Int64();
						
/*** NRH's Alpha2 timer expires. We enter Hybrid mode.***/
	//Test that we do not get response before alpha2 has expired
	TESTL(iProxy->WaitForResponse(KAlpha2Timeout-timeElapsed-KDelta) == ENetMsgTimeoutExpired); 
	TESTL(iProxy->WaitForResponse(2*KDelta) == ENetMsgRespondLocationRequest); 	
	getSessionId = NULL;
	TInt getReason = KErrNone;
	TPositionSatelliteInfo* getPositionInfo = NULL;
	cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getPositionInfo);
	TESTL(getSessionId->SessionNum() == iSessionId.SessionNum());
	TESTL(getReason==KErrNone);
	CleanupStack::PopAndDestroy(cleanupCnt);

	// no need for looping, we assume that the next update location from GPS will give accurate fix
	quality = ArgUtils::Quality(); 
	iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);

	// RequestAssistanceData(0)
	TESTL(iProxy->WaitForResponse(KSmallTimeOut) == ENetMsgRequestAssistanceData); 
	cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataGroup);
	TESTL(dataGroup == EAssistanceDataNone);		
	CleanupStack::PopAndDestroy(cleanupCnt);
	
	//	GPS positions meets required accuracy. This is sent immediately to protocol module
	// The ini file should contain accurate gps fix for this test case to work
	TESTL(iProxy->WaitForResponse(KTTimeout) == ENetMsgRespondLocationRequest);	
	getSessionId = NULL;
	getReason = KErrNone;
	getPositionInfo = NULL;
	cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getPositionInfo);
	TESTL(getSessionId->SessionNum() == iSessionId.SessionNum());
	TESTL(getReason == KErrNone);
	// Test position is the same as in the ini file data fed to the GPS module
	// $update,1,2,51.5015,-0.105,50,2,3*
	TPosition gpsPos;
	getPositionInfo->GetPosition(gpsPos);
	TESTL(gpsPos.Latitude()==51.5015 && gpsPos.Longitude()==-0.105 && gpsPos.Altitude()==50 && gpsPos.HorizontalAccuracy()==2 && gpsPos.VerticalAccuracy()==3); 
	CleanupStack::PopAndDestroy(cleanupCnt);
				
// Network Result Notification Start
	// ProcessLocationUpdate()
	//Final Network Position is the GPS position
	TPositionInfo gpsPosInfo;
	gpsPosInfo.SetPosition(gpsPos);
	gpsPosInfo.SetUpdateType(EPositionUpdateGeneral);
	gpsPosInfo.SetPositionMode(TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted);
	gpsPosInfo.SetPositionModeReason(EPositionModeReasonNone);
	iProxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &gpsPosInfo);
// Network Result Notification Stop
	
// Session Complete Start
	reason = KErrNone;
	iProxy->CallL(ENetMsgProcessSessionComplete, &iSessionId, &reason);
	MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask = MLbsNetworkProtocolObserver::EServiceNone;
	iProxy->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask);
// Session Complete Stop

	// the REF position request has completed, so now, after injecting the FNP and Session Complete
	// we expect that the other request to complete with KErrNone
	User::WaitForRequest(transPosStatus);
 
	TESTL(transPosStatus==KErrNone);
	return TestStepResult();
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:ctlbshybridueassistedx3paccurategps.cpp


注:本文中的TPosition::Altitude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。