supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplconnrequestor.cpp
branchRCL_3
changeset 49 10852b179f64
parent 45 6b6920c56e2f
child 55 ea98413ce11f
equal deleted inserted replaced
47:fce0ae2e4223 49:10852b179f64
    45 											 MOMASuplConnObserver& aObserver):
    45 											 MOMASuplConnObserver& aObserver):
    46     				 						 CActive( EPriorityStandard ),
    46     				 						 CActive( EPriorityStandard ),
    47     				 						 iCommMgr(aCommMgr), 
    47     				 						 iCommMgr(aCommMgr), 
    48     				 						 iProtocolManager(aProtoMgr),
    48     				 						 iProtocolManager(aProtoMgr),
    49     				 						 iPort(aPort),
    49     				 						 iPort(aPort),
    50     				 						 iObserver( aObserver),    				 						  
    50     				 						 iObserver( aObserver),
    51     				 						 iIapDialogShown(EFalse),
    51     				 						 iTriggerSession(EFalse)
    52     				 						 iIapDlgTimerExpired(EFalse),    				 			            
       
    53     				 			             iIsTimeoutDialogTimerStarted(EFalse),
       
    54 											 iTriggerSession(EFalse)
       
    55     {
    52     {
    56 			
    53 			
    57     }
    54     }
    58 
    55 
    59 // -----------------------------------------------------------------------------
    56 // -----------------------------------------------------------------------------
    76     	
    73     	
    77     	iLastConnectionError = KErrNone;
    74     	iLastConnectionError = KErrNone;
    78     	
    75     	
    79     	iCurrentSLPId = KErrNotFound;
    76     	iCurrentSLPId = KErrNotFound;
    80     	
    77     	
    81     	iDialogTimer = COMASuplDialogTimer::NewL(*this);
    78     
    82     }
    79     }
    83 
    80 
    84 // -----------------------------------------------------------------------------
    81 // -----------------------------------------------------------------------------
    85 // COMASuplConnRequestor::NewL
    82 // COMASuplConnRequestor::NewL
    86 // Two-phased constructor.
    83 // Two-phased constructor.
   106 // -----------------------------------------------------------------------------
   103 // -----------------------------------------------------------------------------
   107 //
   104 //
   108 COMASuplConnRequestor::~COMASuplConnRequestor()
   105 COMASuplConnRequestor::~COMASuplConnRequestor()
   109     {
   106     {
   110     	Cancel();
   107     	Cancel();
   111     	if(iDialogTimer)
   108     
   112     	    {
   109 	  	delete iSuplSettings;
   113     	    iDialogTimer->Cancel();
       
   114     	    delete iDialogTimer;
       
   115     	    iDialogTimer = NULL;
       
   116     	    }
       
   117     	delete iSuplSettings;
       
   118     	delete iTrace;
   110     	delete iTrace;
   119     	delete iFallBackHandler;
   111     	delete iFallBackHandler;
   120     }
   112     }
   121 
   113 
   122 // -----------------------------------------------------------------------------
   114 // -----------------------------------------------------------------------------
   153                 if(!ret)
   145                 if(!ret)
   154 					{
   146 					{
   155 						buffer.Copy(_L("No access point configured for "));
   147 						buffer.Copy(_L("No access point configured for "));
   156 						buffer.Append(iHostAddress);
   148 						buffer.Append(iHostAddress);
   157 						iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
   149 						iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
   158 						if( isIapDialogShown )
   150 						buffer.Copy(_L("Calling CreateConnection with no IAP"));
   159 						    {
   151 						iTrace->Trace(buffer,KTraceFileName, __LINE__);
   160 						    TInt err = iProtocolManager.LaunchSettingsUI(this,iHostAddress);
   152 						iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,-1);
   161 						    if(err != KErrNone)
   153 						OpenConnection();
   162                                 {
       
   163                                 buffer.Copy(_L("Error in launching UI : "));
       
   164                                 buffer.AppendNum(err);
       
   165                                 iTrace->Trace(buffer,KTraceFileName, __LINE__);                 
       
   166                                 iHostAddress.Zero();
       
   167                                 iObserver.OperationCompleteL(err);
       
   168                                 }
       
   169 						        else
       
   170 						        iIapDialogShown = ETrue;
       
   171 						    }
       
   172 						
       
   173 						
   154 						
   174 					}
   155 					}
   175 				else
   156 				else
   176 				    {
   157 				    {
   177 				    iIsTimeoutDialogTimerStarted = EFalse;
       
   178     			    iDialogTimer->Cancel();
       
   179 				    buffer.Copy(_L("Connecting to "));
   158 				    buffer.Copy(_L("Connecting to "));
   180 				    buffer.Append(iHostAddress);
   159 				    buffer.Append(iHostAddress);
   181 				    iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
   160 				    iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
   182 				    iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,iIAPId);
   161 				    iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,iIAPId);
   183 				    OpenConnection();
   162 				    OpenConnection();
   193 
   172 
   194 // -----------------------------------------------------------------------------
   173 // -----------------------------------------------------------------------------
   195 // COMASuplConnRequestor::OpenConnection
   174 // COMASuplConnRequestor::OpenConnection
   196 // -----------------------------------------------------------------------------
   175 // -----------------------------------------------------------------------------
   197 //    
   176 //    
   198 void COMASuplConnRequestor::CreateConnectionL(TInt aDialogTimeOutDelay, TBool aTriggerSession)
   177 void COMASuplConnRequestor::CreateConnectionL(TInt /*aDialogTimeOutDelay*/, TBool aTriggerSession)
   199     {
   178     {
   200     iIsTimeoutDialogTimerStarted = ETrue;
       
   201     
       
   202     iDialogTimer->StartTimer(aDialogTimeOutDelay); 
       
   203     CreateConnectionL(aTriggerSession);
   179     CreateConnectionL(aTriggerSession);
   204     }
   180     }
   205 // -----------------------------------------------------------------------------
   181 // -----------------------------------------------------------------------------
   206 // COMASuplConnRequestor::OpenConnection
   182 // COMASuplConnRequestor::OpenConnection
   207 // -----------------------------------------------------------------------------
   183 // -----------------------------------------------------------------------------
   474 	   	}
   450 	   	}
   475 		CleanupStack::PopAndDestroy(2);//delete tableView and commDb
   451 		CleanupStack::PopAndDestroy(2);//delete tableView and commDb
   476 		return result;
   452 		return result;
   477 	}
   453 	}
   478 	
   454 	
   479 // -----------------------------------------------------------------------------
   455 
   480 // COMASuplConnRequestor::SettingsUICompleted
       
   481 // 
       
   482 // -----------------------------------------------------------------------------
       
   483 
       
   484 void COMASuplConnRequestor::SettingsUICompletedL(TInt aError)
       
   485 	{
       
   486 		TBuf<128> buffer(_L("COMASuplConnRequestor:SettingsUICompleted Error: "));
       
   487 		buffer.AppendNum(aError);
       
   488 		iTrace->Trace(buffer,KTraceFileName, __LINE__); 
       
   489 		
       
   490 		if (iIsTimeoutDialogTimerStarted)
       
   491 		    {                
       
   492 		    iTrace->Trace(_L("COMASuplSession::SettingsUICompleted, stopping timer "), KTraceFileName, __LINE__);
       
   493 		    iIsTimeoutDialogTimerStarted = EFalse;                    
       
   494 		    iDialogTimer->StopTimer();
       
   495 		    }
       
   496 		if (iIapDlgTimerExpired)
       
   497 		    {
       
   498 		    iIapDlgTimerExpired = EFalse;
       
   499 		    iIapDialogShown = EFalse;
       
   500 		    iProtocolManager.LaunchSuplDialogTimeoutUI(this);
       
   501 		    iObserver.OperationCompleteL(KErrNone);
       
   502 		    return;
       
   503 		    }
       
   504 		if(aError == KErrNone)
       
   505 			{
       
   506 				TBuf<100> IapName;
       
   507 				TInt err = iProtocolManager.GetLastUsedAccessPoint(IapName,iIAPId);
       
   508 				 if(err == KErrNone)
       
   509 					{
       
   510 						buffer.Copy(_L("Connecting to "));
       
   511 						buffer.Append(iHostAddress);
       
   512 						buffer.Append(_L(" using IAP "));
       
   513 						buffer.Append(IapName);
       
   514 						iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
       
   515 						iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,iIAPId);
       
   516 						SaveAccessPoint(IapName);
       
   517 						OpenConnection();
       
   518 					}
       
   519 				 else
       
   520 				 	{
       
   521 				 		iObserver.OperationCompleteL(err);	
       
   522 				 	}	
       
   523 			}
       
   524 		else
       
   525 			{
       
   526 				iObserver.OperationCompleteL(aError);	
       
   527 			}	
       
   528 		
       
   529 	}
       
   530 
   456 
   531 // -----------------------------------------------------------------------------
   457 // -----------------------------------------------------------------------------
   532 // COMASuplConnRequestor::SaveAccessPoint
   458 // COMASuplConnRequestor::SaveAccessPoint
   533 // 
   459 // 
   534 // -----------------------------------------------------------------------------
   460 // -----------------------------------------------------------------------------
   592 void COMASuplConnRequestor::UpdateSLPListForHomeUsage(TBool aHomeNetwork)
   518 void COMASuplConnRequestor::UpdateSLPListForHomeUsage(TBool aHomeNetwork)
   593 {
   519 {
   594 			iFallBackHandler->UpdateSLPListForHomeUsage(aHomeNetwork);
   520 			iFallBackHandler->UpdateSLPListForHomeUsage(aHomeNetwork);
   595 }
   521 }
   596 
   522 
   597 // -----------------------------------------------------------------------------
       
   598 // COMASuplConnRequestor::DialogTimerExpiredL
       
   599 // Checks whether UI is displayed or not previously
       
   600 // 
       
   601 // -----------------------------------------------------------------------------
       
   602 void COMASuplConnRequestor::DialogTimerExpiredL()
       
   603 {
       
   604    iTrace->Trace(_L("COMASuplConnRequestor:Timer Expired for SUPL IAP Dialog"), KTraceFileName, __LINE__); 
       
   605 
       
   606     if (!iIapDialogShown)
       
   607         iProtocolManager.LaunchSuplDialogTimeoutUI(this);
       
   608     else
       
   609         iIapDlgTimerExpired = ETrue;  
       
   610     return; 
       
   611 }
       
   612 
   523 
   613 TUint COMASuplConnRequestor::GetPortNumber()
   524 TUint COMASuplConnRequestor::GetPortNumber()
   614 	{
   525 	{
   615 	return iConnection->GetPortNumberUsed();
   526 		if(iConnection)
       
   527 			return iConnection->GetPortNumberUsed();
       
   528 		else 
       
   529 			return 0;
   616 	}
   530 	}
   617 	
   531 	
   618 	
   532 	
   619 //  End of File
   533 //  End of File