supl/locationomasuplprotocolhandler/protocolhandlerver2/src/epos_comasuplconnrequestor.cpp
branchRCL_3
changeset 55 ea98413ce11f
parent 49 10852b179f64
equal deleted inserted replaced
49:10852b179f64 55:ea98413ce11f
    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     				 						 iTriggerSession(EFalse)
    51     				 						 iIapDialogShown(EFalse),
       
    52     				 						 iIapDlgTimerExpired(EFalse),    				 			            
       
    53     				 			             iIsTimeoutDialogTimerStarted(EFalse),
       
    54 											 iTriggerSession(EFalse)
    52     {
    55     {
    53 			
    56 			
    54     }
    57     }
    55 
    58 
    56 // -----------------------------------------------------------------------------
    59 // -----------------------------------------------------------------------------
    73     	
    76     	
    74     	iLastConnectionError = KErrNone;
    77     	iLastConnectionError = KErrNone;
    75     	
    78     	
    76     	iCurrentSLPId = KErrNotFound;
    79     	iCurrentSLPId = KErrNotFound;
    77     	
    80     	
    78     
    81     	iDialogTimer = COMASuplDialogTimer::NewL(*this);
    79     }
    82     }
    80 
    83 
    81 // -----------------------------------------------------------------------------
    84 // -----------------------------------------------------------------------------
    82 // COMASuplConnRequestor::NewL
    85 // COMASuplConnRequestor::NewL
    83 // Two-phased constructor.
    86 // Two-phased constructor.
   103 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   104 //
   107 //
   105 COMASuplConnRequestor::~COMASuplConnRequestor()
   108 COMASuplConnRequestor::~COMASuplConnRequestor()
   106     {
   109     {
   107     	Cancel();
   110     	Cancel();
   108     
   111     	if(iDialogTimer)
   109 	  	delete iSuplSettings;
   112     	    {
       
   113     	    iDialogTimer->Cancel();
       
   114     	    delete iDialogTimer;
       
   115     	    iDialogTimer = NULL;
       
   116     	    }
       
   117     	delete iSuplSettings;
   110     	delete iTrace;
   118     	delete iTrace;
   111     	delete iFallBackHandler;
   119     	delete iFallBackHandler;
   112     }
   120     }
   113 
   121 
   114 // -----------------------------------------------------------------------------
   122 // -----------------------------------------------------------------------------
   145                 if(!ret)
   153                 if(!ret)
   146 					{
   154 					{
   147 						buffer.Copy(_L("No access point configured for "));
   155 						buffer.Copy(_L("No access point configured for "));
   148 						buffer.Append(iHostAddress);
   156 						buffer.Append(iHostAddress);
   149 						iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
   157 						iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
   150 						buffer.Copy(_L("Calling CreateConnection with no IAP"));
   158 						if( isIapDialogShown )
   151 						iTrace->Trace(buffer,KTraceFileName, __LINE__);
   159 						    {
   152 						iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,-1);
   160 						    TInt err = iProtocolManager.LaunchSettingsUI(this,iHostAddress);
   153 						OpenConnection();
   161 						    if(err != KErrNone)
       
   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 						
   154 						
   173 						
   155 					}
   174 					}
   156 				else
   175 				else
   157 				    {
   176 				    {
       
   177 				    iIsTimeoutDialogTimerStarted = EFalse;
       
   178     			    iDialogTimer->Cancel();
   158 				    buffer.Copy(_L("Connecting to "));
   179 				    buffer.Copy(_L("Connecting to "));
   159 				    buffer.Append(iHostAddress);
   180 				    buffer.Append(iHostAddress);
   160 				    iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
   181 				    iTrace->Trace(buffer,KTraceFileName, __LINE__); 				
   161 				    iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,iIAPId);
   182 				    iConnection = iCommMgr.CreateConnectionL(iHostAddress,iTls,iPskTls,iPort,iIAPId);
   162 				    OpenConnection();
   183 				    OpenConnection();
   172 
   193 
   173 // -----------------------------------------------------------------------------
   194 // -----------------------------------------------------------------------------
   174 // COMASuplConnRequestor::OpenConnection
   195 // COMASuplConnRequestor::OpenConnection
   175 // -----------------------------------------------------------------------------
   196 // -----------------------------------------------------------------------------
   176 //    
   197 //    
   177 void COMASuplConnRequestor::CreateConnectionL(TInt /*aDialogTimeOutDelay*/, TBool aTriggerSession)
   198 void COMASuplConnRequestor::CreateConnectionL(TInt aDialogTimeOutDelay, TBool aTriggerSession)
   178     {
   199     {
       
   200     iIsTimeoutDialogTimerStarted = ETrue;
       
   201     
       
   202     iDialogTimer->StartTimer(aDialogTimeOutDelay); 
   179     CreateConnectionL(aTriggerSession);
   203     CreateConnectionL(aTriggerSession);
   180     }
   204     }
   181 // -----------------------------------------------------------------------------
   205 // -----------------------------------------------------------------------------
   182 // COMASuplConnRequestor::OpenConnection
   206 // COMASuplConnRequestor::OpenConnection
   183 // -----------------------------------------------------------------------------
   207 // -----------------------------------------------------------------------------
   450 	   	}
   474 	   	}
   451 		CleanupStack::PopAndDestroy(2);//delete tableView and commDb
   475 		CleanupStack::PopAndDestroy(2);//delete tableView and commDb
   452 		return result;
   476 		return result;
   453 	}
   477 	}
   454 	
   478 	
   455 
   479 // -----------------------------------------------------------------------------
       
   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 	}
   456 
   530 
   457 // -----------------------------------------------------------------------------
   531 // -----------------------------------------------------------------------------
   458 // COMASuplConnRequestor::SaveAccessPoint
   532 // COMASuplConnRequestor::SaveAccessPoint
   459 // 
   533 // 
   460 // -----------------------------------------------------------------------------
   534 // -----------------------------------------------------------------------------
   518 void COMASuplConnRequestor::UpdateSLPListForHomeUsage(TBool aHomeNetwork)
   592 void COMASuplConnRequestor::UpdateSLPListForHomeUsage(TBool aHomeNetwork)
   519 {
   593 {
   520 			iFallBackHandler->UpdateSLPListForHomeUsage(aHomeNetwork);
   594 			iFallBackHandler->UpdateSLPListForHomeUsage(aHomeNetwork);
   521 }
   595 }
   522 
   596 
       
   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 }
   523 
   612 
   524 TUint COMASuplConnRequestor::GetPortNumber()
   613 TUint COMASuplConnRequestor::GetPortNumber()
   525 	{
   614 	{
   526 		if(iConnection)
   615 	return iConnection->GetPortNumberUsed();
   527 			return iConnection->GetPortNumberUsed();
       
   528 		else 
       
   529 			return 0;
       
   530 	}
   616 	}
   531 	
   617 	
   532 	
   618 	
   533 //  End of File
   619 //  End of File