Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

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);
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtopicQUqfnTopicZwlanQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX