diff -r 2b4ea9893b66 -r 6b6920c56e2f supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplconnrequestor.cpp --- a/supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplconnrequestor.cpp Tue Aug 31 15:37:04 2010 +0300 +++ b/supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplconnrequestor.cpp Wed Sep 01 12:24:21 2010 +0100 @@ -50,7 +50,10 @@ iCommMgr(aCommMgr), iProtocolManager(aProtoMgr), iPort(aPort), - iObserver( aObserver),iPrompt(EFalse),iWlanOnly(EFalse),iIsStaleLocIdPresent(EFalse) + iObserver( aObserver), + iIapDialogShown(EFalse), + iIapDlgTimerExpired(EFalse), + iIsTimeoutDialogTimerStarted(EFalse),iPrompt(EFalse),iWlanOnly(EFalse),iIsStaleLocIdPresent(EFalse) { } @@ -77,6 +80,7 @@ iCurrentSLPId = KErrNotFound; + iDialogTimer = COMASuplDialogTimer::NewL(*this); } // ----------------------------------------------------------------------------- @@ -106,7 +110,12 @@ COMASuplConnRequestor::~COMASuplConnRequestor() { Cancel(); - + if(iDialogTimer) + { + iDialogTimer->Cancel(); + delete iDialogTimer; + iDialogTimer = NULL; + } delete iSuplSettings; delete iTrace; delete iFallBackHandler; @@ -129,42 +138,54 @@ { TBuf<100> iapName; TBuf<128> buffer; - iState = EConnecting; + iState = EConnecting; TBool isIapDialogShown = EFalse; TInt errorCode = iFallBackHandler->GetNextSLPAddressL(iCurrentSLPId,iHostAddress,iapName,iTls,iPskTls,iLastConnectionError,isIapDialogShown); if(errorCode == KErrNone) { - TBool ret = ConvertIAPNameToIdL(iapName,iIAPId); - if(!ret) - { - buffer.Copy(_L("No access point configured for ")); - buffer.Append(iHostAddress); - iTrace->Trace(buffer,KTraceFileName, __LINE__); - buffer.Copy(_L("Calling CreateConnection with no IAP")); - iTrace->Trace(buffer,KTraceFileName, __LINE__); - iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,-1); - OpenConnection(); - - } - else - { - buffer.Copy(_L("Connecting to ")); - buffer.Append(iHostAddress); - iTrace->Trace(buffer,KTraceFileName, __LINE__); - iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,iIAPId); - OpenConnection(); - } - } - else - { - iHostAddress.Zero(); - iObserver.OperationCompleteL(errorCode); - } + TBool ret = ConvertIAPNameToIdL(iapName,iIAPId); + if(!ret) + { + buffer.Copy(_L("No access point configured for ")); + buffer.Append(iHostAddress); + iTrace->Trace(buffer,KTraceFileName, __LINE__); + if( isIapDialogShown ) + { + TInt err = iProtocolManager.LaunchSettingsUI(this,iHostAddress); + if(err != KErrNone) + { + buffer.Copy(_L("Error in launching UI : ")); + buffer.AppendNum(err); + iTrace->Trace(buffer,KTraceFileName, __LINE__); + iHostAddress.Zero(); + iObserver.OperationCompleteL(err); + } + else + iIapDialogShown = ETrue; + } + + + } + else + { + iIsTimeoutDialogTimerStarted = EFalse; + iDialogTimer->Cancel(); + buffer.Copy(_L("Connecting to ")); + buffer.Append(iHostAddress); + iTrace->Trace(buffer,KTraceFileName, __LINE__); + iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,iIAPId); + OpenConnection(); + } + } + else + { + iHostAddress.Zero(); + iObserver.OperationCompleteL(errorCode); + } } } - - + // ----------------------------------------------------------------------------- // COMASuplConnRequestor::CreateConnection for OCC // ----------------------------------------------------------------------------- @@ -178,7 +199,9 @@ iPrompt = aPrompt; iWlanOnly = aWlanOnly; iIsStaleLocIdPresent = ETrue; - + iIsTimeoutDialogTimerStarted = EFalse; + iDialogTimer->Cancel(); + TInt err; err = iRepository->Get(KSuplGeoInfoConvServerName, GeoTagServerName); User::LeaveIfError(err); @@ -199,9 +222,12 @@ // ----------------------------------------------------------------------------- // COMASuplConnRequestor::OpenConnection // ----------------------------------------------------------------------------- -// TODO : Remove this method -void COMASuplConnRequestor::CreateConnectionL(TInt /*aDialogTimeOutDelay*/) +// +void COMASuplConnRequestor::CreateConnectionL(TInt aDialogTimeOutDelay) { + iIsTimeoutDialogTimerStarted = ETrue; + + iDialogTimer->StartTimer(aDialogTimeOutDelay); CreateConnectionL(); } // ----------------------------------------------------------------------------- @@ -242,7 +268,8 @@ if(iIsSettingInitilized) { - if(iConnection) + + if(iConnection) { iState = EConnecting; if(iIsStaleLocIdPresent) @@ -429,7 +456,6 @@ void COMASuplConnRequestor::InitilizeSetting() { iTrace->Trace(_L("Intilizing Setting API..."), KTraceFileName, __LINE__); - iSuplSettings->Initialize(iStatus); SetActive(); } @@ -454,10 +480,7 @@ TUint COMASuplConnRequestor::GetPortNumber() { - if(iConnection) - return iConnection->GetPortNumberUsed(); - else - return 0; + return iConnection->GetPortNumberUsed(); } // ----------------------------------------------------------------------------- @@ -507,7 +530,57 @@ return result; } +// ----------------------------------------------------------------------------- +// COMASuplConnRequestor::SettingsUICompleted +// +// ----------------------------------------------------------------------------- +void COMASuplConnRequestor::SettingsUICompletedL(TInt aError) + { + TBuf<128> buffer(_L("COMASuplConnRequestor:SettingsUICompleted Error: ")); + buffer.AppendNum(aError); + iTrace->Trace(buffer,KTraceFileName, __LINE__); + + if (iIsTimeoutDialogTimerStarted) + { + iTrace->Trace(_L("COMASuplSession::SettingsUICompleted, stopping timer "), KTraceFileName, __LINE__); + iIsTimeoutDialogTimerStarted = EFalse; + iDialogTimer->StopTimer(); + } + if (iIapDlgTimerExpired) + { + iIapDlgTimerExpired = EFalse; + iIapDialogShown = EFalse; + iProtocolManager.LaunchSuplDialogTimeoutUI(this); + iObserver.OperationCompleteL(KErrNone); + return; + } + if(aError == KErrNone) + { + TBuf<100> IapName; + TInt err = iProtocolManager.GetLastUsedAccessPoint(IapName,iIAPId); + if(err == KErrNone) + { + buffer.Copy(_L("Connecting to ")); + buffer.Append(iHostAddress); + buffer.Append(_L(" using IAP ")); + buffer.Append(IapName); + iTrace->Trace(buffer,KTraceFileName, __LINE__); + iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,iIAPId); + SaveAccessPoint(IapName); + OpenConnection(); + } + else + { + iObserver.OperationCompleteL(err); + } + } + else + { + iObserver.OperationCompleteL(aError); + } + + } // ----------------------------------------------------------------------------- // COMASuplConnRequestor::SaveAccessPoint @@ -573,5 +646,19 @@ iFallBackHandler->UpdateSLPListForHomeUsage(aHomeNetwork); } +// ----------------------------------------------------------------------------- +// COMASuplConnRequestor::DialogTimerExpiredL +// Checks whether UI is displayed or not previously +// +// ----------------------------------------------------------------------------- +void COMASuplConnRequestor::DialogTimerExpiredL() + { + iTrace->Trace(_L("COMASuplConnRequestor:Timer Expired for SUPL IAP Dialog"), KTraceFileName, __LINE__); + if (!iIapDialogShown) + iProtocolManager.LaunchSuplDialogTimeoutUI(this); + else + iIapDlgTimerExpired = ETrue; + return; + } // End of File