hotspotfw/hsserver/src/hotspotsession.cpp
changeset 2 6e4b6261703d
parent 0 56b72877c1cb
child 3 ff3b37722600
--- a/hotspotfw/hsserver/src/hotspotsession.cpp	Thu Jan 07 13:31:53 2010 +0200
+++ b/hotspotfw/hsserver/src/hotspotsession.cpp	Mon Jan 18 21:21:32 2010 +0200
@@ -23,13 +23,14 @@
 #include "hssnotif.h"
 #include "hsslogintimer.h"
 #include "hsslogouttimer.h"
+#include "hssclientinterface.h"
+#include "am_debug.h"
 #include <internetconnectivitycrkeys.h>
 #include <WlanCdbCols.h>
 #include <starterclient.h>
-#include "e32std.h"
-#include "am_debug.h"
+#include <cmmanagerext.h>
+#include <e32std.h>
 #include <ecom.h>
-#include "hssclientinterface.h"
 #include <f32file.h>
 #include <apgcli.h>
 
@@ -62,8 +63,6 @@
     iLogoutTimer = CHssLogoutTimer::NewL( *this );
     
     iMgtClient = CWlanMgmtClient::NewL();
-    
-    iRepository = CRepository::NewL( KCRUidInternetConnectivitySettings );
     }
 
 // -----------------------------------------------------------------------------
@@ -127,12 +126,6 @@
         }
     iLogoutTimer = NULL;
     
-    if ( iRepository != NULL )
-        {
-        delete iRepository;
-        }
-    iRepository = NULL;
-    
     if ( iIcts != NULL )
         {
         delete iIcts;
@@ -649,23 +642,9 @@
         {
         delete iIcts;
         }
-    TInt connectivityTestAllowed( EIctsRunAutomatically );
-    iRepository->Get( KIctsTestPermission, connectivityTestAllowed );
-    DEBUG1("CHotSpotSession::TestInternetConnectivityL: %d", connectivityTestAllowed);
-    if ( connectivityTestAllowed == EIctsNeverRun )
-        {
-        TInt indx = iServer.FindMessage( iIapId, EHssStartLogin );
-        if ( KErrNotFound != indx )
-            {
-            iServer.CompleteMessage( indx, KErrNone );    
-            }
-        }
-    else
-        {
-        iIcts = CIctsClientInterface::NewL( iIapId, iNetId, *this );
-        iIcts->StartL();
-        }
-    
+   
+    iIcts = CIctsClientInterface::NewL( iIapId, iNetId, *this );
+    iIcts->StartL();
     }
 
 // -----------------------------------------------------------------------------
@@ -812,13 +791,14 @@
 	{
 	DEBUG("CHotSpotSession::ProcessUnRegisterL");
 	iAllowNotifications = EFalse;
-   
+    TInt ret( KErrNone );
+
     // Read message
     TInt iapId = ( TInt )aMessage.Int0();
     
-    TInt ret( KErrNone );
     // Check that this is not Easy WLAN
-    if ( iServer.GetEasyWlanId() != iapId  )
+    TRAP_IGNORE( EasyWlanIdL() );
+    if ( iEasyWlanId != iapId  )
         {
         TRAPD( err, iIapSettingsHandler->DeleteIapL( iapId ) );
         // return KErrGeneral if IAP removal is not successful
@@ -847,8 +827,9 @@
     TBuf8<KExtensionAPILength> extAPI;
     iIapId = aIapId;
     
-    // This is Easy WLAN. 
-    if ( iServer.GetEasyWlanId() == aIapId )
+    // Check if Easy WLAN.
+    TRAP_IGNORE( EasyWlanIdL() );
+    if ( iEasyWlanId == aIapId )
     	{
     	 DEBUG("CHotSpotSession::ProcessStartLogin Easy WLAN detected");
         // Just test internet connectivity and complete message later
@@ -1168,6 +1149,25 @@
     }
 
 // -----------------------------------------------------------------------------
+// EasyWlanIdL
+// -----------------------------------------------------------------------------
+//
+void CHotSpotSession::EasyWlanIdL()
+    {
+    DEBUG("CHotSpotSession::EasyWlanIdL()");
+    // Set to default value just in case
+    iEasyWlanId = KEasyWlanServiceId; 
+    
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+    
+    iEasyWlanId = cmManager.EasyWlanIdL();
+    DEBUG1("CHotSpotSession::EasyWlanIdL() ret: % d", iEasyWlanId);
+    CleanupStack::PopAndDestroy( &cmManager );
+    }
+
+// -----------------------------------------------------------------------------
 // ConnectionStateChanged
 // -----------------------------------------------------------------------------
 //