// --------------------------------------------------------------------------- // TIap::ResolveIapL // --------------------------------------------------------------------------- // TInt TIap::ResolveIapL( RArray<TIap>& aIapArray ) { RDebug::Print( _L("TEST PRINT: CTestAppConsole::ResolveIapL -start\n") ); TBuf<40> name; TUint32 iapid; CCommsDatabase* db = CCommsDatabase::NewL( EDatabaseTypeIAP ); CleanupStack::PushL( db ); CCommsDbTableView* view = db->OpenTableLC( TPtrC( IAP ) ); TInt res = view->GotoFirstRecord(); if ( res != KErrNone ) { CleanupStack::PopAndDestroy( 2 ); // db, view RDebug::Print( _L("TEST PRINT: CTestAppConsole::ResolveIapL -end err: %d\n"), res ); return res; } while ( res == KErrNone ) { view->ReadTextL( TPtrC( COMMDB_NAME ), name ); view->ReadUintL( TPtrC( COMMDB_ID ), iapid ); aIapArray.AppendL( TIap( iapid, name ) ); res = view->GotoNextRecord(); } CleanupStack::PopAndDestroy( 2 ); // db, view RDebug::Print( _L("TEST PRINT: CTestAppConsole::ResolveIapL -end" ) ); return KErrNone; }
// ----------------------------------------------------------------------------- // CCommsDatEnforcement::LockWLANAccessPointsL() // ----------------------------------------------------------------------------- // void CCommsDatEnforcement::LockWLANAccessPointsL( TBool aLockValue ) { RDEBUG_2("CCommsDatEnforcement::LockAccessPoint( %d )", aLockValue ); //Get WLAN service table and get ServiceID--> which is nothing but IAP ID and lock that record //TBool ret = EFalse; TUint32 apIAPID = 0; CCommsDbTableView* checkView; CCommsDatabase* commsDataBase = CCommsDatabase::NewL(); CleanupStack::PushL( commsDataBase ); checkView = commsDataBase->OpenTableLC(TPtrC(IAP)); RDEBUG(" -> After opening IAP table "); TBuf<KCommsDbSvrMaxFieldLength> serviceType; TInt error = checkView->GotoFirstRecord(); RDEBUG(" -> After going to first record "); while (error == KErrNone) { RDEBUG(" -> KERRNONE "); // Get the ID and check for service type checkView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); if(serviceType == TPtrC(LAN_SERVICE)) { checkView->ReadUintL(TPtrC(COMMDB_ID), apIAPID); RDEBUG_2(" ->found %d WLAN AP. being protected or unprotected", apIAPID ); if(aLockValue) { ((CCommsDbProtectTableView*)checkView)->ProtectRecord(); RDEBUG(" -> WLAN AP protected successfully!"); } else { ((CCommsDbProtectTableView*)checkView)->UnprotectRecord(); RDEBUG(" -> WLAN AP UN protected successfully!"); } } error = checkView->GotoNextRecord(); } CleanupStack::PopAndDestroy(); // checkView CleanupStack::PopAndDestroy( commsDataBase ); }
void CSymTorrentIAPSelectView::GetGPRSIAPsFromIAPTableL() { TBuf<52> iapfromtable; TBuf<53> listItem; TInt err = KErrNone; CCommsDatabase* commsDB = CCommsDatabase::NewL(EDatabaseTypeIAP); CleanupStack::PushL(commsDB); // Open IAP table using the GPRS as the bearer. CCommsDbTableView* gprsTable = commsDB->OpenIAPTableViewMatchingBearerSetLC(ECommDbBearerGPRS, ECommDbConnectionDirectionOutgoing); // Point to the first entry User::LeaveIfError(gprsTable->GotoFirstRecord()); gprsTable->ReadTextL(TPtrC(COMMDB_NAME), iapfromtable); listItem.SetLength(0); listItem.Append(_L("\t")); listItem.Append(iapfromtable); iContainer->AppendItemL(listItem); TUint32 id; gprsTable->ReadUintL(TPtrC(COMMDB_ID), id); User::LeaveIfError(iIAPIDs.Append(id)); while (err = gprsTable->GotoNextRecord(), err == KErrNone) { gprsTable->ReadTextL(TPtrC(COMMDB_NAME), iapfromtable); listItem.SetLength(0); listItem.Append(_L("\t")); listItem.Append(iapfromtable); iContainer->AppendItemL(listItem); TUint32 id; gprsTable->ReadUintL(TPtrC(COMMDB_ID), id); User::LeaveIfError(iIAPIDs.Append(id)); } CleanupStack::PopAndDestroy(); // gprsTable CleanupStack::PopAndDestroy(); // commsDB }
EXPORT_C void CPodcastModel::UpdateIAPListL() { iIapNameArray->Reset(); iIapIdArray.Reset(); CCommsDbTableView* table = iCommDB->OpenTableLC (TPtrC (IAP)); TInt ret = table->GotoFirstRecord (); TPodcastIAPItem IAPItem; TBuf <KCommsDbSvrMaxFieldLength> bufName; while (ret == KErrNone) // There was a first record { table->ReadUintL(TPtrC(COMMDB_ID), IAPItem.iIapId); table->ReadTextL (TPtrC(COMMDB_NAME), bufName); table->ReadTextL (TPtrC(IAP_BEARER_TYPE), IAPItem.iBearerType); table->ReadTextL (TPtrC(IAP_SERVICE_TYPE), IAPItem.iServiceType); iIapIdArray.Append(IAPItem); iIapNameArray->AppendL(bufName); ret = table->GotoNextRecord(); } CleanupStack::PopAndDestroy(); // Close table }
// ----------------------------------------------------------------------------- // COMASuplSettings::ConvertIAPNameToIdL // // ----------------------------------------------------------------------------- TBool COMASuplSettings::ConvertIAPNameToIdL(const TDesC& aIAPName, TUint32& aIAPId) { TBool result = EFalse; CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP); CleanupStack::PushL(commDb); CCommsDbTableView* tableView = commDb->OpenIAPTableViewMatchingBearerSetLC(ECommDbBearerCSD|ECommDbBearerGPRS, ECommDbConnectionDirectionOutgoing); TInt retval = tableView->GotoFirstRecord(); while ((retval == KErrNone) && (!result)) { HBufC * iap_name = tableView->ReadLongTextLC( TPtrC( COMMDB_NAME) ); if (iap_name && (iap_name->Compare(aIAPName) == 0)) { tableView->ReadUintL(TPtrC(COMMDB_ID), aIAPId); result = ETrue; } CleanupStack::PopAndDestroy(); // iap_name retval = tableView->GotoNextRecord(); } CleanupStack::PopAndDestroy(2);//delete tableView and commDb return result; }
QList<XQAccessPoint> XQAccessPointManagerPrivate::accessPointsL() const { QList<XQAccessPoint> aps; XQAccessPoint ap; //open internet accesspoint table CCommsDbTableView* pDbTView = ipCommsDB->OpenTableLC(TPtrC(IAP)); // Loop through all IAPs TUint32 apId = 0; TInt retVal = pDbTView->GotoFirstRecord(); while (retVal == KErrNone) { pDbTView->ReadUintL(TPtrC(COMMDB_ID), apId); ap = accessPointById(apId); if (!ap.isNull()) { aps << ap; } retVal = pDbTView->GotoNextRecord(); } CleanupStack::PopAndDestroy(pDbTView); return aps; }
bool GetProxy( char*& aHost, uint32& aPort, const int32 aIAP ) { # ifdef NAV2_CLIENT_SERIES60_V2 CCommsDatabase * comdb = CCommsDatabase::NewL(); # else CCommsDatabase * comdb = CCommsDatabase::NewL( EDatabaseTypeUnspecified ); # endif CleanupStack::PushL( comdb ); // First get the IAP CCommsDbTableView* iaptable = comdb->OpenViewMatchingUintLC( TPtrC( IAP ), TPtrC( COMMDB_ID ), aIAP ); TInt iapres = iaptable->GotoFirstRecord(); bool found = false; if ( iapres == KErrNone ) { HBufC* iap_name = iaptable->ReadLongTextLC( TPtrC( COMMDB_NAME) ); uint32 iap_service = 0; iaptable->ReadUintL( TPtrC( IAP_SERVICE ), iap_service ); // The current IAP exists! HBufC* iap_type = iaptable->ReadLongTextLC( TPtrC( IAP_SERVICE_TYPE ) ); // Find Proxy for ISP (and same service type) CCommsDbTableView* proxytable = comdb->OpenViewMatchingUintLC( TPtrC( PROXIES ), TPtrC( PROXY_ISP ), iap_service ); TInt dretval= proxytable->GotoFirstRecord(); while ( dretval == KErrNone && !found ) { // Check if matching proxy service type HBufC* proxy_service_type = proxytable->ReadLongTextLC( TPtrC( PROXY_SERVICE_TYPE ) ); if ( proxy_service_type != NULL && proxy_service_type->CompareC( *iap_type ) == 0 ) { // Match! // PROXY_USE_PROXY_SERVER TBool proxy_use_proxy_server = 0; proxytable->ReadBoolL( TPtrC( PROXY_USE_PROXY_SERVER ), proxy_use_proxy_server ); # ifdef NAV2_CLIENT_SERIES60_V2 if ( proxy_use_proxy_server ) { # endif // PROXY_SERVER_NAME - Name of the proxy server HBufC* proxy_server_name = proxytable->ReadLongTextLC( TPtrC( PROXY_SERVER_NAME ) ); if ( proxy_server_name ) { found = true; // Convert to something we can use. aHost = WFTextUtil::TDesCToUtf8L( proxy_server_name->Des() ); proxytable->ReadUintL( TPtrC( PROXY_PORT_NUMBER ), aPort ); // Sanity on port if ( aPort == 9201 ) { // We don't talk wap // XXX: Or no proxy at all? aPort = 8080; } else if ( aPort == 0 ) { // Not valid => no proxy found = false; delete [] aHost; aHost = NULL; } } // End if have proxy_server_name CleanupStack::PopAndDestroy( proxy_server_name ); # ifdef NAV2_CLIENT_SERIES60_V2 } // End if proxy_use_proxy_server is true # endif } // End if service type matches CleanupStack::PopAndDestroy( proxy_service_type ); dretval = proxytable->GotoNextRecord(); // next proxy } // End while all proxies // XXX: Perhaps "IAP_SERVICE_TYPE" table -> [GPRS|ISP]_IP_GATEWAY // especially in s60v1 CleanupStack::PopAndDestroy( proxytable ); CleanupStack::PopAndDestroy( iap_type ); CleanupStack::PopAndDestroy( iap_name ); } // End if the current IAP is found CleanupStack::PopAndDestroy( iaptable ); CleanupStack::PopAndDestroy( comdb ); return found; }
TInt CConnectionManager::SelectIAP() { CArrayFixFlat<TIapData>* iEApList=new (ELeave) CArrayFixFlat<TIapData>(2) ; TInt stack=0; // Make listitems. and PUSH it CAknSinglePopupMenuStyleListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL(list); stack++; // Create popup list and PUSH it. CAknPopupList* popupList = CAknPopupList::NewL(list, R_AVKON_SOFTKEYS_OK_CANCEL, AknPopupLayouts::EMenuWindow); CleanupStack::PushL(popupList);stack++; CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat(5); CleanupStack::PushL(items);stack++; // initialize listbox. list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); TBuf<52> iapfromtable; TInt err = KErrNone; CCommsDatabase* iCommsDB=CCommsDatabase::NewL(EDatabaseTypeIAP); CleanupStack::PushL(iCommsDB);stack++; #ifdef __SERIES60_3X__ CCommsDbTableView* gprsTable = iCommsDB->OpenIAPTableViewMatchingBearerSetLC( iBearerFilter == EApBearerTypeWLAN ? ECommDbBearerWLAN : ECommDbBearerGPRS|ECommDbBearerWLAN|ECommDbBearerVirtual, ECommDbConnectionDirectionOutgoing); #else CCommsDbTableView* gprsTable = iCommsDB->OpenIAPTableViewMatchingBearerSetLC( ECommDbBearerGPRS|ECommDbBearerVirtual, ECommDbConnectionDirectionOutgoing); #endif User::LeaveIfError(gprsTable->GotoFirstRecord()); TInt i=0; TUint32 id; TIapData eap; TInt cur =0; //current value do { gprsTable->ReadTextL(TPtrC(COMMDB_NAME), iapfromtable); gprsTable->ReadUintL(TPtrC(COMMDB_ID), id); items->AppendL(iapfromtable); eap.iIap = id; eap.iName.Copy(iapfromtable); iEApList->AppendL(eap); err = gprsTable->GotoNextRecord(); i++; } while (err == KErrNone); CleanupStack::PopAndDestroy(2); stack--; // Set listitems. CTextListBoxModel* model = list->Model(); model->SetItemTextArray(items); model->SetOwnershipType(ELbmOwnsItemArray); CleanupStack::Pop(); popupList->SetTitleL(_L("Access Point")); list->SetListBoxObserver(popupList); TInt popupOk = popupList->ExecuteLD(); CleanupStack::Pop(); TInt iap=0; if (popupOk) { TInt index = list->CurrentItemIndex(); iap=(*iEApList)[index].iIap; } CleanupStack::PopAndDestroy(); iEApList->Reset(); delete iEApList; return iap; }
void CIAPSettingItem::CompleteConstructionL() { _LIT(KmRouter, "mroute"); CArrayPtr<CAknEnumeratedText> * iaps = new(ELeave) CArrayPtrSeg<CAknEnumeratedText>(10); CleanupStack::PushL(iaps); CArrayPtr<HBufC> * poppedUp = new(ELeave) CArrayPtrSeg<HBufC>(10); CleanupStack::PushL(poppedUp); CAknEnumeratedTextPopupSettingItem::CompleteConstructionL(); // The selection of IAP that indicates "always ask" HBufC * buf; buf = CEikonEnv::Static()->AllocReadResourceL( R_SETTINGS_IAP_ALWAYS_ASK ); iaps->AppendL(new(ELeave) CAknEnumeratedText(-1, buf )); // The selection of IAP that indicates "system default is only shown in // development mode, not in release mode. if ( ! iRelease ) { buf = CEikonEnv::Static()->AllocReadResourceL( R_SETTINGS_IAP_SYSTEM_DEFAULT ); iaps->AppendL(new(ELeave) CAknEnumeratedText(-2, buf )); } #ifdef NAV2_CLIENT_SERIES60_V2 CCommsDatabase * comdb = CCommsDatabase::NewL(); #else CCommsDatabase * comdb = CCommsDatabase::NewL(EDatabaseTypeUnspecified); #endif CleanupStack::PushL(comdb); CCommsDbTableView * iaptable = comdb->OpenTableLC( TPtrC( IAP ) ); TInt retval; retval = iaptable->GotoFirstRecord(); // display all IAPs except mrouter while (retval == KErrNone) { HBufC * iap_name = iaptable->ReadLongTextLC( TPtrC( COMMDB_NAME) ); if ( KErrNotFound == iap_name->FindF(KmRouter) ) { TUint32 iap_id; iaptable->ReadUintL( TPtrC( COMMDB_ID), iap_id ); iaps->AppendL(new(ELeave) CAknEnumeratedText(iap_id, iap_name )); } CleanupStack::Pop(iap_name); // FIXME - Is this right? Does AppendL take over ownership of the iap name? retval = iaptable->GotoNextRecord(); } CleanupStack::PopAndDestroy(iaptable); CleanupStack::PopAndDestroy(comdb); SetEnumeratedTextArrays(iaps, poppedUp); CleanupStack::Pop(poppedUp); CleanupStack::Pop(iaps); // Does the (old) specified iap still exist? Default to // "always ask" otherwise. if (IndexFromValue(ExternalValue()) < 0) { SetInternalValue(-1); SetExternalValue(-1); } }