I am trying to develop a symbian c++ application that scans the network and shows the available SSIDs and their strenght. I know this has been discused here
and also in other posts(I have read the entire section).
The problem is that my program doesn't return any available networks after the request and after the second request it panics and sometimes it restarts my phone. I am using a Nokia N95.
I also tried the program with Active Objects and I am getting the same result. I will share my code with you and I hope that someone could help me with this.
I didn't put the complete files as some of the functions are not
virtual void WLANInfoRetrievedL(CDesCArraySeg * wlanInfo) = 0;
virtual void HandleWLANInfoError(TInt aError) = 0;
class CWLANInfo : public CActive
static CWLANInfo* NewL();
void GetWLANInfoL(MWLANInfoObserver* aObserver);
// from CActive
TInt RunError(TInt aError);
GSMClient -> it implements the observer and calls the WLAN scan function:
iNetworks = new (ELeave) CDesCArraySeg(1);
// establish connection with the monitor server
//Close monitor or else we get an error
iNetworks = NULL;
// This function is used by our class' users to start getting wlan info.
void CWLANInfo::GetWLANInfoL(MWLANInfoObserver* aObserver)
iObserver = aObserver;
// Start async call to receive current wlan information
// get the list of available networks
iMonitor.GetPckgAttribute(EBearerIdWLAN, 0, KNetworkNames, iPkgNetworks, iStatus);
//If error occurs then it is the job of RunError to treat it
// Request completed successfully.
// Now we can notify our observer.
if(iNetworks == NULL)
_LIT(KNetInfo, "Network: %S\tSignal: %d");
// reset networks list
// add retrieved networks to the list
for(TUint i=0; i<iPkgNetworks().iCount; i++)
line.Format(KNetInfo, &netName, iPkgNetworks().iNetwork[i].iSignalStrength);
class CGSMClient : public MWLANInfoObserver
void WLANInfoRetrievedL(CDesCArraySeg * wlanInfo);
void HandleWLANInfoError(TInt aError);
* The WLAN info object
* The WLAN Information
This is the function that returns the iWInfo to the main program
void CGSMClient::WLANInfoRetrievedL(CDesCArraySeg * wlanInfo)
iWInfo = wlanInfo;
... // Then I just use the iWInfo (but I don't delete it)
that in turn uses the wlan information (that is always none)
In the main program I have a GSMClient object that I use to call
* This function is used to list available WLAN networks
iWLANInfo = CWLANInfo::NewL();
the GetWLANSSIDsL and then try to use the information, but
always I receive a non-NULL pointer with 0 networks.
As I said, at the second attempt the program exits or the phone panics and then restarts.
Please tell me what can I do in order to fix the problem and get the result.