hotspotfw/hsclient/NetCfgExtnHotSpot/src/NetCfgExtnHotSpot.cpp
branchRCL_3
changeset 10 dff6ebfd236f
parent 0 56b72877c1cb
child 17 024ee8b21fe2
equal deleted inserted replaced
8:c2bc3f8c7777 10:dff6ebfd236f
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:   Implements Network Config Extension for HotSpot
    14 * Description:   Implements Network Config Extension for HotspotFW
    15 *
    15 *
    16 */
    16 */
       
    17 
    17 
    18 
    18 // INCLUDE FILES
    19 // INCLUDE FILES
    19 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    20 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    20 #include <nifman_internal.h>
    21 #include <nifman_internal.h>
    21 #endif
    22 #endif
    22 #include "NetCfgExtnHotSpot.h"
    23 #include "NetCfgExtnHotSpot.h"
    23 #include "implementationproxy.h"
    24 #include "implementationproxy.h"
    24 #include "am_debug.h"
    25 #include "am_debug.h"
    25 
    26 
    26 
    27 
    27 // ============================ MEMBER FUNCTIONS ===============================
    28 // ============================ MEMBER FUNCTIONS ==============================
    28 
    29 
    29 // -----------------------------------------------------------------------------
    30 // ----------------------------------------------------------------------------
    30 // NewL
    31 // NewL
    31 // -----------------------------------------------------------------------------
    32 // ----------------------------------------------------------------------------
    32 //
    33 //
    33 CNetworkConfigExtensionHotSpot* CNetworkConfigExtensionHotSpot::NewL( 
    34 CNetworkConfigExtensionHotSpot* CNetworkConfigExtensionHotSpot::NewL( 
    34                                                             TAny* aMNifIfNotify )
    35                                                             TAny* aMNifIfNotify )
    35 	{
    36 	{
    36 	MNifIfNotify* nifIfNotify = reinterpret_cast<MNifIfNotify*>( aMNifIfNotify );
    37 	MNifIfNotify* nifIfNotify = reinterpret_cast<MNifIfNotify*>( aMNifIfNotify );
    40 	pDaemon->ConstructL();
    41 	pDaemon->ConstructL();
    41 	CleanupStack::Pop( pDaemon );
    42 	CleanupStack::Pop( pDaemon );
    42 	return pDaemon;
    43 	return pDaemon;
    43 	}
    44 	}
    44 	
    45 	
    45 // -----------------------------------------------------------------------------
    46 // ----------------------------------------------------------------------------
    46 // ConstructL
    47 // ConstructL
    47 // -----------------------------------------------------------------------------
    48 // ----------------------------------------------------------------------------
    48 //    
    49 //    
    49 void CNetworkConfigExtensionHotSpot::ConstructL()
    50 void CNetworkConfigExtensionHotSpot::ConstructL()
    50 	{
    51 	{
    51 	DEBUG( "CNetworkConfigExtensionHotSpot::ConstructL()" );
    52 	DEBUG( "CNetworkConfigExtensionHotSpot::ConstructL()" );
    52 	CNetworkConfigExtensionBase::ConstructL();
    53 	CNetworkConfigExtensionBase::ConstructL();
    53 	iNotAuthenticated = ETrue;
    54 	iNotAuthenticated = ETrue;
    54 	iNotDeregistered = ETrue;
    55 	iNotDeregistered = ETrue;
       
    56 	iIsStartLoginActive = EFalse;
    55 	iHotspotConnect = KErrNotFound;
    57 	iHotspotConnect = KErrNotFound;
    56 	DEBUG( "CNetworkConfigExtensionHotSpot::ConstructL() Done" );
       
    57 	}
    58 	}
    58 
    59 
    59 // -----------------------------------------------------------------------------
    60 // ----------------------------------------------------------------------------
    60 // SendIoctlMessageL 
    61 // SendIoctlMessageL 
    61 // Forwards Ioctl request to the daemon and activates the AO to wait for response
    62 // Forwards Ioctl request to the daemon. Activates the AO to wait for response.
    62 // -----------------------------------------------------------------------------
    63 // ----------------------------------------------------------------------------
    63 //
    64 //
    64 void CNetworkConfigExtensionHotSpot::SendIoctlMessageL( const ESock::RLegacyResponseMsg& aMessage )
    65 void CNetworkConfigExtensionHotSpot::SendIoctlMessageL( 
    65 
    66                                     const ESock::RLegacyResponseMsg& aMessage )
    66 	{
    67 	{
    67   	TInt name = aMessage.Int1();
    68   	TInt name = aMessage.Int1();
    68   	if ( aMessage.Int0() != KCOLConfiguration )
    69   	if ( aMessage.Int0() != KCOLConfiguration )
    69   	    {
    70   	    {
    70   	    User::Leave( KErrNotSupported );
    71   	    User::Leave( KErrNotSupported );
    83   			}   
    84   			}   
    84   		}
    85   		}
    85 	CNetworkConfigExtensionBase::SendIoctlMessageL( aMessage );
    86 	CNetworkConfigExtensionBase::SendIoctlMessageL( aMessage );
    86 	}
    87 	}
    87 	
    88 	
    88 // -----------------------------------------------------------------------------
    89 // ----------------------------------------------------------------------------
    89 // ~CNetworkConfigExtensionHotSpot
    90 // ~CNetworkConfigExtensionHotSpot
    90 // -----------------------------------------------------------------------------
    91 // ----------------------------------------------------------------------------
    91 //
    92 //
    92 CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot()
    93 CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot()
    93 
    94 	{
    94 	{
    95 	DEBUG( "CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot" );
    95 	DEBUG( "CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot()" );
    96 	iClient.Close();
    96 	}	
    97 	}    
    97 
    98 
    98 // -----------------------------------------------------------------------------
    99 // ----------------------------------------------------------------------------
    99 // ImplementationTable
   100 // ImplementationTable
   100 // -----------------------------------------------------------------------------
   101 // ----------------------------------------------------------------------------
   101 //
   102 //
   102 const TImplementationProxy ImplementationTable[] = 
   103 const TImplementationProxy ImplementationTable[] = 
   103     {
   104     {
   104     IMPLEMENTATION_PROXY_ENTRY(0x10282ECA, CNetworkConfigExtensionHotSpot::NewL)
   105     IMPLEMENTATION_PROXY_ENTRY( 0x10282ECA, 
       
   106                                 CNetworkConfigExtensionHotSpot::NewL )
   105     };
   107     };
   106 
   108 
   107 // -----------------------------------------------------------------------------
   109 // ----------------------------------------------------------------------------
   108 // ImplementationGroupProxy
   110 // ImplementationGroupProxy
   109 // -----------------------------------------------------------------------------
   111 // ----------------------------------------------------------------------------
   110 //
   112 //
   111 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
   113 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
   112     {
   114                                                             TInt& aTableCount )
   113     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
   115     {
       
   116     aTableCount = sizeof( ImplementationTable ) / 
       
   117                     sizeof( TImplementationProxy );
   114 
   118 
   115     return ImplementationTable;
   119     return ImplementationTable;
   116     }
   120     }
   117 
   121 
   118 
   122 // ----------------------------------------------------------------------------
   119 // -----------------------------------------------------------------------------
   123 // Deregister
       
   124 // ----------------------------------------------------------------------------
       
   125 //
       
   126 void CNetworkConfigExtensionHotSpot::Deregister( TInt aCause )
       
   127     {
       
   128     DEBUG1( "CNetworkConfigExtensionHotSpot::Deregister() aCause: %d", aCause );
       
   129     CNetworkConfigExtensionBase::Deregister( aCause ); // to parent
       
   130     
       
   131     if ( iIsStartLoginActive )
       
   132         {
       
   133         DEBUG( "CNetworkConfigExtensionHotSpot::Deregister() LoginComplete" );
       
   134         iClient.LoginComplete( iConnectionInfoBuf().iIapId, KErrNone );
       
   135         }
       
   136     iIsStartLoginActive = EFalse;
       
   137     }
       
   138 
       
   139 // ----------------------------------------------------------------------------
   120 // RunL
   140 // RunL
   121 // -----------------------------------------------------------------------------
   141 // ----------------------------------------------------------------------------
   122 //
   142 //
   123 void CNetworkConfigExtensionHotSpot::RunL()
   143 void CNetworkConfigExtensionHotSpot::RunL()
   124 	{
   144     {
   125 	DEBUG( "CNetworkConfigExtensionHotSpot::RunL()" );
   145     DEBUG( "CNetworkConfigExtensionHotSpot::RunL()" );
   126 	if (iLastGenericProgressStage == KConfigDaemonStartingRegistration)
   146     if ( iLastGenericProgressStage == KConfigDaemonStartingRegistration )
   127 		{
   147         {
   128 	
   148         if( iNotAuthenticated )
   129 		if(iNotAuthenticated)
   149             {    
   130 		    {	
   150             DEBUG( "CNetworkConfigExtensionHotSpot::RunL() StartLogin" );
   131 		    DEBUG( "CNetworkConfigExtensionHotSpot::RunL() not auth" );
   151             iHotspotConnect = iClient.Connect();
       
   152             
       
   153             if ( KErrNone == iHotspotConnect )
       
   154                 {
       
   155                 iIsStartLoginActive = ETrue;
       
   156                 iClient.StartLogin( iConnectionInfoBuf().iIapId, 
       
   157                                     iConnectionInfoBuf().iNetId, 
       
   158                                     iStatus );
       
   159                 SetActive();
       
   160                 }
       
   161             else // to parent
       
   162                 {
       
   163                 CNetworkConfigExtensionBase::RunL();
       
   164                 }
       
   165             iNotAuthenticated = EFalse;
       
   166             }
       
   167         else // to parent
       
   168             {
       
   169             DEBUG( "CNetworkConfigExtensionHotSpot::RunL() authenticated" );
       
   170             iIsStartLoginActive = EFalse;
       
   171             CNetworkConfigExtensionBase::RunL();
       
   172             }
       
   173         
       
   174         }
       
   175     else if ( iLastGenericProgressStage == 
       
   176               KConfigDaemonStartingDeregistration )
       
   177         {
       
   178         if( iNotDeregistered )
       
   179             {
       
   180             DEBUG( "CNetworkConfigExtensionHotSpot::RunL() CloseConnection" );
   132             TUint iapId = iConnectionInfoBuf().iIapId;
   181             TUint iapId = iConnectionInfoBuf().iIapId;
   133 	    	TUint networkId = iConnectionInfoBuf().iNetId;
   182             TUint networkId = iConnectionInfoBuf().iNetId;
   134 	    	
   183             
   135 	    	iHotspotConnect = iClient.Connect();
   184             if ( KErrNone == iHotspotConnect )
   136 	    	
   185                 {
   137 	    	if ( KErrNone == iHotspotConnect )
   186                 iClient.CloseConnection( iapId, iStatus );
   138 	    		{
   187                 SetActive();
   139 	    		iClient.StartLogin( iapId, networkId, iStatus);
   188                 }
   140 	    		SetActive();
   189             else // to parent
   141 	    		}
   190                 {
   142 	    	else
   191                 CNetworkConfigExtensionBase::RunL();
   143 	    		{
   192                 }
   144 	    		CNetworkConfigExtensionBase::RunL();
   193             iNotDeregistered = EFalse;
   145 	    		}
   194             }
   146 			iNotAuthenticated = EFalse;
   195         else // to parent
   147             }
   196             {
   148 		else
   197             DEBUG( "CNetworkConfigExtensionHotSpot::RunL() deregistered" );
   149 		    {
   198             CNetworkConfigExtensionBase::RunL();
   150 		    DEBUG( "CNetworkConfigExtensionHotSpot::RunL() close" );
   199             }
   151 			CNetworkConfigExtensionBase::RunL();
   200         }
   152 		    }
   201     else // to parent
   153 		
   202         {
   154 		}
   203         DEBUG( "CNetworkConfigExtensionHotSpot::RunL() original" );
   155     else if (iLastGenericProgressStage == KConfigDaemonStartingDeregistration)
   204         CNetworkConfigExtensionBase::RunL();
   156         {
   205         }
   157         if(iNotDeregistered)
   206     }
   158 		    {
   207     
   159 		    DEBUG( "CNetworkConfigExtensionHotSpot::RunL() dereg" );
   208 // ----------------------------------------------------------------------------
   160             TUint iapId = iConnectionInfoBuf().iIapId;
       
   161 	    	TUint networkId = iConnectionInfoBuf().iNetId;
       
   162 	    	
       
   163 	    	if ( KErrNone == iHotspotConnect )
       
   164 	    		{
       
   165 	    		iClient.CloseConnection( iapId, iStatus);
       
   166 	    		SetActive();
       
   167 	    		}
       
   168 	    	else
       
   169 	    		{
       
   170 	    		CNetworkConfigExtensionBase::RunL();
       
   171 	    		}
       
   172 			iNotDeregistered = EFalse;
       
   173 		    }
       
   174         else
       
   175 		    {
       
   176 		    DEBUG( "CNetworkConfigExtensionHotSpot::RunL() dereg close" );
       
   177 		    iClient.Close();
       
   178 		    CNetworkConfigExtensionBase::RunL();
       
   179 		    }
       
   180         }
       
   181 	else // original =========================================================
       
   182 	    {
       
   183 	    DEBUG( "CNetworkConfigExtensionHotSpot::RunL() original" );
       
   184 		CNetworkConfigExtensionBase::RunL();
       
   185 	    }
       
   186 	}
       
   187 	
       
   188 // -----------------------------------------------------------------------------
       
   189 // DoCancel
   209 // DoCancel
   190 // -----------------------------------------------------------------------------
   210 // ----------------------------------------------------------------------------
   191 //
   211 //
   192 void CNetworkConfigExtensionHotSpot::DoCancel()
   212 void CNetworkConfigExtensionHotSpot::DoCancel()
   193     {
   213     {
   194     DEBUG( "CNetworkConfigExtensionHotSpot::RunL() DoCancel" );
   214     DEBUG( "CNetworkConfigExtensionHotSpot::RunL() DoCancel" );
   195     iClient.CancelLogin();
   215     iClient.CancelLogin();