hotspotfw/hsserver/src/hssiapsettingshandler.cpp
branchRCL_3
changeset 23 b852595f5cbe
parent 22 3b2fb68d23df
child 24 63be7eb3fc78
equal deleted inserted replaced
22:3b2fb68d23df 23:b852595f5cbe
    97         {
    97         {
    98         destination = cmManager.DestinationL(destinations[i]);
    98         destination = cmManager.DestinationL(destinations[i]);
    99         CleanupClosePushL(destination); 
    99         CleanupClosePushL(destination); 
   100         // Internet destination will always exist in the system.
   100         // Internet destination will always exist in the system.
   101         // Internet destination will have ESnapPurposeInternet set in its metadata.
   101         // Internet destination will have ESnapPurposeInternet set in its metadata.
   102         if (destination.MetadataL(CMManager::ESnapMetadataPurpose) == CMManager::ESnapPurposeInternet)
   102         if ( destination.MetadataL( CMManager::ESnapMetadataPurpose ) ==
       
   103              CMManager::ESnapPurposeInternet )
   103             {
   104             {
   104             RCmConnectionMethodExt plugin = cmManager.CreateConnectionMethodL( KUidWlanBearerType );
   105             RCmConnectionMethodExt plugin = cmManager.CreateConnectionMethodL( KUidWlanBearerType );
   105             CleanupClosePushL( plugin );
   106             CleanupClosePushL( plugin );
   106                 
   107                 
   107             plugin.SetStringAttributeL( ECmName, aIapName );
   108             plugin.SetStringAttributeL( ECmName, aIapName );
   126 
   127 
   127 // -----------------------------------------------------------------------------
   128 // -----------------------------------------------------------------------------
   128 // CreateIapL
   129 // CreateIapL
   129 // -----------------------------------------------------------------------------
   130 // -----------------------------------------------------------------------------
   130 //    
   131 //    
   131 void CHssIapSettingsHandler::CreateIapL()
   132 TInt CHssIapSettingsHandler::CreateIapL( TBool aHotspot )
   132     {
   133     {
   133     DEBUG("CHssIapSettingsHandler::CreateIapL");
   134     DEBUG("CHssIapSettingsHandler::CreateIapL");
   134 
   135     TInt ret ( KErrNone );
   135     RCmManagerExt cmManager;
   136     RCmManagerExt cmManager;
   136     cmManager.OpenL();
   137     cmManager.OpenL();
   137     CleanupClosePushL( cmManager );
   138     CleanupClosePushL( cmManager );
   138     
   139     
   139     // Read all destination(SNAP) settings into an array
   140     // Read all destination(SNAP) settings into an array
   148         destination = cmManager.DestinationL( destinations[i] );
   149         destination = cmManager.DestinationL( destinations[i] );
   149         CleanupClosePushL( destination ); 
   150         CleanupClosePushL( destination ); 
   150         // Internet destination will always exist in the system.
   151         // Internet destination will always exist in the system.
   151         // Internet destination will have ESnapPurposeInternet 
   152         // Internet destination will have ESnapPurposeInternet 
   152         // set in its metadata.
   153         // set in its metadata.
   153         if (destination.MetadataL( CMManager::ESnapMetadataPurpose ) == 
   154         if ( destination.MetadataL( CMManager::ESnapMetadataPurpose ) == 
   154                                         CMManager::ESnapPurposeInternet )
   155                                         CMManager::ESnapPurposeInternet )
   155             {
   156             {
   156             CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL();
   157             CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL();
   157             CleanupStack::PushL( wlanMgmtClient );
   158             CleanupStack::PushL( wlanMgmtClient );
   158             
   159             
   192             plugin.SetIntAttributeL( CMManager::EWlanSecurityMode,
   193             plugin.SetIntAttributeL( CMManager::EWlanSecurityMode,
   193                     ConvertConnectionSecurityModeToSecModeL( secMode ));
   194                     ConvertConnectionSecurityModeToSecModeL( secMode ));
   194             plugin.SetIntAttributeL( EWlanConnectionMode, 
   195             plugin.SetIntAttributeL( EWlanConnectionMode, 
   195                     ConvertConnectionModeToNetModeL( connMode ) );
   196                     ConvertConnectionModeToNetModeL( connMode ) );
   196             plugin.SetBoolAttributeL( EWlanScanSSID, scanSsid );
   197             plugin.SetBoolAttributeL( EWlanScanSSID, scanSsid );
       
   198             
       
   199             if ( aHotspot )
       
   200                 {
       
   201 				// A hotspot IAP. Mark it so it can be deleted after the use.
       
   202                 plugin.SetStringAttributeL( ECmConfigDaemonManagerName, 
       
   203                                             KHotSpotPlugin );
       
   204                 }
       
   205             
   197             destination.AddConnectionMethodL( plugin );
   206             destination.AddConnectionMethodL( plugin );
   198             destination.UpdateL();
   207             destination.UpdateL();
   199             serviceId = plugin.GetIntAttributeL( EWlanServiceId );                
   208             serviceId = plugin.GetIntAttributeL( EWlanServiceId );                
   200            
   209             ret = plugin.GetIntAttributeL( ECmIapId );  
   201             CleanupStack::PopAndDestroy( &plugin ); 
   210             CleanupStack::PopAndDestroy( &plugin ); 
   202             if ( secMode == EWlanConnectionSecurityWep )
   211             if ( secMode == EWlanConnectionSecurityWep )
   203                 {
   212                 {
   204                 SaveWEPKeyL( easyWlanServiceId, serviceId );
   213                 SaveWEPKeyL( easyWlanServiceId, serviceId );
   205                 }
   214                 }
   215         CleanupStack::PopAndDestroy( &destination ); 
   224         CleanupStack::PopAndDestroy( &destination ); 
   216         }
   225         }
   217     CleanupStack::PopAndDestroy( &destinations ); 
   226     CleanupStack::PopAndDestroy( &destinations ); 
   218     CleanupStack::PopAndDestroy( &cmManager );
   227     CleanupStack::PopAndDestroy( &cmManager );
   219 
   228 
   220     DEBUG("CHssIapSettingsHandler::CreateIapL Done");
   229     DEBUG1("CHssIapSettingsHandler::CreateIapL Done iapId: %d", ret);
       
   230     return ret;
   221     }
   231     }
   222 
   232 
   223 // -----------------------------------------------------------------------------
   233 // -----------------------------------------------------------------------------
   224 // DeleteIapL
   234 // DeleteIapL
   225 // -----------------------------------------------------------------------------
   235 // -----------------------------------------------------------------------------
   239     TBool result = plugin.DeleteL();
   249     TBool result = plugin.DeleteL();
   240    
   250    
   241     DEBUG1("CHssIapSettingsHandler:::DeleteIapL result = %d ", result);
   251     DEBUG1("CHssIapSettingsHandler:::DeleteIapL result = %d ", result);
   242     CleanupStack::PopAndDestroy( &plugin );
   252     CleanupStack::PopAndDestroy( &plugin );
   243     CleanupStack::PopAndDestroy( &cmManager );
   253     CleanupStack::PopAndDestroy( &cmManager );
       
   254     }
       
   255 
       
   256 // ---------------------------------------------------------
       
   257 // MoveIapL()
       
   258 // ---------------------------------------------------------
       
   259 //
       
   260 void  CHssIapSettingsHandler::MoveIapL( const TUint aIapId )
       
   261     {
       
   262     DEBUG1("CHssIapSettingsHandler::MoveIapL aIapId=%d ", aIapId);
       
   263     // Now move to Internet SNAP
       
   264     RCmManagerExt cmManager;
       
   265     cmManager.OpenL();
       
   266     CleanupClosePushL( cmManager );
       
   267     
       
   268     // Read all destination(SNAP) settings into an array
       
   269     RArray<TUint32> destinations;
       
   270     CleanupClosePushL( destinations );
       
   271     
       
   272     cmManager.AllDestinationsL( destinations );
       
   273     RCmDestinationExt destination;
       
   274     // Loop through each destination
       
   275     for( TInt i = 0; i < destinations.Count(); i++ )
       
   276         {
       
   277         destination = cmManager.DestinationL( destinations[i] );
       
   278         CleanupClosePushL( destination ); 
       
   279         // Internet destination will always exist in the system.
       
   280         // Internet destination will have ESnapPurposeInternet 
       
   281         // set in its metadata.
       
   282         if ( destination.MetadataL( CMManager::ESnapMetadataPurpose ) == 
       
   283                                     CMManager::ESnapPurposeInternet )
       
   284             {
       
   285             RCmConnectionMethodExt iap = cmManager.ConnectionMethodL( aIapId );
       
   286             CleanupClosePushL( iap );
       
   287             iap.SetStringAttributeL( ECmConfigDaemonManagerName, KHotSpotPlugin );
       
   288             destination.AddConnectionMethodL( iap );
       
   289             CleanupStack::PopAndDestroy( &iap );
       
   290             destination.UpdateL();
       
   291             }
       
   292         CleanupStack::PopAndDestroy( &destination ); 
       
   293         }
       
   294     CleanupStack::PopAndDestroy( &destinations ); 
       
   295     CleanupStack::PopAndDestroy( &cmManager );
       
   296    
       
   297     DEBUG( "CHssIapSettingsHandler::MoveIapL Done" );
   244     }
   298     }
   245 
   299 
   246 // ---------------------------------------------------------
   300 // ---------------------------------------------------------
   247 // SaveWEPKeyL()
   301 // SaveWEPKeyL()
   248 // ---------------------------------------------------------
   302 // ---------------------------------------------------------