Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Easiest way to query Access Point (IAP)

From Wiki
Jump to: navigation, search
Article Metadata
Article
Created: rathodavinash (29 Jun 2007)
Last edited: hamishwillee (23 Jul 2012)

Lots of applications need user input for the Access point to use. The easiest way to query for an IAP is as follows:

Header required:

#include <commdb.h>
#include <ApSettingsHandlerUI.h>


Link against:

LIBRARY apsettingshandlerui.lib
LIBRARY commdb.lib

Source file:

void CMyAppView::AccessPointGetterL()
{
iConnOK=EFalse;
 
CApSettingsHandler* settingsHandler = CApSettingsHandler::NewLC(
ETrue,
EApSettingsSelListIsPopUp ,
EApSettingsSelMenuSelectNormal,
KEApIspTypeAll,
EApBearerTypeAll,
KEApSortNameAscending);
 
TUint32 originallyFocused(0);
// 0 is not valid IAP id. Failed if 0 after RunSettingsL().
TUint32 selectedIap(0);
 
// Show the dialog
settingsHandler->RunSettingsL(originallyFocused, selectedIap);
 
// The CApUtils API is deprecated/removed, the following code can be
used
// to convert the WapAP Id to IAP Id
if (selectedIap)
{
CCommsDatabase* db = CCommsDatabase::NewL();
CleanupStack::PushL(db);
 
CCommsDbTableView* wapTable;
wapTable = db->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
TPtrC(COMMDB_ID), selectedIap );
User::LeaveIfError( wapTable->GotoFirstRecord() );
 
TBuf<100> wapBearer;
wapTable->ReadTextL(TPtrC(WAP_CURRENT_BEARER), wapBearer);
 
if ( wapBearer == TPtrC(WAP_IP_BEARER) )
{
CCommsDbTableView* bearerTable;
bearerTable = db->OpenViewMatchingUintLC( TPtrC(wapBearer),
TPtrC(WAP_ACCESS_POINT_ID),
selectedIap );
User::LeaveIfError( bearerTable->GotoFirstRecord() );
bearerTable->ReadUintL(TPtrC(WAP_IAP), iIap );
CleanupStack::PopAndDestroy( bearerTable ); // bearerTable
}
else
{
User::Leave( KErrInvalidBearerType );
}
CleanupStack::PopAndDestroy(2); // db, wapTable,
}
else
{
iIap = 0;
}
 
CleanupStack::PopAndDestroy(settingsHandler);
 
if(!iIap)
{
iConnOK=EFalse;
}
else
{
iConnOK=ETrue;
}
}

Header file:

TBool iConnOK;		//< Is connection set?
TUint32 iIap; //< Current IAP
This page was last modified on 23 July 2012, at 07:53.
21 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×