本文整理汇总了C++中TPosition::SetCoordinate方法的典型用法代码示例。如果您正苦于以下问题:C++ TPosition::SetCoordinate方法的具体用法?C++ TPosition::SetCoordinate怎么用?C++ TPosition::SetCoordinate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPosition
的用法示例。
在下文中一共展示了TPosition::SetCoordinate方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2:
// ---------------------------------------------------------
// 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);
}
示例3: 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();
}
示例4: 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);
}
示例5: 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)));
}
示例6: 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);
}
示例7: GetConfigured_PosInfosL
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);
}
}
示例8:
void CLcfPsyDummy1::GetBasicPositionInfoL(TPositionInfoBase& aPosInfo)
{
// The position info object is at least a TPositionInfo
TPositionInfo* posInfo =
static_cast<TPositionInfo*>(&aPosInfo);
TPosition pos;
// Calculate the position and fill in the position info
// object
// Latitude, Longtitude, altitude
pos.SetCoordinate(57.1, 11.3, 32.5);
// set horizontal and vertical accuracy
pos.SetAccuracy(40.0, 40.0);
// set time of fix
pos.SetCurrentTime();
// Set position in position info.
posInfo->SetPosition(pos);
// Set the implementation uid
posInfo->SetModuleId(ImplementationUid());
}
示例9:
void CLcfPsyDummy3::GetBasicPositionInfoL(TPositionInfoBase& aPosInfo)
{
// The position info object is at least a TPositionInfo
TPositionInfo* posInfo =
static_cast<TPositionInfo*>(&aPosInfo);
TPosition pos;
// Calculate the position and fill in the position info
// object
pos.SetCoordinate(67.567, -12.34, 45.32);
// set horizontal and vertical accuracy
pos.SetAccuracy(150.0, 500.0);
// set time of fix
pos.SetCurrentTime();
// Set position in position info.
posInfo->SetPosition(pos);
// Set the implementation uid
posInfo->SetModuleId(ImplementationUid());
}
示例10: OpenFileForAppend
// ---------------------------------------------------------
// CTestPsy2Positioner::NotifyPositionUpdate
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsTestProxyPsy2Positioner::NotifyPositionUpdate(TPositionInfoBase& aPosInfo, TRequestStatus& aStatus)
{
TBuf<256> buf;
OpenFileForAppend();
_LIT(KTestProxyPsy2Positioner, " Request issued to TestProxyPsy2Positioner");
buf.Append(KTestProxyPsy2Positioner);
_LIT(KAppend, "\r");
buf.Append(KAppend);
iFileText.Write(buf);
iFile.Close();
TRequestStatus* status = &aStatus;
TPositionInfo* posInfo = static_cast<TPositionInfo*> (&aPosInfo);
TPosition pos;
pos.SetCoordinate(10, 20, 30);
posInfo->SetPosition(pos);
TUid implUid = { KPosImplementationUid };
posInfo->SetModuleId(implUid);
TUint32 request = posInfo->UpdateType();
switch (request)
{
// case 1-10 - TC269
// case 11-15 - TC270
// case 21-26 - TC271
case 1:
case 5:
case 12:
case 13:
case 14:
case 21:
case 23:
case 24:
User::RequestComplete( status, KPositionPartialUpdate);
break;
case 2:
case 3:
case 4:
case 11:
case 15:
case 22:
User::RequestComplete( status, KErrLocked);
break;
case 6:
case 9:
case 10:
case 25:
User::RequestComplete( status, KErrDied);
break;
case 7:
case 8:
case 26:
User::RequestComplete( status, KErrBadPower);
break;
case 4701:
iRequestHandler->SetErrorCode(KErrNone);
iRequestHandler->SetTimerDelay(2000000);
iRequestHandler->NotifyPositionUpdate(posInfo, status);
break;
case 4702:
iRequestHandler->SetErrorCode(KErrNone);
iRequestHandler->SetTimerDelay(3000000);
iRequestHandler->NotifyPositionUpdate(posInfo, status);
break;
case 4703:
iRequestHandler->SetErrorCode(KErrNone);
iRequestHandler->SetTimerDelay(2000000);
iRequestHandler->NotifyPositionUpdate(posInfo, status);
break;
case 4704:
iRequestHandler->SetErrorCode(KErrNone);
iRequestHandler->SetTimerDelay(3000000);
iRequestHandler->NotifyPositionUpdate(posInfo, status);
break;
case 4708:
case 304:
iRequestHandler->SetErrorCode(KErrNone);
iRequestHandler->SetTimerDelay(1000000); // 1 second
iRequestHandler->NotifyPositionUpdate(posInfo, status);
break;
case 100:
iRequestHandler->ReportStatus(
TPositionModuleStatus::EDeviceInitialising,
TPositionModuleStatus::EDataQualityUnknown);
User::RequestComplete( status, KErrNone );
break;
case 200:
iRequestHandler->ReportStatus(
TPositionModuleStatus::EDeviceActive,
TPositionModuleStatus::EDataQualityUnknown);
//.........这里部分代码省略.........
示例11: ProcessNetworkLocationMessage
void CNetworkGateway::ProcessNetworkLocationMessage(const TLbsNetLocMsgBase& aMessage)
{
LBSLOG(ELogP2, "CNetworkGateway::ProcessNetworkLocationMessage:");
LBSLOG2(ELogP3, "Type : %d", aMessage.Type());
switch (aMessage.Type())
{
case TLbsNetLocMsgBase::ENetLocMsgNetworkLocationRequest:
{
TInt reason = KErrNone;
const TLbsNetLocNetworkLocationRequestMsg& req = static_cast<const TLbsNetLocNetworkLocationRequestMsg&>(aMessage);
iCurrentNetLocReqId = req.SessionId();
if (req.Quality().MaxFixTime() == 0)//answer req with incorrect session id
{
iCurrentNetLocReqId.SetSessionNum(999);
TLbsNetLocNetworkLocationCompleteMsg msg(iCurrentNetLocReqId, reason);
iNetworkLocationChannel->SendNetworkLocationMessage(msg);
}
else if (req.Quality().MaxFixTime() == 1)//answer req with unknown response type
{
TLbsNetLocNetworkLocationCancelMsg msg(iCurrentNetLocReqId, reason);
iNetworkLocationChannel->SendNetworkLocationMessage(msg);
}
else
{
TLbsNetLocNetworkLocationCompleteMsg msg(iCurrentNetLocReqId, reason);
iNetworkLocationChannel->SendNetworkLocationMessage(msg);
}
// for testing return a fixed test location
TPositionCourseInfo posInfo;
TPosition pos;
pos.SetCoordinate(50, 80);
posInfo.SetPosition(pos);
TCourse course;
course.SetSpeed(10.0);
course.SetVerticalSpeed(20.0);
course.SetHeading(30.0);
course.SetSpeedAccuracy(1.0);
course.SetVerticalSpeedAccuracy(2.0);
course.SetHeadingAccuracy(3.0);
course.SetCourse(40.0);
course.SetCourseAccuracy(4.0);
posInfo.SetCourse(course);
iNetworkLocationChannel->SetReferencePosition(iCurrentNetLocReqId, posInfo);
break;
}
case TLbsNetLocMsgBase::ENetLocMsgNetworkLocationCancel:
{
const TLbsNetLocNetworkLocationCancelMsg& cancel = static_cast<const TLbsNetLocNetworkLocationCancelMsg&>(aMessage);
// for test netlocmanager, return the location info directly without sending request to network protocol
iCurrentNetLocReqId = cancel.SessionId();
TInt reason = KErrNone;
TLbsNetLocNetworkLocationCompleteMsg msg(iCurrentNetLocReqId, reason);
iNetworkLocationChannel->SendNetworkLocationMessage(msg);
break;
}
case TLbsNetLocMsgBase::ENetLocMsgNetworkLocationComplete:
default:
{
break;
}
}
}
示例12: GetLastKnownPositionArea
EXPORT_C void RLbsLocMonitorAreaPositioner::GetLastKnownPositionArea(TPositionInfoBase& aPosInfo,
TPositionAreaInfoBase& aAreaInfo,
const TPosAreaReqParams& aParameters,
TRequestStatus& aStatus)const
{
const_cast<RLbsLocMonitorAreaPositioner*>(this)->SetLKPARequestStatus(&aStatus);
aStatus = KRequestPending;
// Return a dummy area info
switch(aParameters.iPositionAreaType)
{
case EPositionAreaInfoClass:
{
TPositionAreaInfo& areainfo = static_cast<TPositionAreaInfo &>(aAreaInfo);
areainfo.SetArea(TPositionAreaInfo::EAreaCity);
break;
}
case (EPositionAreaExtendedInfoClass+EPositionAreaInfoClass):
{
TPositionAreaExtendedInfo& areaextendedinfo = static_cast<TPositionAreaExtendedInfo &>(aAreaInfo);
areaextendedinfo.SetArea(TPositionAreaInfo::EAreaCity);
areaextendedinfo.SetCellIdMatch(ETrue);
areaextendedinfo.SetLocationAreaCodeMatch(ETrue);
areaextendedinfo.SetMobileCountryCodeMatch(ETrue);
areaextendedinfo.SetMobileNetworkCodeMatch(ETrue);
break;
}
}
// Return a dummy position
TPositionInfo& posinfo = static_cast<TPositionInfo &>(aPosInfo);
TPosition testpos;
testpos.SetCoordinate(DUMMY_LAST_KNOWN_POS_LATITUDE1, DUMMY_LAST_KNOWN_POS_LONGITUDE1, DUMMY_LAST_KNOWN_POS_ALTITUDE1);
posinfo.SetPosition(testpos);
// The values used in the timer for delaying the response from the test location monitor
// to the location server
TTimeIntervalMicroSeconds32 delay, interval;
delay = 2000000; //2 sec
interval = 100000000;
// 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].
// Modify the behaviour of the Location Monitor based on the testcase using the value of the
// property
TInt testcase, propRead;
propRead = iTestLKPAreaKey.Get(KLocSrvTestSuite, KLbsLocMonitorTestLKPAreaKey,testcase);
if (propRead==KErrNone)
{
switch(testcase)
{
case EGetLKPosAreaNotFound:
{
TRequestStatus* pStat = &aStatus;
User::RequestComplete(pStat, KErrNotFound);
return;
}
case EGetLKPAreaTimedOut:
delay = 1000000000;;
break;
default:
break;
}
}
iDelayedLKPAreaUpdate->Start(delay, interval, TCallBack(LKPATimerCallback, const_cast<RLbsLocMonitorAreaPositioner*>(this)));
}
示例13: GetPosition
/*
This method returns a position and area info to the client.
*/
TInt RLbsLocMonitorDb::GetPosition(TPosition& aPosition, const RPointerArray<TLbsLocMonitorAreaInfoBase>& /*aAreaInfo*/, TPositionAreaExtendedInfo& aMatchingAreaInfo, TRequestStatus& aStatus)
{
LBSLOG(ELogP1, "RLbsLocMonitorDb::GetPosition()");
TInt completionCode = KErrNone;
aStatus = KRequestPending;
iCallCount ++;
if (iFailNextRequest)
{
completionCode = KErrNotFound;
iFailNextRequest = EFalse;
}
else if(iShortDelayNextRequest || iLongDelayNextRequest)
{
// Remember client request's return params and
// force a delay.
iClientPosition = &aPosition;
iClientMatchAreaInfo = &aMatchingAreaInfo;
iClientStatus = &aStatus;
if (!iTimer->IsActive())
{
TInt delayInMicroSecs = iLongDelayNextRequest?15000000:1000000; // 1 or 15 seconds
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(KLatGetPos1, KLongGetPos1);
// Set a match level as if it was found in the DB
aMatchingAreaInfo.SetArea(TPositionAreaInfo::EAreaCity);
aMatchingAreaInfo.SetMobileCountryCodeMatch(ETrue);
aMatchingAreaInfo.SetMobileNetworkCodeMatch(ETrue);
aMatchingAreaInfo.SetLocationAreaCodeMatch(ETrue);
aMatchingAreaInfo.SetCellIdMatch(ETrue);
break;
// Return different values for second and later requests
// that occurred in the same test.
default:
aPosition.SetCoordinate(KLatGetPos2, KLongGetPos2);
// Set a match level as if it was found in the DB
aMatchingAreaInfo.SetArea(TPositionAreaInfo::EAreaCountry);
aMatchingAreaInfo.SetMobileCountryCodeMatch(ETrue);
aMatchingAreaInfo.SetMobileNetworkCodeMatch(EFalse);
aMatchingAreaInfo.SetLocationAreaCodeMatch(EFalse);
aMatchingAreaInfo.SetCellIdMatch(EFalse);
break;
}
}
TRequestStatus* status = &aStatus;
User::RequestComplete(status, completionCode);
return KErrNone;
}
示例14: nmeaPtr
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();
}