hotspotfw/hsserver/src/hssiapsettingshandler.cpp
branchRCL_3
changeset 14 d9aaeb96a256
parent 10 dff6ebfd236f
child 22 3b2fb68d23df
equal deleted inserted replaced
13:858c6c491d0e 14:d9aaeb96a256
   146     for( TInt i = 0; i < destinations.Count(); i++ )
   146     for( TInt i = 0; i < destinations.Count(); i++ )
   147         {
   147         {
   148         destination = cmManager.DestinationL( destinations[i] );
   148         destination = cmManager.DestinationL( destinations[i] );
   149         CleanupClosePushL( destination ); 
   149         CleanupClosePushL( destination ); 
   150         // Internet destination will always exist in the system.
   150         // Internet destination will always exist in the system.
   151         // Internet destination will have ESnapPurposeInternet set in its metadata.
   151         // Internet destination will have ESnapPurposeInternet 
       
   152         // set in its metadata.
   152         if (destination.MetadataL( CMManager::ESnapMetadataPurpose ) == 
   153         if (destination.MetadataL( CMManager::ESnapMetadataPurpose ) == 
   153                                         CMManager::ESnapPurposeInternet )
   154                                         CMManager::ESnapPurposeInternet )
   154             {
   155             {
   155             CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL();
   156             CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL();
   156             CleanupStack::PushL( wlanMgmtClient );
   157             CleanupStack::PushL( wlanMgmtClient );
   157             
   158             
   158             TWlanConnectionMode connMode( EWlanConnectionModeNotConnected );
   159             TWlanConnectionMode connMode;
   159             wlanMgmtClient->GetConnectionMode( connMode );
   160             User::LeaveIfError( 
   160 
   161                     wlanMgmtClient->GetConnectionMode( connMode ) );
   161             TWlanConnectionSecurityMode secMode( EWlanConnectionSecurityOpen );
   162             
   162             wlanMgmtClient->GetConnectionSecurityMode( secMode );
   163             TWlanConnectionSecurityMode secMode;
   163                         
   164             User::LeaveIfError( 
       
   165                     wlanMgmtClient->GetConnectionSecurityMode( secMode ) );
       
   166                           
   164             HBufC* ssid( NULL );
   167             HBufC* ssid( NULL );
   165             TWlanSsid ssidConn;
   168             TWlanSsid ssidConn;
   166             
   169             
   167             User::LeaveIfError( wlanMgmtClient->GetConnectionSsid( ssidConn ) );
   170             User::LeaveIfError( 
       
   171                     wlanMgmtClient->GetConnectionSsid( ssidConn ) );
   168             ssid = HBufC::NewLC( ssidConn.Length() );
   172             ssid = HBufC::NewLC( ssidConn.Length() );
   169             ssid->Des().Copy( ssidConn ); 
   173             ssid->Des().Copy( ssidConn ); 
   170             
   174             
   171             TUint32 serviceId(0);
   175             TUint32 serviceId(0);
   172             TUint32 easyWlanIapId(0);
   176             TUint32 easyWlanIapId(0);
   173             easyWlanIapId = cmManager.EasyWlanIdL();
   177             easyWlanIapId = cmManager.EasyWlanIdL();
   174             DEBUG1("CHssIapSettingsHandler::SaveDestinationL easyWlanIapId: %d", 
   178                        
   175                     easyWlanIapId);            
       
   176             
       
   177             RCmConnectionMethodExt easyWlanPlugin;
   179             RCmConnectionMethodExt easyWlanPlugin;
   178             easyWlanPlugin = cmManager.ConnectionMethodL( easyWlanIapId );
   180             easyWlanPlugin = cmManager.ConnectionMethodL( easyWlanIapId );
   179             CleanupClosePushL( easyWlanPlugin );
   181             CleanupClosePushL( easyWlanPlugin );
   180             TBool scanSsid = easyWlanPlugin.GetBoolAttributeL( EWlanScanSSID );
   182             TBool scanSsid = easyWlanPlugin.GetBoolAttributeL( EWlanScanSSID );
   181             DEBUG1("CHssIapSettingsHandler::SaveDestinationL scanSsid: %d", scanSsid);
   183             TUint32 easyWlanServiceId = 
   182             TUint32 easyWlanServiceId = easyWlanPlugin.GetIntAttributeL( EWlanServiceId );
   184                     easyWlanPlugin.GetIntAttributeL( EWlanServiceId );
   183             DEBUG1("CHssIapSettingsHandler::SaveDestinationL easyWlanServiceId: %d", easyWlanServiceId);
       
   184             CleanupStack::PopAndDestroy(); // easyWlanPlugin;
   185             CleanupStack::PopAndDestroy(); // easyWlanPlugin;
   185             
   186             
   186             RCmConnectionMethodExt plugin =
   187             RCmConnectionMethodExt plugin =
   187                 cmManager.CreateConnectionMethodL( KUidWlanBearerType );
   188                 cmManager.CreateConnectionMethodL( KUidWlanBearerType );
   188             CleanupClosePushL( plugin );        
   189             CleanupClosePushL( plugin );        
   195             plugin.SetBoolAttributeL( EWlanScanSSID, scanSsid );
   196             plugin.SetBoolAttributeL( EWlanScanSSID, scanSsid );
   196             destination.AddConnectionMethodL( plugin );
   197             destination.AddConnectionMethodL( plugin );
   197             destination.UpdateL();
   198             destination.UpdateL();
   198             serviceId = plugin.GetIntAttributeL( EWlanServiceId );                
   199             serviceId = plugin.GetIntAttributeL( EWlanServiceId );                
   199            
   200            
   200             CleanupStack::PopAndDestroy( &plugin ); // Close() called
   201             CleanupStack::PopAndDestroy( &plugin ); 
   201             if ( secMode == EWlanConnectionSecurityWep )
   202             if ( secMode == EWlanConnectionSecurityWep )
   202                 {
   203                 {
   203                 SaveWEPKeyL( easyWlanServiceId, serviceId );
   204                 SaveWEPKeyL( easyWlanServiceId, serviceId );
   204                 }
   205                 }
   205                     
   206                     
   206             if ( secMode == EWlanConnectionSecurityWpaPsk )
   207             if ( secMode == EWlanConnectionSecurityWpaPsk )
   207                 {
   208                 {
   208                 SaveWPAKeyL( easyWlanServiceId, serviceId );
   209                 SaveWPAKeyL( easyWlanServiceId, serviceId );
   209                 }
   210                 }
   210             CleanupStack::PopAndDestroy( ssid ); // ssid
   211             
       
   212             CleanupStack::PopAndDestroy( ssid ); 
   211             CleanupStack::PopAndDestroy( wlanMgmtClient );
   213             CleanupStack::PopAndDestroy( wlanMgmtClient );
   212             }
   214             }
   213         CleanupStack::PopAndDestroy(); // destination
   215         CleanupStack::PopAndDestroy( &destination ); 
   214         }
   216         }
   215     CleanupStack::PopAndDestroy(); // destinations
   217     CleanupStack::PopAndDestroy( &destinations ); 
   216     CleanupStack::PopAndDestroy( &cmManager );
   218     CleanupStack::PopAndDestroy( &cmManager );
   217 
   219 
   218     DEBUG("CHssIapSettingsHandler::CreateIapL Done");
   220     DEBUG("CHssIapSettingsHandler::CreateIapL Done");
   219     }
   221     }
   220 
   222