// --------------------------------------------------------- // CT_LbsClientPosTp76::CheckModuleInfoL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp76::CheckModuleInfoL(const TPositionModuleInfo& dbInfo, const TPositionModuleInfo& clientInfo) { _LIT(KNotSame, "Module Info from settings is not the same as when read by GetModuleInfoById"); if (dbInfo.IsAvailable() != clientInfo.IsAvailable() || dbInfo.ModuleId() != clientInfo.ModuleId() || dbInfo.DeviceLocation() != clientInfo.DeviceLocation() || dbInfo.Capabilities() != clientInfo.Capabilities() || dbInfo.TechnologyType() != clientInfo.TechnologyType() || dbInfo.Version().iBuild != clientInfo.Version().iBuild || dbInfo.Version().iMajor != clientInfo.Version().iMajor || dbInfo.Version().iMinor != clientInfo.Version().iMinor || dbInfo.Version().Name() != clientInfo.Version().Name() || dbInfo.ClassesSupported(EPositionInfoFamily) != clientInfo.ClassesSupported(EPositionInfoFamily)) { LogErrorAndLeaveL(KNotSame); } TPositionQuality dbQuality; TPositionQuality clientQuality; dbInfo.GetPositionQuality(dbQuality); clientInfo.GetPositionQuality(clientQuality); if (dbQuality.TimeToFirstFix() != clientQuality.TimeToFirstFix() || dbQuality.TimeToNextFix() != clientQuality.TimeToNextFix() || dbQuality.HorizontalAccuracy() != clientQuality.HorizontalAccuracy() || dbQuality.VerticalAccuracy() != clientQuality.VerticalAccuracy() || dbQuality.CostIndicator() != clientQuality.CostIndicator() || dbQuality.PowerConsumption() != clientQuality.PowerConsumption() ) { LogErrorAndLeaveL(KNotSame); } TBuf<30> name1; TBuf<30> name2; dbInfo.GetModuleName(name1); clientInfo.GetModuleName(name2); if (name1 != name2) { LogErrorAndLeaveL(KNotSame); } }
XQLocation::Error XQLocationPrivate::openConnectionToPositioner() { XQLocation::Error error = XQLocation::NoError; if (!ipPositionerObserver) { // Create Observer for PositionServer TRAPD(err, ipPositionServerObserver = CPositionServerObserver::NewL(this)); if (err != KErrNone) { return XQLocation::OutOfMemoryError; } error = ipPositionServerObserver->Init(); if (error != XQLocation::NoError) { delete ipPositionServerObserver; ipPositionServerObserver = NULL; return error; } // Create Observer for Positioner TRAP(err, ipPositionerObserver = CPositionerObserver::NewL(this)); if (err != KErrNone) { delete ipPositionServerObserver; ipPositionServerObserver = NULL; return XQLocation::OutOfMemoryError; } RPositionServer& posServer = ipPositionServerObserver->PositionServer(); error = ipPositionerObserver->Init(posServer,updateInterval); if (error != XQLocation::NoError) { delete ipPositionerObserver; ipPositionerObserver = NULL; delete ipPositionServerObserver; ipPositionServerObserver = NULL; return error; } speedAvailable = false; satelliteInfoAvailable = false; TPositionModuleInfo moduleInfo; err = posServer.GetModuleInfoById(ipPositionServerObserver->PositionModuleId(), moduleInfo); if (err == KErrNone) { TPositionModuleInfo::TCapabilities caps = moduleInfo.Capabilities(); if (caps & TPositionModuleInfo::ECapabilitySpeed) { speedAvailable = true; } if (caps & TPositionModuleInfo::ECapabilitySatellite) { satelliteInfoAvailable = true; } } } return error; }
//Initialize the posInfo with appropriate fields bool CQMLBackendAO::initializePosInfo() { #if !defined QT_NO_DEBUG qDebug() << "CQMLBackendAO::initializePosInfo\n" ; #endif if (!mPosInfo) { mPosInfo = HPositionGenericInfo::New(); if (mPosInfo == NULL) return FALSE; } else { mPosInfo->ClearRequestedFields(); mPosInfo->ClearPositionData(); } RPositionServer posServer; TPositionModuleInfo moduleInfo; TInt error = KErrNone; //get the posiiton server posServer = mRequester->getPositionServer(); //retrieve the module id used by the posiitoner if (mRequestType == RegularUpdate) error = posServer.GetModuleInfoById(mRequester->getCurrentPositonModuleID(), moduleInfo); else error = posServer.GetModuleInfoById(mRequester->getRequestUpdateModuleID(), moduleInfo); if (error == KErrNone) { //get capabilities of the module TPositionModuleInfo::TCapabilities caps = moduleInfo.Capabilities(); if (caps & TPositionModuleInfo::ECapabilitySatellite) { mPosInfo->SetRequestedField(EPositionFieldSatelliteNumInView); mPosInfo->SetRequestedField(EPositionFieldSatelliteNumUsed); } if (caps & TPositionModuleInfo::ECapabilitySpeed) { mPosInfo->SetRequestedField(EPositionFieldHorizontalSpeed); mPosInfo->SetRequestedField(EPositionFieldVerticalSpeed); } if (caps & TPositionModuleInfo::ECapabilityCompass) { mPosInfo->SetRequestedField(EPositionFieldMagneticCourseError); mPosInfo->SetRequestedField(EPositionFieldHeading); } return TRUE; } return FALSE; }
QGeoPositionInfo CPsyContainer::lastKnownPosition(bool aFromSatellitePositioningMethodsOnly) { QGeoPositionInfo posUpdate; TPosition pos; TInt error = KErrNone; RPositioner lastKnownpositioner; TRequestStatus status; error = lastKnownpositioner.Open(PosServer()); //request for lastknown position update and wait for the request to complete if (error == KErrNone) { TPositionInfo posInfo; lastKnownpositioner.SetRequestor(CRequestor::ERequestorService , CRequestor::EFormatApplication, _L("QTmobility_Location")); lastKnownpositioner.GetLastKnownPosition(posInfo, status); //Sub-optimal implementation inherited from the previous implementation //Since this is a 'once in a while' usecase, this should be ok //An optimal implementation will be much more complex and will need changes //in the symbian locaiton stack User::WaitForRequest(status); error = status.Int(); lastKnownpositioner.Close(); if ((error == KErrNone) || (error == KPositionPartialUpdate)) { TPositionModuleInfo modInfo; iPosServer.GetModuleInfoById(posInfo.ModuleId(), modInfo); if (!aFromSatellitePositioningMethodsOnly || (aFromSatellitePositioningMethodsOnly && (modInfo.Capabilities() & TPositionModuleInfo::ECapabilitySatellite))) { PsyUtils::TPositionInfo2QGeoPositionInfo(posInfo, posUpdate); } } } return posUpdate; }
EXPORT_C TBool T_LbsUtils::Compare_ModuleInfo(TPositionModuleInfo& aModInfoSideA, TPositionModuleInfo& aModInfoSideB) { // Compare all module information items and quality. // Compare module id. if (aModInfoSideA.ModuleId() != aModInfoSideB.ModuleId()) { return EFalse; } // Compare is available flag. if (aModInfoSideA.IsAvailable() != aModInfoSideB.IsAvailable()) { return EFalse; } // Compare technology type. if (aModInfoSideA.TechnologyType() != aModInfoSideB.TechnologyType()) { return EFalse; } // Compare device location. if (aModInfoSideA.DeviceLocation() != aModInfoSideB.DeviceLocation()) { return EFalse; } // Compare capabilities. if (aModInfoSideA.Capabilities() != aModInfoSideB.Capabilities()) { return EFalse; } // Compare each of the family classes. Use min and max enum values. for (TInt i = EPositionInfoFamily; i <= EPositionUpdateOptionsFamily; i++) { if (aModInfoSideA.ClassesSupported(static_cast<TPositionClassFamily>(i)) != aModInfoSideB.ClassesSupported(static_cast<TPositionClassFamily>(i))) { return EFalse; } } // Compare version. if ((aModInfoSideA.Version().iMajor != aModInfoSideB.Version().iMajor) || (aModInfoSideA.Version().iMinor != aModInfoSideB.Version().iMinor) || (aModInfoSideA.Version().iBuild != aModInfoSideB.Version().iBuild)) { return EFalse; } // Compare module name. TBuf<KPositionMaxModuleName> modNameSideA; TBuf<KPositionMaxModuleName> modNameSideB; aModInfoSideA.GetModuleName(modNameSideA); aModInfoSideB.GetModuleName(modNameSideB); if (0 != modNameSideA.Compare(modNameSideB)) { return EFalse; } // Compare module quality. TPositionQuality qualitySideA; TPositionQuality qualitySideB; aModInfoSideA.GetPositionQuality(qualitySideA); aModInfoSideB.GetPositionQuality(qualitySideB); return Compare_PositionQuality(qualitySideA, qualitySideB); }