# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1282204780 -10800 # Node ID b852595f5cbe8ee0b02745a4cbdb170c519e4f06 # Parent 3b2fb68d23df48dc2bca861ed21d9051efe7e381 Revision: 201029 Kit: 201033 diff -r 3b2fb68d23df -r b852595f5cbe hotspotfw/hsbrowser/inc/hsbrowserictsobserver.h --- a/hotspotfw/hsbrowser/inc/hsbrowserictsobserver.h Thu Jul 15 19:54:09 2010 +0300 +++ b/hotspotfw/hsbrowser/inc/hsbrowserictsobserver.h Thu Aug 19 10:59:40 2010 +0300 @@ -84,6 +84,11 @@ * Not owned. */ CHsBrowserContainer* iContainer; + + /** + * Flag for authentication ok indication to Hotspot Server + */ + TBool iAuthenticatedOkSent; }; #endif // HSBROWSERICTSOBSERVER_H diff -r 3b2fb68d23df -r b852595f5cbe hotspotfw/hsbrowser/src/hsbrowserictsobserver.cpp --- a/hotspotfw/hsbrowser/src/hsbrowserictsobserver.cpp Thu Jul 15 19:54:09 2010 +0300 +++ b/hotspotfw/hsbrowser/src/hsbrowserictsobserver.cpp Thu Aug 19 10:59:40 2010 +0300 @@ -85,13 +85,16 @@ if ( iContainer ) { CHsBrowserModel* model = iContainer->Model(); - if ( model ) + if ( model && !iAuthenticatedOkSent ) { + // Send this only once per session + iAuthenticatedOkSent = ETrue; model->SetState( EHsBrowserUiAuthenticatedOk, ETrue ); + // Do this only once too + iContainer->ShowLoginCompleteNote(); + iContainer->SendToBackground(); + iContainer->UpdateSoftkeys(); } - iContainer->ShowLoginCompleteNote(); - iContainer->SendToBackground(); - iContainer->UpdateSoftkeys(); } } @@ -100,7 +103,8 @@ // --------------------------------------------------------- // CHsBrowserIctsObserver::CHsBrowserIctsObserver( - CHsBrowserContainer* aContainer ) : iContainer( aContainer ) + CHsBrowserContainer* aContainer ) : iContainer( aContainer ), + iAuthenticatedOkSent( EFalse ) { DEBUG( "CHsBrowserIctsObserver::CHsBrowserIctsObserver()" ); } diff -r 3b2fb68d23df -r b852595f5cbe hotspotfw/hsserver/inc/hotspotserver.h --- a/hotspotfw/hsserver/inc/hotspotserver.h Thu Jul 15 19:54:09 2010 +0300 +++ b/hotspotfw/hsserver/inc/hotspotserver.h Thu Aug 19 10:59:40 2010 +0300 @@ -239,6 +239,13 @@ void CheckIapsL(); /** + * Activates WLAN notifications. + * @since Series 60 5.2 + * @return None + */ + void ActivateWlanNotificationsL(); + + /** * Get login timer value for the specified client. * @since Series 60 5.2 * @param aClientUid, clients user id diff -r 3b2fb68d23df -r b852595f5cbe hotspotfw/hsserver/inc/hotspotsession.h --- a/hotspotfw/hsserver/inc/hotspotsession.h Thu Jul 15 19:54:09 2010 +0300 +++ b/hotspotfw/hsserver/inc/hotspotsession.h Thu Aug 19 10:59:40 2010 +0300 @@ -229,7 +229,7 @@ * Updates UI state of HotSpot browser logon application. * @param aMessage, Message for completing request */ - void ProcessUiState( const RMessage2& aMessage ); + void ProcessUiStateL( const RMessage2& aMessage ); /** * Start HotSpot browser logon application. diff -r 3b2fb68d23df -r b852595f5cbe hotspotfw/hsserver/inc/hssiapsettingshandler.h --- a/hotspotfw/hsserver/inc/hssiapsettingshandler.h Thu Jul 15 19:54:09 2010 +0300 +++ b/hotspotfw/hsserver/inc/hssiapsettingshandler.h Thu Aug 19 10:59:40 2010 +0300 @@ -136,15 +136,23 @@ /** * Create new IAP to Internet SNAP. + * @param aHotspot, ETrue if captive portal detected + * @return Iap ID, Otherwise aIapId will be null */ - void CreateIapL(); + TInt CreateIapL( TBool aHotspot ); /** * Deletes the IAP * @param aIapID, IAP id */ void DeleteIapL( const TUint aIapId ); - + + /** + * Moves the IAP to Internet SNAP + * @param aIapID, IAP id + */ + void MoveIapL( const TUint aIapId ); + protected: /** diff -r 3b2fb68d23df -r b852595f5cbe hotspotfw/hsserver/src/hotspotserver.cpp --- a/hotspotfw/hsserver/src/hotspotserver.cpp Thu Jul 15 19:54:09 2010 +0300 +++ b/hotspotfw/hsserver/src/hotspotserver.cpp Thu Aug 19 10:59:40 2010 +0300 @@ -165,9 +165,7 @@ // Activate notifications for IAP check purposes. Done with every server startup. // When EWlanConnectionModeNotConnected is received we can cancel this. iMgtClient = CWlanMgmtClient::NewL(); -#ifndef __WINS__ - iMgtClient->ActivateNotificationsL( *this ); -#endif + ActivateWlanNotificationsL(); } // ----------------------------------------------------------------------------- @@ -278,7 +276,7 @@ delete plugin; DEBUG1("CHotSpotServer::CheckIapsL find client error: %d", error ); - if ( error == KErrNotFound ) + if ( error != KErrNone ) { // Remove from database RCmManagerExt cmManager; @@ -304,6 +302,19 @@ } // ----------------------------------------------------------------------------- +// ActivateWlanNotificationsL +// ----------------------------------------------------------------------------- +// +void CHotSpotServer::ActivateWlanNotificationsL() + { + DEBUG("CHotSpotServer::ActivateWlanNotificationsL"); +#ifndef __WINS__ + iMgtClient->CancelNotifications(); + iMgtClient->ActivateNotificationsL( *this ); +#endif + } + +// ----------------------------------------------------------------------------- // NewSessionL // ----------------------------------------------------------------------------- // diff -r 3b2fb68d23df -r b852595f5cbe hotspotfw/hsserver/src/hotspotsession.cpp --- a/hotspotfw/hsserver/src/hotspotsession.cpp Thu Jul 15 19:54:09 2010 +0300 +++ b/hotspotfw/hsserver/src/hotspotsession.cpp Thu Aug 19 10:59:40 2010 +0300 @@ -50,7 +50,8 @@ // CHotSpotSession::CHotSpotSession( CHotSpotServer& aServer ) : iServer( aServer ), iClient( NULL ), iSrvNotifications ( NULL ), - iNotificationHandle( NULL ), iAllowNotifications( ETrue ), iHotspotExtension( ETrue ) + iNotificationHandle( NULL ), iAllowNotifications( ETrue ), + iHotspotExtension( ETrue ) { } @@ -160,7 +161,6 @@ switch ( aMessage.Function() ) { case EHssActivateNotifications : - DEBUG( "CHotSpotSession::ActivateNotificationsL" ); iAllowNotifications = EFalse; if ( iNotifications == NULL ) @@ -171,7 +171,6 @@ HandleOrderNotifications( aMessage ); break; case EHssCancelNotifications : - DEBUG( "CHotSpotSession::CancelNotifications" ); iAllowNotifications = EFalse; iMgtClient->CancelNotifications( ); @@ -259,12 +258,10 @@ { if ( value == KErrNone ) { - DEBUG( "EHssLoginComplete1" ); iServer.CompleteMessage( indx, KErrNone ); } else { - DEBUG( "EHssLoginComplete2" ); iServer.CompleteMessage( indx, KErrCancel ); iServer.SetLogoutFlag( ETrue ); } @@ -303,7 +300,7 @@ // Otherwise message completed elsewhere. if ( KErrNone != err ) { - indx = iServer.FindMessage(iIapId, EHssStartLogin ); + indx = iServer.FindMessage( iIapId, EHssStartLogin ); if ( indx >= 0 ) { iServer.CompleteMessage( indx , KErrNone ); @@ -466,7 +463,9 @@ aMessage.Complete( KErrNone ); break; case EHssUiState: - ProcessUiState( aMessage ); + TRAP_IGNORE( ProcessUiStateL( aMessage ) ); + // Just complete the message + aMessage.Complete( KErrNone ); break; case EHssStartBrowser: { @@ -630,7 +629,7 @@ { case EConnectionOk : // Create IAP first, then complete the message to connection. - TRAP_IGNORE( iIapSettingsHandler->CreateIapL() ); + TRAP_IGNORE( iIapSettingsHandler->CreateIapL( EFalse ) ); indx = iServer.FindMessage( iIapId, EHssStartLogin ); if ( KErrNotFound != indx ) { @@ -1038,12 +1037,12 @@ } // ----------------------------------------------------------------------------- -// ProcessUiState +// ProcessUiStateL // ----------------------------------------------------------------------------- // -void CHotSpotSession::ProcessUiState( const RMessage2& aMessage ) +void CHotSpotSession::ProcessUiStateL( const RMessage2& aMessage ) { - DEBUG( "CHotSpotSession::ProcessUiState()" ); + DEBUG( "CHotSpotSession::ProcessUiStateL()" ); TBool completeMsg = EFalse; TInt indx( KErrNone ); TInt indxBrowser( KErrNone ); @@ -1057,31 +1056,57 @@ { case EHsBrowserUiRunning: { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiRunning" ); + DEBUG( "CHotSpotSession::ProcessUiStateL() EHsBrowserUiRunning" ); break; } case EHsBrowserUiAuthenticatedOk: { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiAuthenticatedOk" ); - + DEBUG( "CHotSpotSession::ProcessUiStateL() EHsBrowserUiAuthenticatedOk" ); + // Check if Easy WLAN. + TInt easyWlan = iServer.GetEasyWlanId(); + if ( easyWlan != iIapId ) + { + iIapSettingsHandler->MoveIapL( iIapId ); + // Activate notifications and mark as client IAP so that + // IAP can be deleted after the use. + TBuf clientUid; + iServer.SetClientIap( iIapId, clientUid ); + iServer.ActivateWlanNotificationsL(); + } + else + { + TInt iapId( 0 ); + iapId = iIapSettingsHandler->CreateIapL( ETrue ); + if ( iapId > 0 ) + { + // Activate notifications and mark as client IAP so that + // IAP can be deleted after the use. + TBuf clientUid; + iServer.SetClientIap( iapId, clientUid ); + iServer.ActivateWlanNotificationsL(); + } + } + completeMsg = ETrue; + DEBUG( "CHotSpotSession::ProcessUiStateL() EHsBrowserUiAuthenticatedOk Done" ); break; } case EHsBrowserUiAuthenticatedNok: { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiAuthenticatedNok" ); + DEBUG( "CHotSpotSession::ProcessUiStateL() EHsBrowserUiAuthenticatedNok" ); + completeMsg = ETrue; break; } case EHsBrowserUiClosed: { - DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiClosed" ); + DEBUG( "CHotSpotSession::ProcessUiStateL() EHsBrowserUiClosed" ); completeMsg = ETrue; break; } default: { - DEBUG( "CHotSpotSession::ProcessUiState() default" ); + DEBUG( "CHotSpotSession::ProcessUiStateL() default" ); completeMsg = ETrue; } } @@ -1091,20 +1116,14 @@ // complete messages EHssStartLogin/EHssStartBrowser if ( indx >= 0 ) { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartLogin" ); + DEBUG( "CHotSpotSession::ProcessUiStateL() completing EHssStartLogin" ); iServer.CompleteMessage( indx , KErrNone ); - aMessage.Complete( KErrNone ); } - else if ( indxBrowser >= 0 ) + + if ( indxBrowser >= 0 ) { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartBrowser" ); + DEBUG( "CHotSpotSession::ProcessUiStateL() completing EHssStartBrowser" ); iServer.CompleteMessage( indxBrowser, ret ); - aMessage.Complete( KErrNone ); - } - else - { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssUiState" ); - aMessage.Complete( KErrNotFound ); } } } diff -r 3b2fb68d23df -r b852595f5cbe hotspotfw/hsserver/src/hssiapsettingshandler.cpp --- a/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Thu Jul 15 19:54:09 2010 +0300 +++ b/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Thu Aug 19 10:59:40 2010 +0300 @@ -99,7 +99,8 @@ CleanupClosePushL(destination); // Internet destination will always exist in the system. // Internet destination will have ESnapPurposeInternet set in its metadata. - if (destination.MetadataL(CMManager::ESnapMetadataPurpose) == CMManager::ESnapPurposeInternet) + if ( destination.MetadataL( CMManager::ESnapMetadataPurpose ) == + CMManager::ESnapPurposeInternet ) { RCmConnectionMethodExt plugin = cmManager.CreateConnectionMethodL( KUidWlanBearerType ); CleanupClosePushL( plugin ); @@ -128,10 +129,10 @@ // CreateIapL // ----------------------------------------------------------------------------- // -void CHssIapSettingsHandler::CreateIapL() +TInt CHssIapSettingsHandler::CreateIapL( TBool aHotspot ) { DEBUG("CHssIapSettingsHandler::CreateIapL"); - + TInt ret ( KErrNone ); RCmManagerExt cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); @@ -150,7 +151,7 @@ // Internet destination will always exist in the system. // Internet destination will have ESnapPurposeInternet // set in its metadata. - if (destination.MetadataL( CMManager::ESnapMetadataPurpose ) == + if ( destination.MetadataL( CMManager::ESnapMetadataPurpose ) == CMManager::ESnapPurposeInternet ) { CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL(); @@ -194,10 +195,18 @@ plugin.SetIntAttributeL( EWlanConnectionMode, ConvertConnectionModeToNetModeL( connMode ) ); plugin.SetBoolAttributeL( EWlanScanSSID, scanSsid ); + + if ( aHotspot ) + { + // A hotspot IAP. Mark it so it can be deleted after the use. + plugin.SetStringAttributeL( ECmConfigDaemonManagerName, + KHotSpotPlugin ); + } + destination.AddConnectionMethodL( plugin ); destination.UpdateL(); serviceId = plugin.GetIntAttributeL( EWlanServiceId ); - + ret = plugin.GetIntAttributeL( ECmIapId ); CleanupStack::PopAndDestroy( &plugin ); if ( secMode == EWlanConnectionSecurityWep ) { @@ -217,7 +226,8 @@ CleanupStack::PopAndDestroy( &destinations ); CleanupStack::PopAndDestroy( &cmManager ); - DEBUG("CHssIapSettingsHandler::CreateIapL Done"); + DEBUG1("CHssIapSettingsHandler::CreateIapL Done iapId: %d", ret); + return ret; } // ----------------------------------------------------------------------------- @@ -244,6 +254,50 @@ } // --------------------------------------------------------- +// MoveIapL() +// --------------------------------------------------------- +// +void CHssIapSettingsHandler::MoveIapL( const TUint aIapId ) + { + DEBUG1("CHssIapSettingsHandler::MoveIapL aIapId=%d ", aIapId); + // Now move to Internet SNAP + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL( cmManager ); + + // Read all destination(SNAP) settings into an array + RArray destinations; + CleanupClosePushL( destinations ); + + cmManager.AllDestinationsL( destinations ); + RCmDestinationExt destination; + // Loop through each destination + for( TInt i = 0; i < destinations.Count(); i++ ) + { + destination = cmManager.DestinationL( destinations[i] ); + CleanupClosePushL( destination ); + // Internet destination will always exist in the system. + // Internet destination will have ESnapPurposeInternet + // set in its metadata. + if ( destination.MetadataL( CMManager::ESnapMetadataPurpose ) == + CMManager::ESnapPurposeInternet ) + { + RCmConnectionMethodExt iap = cmManager.ConnectionMethodL( aIapId ); + CleanupClosePushL( iap ); + iap.SetStringAttributeL( ECmConfigDaemonManagerName, KHotSpotPlugin ); + destination.AddConnectionMethodL( iap ); + CleanupStack::PopAndDestroy( &iap ); + destination.UpdateL(); + } + CleanupStack::PopAndDestroy( &destination ); + } + CleanupStack::PopAndDestroy( &destinations ); + CleanupStack::PopAndDestroy( &cmManager ); + + DEBUG( "CHssIapSettingsHandler::MoveIapL Done" ); + } + +// --------------------------------------------------------- // SaveWEPKeyL() // --------------------------------------------------------- // diff -r 3b2fb68d23df -r b852595f5cbe hotspotfw/internetconnectivitytestservice/src/ictsengine.cpp --- a/hotspotfw/internetconnectivitytestservice/src/ictsengine.cpp Thu Jul 15 19:54:09 2010 +0300 +++ b/hotspotfw/internetconnectivitytestservice/src/ictsengine.cpp Thu Aug 19 10:59:40 2010 +0300 @@ -225,7 +225,10 @@ StopPolling(); iClient.ConnectivityObserver( EConnectionNotOk, iString ); } - iPollingIntervalTimer->After( iPollingInterval ); + else + { + iPollingIntervalTimer->After( iPollingInterval ); + } } // ---------------------------------------------------------------------------