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


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

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


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

示例1: RunL

void CPosition::RunL()
{
    TPosition position;
    iPositionInfo.GetPosition(position);

    TTime now;
    now.UniversalTime();

    TTimeIntervalSeconds interval = 0;
    now.SecondsFrom(position.Time(), interval);

    LOGARG("Interval between retrieved position and current time: %d secs", interval.Int());

    // Compare that retrieved data is not outdated
    if (iStatus == KErrNone && interval.Int() < 300)
    {
        iObserver.PositionUpdateL(iStatus.Int(), position);
    }
    else if (iStatus == KErrTimedOut)
    {
        iObserver.PositionUpdateL(iStatus.Int(), position);
    }
    else
    {
        iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus);
        SetActive();

        iState = EGps;
    }
}
开发者ID:DavidCaabeiro,项目名称:openmar,代码行数:30,代码来源:Position.cpp

示例2: CalculateTimeCorrection

/** Calculates a difference between the system UTC time and the GPS based UTC time.
Accuracy of the calculations is affected by:
   - time required to process the satellite information in the GPS HW
   - time required to transfer the information over a HW link from the GPS HW to a mobile phone
   - time required to receive the information by a Symbian OS drivers and decode by the AGPS
     integration module

@param aSatInfo A satellite information with the GPS based UTC time
@param aTimeCorr A time correction that must be applied to the System UTC time. Not valid if the method returns an error.
@return KErrNone if sucedded. 
        KErrNotSupported if the satellite (GPS based UTC time) or the position 
        reception time is not present (0).
@see TPositionSatelliteInfo
@internalComponent
*/
TInt CAutoClockAdjust::CalculateTimeCorrection(const TPositionSatelliteInfo &aSatInfo, TTimeIntervalMicroSeconds &aTimeCorr)
	{
	LBSLOG(ELogP1, "CAutoClockAdjust::CalculateTimeCorrection()\n");
	// The System UTC time when the location has been received from a GPS
	TTime recTime;
	// GPS based UTC time (satellite time)
	TTime satTime;

	TPosition pos;
	TInt err = KErrNone;
		
	aSatInfo.GetPosition(pos);
	recTime = pos.Time();
	satTime = aSatInfo.SatelliteTime();
	
	if ((recTime == 0) || (satTime == 0))
		{
		err = KErrNotSupported;
		}
	else
		{
		aTimeCorr = satTime.MicroSecondsFrom(recTime);
		}
	
	return err;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:41,代码来源:lbsautoclockadjust.cpp

示例3: SaveAsLastKnownPosition

void CPositionRequest::SaveAsLastKnownPosition()
    {
    TPosition pos;
    TPositionInfo& positionInfo = PositionInfo(iPositionBuffer);
    positionInfo.GetPosition(pos);

    // Don't set last known position if the position request is in the past. //TODO check if this is required
    if (iReqStartTime <= pos.Time())
        {
        iLocMonitorReqHandler.SetPositionInfo(positionInfo);
        }
    }
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:12,代码来源:EPos_CPositionRequest.cpp

示例4:

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

示例5: 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

示例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: 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

示例8: 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

示例9: 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


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