×

Discussion Board

Results 1 to 5 of 5

Thread: WLAN scanning

  1. #1
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Netherlands
    Posts
    115

    WLAN scanning

    I use the following function to scan for WLAN's:

    Code:
    void CMyWlanScanner::ScanWlan( CArrayFix<TWlanProperties>& aWlanList )	
    {
    	CWlanScanInfo* scanInfo = CWlanScanInfo::NewL();
    	CleanupStack::PushL( scanInfo );
    	
    	iWlanMgmtClient->GetScanResults( *scanInfo );
    	
    	aWlanList.Reset();
    	
    	for( scanInfo->First(); !scanInfo->IsDone(); scanInfo->Next() )
    	{
    		TWlanProperties wlan;
    		
    		wlan.iSecurity = scanInfo->SecurityMode();
    		wlan.iCapability = scanInfo->Capability();
    		wlan.iQuality = scanInfo->RXLevel();
    		wlan.iBeaconInterval = scanInfo->BeaconInterval();
    
    		TWlanBssid cBssid;
    		scanInfo->Bssid( cBssid );
    		
    		TBuf<64> bssbuf;
    		for( TInt k = 0; k < cBssid.Length(); k++ )
    			bssbuf.AppendFormat( _L("%02x:"), cBssid[k] );
    		//remove last :
    		if ( bssbuf.Length() > 0 )
    			bssbuf.Delete( bssbuf.Length()-1, 1 );
    		
    		wlan.iBssid.Copy( bssbuf );
    				
    		TUint8 ieLen( 0 );
    		const TUint8* ieData( NULL );
    		TInt ret = scanInfo->InformationElement( KWlan802Dot11SsidIE, ieLen, &ieData );
    		if ( ret == KErrNone )
    		{
    			TPtrC8 ptr( ieData, ieLen );
    			wlan.iSsid.Copy( ptr );
    		}
    		
    		aWlanList.AppendL( wlan );
    	}
    	
    	CleanupStack::PopAndDestroy( scanInfo );
    }
    where TWlanProperties is a simple class to hold data:
    Code:
    class TWlanProperties
    {
    public:
    	TBuf<64>	iBssid;
    	TBuf<64>	iSsid;
    	TWlanConnectionMode	iMode;
    	TUint8 		iQuality;
    	TWlanConnectionSecurityMode iSecurity;
    	TInt32		iBeaconInterval;
    	TUint16		iCapability;
    };
    What I'm seeing is that the Signal Quality value is sometimes carried over between two subsequent WLAN's.

    So a scan would show:
    WlanSsid01 -- WPA infra -- [74]
    WlanSsid02 -- Open infra -- [68]
    WlanSsid03 -- WEP infra -- [20]
    WlanSsid04 -- WPA infra -- [20]
    In this example, the number at the end denotes the signal quality (lower = better). WlanSsid04 would be a distant weak signal, but it sometimes shows up with the same quality as WlanSsid03.
    This pattern of 2 (or even 3) identical signal qualities for subsequent WLAN's keeps appearing repeatedly.

    Am I doing something wrong?


    Another question related to the WLAN scanning: does the N95 keep updating an internal "available WLAN UID" list, returned by iWlanMgmtClient->GetAvailableIaps( availableIaps ) independent of any API calls or WLAN scans? I noticed that it returns valid data immediately, and only changes once every 6-8 seconds... I'm wondering whether it has any impact on battery usage if I'd be repeatedly calling this GetAvailableIaps method.
    IDE: Carbide.c++ 1.3 / 2.0beta
    SDK: S60 3rd edition MP / FP1
    V2.10.013 (15-09-06) @ Nokia N91
    V20.0.058 (21-10-06) @ Nokia N93
    V30.0.015 (15-07-08) @ Nokia N95

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,740

    Re: WLAN scanning

    You should read docs from FN main site: www.forum.nokia.com, Documentation / Symbian C++ on the left, Networking. You will like "WLAN Control in S60 APIs" for example.

  3. #3
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Netherlands
    Posts
    115

    Re: WLAN scanning

    I read the document and I read the wiki examples. However, it doesn't answer the question why it returns wrong signal strengths randomly.


    Another related question:

    Code:
    void CMyWlanEngine::GetIapList( CArrayFix<TIapProperties>& aIapList, TBool WlanOnly )
    {
    	CCommsDatabase* db = CCommsDatabase::NewL();
    	CleanupStack::PushL( db );
    	
    	TInt bearerFilter = ( WlanOnly ? EApBearerTypeWLAN : EApBearerTypeAllBearers );
    	
    	CApSelect* ap = CApSelect::NewLC(
    				*db,
    	 			KEApIspTypeAll,
    	 			bearerFilter,
    	 			KEApSortNameAscending,
    	 			0,
    	 			EVpnFilterBoth,
    	 			ETrue );
    
    	RArray<TUint> availableIaps;
    	iWlanClient->GetAvailableIaps( availableIaps );
    	
    	if (! ap->MoveToFirst()) {
    		CleanupStack::PopAndDestroy(2); // db, ap
    		return;
    	}
    	
    	aIapList.Reset();
    	
    	for ( TUint i = 0; i < ap->Count(); i++, ap->MoveNext() ) {
    
    		TIapProperties iap;
    		iap.iName.Copy( ap->Name() );
    		
    		TUint uid = iap.iUid = ap->Uid();
    		TInt bearer = iap.iBearer = ap->BearerType();
    
    		iap.iAvailable = EFalse;
    		
    		if ( bearer & EApBearerTypeWLAN ) {
    			// Check whether this WLAN is available
    			for( TInt j = 0; j < availableIaps.Count(); j++)
    				if ( uid == availableIaps[j] )
    					iap.iAvailable = ETrue;
    			
    		} else {
    			// GPRS/UMTS always available
    			iap.iAvailable = ETrue;
    		}
    		
    		aIapList.AppendL( iap );
    	}
    
    	CleanupStack::PopAndDestroy( 2 );   // db, ap
    }
    Again with TIapProperties being a data class:
    Code:
    class TIapProperties
    {
    public:
    	TBuf<40>	iName;
    	TUint32		iUid;
    	TInt		iBearer;
    	TBool		iAvailable;
    };
    For my newly created 3G connection, it returns ap->Uid()=35. However, when starting the connection with IapId=35 it results in KErrNotFound. I found out that its actual IapId is 54.

    So... is this returned Uid() the same as the IapId that is used for defining the access point? If yes, why does it return a different value? If no, how do I obtain the IapId for the phone's stored Access Points.
    IDE: Carbide.c++ 1.3 / 2.0beta
    SDK: S60 3rd edition MP / FP1
    V2.10.013 (15-09-06) @ Nokia N91
    V20.0.058 (21-10-06) @ Nokia N93
    V30.0.015 (15-07-08) @ Nokia N95

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,740

    Re: WLAN scanning

    Uid and IAP Id are two different things. Check CApUtils::IapIdFromWapIdL

  5. #5
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Netherlands
    Posts
    115

    Re: WLAN scanning

    Aah I see, thanks.

    CApUtils seems to be deprecated, but I have another similar thing that converts the UID to IapId.
    IDE: Carbide.c++ 1.3 / 2.0beta
    SDK: S60 3rd edition MP / FP1
    V2.10.013 (15-09-06) @ Nokia N91
    V20.0.058 (21-10-06) @ Nokia N93
    V30.0.015 (15-07-08) @ Nokia N95

Similar Threads

  1. Replies: 4
    Last Post: 2009-06-09, 12:08
  2. wlan blocked by scanning with WLanMgntClient
    By paipeng in forum Symbian Networking & Messaging (Closed)
    Replies: 6
    Last Post: 2008-07-03, 13:24
  3. Periodically scanning for WLAN SSIDs from Java midlet..
    By mortenlindeberg in forum Wired and Wireless interfaces (Closed)
    Replies: 2
    Last Post: 2008-02-28, 09:24
  4. How to set WLAN IAP network mode to Ad-hoc instead of Infrastructure?
    By PopAndDestroy in forum Wired and Wireless interfaces (Closed)
    Replies: 2
    Last Post: 2007-08-29, 08:04
  5. Wlan scanning module
    By bergerc in forum Symbian
    Replies: 2
    Last Post: 2007-07-20, 10:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×