Categories: S60 | WLAN | Symbian C++ | Code Examples | How To
This page was last modified 06:47, 27 March 2008.
How to retrive SSID used in WLAN IAP and IAP used by VPN IAP programmatically
From Forum Nokia Wiki
We can retrieve IAP used by VPN IAP by retrieving VPN_SERVICE_IAP value in VPN_SERVICE table.
We can use the following two approaches to retrieve SSID-
1.First one is to use CApDataHandler and CApAccessPointItem -ReadTextL with EApWlanNetworkName as parameter to get SSID.
2.Second approach is to read WLAN_SSID from WLAN_SERVICE Table.
The following code snippet is tested in E61i.
Example Code
Header files: apdatahandler.h apaccesspointitem.h apselect.h COMMDB.H aputils.h
Libraries: Commdb.lib apengine.lib
//Code to retrieve IAP used by VPN IAP CCommsDbTableView* view = commsdb->OpenTableLC(TPtrC(VPN_SERVICE));//VPN_SERVICE TInt retval = view->GotoFirstRecord(); CApUtils *aputil = CApUtils::NewLC(*commsdb); TUint32 vpnId,cmId,nwId; TBuf<50> vpnIdB,cmIdB,nwIdB,name; while (retval == KErrNone) { //Read IAP used by VPN IAP view->ReadUintL(TPtrC(VPN_SERVICE_IAP),vpnId); view->ReadTextL(TPtrC(COMMDB_NAME),commName); vpnIdB.AppendNum(vpnId); CEikonEnv::InfoWinL(_L("COMMDB_NAME"),commName); CEikonEnv::InfoWinL(_L("VpnIapID"),vpnIdB); //Gives the name of a given access point from IAP ID aputil->NameL(vpnId,name); CEikonEnv::InfoWinL(_L("AP in VAP"),name); name.Zero(); commName.Zero(); vpnIdB.Zero(); retval = view->GotoNextRecord(); } //First approach to retrieve SSID used in WLAN IAP TUint32 APuid; TBuf<50> ssidBuf,name; TInt count = 0; CCommsDatabase *commsdb= CCommsDatabase::NewL(); //Filter only WLAN APS with bearer type EApBearerTypeWLAN CApSelect * select=CApSelect::NewLC (*commsdb,KEApIspTypeAll,EApBearerTypeWLAN,KEApSortUidAscending); CApDataHandler* datHand = CApDataHandler::NewLC(*commsdb); CApAccessPointItem* ap = CApAccessPointItem::NewLC(); TBool move = select->MoveToFirst(); while(count<select->Count()) { if(move==TRUE) name =select->Name(); //Get AP Id APuid =select->Uid(); name.AppendNum(APuid); CEikonEnv::InfoWinL(_L("AP Name & ID"),name);//Displays AccessPoint Name and its ID datHand->AccessPointDataL(APuid, *ap); // Pass APuid as param //Read SSID ap->ReadTextL(EApWlanNetworkName, ssidBuf); CEikonEnv::InfoWinL(_L("SSID"),ssidBuf); ssidBuf.Zero(); name.Zero(); TBool move = select->MoveNext(); count=count+1; } CleanupStack::PopAndDestroy(3); //Second approach to retrieve SSID TBuf<100> ssid; // Open WLAN SERVICE table CCommsDbTableView* view = commsdb->OpenTableLC(TPtrC(WLAN_SERVICE)); TInt retval = view->GotoFirstRecord(); while (retval == KErrNone) { //Read SSID value view->ReadTextL(TPtrC(WLAN_SSID),ssid); CEikonEnv::InfoWinL(_L("SSID"),ssid); ssid.Zero(); retval = view->GotoNextRecord(); } CleanupStack::PopAndDestroy(view);
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Connecting to WLAN access point | NigelT | Symbian Networking & Messaging | 12 | 2007-05-04 22:01 |
| Basic Mail configuration Mail-IAP-Name | Jorrti | Smart Messaging | 1 | 1970-01-01 02:00 |
| Launch browser with specific IAP | nadav70 | General Symbian C++ | 7 | 2008-04-01 13:05 |
| HOw to implement CHttpFilterProxyInterface::InstallFilterL(iSession) Using Sockets | indvin | Symbian Networking & Messaging | 0 | 2006-01-13 07:06 |
| IAP Dialog box - Trapping "Cancel Button" Click? | sethuraman | Symbian Networking & Messaging | 2 | 2006-04-10 09:58 |
