Revision: 201015 RCL_3 PDK_3.0.i
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 27 Apr 2010 17:47:07 +0300
branchRCL_3
changeset 14 d9aaeb96a256
parent 13 858c6c491d0e
child 16 61c93568468d
Revision: 201015 Kit: 201017
hotspotfw/hsclient/src/hssiaphandler.cpp
hotspotfw/hsserver/src/hotspotsession.cpp
hotspotfw/hsserver/src/hssiapsettingshandler.cpp
wlanutilities/wlansniffer/apwizard/src/wsfwlaniapcreator.cpp
--- a/hotspotfw/hsclient/src/hssiaphandler.cpp	Wed Apr 14 17:07:39 2010 +0300
+++ b/hotspotfw/hsclient/src/hssiaphandler.cpp	Tue Apr 27 17:47:07 2010 +0300
@@ -98,10 +98,11 @@
     CleanupClosePushL( cmManager );
     
     TUint easyWlanId = cmManager.EasyWlanIdL();
+    
     // Easy WLAN can't be modified
     if ( easyWlanId == aIapID )
     	{
-    	cmManager.Close();
+        CleanupStack::PopAndDestroy( &cmManager ); 
     	return KErrPermissionDenied;
     	}
     
@@ -117,8 +118,8 @@
         plugin.SetStringAttributeL( ECmName, aSettings.Name );
         plugin.UpdateL();
         }
-    CleanupStack::PopAndDestroy( &plugin ); // Close() called on "plugin"
-    CleanupStack::PopAndDestroy( &cmManager ); // Close() called on "cmManager"
+    CleanupStack::PopAndDestroy( &plugin ); 
+    CleanupStack::PopAndDestroy( &cmManager ); 
 
     // CommsDat section starts
     CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion());
--- a/hotspotfw/hsserver/src/hotspotsession.cpp	Wed Apr 14 17:07:39 2010 +0300
+++ b/hotspotfw/hsserver/src/hotspotsession.cpp	Tue Apr 27 17:47:07 2010 +0300
@@ -630,7 +630,11 @@
                 {
                 iServer.CompleteMessage( indx, KErrNone );    
                 }
-            TRAP_IGNORE( iIapSettingsHandler->CreateIapL() );
+            TRAPD( trap, iIapSettingsHandler->CreateIapL() );
+            if ( trap != KErrNone )
+                {
+                DEBUG1("CHotSpotSession::ConnectivityObserver trap: %d", trap);
+                }
             break;
         case EHttpAuthenticationNeeded :
             // Start browser for authentication
--- a/hotspotfw/hsserver/src/hssiapsettingshandler.cpp	Wed Apr 14 17:07:39 2010 +0300
+++ b/hotspotfw/hsserver/src/hssiapsettingshandler.cpp	Tue Apr 27 17:47:07 2010 +0300
@@ -148,39 +148,40 @@
         destination = cmManager.DestinationL( destinations[i] );
         CleanupClosePushL( destination ); 
         // Internet destination will always exist in the system.
-        // Internet destination will have ESnapPurposeInternet set in its metadata.
+        // Internet destination will have ESnapPurposeInternet 
+        // set in its metadata.
         if (destination.MetadataL( CMManager::ESnapMetadataPurpose ) == 
                                         CMManager::ESnapPurposeInternet )
             {
             CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL();
             CleanupStack::PushL( wlanMgmtClient );
             
-            TWlanConnectionMode connMode( EWlanConnectionModeNotConnected );
-            wlanMgmtClient->GetConnectionMode( connMode );
-
-            TWlanConnectionSecurityMode secMode( EWlanConnectionSecurityOpen );
-            wlanMgmtClient->GetConnectionSecurityMode( secMode );
-                        
+            TWlanConnectionMode connMode;
+            User::LeaveIfError( 
+                    wlanMgmtClient->GetConnectionMode( connMode ) );
+            
+            TWlanConnectionSecurityMode secMode;
+            User::LeaveIfError( 
+                    wlanMgmtClient->GetConnectionSecurityMode( secMode ) );
+                          
             HBufC* ssid( NULL );
             TWlanSsid ssidConn;
             
-            User::LeaveIfError( wlanMgmtClient->GetConnectionSsid( ssidConn ) );
+            User::LeaveIfError( 
+                    wlanMgmtClient->GetConnectionSsid( ssidConn ) );
             ssid = HBufC::NewLC( ssidConn.Length() );
             ssid->Des().Copy( ssidConn ); 
             
             TUint32 serviceId(0);
             TUint32 easyWlanIapId(0);
             easyWlanIapId = cmManager.EasyWlanIdL();
-            DEBUG1("CHssIapSettingsHandler::SaveDestinationL easyWlanIapId: %d", 
-                    easyWlanIapId);            
-            
+                       
             RCmConnectionMethodExt easyWlanPlugin;
             easyWlanPlugin = cmManager.ConnectionMethodL( easyWlanIapId );
             CleanupClosePushL( easyWlanPlugin );
             TBool scanSsid = easyWlanPlugin.GetBoolAttributeL( EWlanScanSSID );
-            DEBUG1("CHssIapSettingsHandler::SaveDestinationL scanSsid: %d", scanSsid);
-            TUint32 easyWlanServiceId = easyWlanPlugin.GetIntAttributeL( EWlanServiceId );
-            DEBUG1("CHssIapSettingsHandler::SaveDestinationL easyWlanServiceId: %d", easyWlanServiceId);
+            TUint32 easyWlanServiceId = 
+                    easyWlanPlugin.GetIntAttributeL( EWlanServiceId );
             CleanupStack::PopAndDestroy(); // easyWlanPlugin;
             
             RCmConnectionMethodExt plugin =
@@ -197,7 +198,7 @@
             destination.UpdateL();
             serviceId = plugin.GetIntAttributeL( EWlanServiceId );                
            
-            CleanupStack::PopAndDestroy( &plugin ); // Close() called
+            CleanupStack::PopAndDestroy( &plugin ); 
             if ( secMode == EWlanConnectionSecurityWep )
                 {
                 SaveWEPKeyL( easyWlanServiceId, serviceId );
@@ -207,12 +208,13 @@
                 {
                 SaveWPAKeyL( easyWlanServiceId, serviceId );
                 }
-            CleanupStack::PopAndDestroy( ssid ); // ssid
+            
+            CleanupStack::PopAndDestroy( ssid ); 
             CleanupStack::PopAndDestroy( wlanMgmtClient );
             }
-        CleanupStack::PopAndDestroy(); // destination
+        CleanupStack::PopAndDestroy( &destination ); 
         }
-    CleanupStack::PopAndDestroy(); // destinations
+    CleanupStack::PopAndDestroy( &destinations ); 
     CleanupStack::PopAndDestroy( &cmManager );
 
     DEBUG("CHssIapSettingsHandler::CreateIapL Done");
--- a/wlanutilities/wlansniffer/apwizard/src/wsfwlaniapcreator.cpp	Wed Apr 14 17:07:39 2010 +0300
+++ b/wlanutilities/wlansniffer/apwizard/src/wsfwlaniapcreator.cpp	Tue Apr 27 17:47:07 2010 +0300
@@ -493,9 +493,27 @@
 TUint32 CWsfWlanIapCreator::CreateConnectionMethodL( TWsfWlanInfo& aWlanInfo )
     {
     LOG_ENTERFN( "CWsfWlanIapCreator::CreateConnectionMethodL" );
-    HBufC* ssid16 = HBufC::NewLC( aWlanInfo.iSsid.Length() );
-    ssid16->Des().Copy( aWlanInfo.iSsid );
-
+    
+    HBufC* name16 = NULL;
+    HBufC* ssid16 = NULL;
+    
+    if ( aWlanInfo.iRawSsid.Length() )
+        {
+        // ssid is from scan result store it as it is 
+        // since the encoding of ssid is unknown
+        name16 = HBufC::NewLC( aWlanInfo.iRawSsid.Length() );
+        name16->Des().Copy( aWlanInfo.iRawSsid );
+        ssid16 = HBufC::NewLC( aWlanInfo.iRawSsid.Length() );
+        ssid16->Des().Copy( aWlanInfo.iRawSsid );
+        }
+    else
+        {
+        // user has inputted ssid store it to name as unicode since it is utf-8 
+        name16 = aWlanInfo.GetSsidAsUnicodeLC();
+        ssid16 = HBufC::NewLC( aWlanInfo.iSsid.Length() );
+        ssid16->Des().Copy( aWlanInfo.iSsid );
+        }
+        
     TUint32 iapId( 0 );
     
     if ( !iDestinationId )
@@ -507,7 +525,7 @@
                                                          KUidWlanBearerType );
         CleanupClosePushL( cm );
         
-        cm.SetStringAttributeL( ECmName, *ssid16 );
+        cm.SetStringAttributeL( ECmName, *name16 );
         cm.SetStringAttributeL( EWlanSSID, *ssid16 );
         cm.SetIntAttributeL( EWlanSecurityMode, aWlanInfo.iSecurityMode );
         cm.SetIntAttributeL( EWlanConnectionMode, aWlanInfo.iNetMode );
@@ -522,8 +540,16 @@
         // now retrieve the name again to see if it has been changed 
         // (ExistingCmName -> ExistingCmName(01) and alike)
         HBufC* cmName = cm.GetStringAttributeL( ECmName );
-        aWlanInfo.iNetworkName.Copy( *cmName );
         
+        TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8( 
+                                                        aWlanInfo.iNetworkName, 
+                                                        *cmName  );
+        if ( error )
+            {
+            LOG_WRITE( "ConvertFromUnicodeToUtf8 failed");
+            aWlanInfo.iNetworkName.Copy( *cmName );
+            }
+
         delete cmName;
         
         CleanupStack::PopAndDestroy( &cm );
@@ -541,7 +567,7 @@
                                                          KUidWlanBearerType );
         CleanupClosePushL( cm );
 
-        cm.SetStringAttributeL( ECmName, *ssid16 );
+        cm.SetStringAttributeL( ECmName, *name16 );
         cm.SetStringAttributeL( EWlanSSID, *ssid16 );
         cm.SetIntAttributeL( EWlanSecurityMode, aWlanInfo.iSecurityMode );
         cm.SetIntAttributeL( EWlanConnectionMode, aWlanInfo.iNetMode );
@@ -556,7 +582,14 @@
         // now retrieve the name again to see if it has been changed 
         // (ExistingCmName -> ExistingCmName(01) and alike)
         HBufC* cmName = cm.GetStringAttributeL( ECmName );
-        aWlanInfo.iNetworkName.Copy( *cmName );
+        TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8( 
+                                                         aWlanInfo.iNetworkName, 
+                                                         *cmName  );
+        if ( error )
+            {
+            LOG_WRITE( "ConvertFromUnicodeToUtf8 failed");
+            aWlanInfo.iNetworkName.Copy( *cmName );
+            }
         
         delete cmName;
         
@@ -565,6 +598,7 @@
         }
 
     CleanupStack::PopAndDestroy( ssid16 );
+    CleanupStack::PopAndDestroy( name16 );
 
     aWlanInfo.iIapId = iapId;
     LOG_WRITEF( "new iapId = %d", iapId );