# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1264503844 -7200 # Node ID ff3b3772260050f2160ff30eb1bdc1fdc28a9b0a # Parent 6e4b6261703d2fc7e7267968f45b020c195b57c5 Revision: 201001 Kit: 201004 diff -r 6e4b6261703d -r ff3b37722600 hotspotfw/hsserver/src/hotspotserver.cpp --- a/hotspotfw/hsserver/src/hotspotserver.cpp Mon Jan 18 21:21:32 2010 +0200 +++ b/hotspotfw/hsserver/src/hotspotserver.cpp Tue Jan 26 13:04:04 2010 +0200 @@ -16,6 +16,10 @@ */ + + + + // INCLUDE FILES #include #include @@ -110,10 +114,10 @@ // ----------------------------------------------------------------------------- // void PanicClient(const RMessagePtr2& aMessage,THotspotPanic aPanic) - { - _LIT(KPanic,"HotspotServer"); - aMessage.Panic(KPanic,aPanic); - } + { + _LIT(KPanic,"HotspotServer"); + aMessage.Panic(KPanic,aPanic); + } // ============================ MEMBER FUNCTIONS =============================== @@ -122,45 +126,43 @@ // ----------------------------------------------------------------------------- // CHotSpotServer::CHotSpotServer() - :CPolicyServer( EPriorityStandard, THotSpotServerPlatSecPolicy, ESharableSessions ) + :CPolicyServer( EPriorityStandard, THotSpotServerPlatSecPolicy, ESharableSessions ) { - } + } // ----------------------------------------------------------------------------- // NewLC // ----------------------------------------------------------------------------- // CHotSpotServer* CHotSpotServer::NewLC() - { - DEBUG("**** HotSpotServer: CHotSpotServer::NewLC"); - CHotSpotServer* self = new(ELeave) CHotSpotServer; - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } + { + DEBUG("**** HotSpotServer: CHotSpotServer::NewLC"); + CHotSpotServer* self = new(ELeave) CHotSpotServer; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } // ----------------------------------------------------------------------------- // ~CHotSpotServer // ----------------------------------------------------------------------------- // CHotSpotServer::~CHotSpotServer() - { - DEBUG("**** HotSpotServer: CHotSpotServer::~CHotSpotServer"); + { + DEBUG("**** HotSpotServer: CHotSpotServer::~CHotSpotServer"); iMap.Close(); iNotificationArray.Close(); iLoginLogoutTimerArray.Close(); - if ( iMgtClient != NULL ) + if ( iMgtClient != NULL ) { -#ifndef __WINS__ +#ifndef __WINS__ iMgtClient->CancelNotifications(); #endif delete iMgtClient; } - iMgtClient = NULL; - - } + } // ----------------------------------------------------------------------------- // ConstructL @@ -190,23 +192,23 @@ // ----------------------------------------------------------------------------- // void CHotSpotServer::ConnectionStateChanged( TWlanConnectionMode aNewState ) - { - DEBUG1( "CHotSpotServer::ConnectionStateChanged() aNewState=%d", aNewState ); + { + DEBUG1( "CHotSpotServer::ConnectionStateChanged() aNewState=%d", aNewState ); if ( aNewState == EWlanConnectionModeNotConnected ) - { - if ( iMgtClient != NULL ) + { + if ( iMgtClient != NULL ) { #ifndef __WINS__ iMgtClient->CancelNotifications(); #endif } - - TRAPD(err, CheckIapsL()); - if ( err != KErrNone ) - { - DEBUG1("CHotSpotServer::ConnectionStateChanged(): %d", err); - } - } + + TRAPD(err, CheckIapsL()); + if ( err != KErrNone ) + { + DEBUG1("CHotSpotServer::ConnectionStateChanged(): %d", err); + } + } } // ----------------------------------------------------------------------------- @@ -216,80 +218,80 @@ void CHotSpotServer::CheckIapsL() { DEBUG("CHotSpotServer::CheckIapsL"); - - _LIT(KMarkFirst, "[" ); - _LIT(KMarkLast, "]" ); - // This is needed to be checked only once per boot - if ( iIapCheckValue == EFalse ) - { - iIapCheckValue = ETrue; - - RCmManagerExt cmManager; - cmManager.OpenL(); - CleanupClosePushL(cmManager); + + _LIT(KMarkFirst, "[" ); + _LIT(KMarkLast, "]" ); + // This is needed to be checked only once per boot + if ( iIapCheckValue == EFalse ) + { + iIapCheckValue = ETrue; + + RCmManagerExt cmManager; + cmManager.OpenL(); + CleanupClosePushL(cmManager); - TBool supportedBearersOnly = ETrue; - TBool legacyCmsOnly = EFalse; - - RArray cmArray; + TBool supportedBearersOnly = ETrue; + TBool legacyCmsOnly = EFalse; + + RArray cmArray; CleanupClosePushL( cmArray ); - - cmManager.ConnectionMethodL( cmArray, supportedBearersOnly, legacyCmsOnly ); - DEBUG1("CHotSpotServer::CheckIapsL count: %d", cmArray.Count()); - for( TInt i = 0; i < cmArray.Count(); i++ ) - { - RCmConnectionMethodExt cm; - TRAPD( err, cm = cmManager.ConnectionMethodL( cmArray[i] ) ); - DEBUG1("CHotSpotServer::CheckIapsL: err %d", err ); - if ( KErrNone == err ) - { - HBufC* client( NULL ); - TRAPD( errr, client = cm.GetStringAttributeL( EWlanServiceExtensionTableName )); - DEBUG1("CHotSpotServer::CheckIapsL: errr %d", errr ); - if( KErrNone == errr ) - { - TBuf clientUid; - TUid uid(TUid::Null()); - - clientUid.Copy( client->Des() ); + + cmManager.ConnectionMethodL( cmArray, supportedBearersOnly, legacyCmsOnly ); + DEBUG1("CHotSpotServer::CheckIapsL count: %d", cmArray.Count()); + for( TInt i = 0; i < cmArray.Count(); i++ ) + { + RCmConnectionMethodExt cm; + TRAPD( err, cm = cmManager.ConnectionMethodL( cmArray[i] ) ); + DEBUG1("CHotSpotServer::CheckIapsL: err %d", err ); + if ( KErrNone == err ) + { + HBufC* client( NULL ); + TRAPD( errr, client = cm.GetStringAttributeL( EWlanServiceExtensionTableName )); + DEBUG1("CHotSpotServer::CheckIapsL: errr %d", errr ); + if( KErrNone == errr ) + { + TBuf clientUid; + TUid uid(TUid::Null()); + + clientUid.Copy( client->Des() ); delete client; - TInt indx = clientUid.Find( KMarkFirst ); - if ( KErrNotFound != indx ) - { - DEBUG("CHotSpotServer::CheckIapsL Client is found"); - clientUid.Delete( indx, 1 ); - indx = clientUid.Find( KMarkLast ); - if ( KErrNotFound != indx ) - { - clientUid.Delete( indx, 1 ); - } - // Convert TBuf to TUid - TLex lex( clientUid ); - TUint value( 0 ); - User::LeaveIfError( lex.Val( value, EHex ) ); - uid.iUid = value; - - // Try to find if 3rd party client exists. - // Delete IAP if no client. - CHssClientPlugin* plugin(NULL); - TBuf8 nullBuf; - TRAPD( error, plugin = CHssClientPlugin::NewL( uid, nullBuf ) ); - delete plugin; + TInt indx = clientUid.Find( KMarkFirst ); + if ( KErrNotFound != indx ) + { + DEBUG("CHotSpotServer::CheckIapsL Client is found"); + clientUid.Delete( indx, 1 ); + indx = clientUid.Find( KMarkLast ); + if ( KErrNotFound != indx ) + { + clientUid.Delete( indx, 1 ); + } + // Convert TBuf to TUid + TLex lex( clientUid ); + TUint value( 0 ); + User::LeaveIfError( lex.Val( value, EHex ) ); + uid.iUid = value; + + // Try to find if 3rd party client exists. + // Delete IAP if no client. + CHssClientPlugin* plugin(NULL); + TBuf8 nullBuf; + TRAPD( error, plugin = CHssClientPlugin::NewL( uid, nullBuf ) ); + delete plugin; - DEBUG1("CHotSpotServer::CheckIapsL find client error: %d", error ); - if ( error == KErrNotFound ) - { - cm.DeleteL(); - } - } - } - } - DEBUG("CHotSpotServer::CheckIapsLOK"); - } + DEBUG1("CHotSpotServer::CheckIapsL find client error: %d", error ); + if ( error == KErrNotFound ) + { + cm.DeleteL(); + } + } + } + } + DEBUG("CHotSpotServer::CheckIapsLOK"); + } CleanupStack::PopAndDestroy( &cmArray ); CleanupStack::PopAndDestroy( &cmManager ); - } - DEBUG("CHotSpotServer::CheckIapsL Done"); + } + DEBUG("CHotSpotServer::CheckIapsL Done"); } // ----------------------------------------------------------------------------- @@ -299,7 +301,7 @@ CSession2* CHotSpotServer::NewSessionL( const TVersion& aVersion, const RMessage2& /* aMessage */ ) const { - TVersion version( KHotSpotMajorVersionNumber, + TVersion version( KHotSpotMajorVersionNumber, KHotSpotMinorVersionNumber, KHotSpotBuildVersionNumber ); @@ -308,8 +310,8 @@ User::Leave( KErrNotSupported ); } - DEBUG("**** CHotSpotServer::NewSessionL"); - CHotSpotSession* session = + DEBUG("**** CHotSpotServer::NewSessionL"); + CHotSpotSession* session = CHotSpotSession::NewL( const_cast( *this ) ); return session; } @@ -496,13 +498,13 @@ // ----------------------------------------------------------------------------- // TInt CHotSpotServer::RunError( TInt aError ) - { + { // error from CHotSpotSession::ServiceL Message().Complete( aError ); // Continue reading client requests ReStart(); return (KErrNone); - } + } // ----------------------------------------------------------------------------- // GetLoginTimerMicroSecs diff -r 6e4b6261703d -r ff3b37722600 hotspotfw/hsserver/src/hotspotsession.cpp --- a/hotspotfw/hsserver/src/hotspotsession.cpp Mon Jan 18 21:21:32 2010 +0200 +++ b/hotspotfw/hsserver/src/hotspotsession.cpp Tue Jan 26 13:04:04 2010 +0200 @@ -47,9 +47,9 @@ CHotSpotSession::CHotSpotSession( CHotSpotServer& aServer ) : iServer( aServer ), iClient( NULL ), iSrvNotifications ( NULL ), iNotificationHandle( NULL ), iAllowNotifications( ETrue ), iHotspotExtension( ETrue ) - { - - } + { + + } // ----------------------------------------------------------------------------- // ConstructL @@ -83,72 +83,64 @@ // ---------------------------------------------------------------------------------------- // CHotSpotSession::~CHotSpotSession() - { - DEBUG( "CHotSpotSession::~CHotSpotSession()" ); - iPendingNotifications.Close(); - if ( iMgtClient != NULL ) + { + DEBUG( "CHotSpotSession::~CHotSpotSession()" ); + iPendingNotifications.Close(); + if ( iMgtClient != NULL ) { iMgtClient->CancelNotifications(); delete iMgtClient; } - iMgtClient = NULL; - - if ( iIapSettingsHandler != NULL ) + + if ( iIapSettingsHandler != NULL ) { delete iIapSettingsHandler; } - iIapSettingsHandler = NULL; - if ( iClient != NULL ) { delete iClient; } - iClient = NULL; if ( iNotifications != NULL ) { delete iNotifications; } - iNotifications = NULL; if ( iLoginTimer != NULL ) { iLoginTimer->Cancel(); delete iLoginTimer; } - iLoginTimer = NULL; if ( iLogoutTimer != NULL ) { iLogoutTimer->Cancel(); delete iLogoutTimer; } - iLogoutTimer = NULL; if ( iIcts != NULL ) { delete iIcts; } - iIcts = NULL; DEBUG( "CHotSpotSession::~CHotSpotSession() Done" ); - } - + } + // ---------------------------------------------------------------------------------------- // ServiceL // ---------------------------------------------------------------------------------------- // void CHotSpotSession::ServiceL( const RMessage2& aMessage ) - { - DEBUG1( "CHotSpotSession::ServiceL message: %d", aMessage.Function() ); - TRAPD( err, DispatchMessageL( aMessage) ); - if (err != KErrNone) + { + DEBUG1( "CHotSpotSession::ServiceL message: %d", aMessage.Function() ); + TRAPD( err, DispatchMessageL( aMessage) ); + if (err != KErrNone) { // Something went wrong. Complete message to let // the client to continue aMessage.Complete(err); } - } + } // ---------------------------------------------------------------------------------------- // ServiceL // ---------------------------------------------------------------------------------------- @@ -161,49 +153,49 @@ TInt err(KErrNone); TInt indx(KErrNone); TPckgBuf iapPackage( iIapId ); - + switch ( aMessage.Function() ) { case EHssActivateNotifications : iAllowNotifications = EFalse; - DEBUG( "CHotSpotSession::ActivateNotificationsL" ); - if ( iNotifications == NULL ) - { - DEBUG( "CHotSpotSession::DispatchMessageL activated !!!" ); - iNotifications = new (ELeave) HssNotifications(*this); - iMgtClient->ActivateNotificationsL( *iNotifications ); - } + DEBUG( "CHotSpotSession::ActivateNotificationsL" ); + if ( iNotifications == NULL ) + { + DEBUG( "CHotSpotSession::DispatchMessageL activated !!!" ); + iNotifications = new (ELeave) HssNotifications(*this); + iMgtClient->ActivateNotificationsL( *iNotifications ); + } HandleOrderNotifications( aMessage ); break; case EHssCancelNotifications : - iAllowNotifications = EFalse; - DEBUG( "CHotSpotSession::CancelNotifications" ); - iMgtClient->CancelNotifications( ); - if ( iNotifications != NULL ) - { - delete iNotifications; - } - iNotifications = NULL; - HandleCancelNotifications( aMessage ); + iAllowNotifications = EFalse; + DEBUG( "CHotSpotSession::CancelNotifications" ); + iMgtClient->CancelNotifications( ); + if ( iNotifications != NULL ) + { + delete iNotifications; + } + iNotifications = NULL; + HandleCancelNotifications( aMessage ); break; case EHssGetScanResults : // Handled now in client side. Left here for future use. break; case EHssRegister : - ProcessRegisterL( aMessage ); + ProcessRegisterL( aMessage ); break; case EHssUnRegister : - ProcessUnRegisterL( aMessage ); + ProcessUnRegisterL( aMessage ); break; case EHssJoin : - iAllowNotifications = EFalse; + iAllowNotifications = EFalse; // IAP id value1 = ( TInt )aMessage.Int0(); iIapId = value1; indx = iServer.FindMessage(value1, EHssStart ); if ( indx >= 0 ) { - iServer.CompleteMessage( indx , KErrNone ); + iServer.CompleteMessage( indx , KErrNone ); } else { @@ -223,41 +215,41 @@ iIapId = ( TInt )aMessage.Int0(); indx = iServer.FindMessage(iIapId, EHssStart ); if ( indx >= 0 ) - { - iServer.CompleteMessage( indx , KErrAbort); - } - else - { - indx = iServer.FindMessage(iIapId, EHssStartAgain ); + { + iServer.CompleteMessage( indx , KErrAbort); + } + else + { + indx = iServer.FindMessage(iIapId, EHssStartAgain ); if ( indx >= 0 ) - { - iServer.CompleteMessage( indx , KErrAbort ); + { + iServer.CompleteMessage( indx , KErrAbort ); + } } - } aMessage.Complete( KErrNone ); break; case EHssStop : iAllowNotifications = EFalse; - iServer.SetLogoutFlag( ETrue ); - - iLoginTimer->Cancel(); + iServer.SetLogoutFlag( ETrue ); + + iLoginTimer->Cancel(); iLogoutTimer->Cancel(); // IAP id value1 = ( TInt )aMessage.Int0(); for (TInt counter = EHssGetScanResults; counter = 0 ) - { - iServer.CompleteMessage( indx , KErrCancel); - } - } + { + indx = iServer.FindMessage(value1, THotSpotCommands(counter )); + if ( indx >= 0 ) + { + iServer.CompleteMessage( indx , KErrCancel); + } + } aMessage.Complete( KErrNone ); break; case EHssLoginComplete : - iAllowNotifications = EFalse; + iAllowNotifications = EFalse; // IAP id value1 = ( TInt )aMessage.Int0(); // ret value @@ -269,26 +261,25 @@ indx = iServer.FindMessage( value1, EHssStartLogin ); if ( KErrNotFound != indx ) { - if (value2 == KErrNone) - { - DEBUG( "EHssLoginComplete1" ); - iServer.CompleteMessage( indx, KErrNone ); - } - else - { - DEBUG( "EHssLoginComplete2" ); - iServer.CompleteMessage( indx, KErrCancel ); + if (value2 == KErrNone) + { + DEBUG( "EHssLoginComplete1" ); + iServer.CompleteMessage( indx, KErrNone ); + } + else + { + DEBUG( "EHssLoginComplete2" ); + iServer.CompleteMessage( indx, KErrCancel ); iServer.SetLogoutFlag( ETrue ); - } - + } } aMessage.Complete( KErrNone ); break; case EHssLogoutComplete : - iAllowNotifications = EFalse; - iLogoutTimer->Cancel(); - + iAllowNotifications = EFalse; + iLogoutTimer->Cancel(); + // IAP id value1 = ( TInt )aMessage.Int0(); @@ -332,7 +323,7 @@ } break; case EHssCancelLogin : - iLoginTimer->Cancel(); + iLoginTimer->Cancel(); // if client doesn't exist (is NULL), Login(.) has not been // called to client -> that is CancelLogin() not needed to call if ( iClient != NULL ) @@ -348,9 +339,9 @@ aMessage.Complete( KErrNone ); break; case EHssStart: - // IAP id - iServer.SetLoginFlag( ETrue ); - iIapId = ( TInt )aMessage.Int0(); + // IAP id + iServer.SetLoginFlag( ETrue ); + iIapId = ( TInt )aMessage.Int0(); err = iServer.SaveMessage( iIapId, aMessage, EHssStart ); if ( err != KErrNone) { @@ -390,9 +381,9 @@ } break; case EHssStartAgain: - // IAP id - iServer.SetLoginFlag( ETrue ); - iIapId = ( TInt )aMessage.Int0(); + // IAP id + iServer.SetLoginFlag( ETrue ); + iIapId = ( TInt )aMessage.Int0(); err = iServer.SaveMessage( iIapId, aMessage, EHssStartAgain ); if ( err != KErrNone) { @@ -414,13 +405,13 @@ } } } - break; - + break; + case EHssCancel: - iLoginTimer->Cancel(); + iLoginTimer->Cancel(); iLogoutTimer->Cancel(); - // IAP id - iIapId = ( TInt )aMessage.Int0(); + // IAP id + iIapId = ( TInt )aMessage.Int0(); if ( iServer.GetAssociationFlagValue() ) { // We are in association phase and Agent failed it for some reason @@ -429,31 +420,31 @@ indx = iServer.FindMessage(iIapId, EHssStart ); if ( indx >= 0 ) - { - iServer.CompleteMessage( indx , KErrCancel ); - } + { + iServer.CompleteMessage( indx , KErrCancel ); + } indx = iServer.FindMessage(iIapId, EHssStartAgain ); if ( indx >= 0 ) - { - iServer.CompleteMessage( indx , KErrCancel ); - } + { + iServer.CompleteMessage( indx , KErrCancel ); + } indx = iServer.FindMessage(iIapId, EHssCloseConnection ); if ( indx >= 0 ) - { - iServer.CompleteMessage( indx , KErrCancel ); - } + { + iServer.CompleteMessage( indx , KErrCancel ); + } //Not needed to send Logout() //iServer.SetLogoutFlag( ETrue ) //ProcessCloseL( iIapId ) - aMessage.Complete( KErrNone ); + aMessage.Complete( KErrNone ); break; case EHssCloseConnection: iLoginTimer->Cancel(); - iLogoutTimer->Cancel(); + iLogoutTimer->Cancel(); - // IAP id - iIapId = ( TInt )aMessage.Int0(); + // IAP id + iIapId = ( TInt )aMessage.Int0(); if ( iServer.GetAssociationFlagValue() ) { @@ -491,7 +482,7 @@ break; case EHssGetIAP: - aMessage.WriteL( 0, iapPackage ); + aMessage.WriteL( 0, iapPackage ); aMessage.Complete( KErrNone ); break; @@ -500,11 +491,11 @@ 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 ); + 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 ) ); @@ -512,8 +503,8 @@ CleanupStack::PopAndDestroy(buf); } - break; - + break; + case EHssSetTimerValues: { TUid clientUid( TUid::Uid( aMessage.Int0() ) ); @@ -590,12 +581,12 @@ TNotification notif; notif.id = aNotification; notif.data = aData; - if ( iIsNotificationRequestPending ) + if ( iIsNotificationRequestPending ) { - DEBUG( "CHotSpotSession::AddNotification added to array. Request found..." ); - iPendingNotifications.Append( notif ); - HandleNotification(); // check is there client waiting for notification - } + DEBUG( "CHotSpotSession::AddNotification added to array. Request found..." ); + iPendingNotifications.Append( notif ); + HandleNotification(); // check is there client waiting for notification + } } // --------------------------------------------------------- @@ -606,30 +597,30 @@ { DEBUG( "CHotSpotSession::HandleNotification" ); - // Check if we allow notifications - if (iAllowNotifications == TRUE) - { - // Check is there message to wait notification and - // notification that is not sent. - if ( iIsNotificationRequestPending && iPendingNotifications.Count() != 0 ) - { - DEBUG( "CHotSpotSession::HandleNotification - sending response..." ); - iIsNotificationRequestPending = EFalse; + // Check if we allow notifications + if (iAllowNotifications == TRUE) + { + // Check is there message to wait notification and + // notification that is not sent. + if ( iIsNotificationRequestPending && iPendingNotifications.Count() != 0 ) + { + DEBUG( "CHotSpotSession::HandleNotification - sending response..." ); + iIsNotificationRequestPending = EFalse; - THssPckgData data; - TPckg pckg( data ); - data.data = iPendingNotifications[0].data; - TInt ret( iPendingNotificationRequest.Write( 0, pckg ) ); - if ( ret != KErrNone ) - { - iPendingNotificationRequest.Complete( ret ); - return; - } - iPendingNotificationRequest.Complete( iPendingNotifications[0].id ); - iPendingNotifications.Reset(); - } - } - } + THssPckgData data; + TPckg pckg( data ); + data.data = iPendingNotifications[0].data; + TInt ret( iPendingNotificationRequest.Write( 0, pckg ) ); + if ( ret != KErrNone ) + { + iPendingNotificationRequest.Complete( ret ); + return; + } + iPendingNotificationRequest.Complete( iPendingNotifications[0].id ); + iPendingNotifications.Reset(); + } + } + } // ----------------------------------------------------------------------------- // TestInternetConnectivityL @@ -641,6 +632,7 @@ if ( iIcts != NULL ) { delete iIcts; + iIcts = NULL; } iIcts = CIctsClientInterface::NewL( iIapId, iNetId, *this ); @@ -746,16 +738,16 @@ // --------------------------------------------------------- // void CHotSpotSession::ProcessRegisterL( const RMessage2& aMessage ) - { - DEBUG("CHotSpotSession::ProcessRegisterL"); - - iAllowNotifications = EFalse; + { + DEBUG("CHotSpotSession::ProcessRegisterL"); + + iAllowNotifications = EFalse; TBufC< KIapNameLength > iapName; TPckgBuf< TIapName > iapPckg; TUid clientUid; TPckgBuf< TClientUid > uidPckg; TPckgBuf iapPackage( iIapId ); - + // Read message aMessage.ReadL( 0, uidPckg ); clientUid = uidPckg().ClientUid(); @@ -781,16 +773,16 @@ // and no IAP is created aMessage.Complete( KErrNone ); } - } + } // --------------------------------------------------------- // ProcessUnRegisterL // --------------------------------------------------------- // void CHotSpotSession::ProcessUnRegisterL( const RMessage2& aMessage ) - { - DEBUG("CHotSpotSession::ProcessUnRegisterL"); - iAllowNotifications = EFalse; + { + DEBUG("CHotSpotSession::ProcessUnRegisterL"); + iAllowNotifications = EFalse; TInt ret( KErrNone ); // Read message @@ -813,7 +805,7 @@ } aMessage.Complete( ret ); - } + } // ----------------------------------------------------------------------------- // ProcessStartLogin @@ -830,13 +822,13 @@ // Check if Easy WLAN. TRAP_IGNORE( EasyWlanIdL() ); if ( iEasyWlanId == aIapId ) - { - DEBUG("CHotSpotSession::ProcessStartLogin Easy WLAN detected"); + { + DEBUG("CHotSpotSession::ProcessStartLogin Easy WLAN detected"); // Just test internet connectivity and complete message later TestInternetConnectivityL(); - ret = KErrNone; + ret = KErrNone; return ret; - } + } iIapSettingsHandler->FindClientL( aIapId, clientUid, extAPI ); @@ -872,7 +864,7 @@ DEBUG("CHotSpotSession::ProcessStart"); TInt ret( KErrNone ); - TBuf8 extAPI; + TBuf8 extAPI; iIapSettingsHandler->FindClientL( aIapId, iClientUid, extAPI ); if ( iClientUid == TUid::Null() ) @@ -897,14 +889,14 @@ } if ( ret == KErrNone ) - { - iServer.SetAssociationFlag( ETrue ); - iMgtClient->ActivateNotificationsL( *this ); - iClient->Start( aIapId ); - } + { + iServer.SetAssociationFlag( ETrue ); + iMgtClient->ActivateNotificationsL( *this ); + iClient->Start( aIapId ); + } } DEBUG1("CHotSpotSession::ProcessStartL DONE ret%d", ret); - return ret; + return ret; } // ----------------------------------------------------------------------------- @@ -918,18 +910,18 @@ // Client exists if StartAgain is called. if ( iClient == NULL ) - { - TBuf8 nullBuf; + { + TBuf8 nullBuf; ret = CreateClient( iClientUid, nullBuf ); } - if ( ret == KErrNone ) - { - iServer.SetAssociationFlag( ETrue ); // Send association status - iClient->Update( aIapId ); - } + if ( ret == KErrNone ) + { + iServer.SetAssociationFlag( ETrue ); // Send association status + iClient->Update( aIapId ); + } - return ret; + return ret; } // ----------------------------------------------------------------------------- // ProcessAssociationStatus @@ -963,7 +955,7 @@ TInt err( KErrNone ); if ( aUidText == KNullDesC8 ) { - DEBUG("CHotSpotSession::CreateClient iHotspotExtension = EFalse;"); + DEBUG("CHotSpotSession::CreateClient iHotspotExtension = EFalse;"); iHotspotExtension = EFalse; TRAP( err, iClient = CHssClientPlugin::NewL( aUid, aUidText ) ); DEBUG1("CHotSpotSession::CreateClient err: %d", err ); @@ -1004,17 +996,17 @@ TBuf8 nullBuf; ret = CreateClient( clientUid, nullBuf ); } - else - { - ret = KErrNone; - } - iLogoutTimer->After( iServer.GetLogoutTimeMicroSecs( clientUid ) ); + else + { + ret = KErrNone; + } + iLogoutTimer->After( iServer.GetLogoutTimeMicroSecs( clientUid ) ); if ( ret == KErrNone && !iServer.GetLogoutFlagValue() ) - { - DEBUG("CHotSpotSession::ProcessCloseL send Logout()"); + { + DEBUG("CHotSpotSession::ProcessCloseL send Logout()"); iClient->Logout( aIapId ); - iServer.SetLogoutFlag( ETrue ); - iServer.SetLoginFlag( EFalse ); + iServer.SetLogoutFlag( ETrue ); + iServer.SetLoginFlag( EFalse ); } else { @@ -1022,7 +1014,7 @@ } } - return ret; + return ret; } // ----------------------------------------------------------------------------- @@ -1054,7 +1046,7 @@ // ----------------------------------------------------------------------------- // void CHotSpotSession::ProcessUiState( const RMessage2& aMessage ) - { + { DEBUG( "CHotSpotSession::ProcessUiState()" ); TBool completeMsg = EFalse; TInt indx( KErrNone ); @@ -1066,57 +1058,58 @@ 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" ); + { + 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" ); + } + case EHsBrowserUiAuthenticatedNok: + { + DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiAuthenticatedNok" ); + completeMsg = ETrue; + break; + } + case EHsBrowserUiClosed: + { + DEBUG( "CHotSpotSession::ProcessUiState() EHsBrowserUiClosed" ); completeMsg = ETrue; break; - } - default: - { - DEBUG( "CHotSpotSession::ProcessUiState() default" ); + } + 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 ); - } + { + DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartLogin" ); + iServer.CompleteMessage( indx , KErrNone ); + aMessage.Complete( KErrNone ); + } else if ( indxBrowser >= 0 ) - { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartBrowser" ); + { + DEBUG( "CHotSpotSession::ProcessUiState() completing EHssStartBrowser" ); iServer.CompleteMessage( indxBrowser, ret ); aMessage.Complete( KErrNone ); - } - else - { - DEBUG( "CHotSpotSession::ProcessUiState() completing EHssUiState" ); - aMessage.Complete( KErrNotFound ); - } + } + else + { + DEBUG( "CHotSpotSession::ProcessUiState() completing EHssUiState" ); + aMessage.Complete( KErrNotFound ); + } } } diff -r 6e4b6261703d -r ff3b37722600 hotspotfw/hsserver/src/hssiapsettingshandler.cpp --- a/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Mon Jan 18 21:21:32 2010 +0200 +++ b/hotspotfw/hsserver/src/hssiapsettingshandler.cpp Tue Jan 26 13:04:04 2010 +0200 @@ -37,9 +37,9 @@ // ----------------------------------------------------------------------------- // CHssIapSettingsHandler::CHssIapSettingsHandler( ) - { + { DEBUG("CHssIapSettingsHandler::CHssIapSettingsHandler"); - } + } // ----------------------------------------------------------------------------- // ConstructL @@ -68,8 +68,8 @@ // ----------------------------------------------------------------------------- // CHssIapSettingsHandler::~CHssIapSettingsHandler() - { - DEBUG("CHssIapSettingsHandler::~CHssIapSettingsHandler()"); + { + DEBUG("CHssIapSettingsHandler::~CHssIapSettingsHandler()"); } // ----------------------------------------------------------------------------- @@ -150,7 +150,7 @@ // Internet destination will always exist in the system. // Internet destination will have ESnapPurposeInternet set in its metadata. if (destination.MetadataL( CMManager::ESnapMetadataPurpose ) == - CMManager::ESnapPurposeInternet ) + CMManager::ESnapPurposeInternet ) { CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL(); CleanupStack::PushL( wlanMgmtClient ); @@ -256,7 +256,7 @@ cmManager.OpenL(); CleanupClosePushL( cmManager ); - RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId ); + RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId ); CleanupClosePushL( plugin ); HBufC* uid = plugin.GetStringAttributeL( EWlanServiceExtensionTableName ); @@ -267,7 +267,7 @@ // Find and remove [ and ]. // If found [ it's known that buffer contains UID TInt indx = buffer.Find( KMark1 ); - if ( KErrNotFound != indx ) + if ( KErrNotFound != indx ) { DEBUG("CHssIapSettingsHandler::FindClientL Client is found"); buffer.Delete( indx, 1 ); diff -r 6e4b6261703d -r ff3b37722600 wlanutilities/wlansniffer/aiplugin/data/wsfaipluginrsc.rss --- a/wlanutilities/wlansniffer/aiplugin/data/wsfaipluginrsc.rss Mon Jan 18 21:21:32 2010 +0200 +++ b/wlanutilities/wlansniffer/aiplugin/data/wsfaipluginrsc.rss Tue Jan 26 13:04:04 2010 +0200 @@ -357,16 +357,6 @@ //---------------------------------------------------------------------------- -// r_qtn_sniffer_quest_restart_browsing_with_wlan -// String for Web application needs to be restarted query -//---------------------------------------------------------------------------- -RESOURCE TBUF r_qtn_sniffer_quest_restart_browsing_with_wlan - { - buf = qtn_sniffer_quest_restart_browsing_with_wlan; - } - - -//---------------------------------------------------------------------------- // r_restart_browsing_confirmation_query // Query to restart browser with WLAN //---------------------------------------------------------------------------- diff -r 6e4b6261703d -r ff3b37722600 wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp --- a/wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp Mon Jan 18 21:21:32 2010 +0200 +++ b/wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp Tue Jan 26 13:04:04 2010 +0200 @@ -551,44 +551,9 @@ CleanupStack::PopAndDestroy( &cmmanager ); } - - const TUid KBrowserUid = { 0x10008D39 }; - TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); - TApaTask task = taskList.FindApp( KBrowserUid ); - - // Check if the Browser application is already running. - if ( task.Exists() ) - { - HBufC* queryText = StringLoader::LoadLC( - R_QTN_SNIFFER_QUEST_RESTART_BROWSING_WITH_WLAN ); - - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - TInt ret = dlg->ExecuteLD( - R_RESTART_BROWSING_CONFIRMATION_QUERY, - *queryText ); - - CleanupStack::PopAndDestroy( queryText ); - - if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) - { - // User Press OK or Yes and launch the browser - iModel->LaunchBrowserL( passedIap ); - } - else - { - // clean up the temporary IAP if any - iModel->CleanUpCancelledLaunchL(); - - // we are at this point then we can disconnect - // and iModel->DisconnectL() handles view refreshing - iModel->DisconnectL(); - } - } - else - { - // finally launch the browser - iModel->LaunchBrowserL( passedIap ); - } + + // launch the browser + iModel->LaunchBrowserL( passedIap ); } diff -r 6e4b6261703d -r ff3b37722600 wlanutilities/wlansniffer/mainapplication/data/wlansniffer.rss --- a/wlanutilities/wlansniffer/mainapplication/data/wlansniffer.rss Mon Jan 18 21:21:32 2010 +0200 +++ b/wlanutilities/wlansniffer/mainapplication/data/wlansniffer.rss Tue Jan 26 13:04:04 2010 +0200 @@ -681,11 +681,6 @@ buf = qtn_cmon_navi_many_wlan_nws_available; } -RESOURCE TBUF r_qtn_sniffer_quest_restart_browsing_with_wlan - { - buf = qtn_sniffer_quest_restart_browsing_with_wlan; - } - //----------------------------------------------------------------------------- RESOURCE LOCALISABLE_APP_INFO r_sniffer_localisable_app_info diff -r 6e4b6261703d -r ff3b37722600 wlanutilities/wlansniffer/mainapplication/inc/wsfmaincontroller.h --- a/wlanutilities/wlansniffer/mainapplication/inc/wsfmaincontroller.h Mon Jan 18 21:21:32 2010 +0200 +++ b/wlanutilities/wlansniffer/mainapplication/inc/wsfmaincontroller.h Tue Jan 26 13:04:04 2010 +0200 @@ -27,6 +27,7 @@ #include "wsfmainviewpartner.h" #include "wsfstatechangeobserver.h" #include "wsfdetailsviewpartner.h" +#include "wsfwlaninfo.h" @@ -278,6 +279,13 @@ */ static void ReleaseSuppressingKeyEvents( TAny* aPtr ); + /** + * Updates iap id to wlan list + * @since S60 5.2 + * @param aInfo reference of TWsfWlanInfo class + */ + void UpdateIapIdToInfoArray( TWsfWlanInfo & aInfo ); + private: // Data /** diff -r 6e4b6261703d -r ff3b37722600 wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp --- a/wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp Mon Jan 18 21:21:32 2010 +0200 +++ b/wlanutilities/wlansniffer/mainapplication/src/wsfmaincontroller.cpp Tue Jan 26 13:04:04 2010 +0200 @@ -477,21 +477,8 @@ if ( iModel->CreateAccessPointL( info, EFalse ) ) { // update iapID to list - TWsfWlanInfo* temp = iInfoArray->Match( info.iSsid, - iInfoArray->Count() ); - if ( temp && !info.Hidden() ) - { - LOG_WRITE( "Info found" ); - temp->iIapId = info.iIapId; - } - else - { - LOG_WRITE( "Info not found" ); - TWsfWlanInfo* createdInfo = new (ELeave) TWsfWlanInfo( info ); - createdInfo->iVisibility = ETrue; - createdInfo->iStrengthLevel = EWlanSignalStrengthMax; - iInfoArray->AppendL( createdInfo ); - } + UpdateIapIdToInfoArray( info ); + // on success, test it and save it as well result = iModel->TestAccessPointL( info, ETrue, EFalse ); } @@ -524,45 +511,9 @@ CleanupStack::PopAndDestroy( &cmmanager ); } - - const TInt KBrowserUid = 0x10008D39; - TUid id( TUid::Uid( KBrowserUid ) ); - TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); - TApaTask task = taskList.FindApp( id ); - - // Check if the Browser application is already running. - if ( task.Exists() ) - { - HBufC* queryText = StringLoader::LoadLC( - R_QTN_SNIFFER_QUEST_RESTART_BROWSING_WITH_WLAN ); - - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - TInt ret = dlg->ExecuteLD( - R_RESTART_BROWSING_CONFIRMATION_QUERY, - *queryText ); - - CleanupStack::PopAndDestroy( queryText ); - if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) - { - // User Press OK or Yes and launch the browser - iModel->LaunchBrowserL( passedIap ); - } - else - { - // clean up the temporary IAP if any - iModel->CleanUpCancelledLaunchL(); - - // if we are here then we can disconnect - // and iModel->DisconnectL() handles view refreshing - iModel->DisconnectL(); - } - } - else - { - // finally launch the browser - iModel->LaunchBrowserL( passedIap ); - } + // launch the browser + iModel->LaunchBrowserL( passedIap ); } else if ( result == KErrCancel ) { @@ -612,28 +563,8 @@ if ( iModel->CreateAccessPointL( info, EFalse ) ) { // update iapID to list - TWsfWlanInfo* temp = iInfoArray->Match( info.iSsid, - iInfoArray->Count() ); - if ( temp && !info.Hidden() ) - { - LOG_WRITE( "Info found" ); - temp->iIapId = info.iIapId; - - if ( info.iNetworkName.Length() ) - { - // Replace ssid as well since scanner does this same thing - temp->iSsid.Copy( info.iNetworkName ); - } - } - else - { - LOG_WRITE( "Info not found" ); - TWsfWlanInfo* createdInfo = new (ELeave) TWsfWlanInfo( info ); - createdInfo->iVisibility = ETrue; - createdInfo->iStrengthLevel = EWlanSignalStrengthMax; - iInfoArray->AppendL( createdInfo ); - } - + UpdateIapIdToInfoArray( info ); + // on success, test it and save it as well // (testing actually creates the connection) if ( iModel->TestAccessPointL( info, ETrue, ETrue ) == KErrCancel ) @@ -654,6 +585,46 @@ iAppUi->SetSuppressingKeyEvents( EFalse ); } + +// --------------------------------------------------------------------------- +// TWsfMainController::UpdateIapIdToInfoArray +// --------------------------------------------------------------------------- +// +void TWsfMainController::UpdateIapIdToInfoArray( TWsfWlanInfo& aInfo ) + { + LOG_ENTERFN( "TWsfMainController::UpdateIapIdToInfoArray" ); + TWsfWlanInfo* temp = iInfoArray->Match( aInfo.iSsid, iInfoArray->Count() ); + if ( temp && !aInfo.Hidden() ) + { + LOG_WRITE( "Info found" ); + + // Check that there aren't any IAPs with same id + TWsfWlanInfo* wlanInfoWithSameIapId = iInfoArray->Match( aInfo.iIapId, + iInfoArray->Count() ); + if ( wlanInfoWithSameIapId ) + { + // info with same id found set its iap id to zero + LOG_WRITE( "info with same id found" ); + wlanInfoWithSameIapId->iIapId = 0; + } + + temp->iIapId = aInfo.iIapId; + + if ( aInfo.iNetworkName.Length() ) + { + // Replace ssid as well since scanner does this same thing + temp->iSsid.Copy( aInfo.iNetworkName ); + } + } + else + { + LOG_WRITE( "Info not found" ); + TWsfWlanInfo* createdInfo = new (ELeave) TWsfWlanInfo( aInfo ); + createdInfo->iVisibility = ETrue; + createdInfo->iStrengthLevel = EWlanSignalStrengthMax; + iInfoArray->AppendL( createdInfo ); + } + } // --------------------------------------------------------------------------- // TWsfMainController::DisconnectL @@ -857,6 +828,7 @@ if ( iModel->IsConnecting() ) { iModel->SetConnecting( EFalse ); + iModel->SetRefreshState( ETrue ); iAppUi->HideWaitNoteL(); } @@ -867,8 +839,24 @@ iInfoArray->At(0)->iConnectionState == EConnecting ) { iInfoArray->At(0)->iConnectionState = ENotConnected; + TRAPD( error, iModel->CheckIsIapIdValidL( + iInfoArray->At(0)->iIapId ) ); + if ( error ) + { + LOG_WRITEF( "Iap Id %d is not valid - error=%d", + iInfoArray->At(0)->iIapId, error ); + + if ( iInfoArray->At(0)->iRawSsid.Length() ) + { + iInfoArray->At(0)->iSsid.Copy( + iInfoArray->At(0)->iRawSsid ); + } + + iInfoArray->At(0)->iIapId = 0; + } iInfoArray->SortArrayL(); UpdateViewL( iInfoArray ); + iModel->AbortScanningL(); iModel->RefreshScanL(); } }