diff -r c2bc3f8c7777 -r dff6ebfd236f wlanutilities/wlansniffer/model/src/wsfmodel.cpp --- a/wlanutilities/wlansniffer/model/src/wsfmodel.cpp Fri Feb 19 23:55:42 2010 +0200 +++ b/wlanutilities/wlansniffer/model/src/wsfmodel.cpp Fri Mar 12 15:48:54 2010 +0200 @@ -96,6 +96,19 @@ // EXPORT_C CWsfModel::~CWsfModel() { + LOG_ENTERFN( "CWsfModel::~CWsfModel" ); + if ( iIct ) + { + LOG_WRITE( "ict cancel" ); + TRAP_IGNORE( iIct->CancelStartL() ); + delete iIct; + iIct = NULL; + } + if ( iIctWait.IsStarted() ) + { + LOG_WRITE( "ict wait cancel" ); + iIctWait.AsyncStop(); + } iSession.CancelNotifyEvent(); iSession.Close(); delete iScreenSaverWatcher; @@ -143,6 +156,7 @@ // EXPORT_C void CWsfModel::SetEngineObserver( MWsfModelObserver* aObserver ) { + LOG_ENTERFN( "CWsfModel::SetEngineObserver" ); iObserver = aObserver; } @@ -161,6 +175,30 @@ // ---------------------------------------------------------------------------- +// CWsfModel::GetWlanListSize +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::GetWlanListSize( TPckgBuf& aPckg, + TRequestStatus& aStatus ) + { + LOG_ENTERFN( "CWsfModel::GetWlanListSize" ); + iSession.GetWlanListSize( aPckg, aStatus ); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::GetWlanList +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::GetWlanList( TPckgBuf& aPckg, TPtr8& aPtr, + TRequestStatus& aStatus ) + { + LOG_ENTERFN( "CWsfModel::GetWlanList" ); + iSession.GetWlanList( aPckg, aPtr, aStatus ); + } + + +// ---------------------------------------------------------------------------- // CWsfModel::SetActiveViewL // ---------------------------------------------------------------------------- // @@ -234,16 +272,6 @@ { iObserver->ConnectingFinishedL( err ); } - - TBool timerStarted( EFalse ); - timerStarted = iSession.ControlDisconnectTimerL( - EAdcStartTimer | EAdcTimerReset ); - - if ( !timerStarted ) - { - LOG_WRITE( "auto-disconnect timer couldn't be started!" ); - } - iRefreshing = iSession.RequestScanL(); @@ -252,46 +280,36 @@ // ---------------------------------------------------------------------------- -// CWsfModel::ConnectWithoutConnWaiterL +// CWsfModel::ConnectL // ---------------------------------------------------------------------------- // -EXPORT_C int CWsfModel::ConnectWithoutConnWaiterL( TUint32 aIapId, - TBool aTestedAccessPoint ) +EXPORT_C void CWsfModel::ConnectL( TPckgBuf& aPckg, TUint32 aIapId, + TWsfIapPersistence aPersistence, + TRequestStatus& aStatus ) { - LOG_ENTERFN( "CWsfModel::ConnectWithoutConnWaiterL" ); + LOG_ENTERFN( "CWsfModel::ConnectL" ); if ( iObserver ) { iObserver->ConnectingL( aIapId ); } - if ( aTestedAccessPoint ) - { - return iSession.ConnectWlanBearerWithoutConnWaiterL( aIapId, - EIapPersistent ); - } - else - { - return iSession.ConnectWlanBearerWithoutConnWaiterL( aIapId, - EIapExpireOnDisconnect ); - } + + iSession.ConnectWlanBearer( aPckg, aIapId, aPersistence, aStatus ); } - // ---------------------------------------------------------------------------- -// CWsfModel::FinalizeConnectL +// CWsfModel::SetConnectResultL // ---------------------------------------------------------------------------- // -EXPORT_C void CWsfModel::FinalizeConnectL() +EXPORT_C void CWsfModel::SetConnectResultL( TInt aResult, TUint /*aIapId*/ ) { - LOG_ENTERFN( "CWsfModel::FinalizeConnectL" ); + LOG_ENTERFN( "CWsfModel::SetConnectResultL" ); - TBool timerStarted( EFalse ); - timerStarted = iSession.ControlDisconnectTimerL( - EAdcStartTimer | EAdcTimerReset ); + iSession.SetConnectWlanBearerResult( aResult ); - if ( !timerStarted ) + if ( iObserver && aResult != KErrNone ) { - LOG_WRITE( "auto-disconnect timer couldn't be started!" ); + iObserver->ConnectingFinishedL( aResult ); } } @@ -307,7 +325,21 @@ iConnectedIapId = 0; iConnectedNetId = 0; iConnectOnly = EFalse; - iRefreshing = iSession.RequestScanL(); + iRefreshing = iSession.RequestScanL(); + } + + +// ---------------------------------------------------------------------------- +// CWsfModel::Disconnect +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::Disconnect( TPckgBuf& aPckg, TRequestStatus& aStatus ) + { + LOG_ENTERFN( "CWsfModel::Disconnect" ); + iSession.DisconnectWlanBearer( aPckg, aStatus ); + iConnectedIapId = 0; + iConnectedNetId = 0; + iConnectOnly = EFalse; } @@ -387,8 +419,6 @@ { LOG_WRITE( "launching browser..." ); iConnectedIapId = aIapId; - iSession.MonitorAccessPointL( aIapId ); - iSession.ControlDisconnectTimerL( EAdcStopTimer ); iBrowserLauncher->LaunchBrowserL( *this, aIapId ); } else if ( iBrowserLauncher->BrowserIap() == aIapId ) @@ -398,17 +428,6 @@ } } - - -// ---------------------------------------------------------------------------- -// CWsfModel::CleanUpCancelledLaunchL -// ---------------------------------------------------------------------------- -// -EXPORT_C void CWsfModel::CleanUpCancelledLaunchL() - { - LOG_ENTERFN( "CWsfModel::CleanUpCancelledLaunchL" ); - iSession.SetIapPersistenceL( EIapForcedExpiry ); - } // ---------------------------------------------------------------------------- @@ -498,19 +517,6 @@ LOG_WRITEF( "MakeIctIapPersistentL leaved with error = %d", err ); } } - - if ( iKeepConnection ) - { - // trigger the auto-disconnect timer as well - TBool timerStarted( EFalse ); - TRAP_IGNORE( timerStarted = iSession.ControlDisconnectTimerL( - EAdcStartTimer | EAdcTimerReset ) ); - - if ( !timerStarted ) - { - LOG_WRITE( "auto-disconnect timer couldn't be started!" ); - } - } LOG_WRITE( "before AsyncStop" ); // finally stop blocking the caller @@ -519,9 +525,8 @@ { LOG_WRITE( "ICT: AsyncStop" ); iIctWait.AsyncStop(); - } - - + } + } // ----------------------------------------------------------------------------- @@ -797,14 +802,6 @@ if ( err == KErrNone && ictTestPermission == EIctsNeverRun ) { LOG_WRITE( "ICT is set to never run, IAP remains temporary" ); - - if ( !iKeepConnection ) - { - //get the engine monitor the IAP - iSession.MonitorAccessPointL( iIctWlanInfo.iIapId ); - iSession.SetIapPersistenceL( EIapExpireOnShutdown ); - iSession.MonitorAccessPointL( iIctWlanInfo.iIapId ); - } ConnectivityObserver( EConnectionNotOk, KNullDesC ); } @@ -856,13 +853,19 @@ CleanupStack::PopAndDestroy( &cmManager ); LOG_WRITE( "starting ICT test..." ); - CIctsClientInterface* ict = CIctsClientInterface::NewL( - iConnectedIapId, - iConnectedNetId, - *this ); + + if ( iIct ) + { + iIct->CancelStartL(); + delete iIct; + iIct = NULL; + } + + iIct = CIctsClientInterface::NewL( iConnectedIapId, + iConnectedNetId, + *this ); LOG_WRITE( "ICT created" ); - CleanupStack::PushL( ict ); - ict->StartL(); + iIct->StartL(); LOG_WRITE( "ICT: started" ); // enter a waitloop since ICT is a kind of asynchronous service @@ -871,9 +874,8 @@ LOG_WRITE( "ICT: iIctWait started" ); iIctWait.Start(); } - + iIctEnded = EFalse; - CleanupStack::PopAndDestroy( ict ); LOG_WRITE( "ICT test done." ); } @@ -898,6 +900,18 @@ LOG_WRITEF( "iRefreshing = %d", iRefreshing ); return iRefreshing; } + + +// ---------------------------------------------------------------------------- +// CWsfModel::RefreshScan +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::RefreshScan( TPckgBuf& aPckg, + TRequestStatus& aStatus ) + { + LOG_ENTERFN( "CWsfModel::RefreshScan" ); + iSession.RequestScan( aPckg, aStatus ); + } // ---------------------------------------------------------------------------- @@ -978,12 +992,6 @@ LOG_ENTERFN( "CWsfModel::BrowserLaunchFailed" ); LOG_WRITEF( "error = %d", aError ); - // do the cleanup if necessary - TRAP_IGNORE( - iSession.SetIapPersistenceL( EIapForcedExpiry ); - iSession.ControlDisconnectTimerL( EAdcStartTimer | EAdcTimerReset ); - ); - if ( iObserver ) { iObserver->BrowserLaunchFailed( aError ); @@ -999,6 +1007,8 @@ { LOG_ENTERFN( "CWsfModel::BrowserLaunchCompleteL" ); + iSession.MonitorAccessPointL( iConnectedIapId ); + if ( iObserver ) { iObserver->BrowserLaunchCompleteL(); @@ -1016,7 +1026,6 @@ // browser has been terminated, do the cleanup if necessary iSession.SetIapPersistenceL( EIapForcedExpiry ); - iSession.ControlDisconnectTimerL( EAdcStartTimer | EAdcTimerReset ); if ( iObserver ) { @@ -1064,6 +1073,17 @@ return iSession.GetConnectedWlanDetailsL( aWlanInfo ); } +// ---------------------------------------------------------------------------- +// CWsfModel::GetConnectedWlanDetails +// ---------------------------------------------------------------------------- +// +EXPORT_C void CWsfModel::GetConnectedWlanDetails( TPckgBuf& aPckg, + TWsfWlanInfo& aWlanInfo, + TRequestStatus& aStatus ) + { + iSession.GetConnectedWlanDetails( aPckg, aWlanInfo, aStatus ); + } + // ---------------------------------------------------------------------------- // CWsfModel::AbortConnectingL