本文整理汇总了C++中TPosition类的典型用法代码示例。如果您正苦于以下问题:C++ TPosition类的具体用法?C++ TPosition怎么用?C++ TPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TPosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LBS_RDEBUG_VAR_INT
void CPositionRequest::StartPositionDataRequestPhase()
{
LBS_RDEBUG_VAR_INT("CPositionRequest::StartPositionDataRequestPhase() iRequestPhase", iRequestPhase);
__ASSERT_DEBUG(iPositioner,
DebugPanic(EPosServerPanicPositionerNotInitialized));
iReqStartTime.UniversalTime();
TPositionInfo& info = PositionInfo(iPositionBuffer);
// Set datum type to WGS84
TPosition position;
info.GetPosition(position);
position.SetDatum(KPositionDatumWgs84);
info.SetPosition(position);
TPositionInfoBase& infoBase = reinterpret_cast<TPositionInfoBase&>(info);
// issue request to psy
DEBUG_TRACE("calling CPositioner::NotifyPositionUpdate()", __LINE__)
iStatus = KRequestPending;
iPositioner->NotifyPositionUpdate(infoBase, iStatus);
iRequestPhase = EPosReqPositionRequest;
SetActive();
}
示例2: 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;
}
}
示例3:
// ---------------------------------------------------------
// CT_LbsInstallPsyTp273::NotifyPositionUpdate
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsInstallPsyTp273::NotifyPositionUpdate(
TPositionInfoBase& aPosInfo,
TRequestStatus& aStatus)
{
TInt err = KErrNone;
TTime tt;
tt.UniversalTime();
//Request ID must be unique, use universalime as seed
// to give a random number
TInt64 seed = tt.Int64();
TReal lat = 90 * Math::FRand(seed);
TReal lon = 90 * Math::FRand(seed);
TReal32 alt = (TReal32)(90 * Math::FRand(seed));
TPositionInfo* position = static_cast<TPositionInfo*> (&aPosInfo);
TUid implUid = { KPosImplementationUid };
position->SetModuleId(implUid);
TTime now;
now.UniversalTime();
TPosition posse;
posse.SetCoordinate(lat, lon, alt);
posse.SetTime(now);
position->SetPosition(posse);
TRequestStatus* status = &aStatus;
User::RequestComplete(status, err);
}
示例4: satellite
/** 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;
}
示例5: latitude
//
// This test checks that a SetLastKnowPosition request
// results in a request to store a position sent to the DB
//
TVerdict CTe_LocMonitorStep11::doTestStepL()
{
if (TestStepResult()==EPass)
{
TPositionInfo positionInfo;
TPosition position;
TReal64 latitude(11), longitude(21);
position.SetCoordinate(latitude, longitude);
positionInfo.SetPosition(position);
RLbsLocMonitorSession locMonSession;
User::LeaveIfError(locMonSession.Connect());
RLbsLocMonitorAreaPositioner areaPositioner;
areaPositioner.OpenL(locMonSession);
CleanupClosePushL(areaPositioner);
iLocMonDbListener->ListenForLocMonDbFeedback();
areaPositioner.SetLastKnownPosition(positionInfo);
iLocMonDbListener->WaitForDbFeedback();
// Check that the position received by the DB is the position
// sent by the test
TESTL(latitude == iLocMonDbListener->iDbData.iPosition.Latitude());
TESTL(longitude == iLocMonDbListener->iDbData.iPosition.Longitude());
CleanupStack::PopAndDestroy(&areaPositioner);
locMonSession.Close();
}
return TestStepResult();
}
示例6: LBSLOG
/** Adjusts system time if required. The decision whether the adjustment is needed or not
is based on the following criterias:
- satellite time must be present in the location update
- time threshold must be exceeded
- time from a last adjustment is greater than a defined interval.
@param aStatus An error code.
@param TPositionSatelliteInfo Position and time information.
If clock adjustment takes place the TPosition::iTime is
re-set to the satellite time.
@see CLbsAdmin
@see TPositionSatelliteInfo
*/
void CAutoClockAdjust::LocationUpdate(TInt aStatus, TPositionSatelliteInfo& aPosInfo)
{
LBSLOG(ELogP1, "CAutoClockAdjust::LocationUpdate()\n");
TTimeIntervalMicroSeconds timeCorr;
TTime sysTime;
TInt err;
// If adjustment on, no error, and satellite information present
if ((iClockAdjustSetting == CLbsAdmin::EClockAdjustOn) && (aStatus == KErrNone) &&
((aPosInfo.PositionClassType() & EPositionSatelliteInfoClass) == EPositionSatelliteInfoClass))
{
// Is is time do do another time adjustment?
sysTime.UniversalTime();
if (Abs(sysTime.MicroSecondsFrom(iLastAdjustment).Int64()) > (1000*iAdjustInterval))
{
const TPositionSatelliteInfo& satInfo = static_cast<const TPositionSatelliteInfo&>(aPosInfo);
err = CalculateTimeCorrection(satInfo, timeCorr);
if (err == KErrNone)
{
// Is threshold exceeded?
if (Abs(timeCorr.Int64()) > (1000*iAdjustThreshold))
{
sysTime.UniversalTime();
sysTime += timeCorr;
LBSLOG(ELogP9, "->S CGpsSetClockBase::SetUTCTime() ClockModule\n");
LBSLOG5(ELogP9, " > TTime sysTime = %02d:%02d:%02d.%06d\n", sysTime.DateTime().Hour(),
sysTime.DateTime().Minute(),
sysTime.DateTime().Second(),
sysTime.DateTime().MicroSecond());
err = iSetClockImpl->SetUTCTime(sysTime);
LBSLOG2(ELogP9, " Return = %d\n", err);
if (err == KErrNone)
{
// Sync the position time with the satellite time
// to avoid re-adjusting the system time by the manual clock adjustment component.
TPosition pos;
aPosInfo.GetPosition(pos);
pos.SetTime(aPosInfo.SatelliteTime());
aPosInfo.SetPosition(pos);
LBSLOG2(ELogP2, "ACTION: Clock Adjusted by %ld\n", timeCorr.Int64());
}
}
if (err == KErrNone)
{
// Remember the current time even if threshold not exceeded
iLastAdjustment = sysTime;
}
else
{
LBSLOG_WARN2(ELogP3, "Clock Adjustment failed. Error: %d\n", err);
}
}
}
}
}
示例7: 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());
}
示例8: GetLastStoredPosition
/*
This method returns a position to the client. In some testcases, the completion of the
asynchronous request may be delayed.
*/
TInt RLbsLocMonitorDb::GetLastStoredPosition(TPosition& aPosition, TRequestStatus& aStatus)
{
LBSLOG(ELogP1, "RLbsLocMonitorDb::GetLastStoredPosition()");
TInt completionCode = KErrNone;
aStatus = KRequestPending;
iCallCount ++;
if (iFailNextRequest)
{
completionCode = KErrNotFound;
iFailNextRequest = EFalse;
}
else if(iShortDelayNextRequest || iLongDelayNextRequest)
{
// Remember client request's return parms and
// force a delay.
iClientPosition = &aPosition;
iClientStatus = &aStatus;
if (!iTimer->IsActive())
{
TInt delayInMicroSecs = iLongDelayNextRequest?15000000:1000000; // 15 or 1 second
iTimer->Start(delayInMicroSecs, delayInMicroSecs, TCallBack(StopWaiting, this));
}
else
{
// A delay has already been applied. Nothing to do.
}
iShortDelayNextRequest = EFalse;
iLongDelayNextRequest = EFalse;
return KErrNone;
}
else
{
switch (iCallCount)
{
case 1:
// Set a position as if it came from the DB
aPosition.SetCoordinate(KLatGetLast1, KLongGetLast1);
break;
// Return different values for second and later requests
// that occurred in the same test.
default:
aPosition.SetCoordinate(KLatGetLast2, KLongGetLast2);
break;
}
}
TRequestStatus* status = &aStatus;
User::RequestComplete(status, completionCode);
return KErrNone;
}
示例9: PositionInfo
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);
}
}
示例10: CompleteRequest
void CNetworkPsy2::CompleteRequestByDefault()
{
if(!iRequestStatus)
{
return;
}
if(iPositionInfoBase->PositionClassType() & EPositionInfoClass)
{
TPositionInfo* posInfo = static_cast<TPositionInfo*>(iPositionInfoBase);
TPosition pos;
pos.SetCoordinate(1.0, 1.0, 1.0);
pos.SetAccuracy(1.0, 1.0);
posInfo->SetPosition(pos);
}
CompleteRequest(KErrNone);
}
示例11: GetLastKnownPosition
EXPORT_C void RLbsLocMonitorAreaPositioner::GetLastKnownPosition(TPositionInfoBase& aPosInfo,
TRequestStatus& aStatus) const
{
const_cast<RLbsLocMonitorAreaPositioner*>(this)->SetLKPosRequestStatus(&aStatus);
aStatus = KRequestPending;
TPositionInfo& posinfo = reinterpret_cast<TPositionInfo &>(aPosInfo);
TReal64 testlatitude,testlongitude, testaltitude;
testlatitude = 51.88; testlongitude = 0.45; testaltitude = 0.0;
TPosition testpos;
testpos.SetCoordinate(DUMMY_LAST_KNOWN_POS_LATITUDE1, DUMMY_LAST_KNOWN_POS_LONGITUDE1, DUMMY_LAST_KNOWN_POS_ALTITUDE1);
posinfo.SetPosition(testpos);
// as CPeriodic class is used, a higher value of interval ensures we do not receive
// multiple callbacks [we would like to complete the timer after the first callback].
TTimeIntervalMicroSeconds32 delay, interval;
delay = 2000000; //2 sec
interval = 100000000;
// Modify the behaviour of the Location Monitor based on the testcase using the value of the
// property
TInt testcase, propRead;
propRead = iTestLKPosKey.Get(KLocSrvTestSuite, KLbsLocMonitorTestLKPosKey,testcase);
if (propRead==KErrNone)
{
switch(testcase)
{
case EGetLKPosNotFound:
{
TRequestStatus* pStat = &aStatus;
User::RequestComplete(pStat, KErrNotFound);
return;
}
case EGetLKPosTimedOut:
delay = 1000000000;;
break;
default:
break;
}
}
iDelayedLKPosUpdate->Start(delay, interval, TCallBack(LKPosTimerCallback, const_cast<RLbsLocMonitorAreaPositioner*>(this)));
}
示例12: CheckPositionInfoL
void CTriggerFireObserver::CheckPositionInfoL( const TLbtTriggerFireInfo& aFireInfo )
{
TPositionInfo posInfo= aFireInfo.iFiredPositionInfo;
TPosition pos;
posInfo.GetPosition(pos);
TCoordinate firedinfo( pos.Latitude(),pos.Longitude());
TReal32 distance;
firedinfo.Distance( iCoordinate,distance);
if( distance<=iRadiusInMetres )
{
User::Leave(KErrGeneral);
}
}
示例13: switch
// ---------------------------------------------------------
// CTestPsy4Positioner::NotifyPositionUpdate
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsTestProxyPsy5Positioner::NotifyPositionUpdate(TPositionInfoBase& aPosInfo, TRequestStatus& aStatus)
{
TPositionInfo* posInfo = static_cast<TPositionInfo*> (&aPosInfo);
TPosition pos;
pos.SetCoordinate(99, 99, 99);
posInfo->SetPosition(pos);
TUint32 request = posInfo->UpdateType();
switch (request)
{
case 304:
iRequestHandler->SetErrorCode(KErrNone);
break;
default:
iRequestHandler->SetErrorCode(KErrUnknown);
break;
}
iRequestHandler->NotifyPositionUpdate(posInfo, &aStatus);
}
示例14: INFO_PRINTF1
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();
}
示例15: empty
EXPORT_C void T_LbsUtils::GetConfigured_PosInfosL(const TDesC& aConfigFileName, const TDesC& aConfigSection, RPointerArray<TAny>& aPosInfoArr)
/** Fills a position info array with values read from a configuration ini file.
@param aConfigFileName The name of the ini file to read. If the file name is empty (0 length) then
the array will contain a single pos info item with default values.
@param aConfigSection The section within the ini file to read data from.
@param aPosInfoArr The pos info array to which the items are added. The array will cleared of
existing items.
*/
{
// Clear array.
ResetAndDestroy_PosInfoArr(aPosInfoArr);
// Check for config file, if not present create a single default TPositionInfo.
if (aConfigFileName.Length() == 0)
{
TPositionSatelliteInfo* posInfo = new(ELeave) TPositionSatelliteInfo();
TPosition position;
position.SetCoordinate(DEFAULT_NOTIFY_POS_UPDATE_LATITUDE, DEFAULT_NOTIFY_POS_UPDATE_LONGITUDE, DEFAULT_NOTIFY_POS_UPDATE_ALTITUDE);
position.SetAccuracy(DEFAULT_NOTIFY_POS_UPDATE_HORIZONTAL_ACCURACY, DEFAULT_NOTIFY_POS_UPDATE_VERTICAL_ACCURACY);
position.SetCurrentTime();
posInfo->SetPosition(position);
User::LeaveIfError(aPosInfoArr.Append(posInfo));
}
else
{
CPosInfoConfigReader* reader;
reader = CPosInfoConfigReader::NewL(aConfigFileName, aConfigSection, aPosInfoArr);
CleanupStack::PushL(reader);
reader->ProcessL();
CleanupStack::PopAndDestroy(reader);
}
}