wlanutilities/wlansniffer/engine/server/src/wsfwlanscanner.cpp
changeset 2 6e4b6261703d
parent 0 56b72877c1cb
child 8 c2bc3f8c7777
equal deleted inserted replaced
1:d07e190ed096 2:6e4b6261703d
   357 // CWsfWlanScanner::AddConnectedWLANInfo
   357 // CWsfWlanScanner::AddConnectedWLANInfo
   358 // ---------------------------------------------------------------------------
   358 // ---------------------------------------------------------------------------
   359 //    
   359 //    
   360 void CWsfWlanScanner::AddConnectedWLANInfoL()
   360 void CWsfWlanScanner::AddConnectedWLANInfoL()
   361     {
   361     {
       
   362     LOG_ENTERFN( "CWsfWlanScanner::AddConnectedWLANInfoL" );
   362     // Get the possible connection
   363     // Get the possible connection
   363     if ( iConnectionDetailsProvider )
   364     if ( iConnectionDetailsProvider )
   364         {
   365         {
       
   366         TWlanSsid connectedSsid;
       
   367         TInt error = iWlanMgmtClient->GetConnectionSsid( connectedSsid );
       
   368         
       
   369         LOG_WRITEF( "GetConnectionSsid returned=%d", error );
       
   370         
       
   371         TBool connected = ( error == KErrNone && connectedSsid.Length() );
       
   372     
       
   373         if ( !connected && !iConnectionDetailsProvider->IsConnected() )
       
   374             {
       
   375             LOG_WRITEF( "Not connected [connected=%d]", connected );
       
   376             return;
       
   377             }
       
   378         
   365         TWsfWlanInfo* connectedInfo = new (ELeave) TWsfWlanInfo();
   379         TWsfWlanInfo* connectedInfo = new (ELeave) TWsfWlanInfo();
   366         CleanupStack::PushL( connectedInfo );
   380         CleanupStack::PushL( connectedInfo );
       
   381         
   367         if ( iConnectionDetailsProvider->ConnectedWlanConnectionDetailsL(
   382         if ( iConnectionDetailsProvider->ConnectedWlanConnectionDetailsL(
   368                 connectedInfo) )
   383                 connectedInfo) )
   369             {
   384             {
   370             TBuf8<KWlanMaxAccessPointNameLength> connectedSsidOrIap;
   385             TBuf8<KWlanMaxAccessPointNameLength> connectedSsidOrIap;
   371             connectedSsidOrIap.Copy( connectedInfo->iSsid );
   386             connectedSsidOrIap.Copy( connectedInfo->iSsid );
   372             // ConnectedWlanConnectionDetailsL() may have returned an IAP name instead of SSID.
   387             // ConnectedWlanConnectionDetailsL() may have returned an IAP name instead of SSID.
   373             // make sure that we really have SSID in connectedInfo->iSSID at this phase.
   388             // make sure that we really have SSID in connectedInfo->iSSID at this phase.
   374             TWlanSsid connectedSsid;
   389             
   375             iWlanMgmtClient->GetConnectionSsid( connectedSsid );
   390             connectedInfo->iRawSsid.Copy( connectedSsid );
   376             connectedInfo->iSsid.Copy( connectedSsid );
   391             connectedInfo->iSsid.Copy( connectedSsid );
   377             connectedInfo->iCoverage = 0;
   392             connectedInfo->iCoverage = 0;
   378             connectedInfo->iVisibility = 1;
   393             connectedInfo->iVisibility = 1;
   379 
   394 
   380             TBool connectedInfoAppended = EFalse;
   395             TBool connectedInfoAppended = EFalse;
  1342              TPtrC( WLAN_SERVICE), TPtrC( WLAN_SERVICE_ID), serviceId);
  1357              TPtrC( WLAN_SERVICE), TPtrC( WLAN_SERVICE_ID), serviceId);
  1343     User::LeaveIfError(wlanTableView->GotoFirstRecord() );
  1358     User::LeaveIfError(wlanTableView->GotoFirstRecord() );
  1344 
  1359 
  1345     // ssid
  1360     // ssid
  1346     wlanTableView->ReadTextL( TPtrC( NU_WLAN_SSID ), aWlanInfo.iSsid );
  1361     wlanTableView->ReadTextL( TPtrC( NU_WLAN_SSID ), aWlanInfo.iSsid );
  1347                                                       
  1362     aWlanInfo.iRawSsid.Copy( aWlanInfo.iSsid );
       
  1363     
  1348     // security mode
  1364     // security mode
  1349     TUint32 secMode(0);
  1365     TUint32 secMode(0);
  1350     wlanTableView->ReadUintL(TPtrC( WLAN_SECURITY_MODE), secMode);
  1366     wlanTableView->ReadUintL(TPtrC( WLAN_SECURITY_MODE), secMode);
  1351     // Map Wpa2 to Wpa
  1367     // Map Wpa2 to Wpa
  1352     secMode = ( secMode == EWlanSecModeWpa2 )? EWlanSecModeWpa : secMode;
  1368     secMode = ( secMode == EWlanSecModeWpa2 )? EWlanSecModeWpa : secMode;
  1397 
  1413 
  1398         if ( ieLen )
  1414         if ( ieLen )
  1399             {
  1415             {
  1400             ssid8.Copy( ieData, ieLen );
  1416             ssid8.Copy( ieData, ieLen );
  1401             aWlanInfo.iSsid.Copy( ssid8 );
  1417             aWlanInfo.iSsid.Copy( ssid8 );
       
  1418             aWlanInfo.iRawSsid.Copy( ssid8 );
  1402             TBuf<KWlanMaxSsidLength> ssid16;
  1419             TBuf<KWlanMaxSsidLength> ssid16;
  1403             ssid16.Copy( ssid8 );
  1420             ssid16.Copy( ssid8 );
  1404             LOG_WRITEF( "SSID: [%S]", &ssid16 );
  1421             LOG_WRITEF( "SSID: [%S]", &ssid16 );
  1405             }
  1422             }
  1406         else
  1423         else