diff -r d9ec2b8c6bad -r 2fbd1d709fe7 hotspotfw/hsserver/src/hotspotsession.cpp --- a/hotspotfw/hsserver/src/hotspotsession.cpp Wed Jun 23 19:25:42 2010 +0300 +++ b/hotspotfw/hsserver/src/hotspotsession.cpp Tue Jul 06 15:29:22 2010 +0300 @@ -25,14 +25,11 @@ #include "hsslogouttimer.h" #include "hssclientinterface.h" #include "am_debug.h" -#include #include #include -#include #include #include #include -#include // Forward declarations class CWlanMgmtClient; @@ -118,11 +115,7 @@ iLogoutTimer->Cancel(); delete iLogoutTimer; } - - if ( iIcts != NULL ) - { - delete iIcts; - } + DEBUG( "CHotSpotSession::~CHotSpotSession() Done" ); } @@ -179,10 +172,10 @@ HandleCancelNotifications( aMessage ); break; case EHssRegister : - ProcessRegisterL( aMessage ); + ProcessRegister( aMessage ); break; case EHssUnRegister : - ProcessUnRegisterL( aMessage ); + ProcessUnRegister( aMessage ); break; case EHssJoin : iAllowNotifications = EFalse; @@ -294,7 +287,7 @@ } else { - err = ProcessStartLoginL( iIapId, iNetId ); + err = ProcessStartLogin( iIapId, iNetId ); // If client not found, an error was returned. // Otherwise message completed elsewhere. if ( KErrNone != err ) @@ -462,21 +455,11 @@ aMessage.Complete( KErrNone ); break; case EHssUiState: - ProcessUiState( aMessage ); + aMessage.Complete( KErrNotSupported ); break; case EHssStartBrowser: { - TInt len = aMessage.GetDesLength( 0 ); - iIapId = ( TInt )aMessage.Int1(); - iNetId = ( TInt )aMessage.Int2(); - err = iServer.SaveMessage( iIapId, aMessage, EHssStartBrowser ); - HBufC* buf = HBufC::NewLC( len ); - TPtr ptr( buf->Des() ); - User::LeaveIfError( aMessage.Read( 0, ptr ) ); - - AuthenticateL( ptr ); - - CleanupStack::PopAndDestroy(buf); + aMessage.Complete( KErrNotSupported ); break; } case EHssSetTimerValues: @@ -597,70 +580,6 @@ } // ----------------------------------------------------------------------------- -// TestInternetConnectivityL -// ----------------------------------------------------------------------------- -// -void CHotSpotSession::TestInternetConnectivityL() - { - DEBUG("CHotSpotSession::TestInternetConnectivityL"); - if ( iIcts != NULL ) - { - delete iIcts; - iIcts = NULL; - } - - iIcts = CIctsClientInterface::NewL( iIapId, iNetId, *this ); - iIcts->StartL(); - } - -// ----------------------------------------------------------------------------- -// ConnectivityObserver -// ----------------------------------------------------------------------------- -// -void CHotSpotSession::ConnectivityObserver( TIctsTestResult aResult, - const TDesC& aString ) - { - DEBUG1("CHotSpotSession::ConnectivityObserver result: %d", aResult); - TInt indx( KErrNone ); - switch ( aResult ) - { - case EConnectionOk : - indx = iServer.FindMessage( iIapId, EHssStartLogin ); - if ( KErrNotFound != indx ) - { - iServer.CompleteMessage( indx, KErrNone ); - } - TRAPD( trap, iIapSettingsHandler->CreateIapL() ); - if ( trap != KErrNone ) - { - DEBUG1("CHotSpotSession::ConnectivityObserver trap: %d", trap); - } - break; - case EHttpAuthenticationNeeded : - // Start browser for authentication - TRAP_IGNORE( AuthenticateL( aString ) ); - break; - case EConnectionNotOk : - indx = iServer.FindMessage( iIapId, EHssStartLogin ); - if ( KErrNotFound != indx ) - { - iServer.CompleteMessage( indx, KErrNone ); - } - break; - case ETimeout : - indx = iServer.FindMessage( iIapId, EHssStartLogin ); - if ( KErrNotFound != indx ) - { - iServer.CompleteMessage( indx, KErrNone ); - } - - break; - default: - break; - } - } - -// ----------------------------------------------------------------------------- // LoginTimeout // ----------------------------------------------------------------------------- // @@ -713,12 +632,12 @@ } // --------------------------------------------------------- -// ProcessRegisterL +// ProcessRegister // --------------------------------------------------------- // -void CHotSpotSession::ProcessRegisterL( const RMessage2& aMessage ) +void CHotSpotSession::ProcessRegister( const RMessage2& aMessage ) { - DEBUG("CHotSpotSession::ProcessRegisterL"); + DEBUG("CHotSpotSession::ProcessRegister"); iAllowNotifications = EFalse; TBufC< KIapNameLength > iapName; @@ -758,33 +677,25 @@ } // --------------------------------------------------------- -// ProcessUnRegisterL +// ProcessUnRegister // --------------------------------------------------------- // -void CHotSpotSession::ProcessUnRegisterL( const RMessage2& aMessage ) +void CHotSpotSession::ProcessUnRegister( const RMessage2& aMessage ) { - DEBUG("CHotSpotSession::ProcessUnRegisterL"); + DEBUG("CHotSpotSession::ProcessUnRegister"); iAllowNotifications = EFalse; TInt ret( KErrNone ); // Read message TInt iapId = ( TInt )aMessage.Int0(); iServer.RemoveClientIap( iapId ); - // Check that this is not Easy WLAN - TInt easyWlan = iServer.GetEasyWlanId(); - if ( easyWlan != iapId ) + + TRAPD( err, iIapSettingsHandler->DeleteIapL( iapId ) ); + // return KErrGeneral if IAP removal is not successful + if ( err != KErrNone ) { - TRAPD( err, iIapSettingsHandler->DeleteIapL( iapId ) ); - // return KErrGeneral if IAP removal is not successful - if ( err != KErrNone ) - { - ret = KErrGeneral; - } + ret = KErrGeneral; } - else - { - ret = KErrPermissionDenied; - } aMessage.Complete( ret ); DEBUG("CHotSpotSession::ProcessUnRegisterL DONE"); } @@ -793,24 +704,13 @@ // ProcessStartLogin // ----------------------------------------------------------------------------- // -TInt CHotSpotSession::ProcessStartLoginL( const TUint aIapId, const TUint aNetId ) +TInt CHotSpotSession::ProcessStartLogin( const TUint aIapId, const TUint aNetId ) { DEBUG("CHotSpotSession::ProcessStartLogin"); TInt ret( KErrNotFound ); TBuf8 extAPI; iIapId = aIapId; - // Check if Easy WLAN. - TInt easyWlan = iServer.GetEasyWlanId(); - if ( easyWlan == aIapId ) - { - DEBUG("CHotSpotSession::ProcessStartLogin Easy WLAN detected"); - // Just test internet connectivity and complete message later - TestInternetConnectivityL(); - ret = KErrNone; - return ret; - } - TBuf clientUid; TInt err = iServer.GetClientUid( aIapId, clientUid ); @@ -839,7 +739,7 @@ } // ----------------------------------------------------------------------------- -// ProcessStart +// ProcessStartL // ----------------------------------------------------------------------------- // TInt CHotSpotSession::ProcessStartL( const TUint aIapId ) @@ -1035,106 +935,6 @@ } // ----------------------------------------------------------------------------- -// ProcessUiState -// ----------------------------------------------------------------------------- -// -void CHotSpotSession::ProcessUiState( const RMessage2& aMessage ) - { - DEBUG( "CHotSpotSession::ProcessUiState()" ); - TBool completeMsg = EFalse; - TInt indx( KErrNone ); - TInt indxBrowser( KErrNone ); - TInt ret( KErrNone ); - iIapId = ( TInt )aMessage.Int0(); - - indx = iServer.FindMessage( iIapId, EHssStartLogin ); - indxBrowser = iServer.FindMessage( iIapId, EHssStartBrowser ); - THsBrowserUiStates uiState = ( THsBrowserUiStates ) aMessage.Int1(); // UI state - switch ( uiState ) - { - case EHsBrowserUiRunning: - { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiRunning" ); - break; - } - case EHsBrowserUiAuthenticatedOk: - { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiAuthenticatedOk" ); - - completeMsg = ETrue; - break; - } - case EHsBrowserUiAuthenticatedNok: - { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiAuthenticatedNok" ); - completeMsg = ETrue; - break; - } - case EHsBrowserUiClosed: - { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiClosed" ); - completeMsg = ETrue; - break; - } - default: - { - DEBUG( "CHotSpotSession::ProcessUiState() default" ); - completeMsg = ETrue; - } - } - - if ( completeMsg ) - { - // complete messages EHssStartLogin/EHssStartBrowser - if ( indx >= 0 ) - { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartLogin" ); - iServer.CompleteMessage( indx , KErrNone ); - aMessage.Complete( KErrNone ); - } - else if ( indxBrowser >= 0 ) - { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartBrowser" ); - iServer.CompleteMessage( indxBrowser, ret ); - aMessage.Complete( KErrNone ); - } - else - { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssUiState" ); - aMessage.Complete( KErrNotFound ); - } - } - } - -// ----------------------------------------------------------------------------- -// Authenticate() -// ----------------------------------------------------------------------------- -// -void CHotSpotSession::AuthenticateL( const TDesC& aString ) - { - DEBUG("CHotSpotSession::AuthenticateL()"); - - const TInt KBrowserUid = 0x2000AFCC; // hotspot browser application - HBufC* param = HBufC::NewLC( KMaxFileName ); - _LIT(tmpString, "%d, %d, %S"); - param->Des().Format( tmpString, iIapId, iNetId, &aString ); - TUid uid( TUid::Uid( KBrowserUid ) ); - RApaLsSession appArcSession; - User::LeaveIfError( appArcSession.Connect() ); // connect to AppArc server - CleanupClosePushL( appArcSession ); - TThreadId id; - TInt err = appArcSession.StartDocument( *param, TUid::Uid( KBrowserUid ), id ); - if ( err != KErrNone ) - { - DEBUG1( "CHotSpotSession::AuthenticateL() StartDocument: %d", err ); - } - CleanupStack::PopAndDestroy( &appArcSession ); - CleanupStack::PopAndDestroy( param ); - - DEBUG("CHotSpotSession::AuthenticateLC() done"); - } - -// ----------------------------------------------------------------------------- // ModifyClientUid // ----------------------------------------------------------------------------- //