获取所有wlan的名称和信号量

    技术2022-06-28  44

    http://www.cnblogs.com/zelda/archive/2010/09/03/1817197.html

     

        _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     // 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);         iEikonEnv->InfoWinL(line, KNullDesC);         }     // close server session     CleanupStack::PopAndDestroy(&monitor);


    最新回复(0)