supl/locationomasuplprotocolhandler/protocolhandlerver1/src/epos_comasuplsession.cpp
branchRCL_3
changeset 19 02ba3f1733c6
parent 18 d746aee05493
child 20 2b4ea9893b66
equal deleted inserted replaced
18:d746aee05493 19:02ba3f1733c6
   126 																iUsageHomeNW(EFalse),
   126 																iUsageHomeNW(EFalse),
   127 																iEtelNotify(EFalse),
   127 																iEtelNotify(EFalse),
   128 																iEtelRoamingCheck(EFalse),
   128 																iEtelRoamingCheck(EFalse),
   129 																iIapDialogShown(EFalse),
   129 																iIapDialogShown(EFalse),
   130 																iIapDlgTimerExpired(EFalse),
   130 																iIapDlgTimerExpired(EFalse),
   131 																iOMASuplAsnHandlerBaseImpl(aOMASuplAsnHandlerBase)
   131 																iOMASuplAsnHandlerBaseImpl(aOMASuplAsnHandlerBase),iWlanOnly(EFalse)
   132 																
   132 																
   133     { 
   133     { 
   134     }
   134     }
   135  
   135  
   136 //2 nd Phase construction
   136 //2 nd Phase construction
   314         delete iIapNotifier;
   314         delete iIapNotifier;
   315     	iIMSI.Close();
   315     	iIMSI.Close();
   316         delete iDialogTimer;
   316         delete iDialogTimer;
   317         
   317         
   318         delete iNetworkPrivacy;
   318         delete iNetworkPrivacy;
       
   319 
       
   320 	if(iStaleLocationId)
       
   321     	  {
       
   322     	  delete iStaleLocationId;
       
   323     	  iStaleLocationId = NULL;
       
   324     	  }  
   319     	
   325     	
   320     	if(iTrace)
   326     	if(iTrace)
   321     		iTrace->Trace(_L("End of ~COMASuplSession::COMASuplSession"), KTraceFileName, __LINE__); 
   327     		iTrace->Trace(_L("End of ~COMASuplSession::COMASuplSession"), KTraceFileName, __LINE__); 
   322 		    	
   328 		    	
   323     	delete iTrace;
   329     	delete iTrace;
   422 // (other items were commented in a header).
   428 // (other items were commented in a header).
   423 // -----------------------------------------------------------------------------
   429 // -----------------------------------------------------------------------------
   424 //
   430 //
   425  void COMASuplSession::RunSuplSessionL(TRequestStatus& aStatus, TBool aFirstReq, const TDesC& aHslpAddress, 
   431  void COMASuplSession::RunSuplSessionL(TRequestStatus& aStatus, TBool aFirstReq, const TDesC& aHslpAddress, 
   426                                        TBool aFallBack, TInt aAllowedCapabilities,
   432                                        TBool aFallBack, TInt aAllowedCapabilities,
   427  									  TInt aSessionIdSeed,TInt aRequestID)
   433  									  TInt aSessionIdSeed,TInt aRequestID,TBool aIsStaleCellId,COMASuplLocationId* aLocationId,TBool aPrompt,TBool aWlanOnly)
   428     {
   434     {
   429 	    iRunRequestStatus = & aStatus;
   435 	    iRunRequestStatus = & aStatus;
   430 	    *iRunRequestStatus = KRequestPending;
   436 	    *iRunRequestStatus = KRequestPending;
   431 
   437 
   432         iRequestID = aRequestID;
   438         iRequestID = aRequestID;
   433 
   439 
   434     	iTrace->Trace(_L("Start COMASuplSession::RunSuplSession"), KTraceFileName, __LINE__); 
   440     	iTrace->Trace(_L("Start COMASuplSession::RunSuplSession"), KTraceFileName, __LINE__); 
   435     	
   441 
       
   442     	if(aIsStaleCellId)
       
   443     	    {
       
   444     	    iTrace->Trace(_L("Start COMASuplSession::RunSuplSession for Stale Cell Id"), KTraceFileName, __LINE__); 
       
   445     	    iIsStaleLocIdPresent = ETrue;
       
   446 
       
   447      	    
       
   448     	    if(iStaleLocationId)
       
   449     	        {
       
   450     	        delete iStaleLocationId;
       
   451     	        iStaleLocationId = NULL;
       
   452     	        }   	        
       
   453 
       
   454     	    iStaleLocationId = aLocationId;
       
   455     	    iStaleLocIdPrompt = aPrompt;
       
   456     	    iWlanOnly = aWlanOnly; //OCC
       
   457     	    
       
   458     	    iTrace->Trace(_L("Deleting pos requestor as session is for Stale Cell Id"), KTraceFileName, __LINE__); 
       
   459             delete iOMASuplPOSRequestor;
       
   460              iOMASuplPOSRequestor = NULL;
       
   461              
       
   462     	    // Delete the POS Session
       
   463     	     delete iPOSSession;
       
   464     	     iPOSSession = NULL;    	     
       
   465 
       
   466     	    }
   436     	// Log Session Id
   467     	// Log Session Id
   437     	TBuf<64> id;
   468     	TBuf<64> id;
   438     	id.Append(_L("Session  Id is "));
   469     	id.Append(_L("Session  Id is "));
   439     	id.AppendNum(aSessionIdSeed);
   470     	id.AppendNum(aSessionIdSeed);
   440     	iTrace->Trace(id,KTraceFileName, __LINE__); 
   471     	iTrace->Trace(id,KTraceFileName, __LINE__); 
   443     	id.Copy(_L("Received Capability is "));
   474     	id.Copy(_L("Received Capability is "));
   444     	id.AppendNum(aAllowedCapabilities);
   475     	id.AppendNum(aAllowedCapabilities);
   445     	iTrace->Trace(id,KTraceFileName, __LINE__); 
   476     	iTrace->Trace(id,KTraceFileName, __LINE__); 
   446     	
   477     	
   447     	iSETSessionUniqueId = aSessionIdSeed;
   478     	iSETSessionUniqueId = aSessionIdSeed;
   448 
   479     	
       
   480 		iIhaveLaunchedUsagedialog = EFalse;
   449 		
   481 		
   450 		TInt networkMode = 1;
   482 		TInt networkMode = 1;
   451 		networkMode = GetNetworkModeL();
   483 		networkMode = GetNetworkModeL();
   452 		
   484 		
   453 		if ( networkMode == ECoreAppUIsNetworkConnectionNotAllowed )
   485 	 if(!iWlanOnly)	//OCC	
   454 			{
   486             {
   455 				id.Copy(_L("The device is in OFFLINE mode."));
   487             if ( networkMode == ECoreAppUIsNetworkConnectionNotAllowed )
   456 				iTrace->Trace(id,KTraceFileName, __LINE__); 
   488                 {
   457 				iSessionObserver.TerminateSession(this, KErrGeneral);
   489                     id.Copy(_L("The device is in OFFLINE mode."));
   458 				return;
   490                     iTrace->Trace(id,KTraceFileName, __LINE__); 
   459 			}
   491                     iSessionObserver.TerminateSession(this, KErrGeneral);
   460 		else
   492                     return;
   461 			{
   493                 }
   462 				id.Copy(_L("The device is in ON LINE mode."));
   494             else
   463 				iTrace->Trace(id,KTraceFileName, __LINE__); 
   495                 {
   464 			}
   496                     id.Copy(_L("The device is in ON LINE mode."));
       
   497                     iTrace->Trace(id,KTraceFileName, __LINE__); 
       
   498                 }
       
   499             } //OCC
   465 
   500 
   466     	if(aAllowedCapabilities == 0)
   501     	if(aAllowedCapabilities == 0)
   467     		{
   502     		{
   468 				iAllowedCapabilities = KGpsSETBased | KAutonomousGps| KAFLT | KECID | KEOTD | KOTDOA | KCID; 
   503 				iAllowedCapabilities = KGpsSETBased | KAutonomousGps| KAFLT | KECID | KEOTD | KOTDOA | KCID; 
   469     		}
   504     		}
   474     		
   509     		
   475    		//Ownership transfer to iSuplSessionId
   510    		//Ownership transfer to iSuplSessionId
   476 		iSuplSessionId->SetSLPSessionID(NULL); 	
   511 		iSuplSessionId->SetSLPSessionID(NULL); 	
   477 		
   512 		
   478 		iConnRequestor->SetDefaultParametersL(aHslpAddress,aFallBack);
   513 		iConnRequestor->SetDefaultParametersL(aHslpAddress,aFallBack);
   479 
   514 		
   480         if (aFirstReq)
   515 		 id.Copy(_L("aFallBack value is "));
   481             CheckForSuplUsageL();
   516 		 id.AppendNum(aFallBack);
   482         else
   517 		 iTrace->Trace(id,KTraceFileName, __LINE__);
   483             CheckForPreviousResultL();        
   518 
       
   519        if(!iWlanOnly) //OCC
       
   520 		    {
       
   521             iTrace->Trace(_L("iWLANOnly false COMASuplSession::RunSuplSession"), KTraceFileName, __LINE__);
       
   522            
       
   523             id.Copy(_L("aFirstReq value is "));
       
   524             id.AppendNum(aFirstReq);
       
   525             iTrace->Trace(id,KTraceFileName, __LINE__);
       
   526             
       
   527             if (aFirstReq)
       
   528                 {
       
   529                 iTrace->Trace(_L("start CheckForSuplUsageL COMASuplSession::RunSuplSession"), KTraceFileName, __LINE__);
       
   530                 CheckForSuplUsageL();
       
   531                 }
       
   532             else
       
   533                 {
       
   534                 iTrace->Trace(_L("start CheckForPreviousResultL COMASuplSession::RunSuplSession"), KTraceFileName, __LINE__);
       
   535                 CheckForPreviousResultL();  
       
   536                 }
       
   537             }
       
   538 		else
       
   539 		    {
       
   540 		    iTrace->Trace(_L("iWLANOnly true COMASuplSession::RunSuplSession"), KTraceFileName, __LINE__); 
       
   541             InitializeL(iRequestID);
       
   542 		    } //OCC     
   484 
   543 
   485 	    
   544 	    
   486 		// Clear  Position....
   545 		// Clear  Position....
   487 		delete iPosition;
   546 		delete iPosition;
   488 		iPosition = NULL;
   547 		iPosition = NULL;
   489 		
   548 
   490 	    
   549 	    
   491 		iTrace->Trace(_L("End of COMASuplSession::RunSuplSession"), KTraceFileName, __LINE__); 
   550 		iTrace->Trace(_L("End of COMASuplSession::RunSuplSession"), KTraceFileName, __LINE__); 
   492     }
   551     }
   493 
   552 
   494 // -----------------------------------------------------------------------------
   553 // -----------------------------------------------------------------------------
   503                                         const TDesC& aHslpAddress, TBool aFallBack,
   562                                         const TDesC& aHslpAddress, TBool aFallBack,
   504   										TInt aAllowedCapabilities,TInt aSessionIdSeed,
   563   										TInt aAllowedCapabilities,TInt aSessionIdSeed,
   505   										TSuplTerminalQop& aQop, TInt aRequestID)
   564   										TSuplTerminalQop& aQop, TInt aRequestID)
   506   	{
   565   	{
   507   	
   566   	
       
   567         iIhaveLaunchedUsagedialog = EFalse;
   508   		
   568   		
   509 	  	iClientQop = aQop;
   569 	  	iClientQop = aQop;
   510 	  	
   570 	  	
   511 		TInt delay;
   571 		TInt delay;
   512 		if(iClientQop.GetDelay(delay) != KErrNotFound)
   572 		if(iClientQop.GetDelay(delay) != KErrNotFound)
   651 		if(iIsQoPPresent)
   711 		if(iIsQoPPresent)
   652 			{
   712 			{
   653 				COMASuplStartState* startSuplState =  static_cast <COMASuplPosInitState *>(iSuplState);
   713 				COMASuplStartState* startSuplState =  static_cast <COMASuplPosInitState *>(iSuplState);
   654 				startSuplState->SetQop(iClientQop);
   714 				startSuplState->SetQop(iClientQop);
   655 			}
   715 			}
   656 		//SMP Changes
   716 		if(iIsStaleLocIdPresent)
   657 		iSuplMsgType = ESUPL_START;
   717 		    {
   658 		SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); 	
   718 		    iTrace->Trace(_L("GenerateSuplStartL setting stale location id in supl start"), KTraceFileName, __LINE__);
       
   719 		    COMASuplStartState* startSuplState =  static_cast <COMASuplPosInitState *>(iSuplState);
       
   720 		    startSuplState->SetStaleCellIdToUse(iStaleLocationId->CloneL());
       
   721 		    }
       
   722         iSuplSessionState = ESUPL_GENERATE;
       
   723         iSuplMsgType = ESUPL_START;
   659 		TInt err = iSuplState->GenerateMessageL();
   724 		TInt err = iSuplState->GenerateMessageL();
   660 
   725 	
       
   726 
       
   727 		SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating);	
   661 	}  
   728 	}  
   662 	 
   729 	 
   663 
   730 
   664 // -----------------------------------------------------------------------------
   731 // -----------------------------------------------------------------------------
   665 // COMASuplSession::GenerateSuplPosInitL
   732 // COMASuplSession::GenerateSuplPosInitL
   698 			TBuf<128> msg(_L("COMASuplSession::GenerateSuplPosInitL() without last 2 params : "));
   765 			TBuf<128> msg(_L("COMASuplSession::GenerateSuplPosInitL() without last 2 params : "));
   699 			msg.AppendNum(iPosMethod);
   766 			msg.AppendNum(iPosMethod);
   700 			iTrace->Trace(msg, KTraceFileName, __LINE__);
   767 			iTrace->Trace(msg, KTraceFileName, __LINE__);
   701 			iSuplState = COMASuplPosInitState::NewL(iSETCapabilities, iMobilePhone, iUT2_PosInitTimer,
   768 			iSuplState = COMASuplPosInitState::NewL(iSETCapabilities, iMobilePhone, iUT2_PosInitTimer,
   702  						 iOMASuplPOSRequestor,iAllowedCapabilities,iRequestType, iPosMethod,iOMASuplAsnHandlerBaseImpl);
   769  						 iOMASuplPOSRequestor,iAllowedCapabilities,iRequestType, iPosMethod,iOMASuplAsnHandlerBaseImpl);
       
   770 			if(iIsStaleLocIdPresent)
       
   771 			    {
       
   772 			    iTrace->Trace(_L("COMASuplSession::GenerateSuplPosInitL() Setting Stale Location Id "), KTraceFileName, __LINE__);
       
   773 			    COMASuplPosInitState* posInitSuplState =  static_cast <COMASuplPosInitState *>(iSuplState);
       
   774 			    posInitSuplState->SetStaleCellIdToUse(iStaleLocationId->CloneL());
       
   775 			    }
   703 		
   776 		
   704 		}
   777 		}
   705 		iSuplState->SetMsgStateObserver(this);
   778 		iSuplState->SetMsgStateObserver(this);
   706 		
   779 		
   707 		//SMP Changes
   780 		//SMP Changes
   813 // (other items were commented in a header).
   886 // (other items were commented in a header).
   814 // -----------------------------------------------------------------------------
   887 // -----------------------------------------------------------------------------
   815 //
   888 //
   816 void COMASuplSession::OperationCompleteL(TInt aErrorCode)
   889 void COMASuplSession::OperationCompleteL(TInt aErrorCode)
   817 	{
   890 	{
       
   891 	iTrace->Trace(_L("COMASuplSession::OperationCompleteL"), KTraceFileName, __LINE__); 
   818 	TBuf<256> msg;
   892 	TBuf<256> msg;
   819 	if(KErrNone != aErrorCode)
   893 	if(KErrNone != aErrorCode)
   820 		{
   894 		{
   821 			msg.Copy(_L("Actual Error Code : "));
   895 			msg.Copy(_L("Actual Error Code : "));
   822 			msg.AppendNum(aErrorCode);
   896 			msg.AppendNum(aErrorCode);
   825             if (iSuplSessionState == ESUPL_CONNECTING)
   899             if (iSuplSessionState == ESUPL_CONNECTING)
   826                 CheckForPersistentFailure(aErrorCode);                    
   900                 CheckForPersistentFailure(aErrorCode);                    
   827 			HandleSuplErrorL(aErrorCode);
   901 			HandleSuplErrorL(aErrorCode);
   828 			return;
   902 			return;
   829 		}
   903 		}
       
   904 	
       
   905 	msg.Copy(_L("iSuplSessionState : "));
       
   906 	msg.AppendNum(iSuplSessionState);
       
   907 	iTrace->Trace(msg, KTraceFileName, __LINE__); 
   830 		
   908 		
   831 	TInt err = KErrNone;
   909 	TInt err = KErrNone;
   832 	
   910 	
   833 	switch(iSuplSessionState)
   911 	switch(iSuplSessionState)
   834 	{
   912 	{
   886 					              }                                                
   964 					              }                                                
   887 				 TRAP( err, iConnRequestor->CreateConnectionL(delay) );
   965 				 TRAP( err, iConnRequestor->CreateConnectionL(delay) );
   888 				 }
   966 				 }
   889 		     else //terminal initiated case
   967 		     else //terminal initiated case
   890 		         {
   968 		         {
   891             	TRAP( err, iConnRequestor->CreateConnectionL() );
   969                  iTrace->Trace(_L("Connection block."), KTraceFileName, __LINE__);
       
   970             	if(iIsStaleLocIdPresent)
       
   971                      {
       
   972                      TRAP( err, iConnRequestor->CreateConnectionL(iStaleLocIdPrompt,iWlanOnly) );
       
   973                      }
       
   974                  else
       
   975                      {
       
   976                      TRAP( err, iConnRequestor->CreateConnectionL() );
       
   977                      }
   892 		         }
   978 		         }
   893 			        if(KErrNone != err)
   979 			        if(KErrNone != err)
   894 				        {
   980 				        {
   895 						    HandleSuplErrorL(err);
   981 						    HandleSuplErrorL(err);
   896 						    break;
   982 						    break;
  4056     msg.Copy(_L("SUPL Usage UI completed with ... "));
  4142     msg.Copy(_L("SUPL Usage UI completed with ... "));
  4057     msg.AppendNum(aError);
  4143     msg.AppendNum(aError);
  4058     iTrace->Trace(msg,KTraceFileName, __LINE__); 
  4144     iTrace->Trace(msg,KTraceFileName, __LINE__); 
  4059 
  4145 
  4060     iPrevUsageResult = aError;                    
  4146     iPrevUsageResult = aError;                    
       
  4147     iIhaveLaunchedUsagedialog = EFalse;                 
  4061 
  4148 
  4062 
  4149 
  4063     if (aError == KErrNone)
  4150     if (aError == KErrNone)
  4064         {
  4151         {
  4065         iProtocolManager.UpdateAllSubSessnsInSameSession(iIpcSessionId);                
  4152         iProtocolManager.UpdateAllSubSessnsInSameSession(iIpcSessionId);                
  4216         {            
  4303         {            
  4217             iUsageHomeNW = aHomeNw;   
  4304             iUsageHomeNW = aHomeNw;   
  4218             iConnRequestor->UpdateSLPListForHomeUsage(iUsageHomeNW);             
  4305             iConnRequestor->UpdateSLPListForHomeUsage(iUsageHomeNW);             
  4219             CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage();
  4306             CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage();
  4220             
  4307             
  4221             if (usage == CSuplSettings::ESuplUsageAlwaysAsk)
  4308             if (usage == CSuplSettings::ESuplUsageAlwaysAsk || iStaleLocIdPrompt)
  4222                 {
  4309                 {
  4223                 TInt err;                
  4310                 TInt err;                
       
  4311                 if (!iSuplSettings->IsUIActive() )
       
  4312                     {                        
  4224                     if (!aHomeNw)
  4313                     if (!aHomeNw)
  4225                         {                            
  4314                         {                            
  4226                         iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__);
  4315                         iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__);
       
  4316                         iIhaveLaunchedUsagedialog = ETrue;                 
  4227                         err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue);        
  4317                         err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue);        
  4228                         }
  4318                         }
  4229                     else
  4319                     else
  4230                         {                            
  4320                         {                            
  4231                         iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is not roaming"), KTraceFileName, __LINE__);
  4321                         iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is not roaming"), KTraceFileName, __LINE__);
       
  4322                         iIhaveLaunchedUsagedialog = ETrue;                 
  4232                         err = iProtocolManager.LaunchSuplUsageSettingsUI(this, EFalse);        
  4323                         err = iProtocolManager.LaunchSuplUsageSettingsUI(this, EFalse);        
  4233                         }
  4324                         }
       
  4325                     }
       
  4326                 else
       
  4327                     err = KErrInUse;                        
  4234 
  4328 
  4235                 if(KErrNone != err && KErrInUse == err)
  4329                 if(KErrNone != err && KErrInUse == err)
  4236                     {
  4330                     {
  4237                         iTrace->Trace(_L("Dialog in use, setting flag"), KTraceFileName, __LINE__);
  4331                         iTrace->Trace(_L("Dialog in use, setting flag"), KTraceFileName, __LINE__);
  4238                         SetSuplUsageFlag();                            
  4332                         SetSuplUsageFlag();                            
  4594 TBool COMASuplSession::IsEtelRoamingSet()
  4688 TBool COMASuplSession::IsEtelRoamingSet()
  4595     {
  4689     {
  4596     iTrace->Trace(_L("COMASuplSession::IsEtelRoamingSet"), KTraceFileName, __LINE__); 
  4690     iTrace->Trace(_L("COMASuplSession::IsEtelRoamingSet"), KTraceFileName, __LINE__); 
  4597     return iEtelRoamingCheck;
  4691     return iEtelRoamingCheck;
  4598     }        
  4692     }        
       
  4693 	
       
  4694 TBool COMASuplSession::HasMeLaunchedUsageDialog()
       
  4695 {
       
  4696 	return iIhaveLaunchedUsagedialog; 
       
  4697 }
       
  4698 
  4599 
  4699 
  4600 // -----------------------------------------------------------------------------
  4700 // -----------------------------------------------------------------------------
  4601 // COMASuplSession::DialogTimerExpiredL
  4701 // COMASuplSession::DialogTimerExpiredL
  4602 // Checks whether UI is displayed or not previously
  4702 // Checks whether UI is displayed or not previously
  4603 // 
  4703 //