hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp
branchRCL_3
changeset 10 dff6ebfd236f
parent 0 56b72877c1cb
child 17 024ee8b21fe2
--- a/hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp	Fri Feb 19 23:55:42 2010 +0200
+++ b/hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp	Fri Mar 12 15:48:54 2010 +0200
@@ -11,10 +11,11 @@
 *
 * Contributors:
 *
-* Description:   Implements Network Config Extension for HotSpot
+* Description:   Implements Network Config Extension for HotspotFW
 *
 */
 
+
 // INCLUDE FILES
 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
 #include <nifman_internal.h>
@@ -24,11 +25,11 @@
 #include "am_debug.h"
 
 
-// ============================ MEMBER FUNCTIONS ===============================
+// ============================ MEMBER FUNCTIONS ==============================
 
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 // NewL
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 CNetworkConfigExtensionHotSpot* CNetworkConfigExtensionHotSpot::NewL( 
                                                             TAny* aMNifIfNotify )
@@ -42,9 +43,9 @@
 	return pDaemon;
 	}
 	
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 // ConstructL
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //    
 void CNetworkConfigExtensionHotSpot::ConstructL()
 	{
@@ -52,17 +53,17 @@
 	CNetworkConfigExtensionBase::ConstructL();
 	iNotAuthenticated = ETrue;
 	iNotDeregistered = ETrue;
+	iIsStartLoginActive = EFalse;
 	iHotspotConnect = KErrNotFound;
-	DEBUG( "CNetworkConfigExtensionHotSpot::ConstructL() Done" );
 	}
 
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 // SendIoctlMessageL 
-// Forwards Ioctl request to the daemon and activates the AO to wait for response
-// -----------------------------------------------------------------------------
+// Forwards Ioctl request to the daemon. Activates the AO to wait for response.
+// ----------------------------------------------------------------------------
 //
-void CNetworkConfigExtensionHotSpot::SendIoctlMessageL( const ESock::RLegacyResponseMsg& aMessage )
-
+void CNetworkConfigExtensionHotSpot::SendIoctlMessageL( 
+                                    const ESock::RLegacyResponseMsg& aMessage )
 	{
   	TInt name = aMessage.Int1();
   	if ( aMessage.Int0() != KCOLConfiguration )
@@ -85,109 +86,128 @@
 	CNetworkConfigExtensionBase::SendIoctlMessageL( aMessage );
 	}
 	
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 // ~CNetworkConfigExtensionHotSpot
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot()
+	{
+	DEBUG( "CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot" );
+	iClient.Close();
+	}    
 
-	{
-	DEBUG( "CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot()" );
-	}	
-
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 // ImplementationTable
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 const TImplementationProxy ImplementationTable[] = 
     {
-    IMPLEMENTATION_PROXY_ENTRY(0x10282ECA, CNetworkConfigExtensionHotSpot::NewL)
+    IMPLEMENTATION_PROXY_ENTRY( 0x10282ECA, 
+                                CNetworkConfigExtensionHotSpot::NewL )
     };
 
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 // ImplementationGroupProxy
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+                                                            TInt& aTableCount )
     {
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    aTableCount = sizeof( ImplementationTable ) / 
+                    sizeof( TImplementationProxy );
 
     return ImplementationTable;
     }
 
+// ----------------------------------------------------------------------------
+// Deregister
+// ----------------------------------------------------------------------------
+//
+void CNetworkConfigExtensionHotSpot::Deregister( TInt aCause )
+    {
+    DEBUG1( "CNetworkConfigExtensionHotSpot::Deregister() aCause: %d", aCause );
+    CNetworkConfigExtensionBase::Deregister( aCause ); // to parent
+    
+    if ( iIsStartLoginActive )
+        {
+        DEBUG( "CNetworkConfigExtensionHotSpot::Deregister() LoginComplete" );
+        iClient.LoginComplete( iConnectionInfoBuf().iIapId, KErrNone );
+        }
+    iIsStartLoginActive = EFalse;
+    }
 
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 // RunL
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 void CNetworkConfigExtensionHotSpot::RunL()
-	{
-	DEBUG( "CNetworkConfigExtensionHotSpot::RunL()" );
-	if (iLastGenericProgressStage == KConfigDaemonStartingRegistration)
-		{
-	
-		if(iNotAuthenticated)
-		    {	
-		    DEBUG( "CNetworkConfigExtensionHotSpot::RunL() not auth" );
-            TUint iapId = iConnectionInfoBuf().iIapId;
-	    	TUint networkId = iConnectionInfoBuf().iNetId;
-	    	
-	    	iHotspotConnect = iClient.Connect();
-	    	
-	    	if ( KErrNone == iHotspotConnect )
-	    		{
-	    		iClient.StartLogin( iapId, networkId, iStatus);
-	    		SetActive();
-	    		}
-	    	else
-	    		{
-	    		CNetworkConfigExtensionBase::RunL();
-	    		}
-			iNotAuthenticated = EFalse;
+    {
+    DEBUG( "CNetworkConfigExtensionHotSpot::RunL()" );
+    if ( iLastGenericProgressStage == KConfigDaemonStartingRegistration )
+        {
+        if( iNotAuthenticated )
+            {    
+            DEBUG( "CNetworkConfigExtensionHotSpot::RunL() StartLogin" );
+            iHotspotConnect = iClient.Connect();
+            
+            if ( KErrNone == iHotspotConnect )
+                {
+                iIsStartLoginActive = ETrue;
+                iClient.StartLogin( iConnectionInfoBuf().iIapId, 
+                                    iConnectionInfoBuf().iNetId, 
+                                    iStatus );
+                SetActive();
+                }
+            else // to parent
+                {
+                CNetworkConfigExtensionBase::RunL();
+                }
+            iNotAuthenticated = EFalse;
             }
-		else
-		    {
-		    DEBUG( "CNetworkConfigExtensionHotSpot::RunL() close" );
-			CNetworkConfigExtensionBase::RunL();
-		    }
-		
-		}
-    else if (iLastGenericProgressStage == KConfigDaemonStartingDeregistration)
+        else // to parent
+            {
+            DEBUG( "CNetworkConfigExtensionHotSpot::RunL() authenticated" );
+            iIsStartLoginActive = EFalse;
+            CNetworkConfigExtensionBase::RunL();
+            }
+        
+        }
+    else if ( iLastGenericProgressStage == 
+              KConfigDaemonStartingDeregistration )
         {
-        if(iNotDeregistered)
-		    {
-		    DEBUG( "CNetworkConfigExtensionHotSpot::RunL() dereg" );
+        if( iNotDeregistered )
+            {
+            DEBUG( "CNetworkConfigExtensionHotSpot::RunL() CloseConnection" );
             TUint iapId = iConnectionInfoBuf().iIapId;
-	    	TUint networkId = iConnectionInfoBuf().iNetId;
-	    	
-	    	if ( KErrNone == iHotspotConnect )
-	    		{
-	    		iClient.CloseConnection( iapId, iStatus);
-	    		SetActive();
-	    		}
-	    	else
-	    		{
-	    		CNetworkConfigExtensionBase::RunL();
-	    		}
-			iNotDeregistered = EFalse;
-		    }
-        else
-		    {
-		    DEBUG( "CNetworkConfigExtensionHotSpot::RunL() dereg close" );
-		    iClient.Close();
-		    CNetworkConfigExtensionBase::RunL();
-		    }
+            TUint networkId = iConnectionInfoBuf().iNetId;
+            
+            if ( KErrNone == iHotspotConnect )
+                {
+                iClient.CloseConnection( iapId, iStatus );
+                SetActive();
+                }
+            else // to parent
+                {
+                CNetworkConfigExtensionBase::RunL();
+                }
+            iNotDeregistered = EFalse;
+            }
+        else // to parent
+            {
+            DEBUG( "CNetworkConfigExtensionHotSpot::RunL() deregistered" );
+            CNetworkConfigExtensionBase::RunL();
+            }
         }
-	else // original =========================================================
-	    {
-	    DEBUG( "CNetworkConfigExtensionHotSpot::RunL() original" );
-		CNetworkConfigExtensionBase::RunL();
-	    }
-	}
-	
-// -----------------------------------------------------------------------------
+    else // to parent
+        {
+        DEBUG( "CNetworkConfigExtensionHotSpot::RunL() original" );
+        CNetworkConfigExtensionBase::RunL();
+        }
+    }
+    
+// ----------------------------------------------------------------------------
 // DoCancel
-// -----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 //
 void CNetworkConfigExtensionHotSpot::DoCancel()
     {