×
Namespaces

Variants
Actions

搜索可用的WLAN网络

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

文章
huwell 在 28 Jun 2007 创建
最后由 hamishwillee 在 15 Dec 2011 编辑
  • 设备, 软件 版本:

S60 3rd Edition


  • 说明:

搜索可用的WLAN网络:我该如何获得网络的SSID和信号强度?


  • 详细描述:

搜索WLAN可用网络时,可以通过Connection Moniter Server API来获得他们实际的信号强度。 下面是该API的一个使用示例:


#include <rconnmon.h>
 
void CWlanTest:: ListNetworksAndSignalL(CDesCArraySeg& aNetworks)
 
{
 
_LIT(KNetInfo, "Network: %S\tSignal: %d");
 
TBuf<32> netName;
 
TBuf<100> line;
 
RConnectionMonitor monitor;
 
TPckgBuf<TConnMonNetworkNames> pkgNetworks;
 
// establish connection with the monitor server
 
monitor.ConnectL();
 
// prepare leave clean-up
 
CleanupClosePushL(monitor);
 
TRequestStatus status;
 
// get the list of available networks
 
monitor.GetPckgAttribute(EBearerIdWLAN, 0, KNetworkNames, pkgNetworks, status);
 
// suspend thread until the info is retrieved
 
// production code should use active objects
 
User::WaitForRequest( status ) ;
 
// leave if the asynchronous method returned an error
 
User::LeaveIfError(status.Int());
 
// reset networks list
 
aNetworks.Reset();
 
// add retrieved networks to the list
 
for(TUint i=0; i<pkgNetworks().iCount; i++)
 
{
 
netName.Copy(pkgNetworks().iNetwork[i].iName);
 
line.Format(KNetInfo, &netName, pkgNetworks().iNetwork[i].iSignalStrength);
 
aNetworks.AppendL(line);
 
}
 
// close server session
 
CleanupStack::PopAndDestroy(&monitor);
 
}


Note:

  • - Link against: ConnMon.lib
  • - S60 3rd Edition-specific capability needed: NetworkServices
This page was last modified on 15 December 2011, at 13:42.
64 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.

×