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); }
void CTTGPSLoggerPositioningMethod::EditItemL(TBool aCalledFromMenu) // edit text { CDesC16ArrayFlat *itemArray = new (ELeave) CDesC16ArrayFlat(20); CDesC16ArrayFlat *itemArrayDetails = new (ELeave) CDesC16ArrayFlat(20); CleanupStack::PushL(itemArray); // in case the appends leave CleanupStack::PushL(itemArrayDetails); // in case the appends leave RPositionServer iPositionServer; RPositioner iPositioner; User::LeaveIfError(iPositionServer.Connect()); User::LeaveIfError(iPositioner.Open(iPositionServer)); itemArray->AppendL(_L("(Info on all modules)")); itemArray->AppendL(_L("(Default)")); TUint aModules = 0; TInt defaultModule=-1; // Get the available numbers of modules User::LeaveIfError(iPositionServer.GetNumModules(aModules)); TPositionModuleInfo info; TPositionModuleId aModuleId; iPositionServer.GetDefaultModuleId(aModuleId); // Prepare itemArray and itemArrayDetails for(TUint i = 0; i < aModules; i++) { if ((iPositionServer.GetModuleInfoByIndex(i,info) == KErrNone) && (info.IsAvailable())) { TBuf<200> smallBuffer; smallBuffer.Zero(); info.GetModuleName(smallBuffer); itemArray->AppendL(smallBuffer); TBuf<200> buffer; buffer.Zero(); info.GetModuleName(buffer); buffer.Append(_L(" (")); if (info.DeviceLocation() & TPositionModuleInfo::EDeviceExternal) buffer.Append(_L("External ")); if (info.DeviceLocation() & TPositionModuleInfo::EDeviceInternal) buffer.Append(_L("Internal ")); if (info.DeviceLocation() & TPositionModuleInfo::EDeviceUnknown) buffer.Append(_L("Unknown ")); if (info.TechnologyType()& TPositionModuleInfo::ETechnologyAssisted) buffer.Append(_L("Assisted ")); if (info.TechnologyType()& TPositionModuleInfo::ETechnologyTerminal) buffer.Append(_L("GPS, ")); if (info.TechnologyType()& TPositionModuleInfo::ETechnologyNetwork) buffer.Append(_L("Network, ")); if (info.TechnologyType()& TPositionModuleInfo::ETechnologyUnknown) buffer.Append(_L("Unknown tech, ")); if (buffer.Mid(buffer.Length()-2, 2).Compare( _L(", ")) == KErrNone) buffer.Replace(buffer.Length()-2, 2, _L(")")); if (buffer.Mid(buffer.Length()-1, 1).Compare( _L(" ")) == KErrNone) buffer.Replace(buffer.Length()-1, 1, _L(")")); if ( info.ModuleId() == aModuleId) { buffer.Append(_L(" [Default]")); defaultModule=i; } itemArrayDetails->AppendL(buffer); } } iPositioner.Close(); iPositionServer.Close(); // Present list of positioning methods TInt selectIndex; selectIndex=iPosMethod+1; HBufC* title = NULL; title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_DIALOG_POSITIONING_TITLE); // Select positioning method: CAknListQueryDialog* dialog = new (ELeave) CAknListQueryDialog(&selectIndex); dialog->PrepareLC(R_TTGP_DIALOG_LISTQUERY); dialog->QueryHeading()->SetTextL(*title); dialog->SetItemTextArray(itemArray); dialog->SetOwnershipType(ELbmDoesNotOwnItemArray); TInt answer = dialog->RunLD(); CleanupStack::PopAndDestroy(); // title // Check answer if (answer) { if (selectIndex==0) // (Info on all modules) { TBuf<1000> aText; aText.Zero(); for (TInt i=0;i<itemArrayDetails->Count();i++) { aText.AppendFormat(_L("%d. "), i+1); aText.Append(itemArrayDetails->MdcaPoint(i)); if (i<itemArrayDetails->Count()-1) aText.Append(_L("\n")); } HBufC* title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_AVAILABLEPOSITIONING_TITLE); // Available modules: CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog(); CleanupStack::PushL(dialog); dialog->PrepareLC(R_TTGP_DIALOG_MESSAGEQUERY_OK); dialog->QueryHeading()->SetTextL(*title); dialog->SetMessageTextL(aText); CleanupStack::Pop(); // dialog dialog->RunLD(); CleanupStack::PopAndDestroy(); // title } else if (selectIndex==1) // Default module { if (defaultModule>-1) { // Present default module name HBufC* title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_SELECTEDPOSITIONING_TITLE); // Selected module: CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog(); CleanupStack::PushL(dialog); dialog->PrepareLC(R_TTGP_DIALOG_MESSAGEQUERY_OK); dialog->QueryHeading()->SetTextL(*title); dialog->SetMessageTextL(itemArrayDetails->MdcaPoint(defaultModule)); CleanupStack::Pop(); // dialog dialog->RunLD(); CleanupStack::PopAndDestroy(); // title } iPosMethod=0; // default module selected C_APPUI->Engine()->Requester()->SetPositioningMethod(iPosMethod); C_APPUI->Engine()->Requester()->StartL(); } else if (selectIndex>1) // Custom selection of the module { HBufC* title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_SELECTEDPOSITIONING_TITLE); // Selected module: CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog(); CleanupStack::PushL(dialog); dialog->PrepareLC(R_TTGP_DIALOG_MESSAGEQUERY_OK); dialog->QueryHeading()->SetTextL(*title); dialog->SetMessageTextL(itemArrayDetails->MdcaPoint(selectIndex-2)); CleanupStack::Pop(); // dialog dialog->RunLD(); CleanupStack::PopAndDestroy(); // title iPosMethod=selectIndex-1; C_APPUI->Engine()->Requester()->SetPositioningMethod(iPosMethod); C_APPUI->Engine()->Requester()->StartL(); } UpdateListBoxTextL(); } CleanupStack::PopAndDestroy(); // itemArrayDetails CleanupStack::PopAndDestroy(); // itemArray }