4673 { |
4692 { |
4674 iTrace->Trace(_L("Timer Expired for SUPL_POSINIT"), KTraceFileName, __LINE__); |
4693 iTrace->Trace(_L("Timer Expired for SUPL_POSINIT"), KTraceFileName, __LINE__); |
4675 OperationCompleteL(KErrTimedOut); |
4694 OperationCompleteL(KErrTimedOut); |
4676 } |
4695 } |
4677 |
4696 |
4678 |
4697 // ----------------------------------------------------------------------------- |
|
4698 // COMASuplSession::SettingsUsageUICompletedL |
|
4699 // |
|
4700 // ----------------------------------------------------------------------------- |
|
4701 void COMASuplSession::SettingsUsageUICompletedL(TInt aError) |
|
4702 { |
|
4703 iUIFlag = EFalse; |
|
4704 TBuf<64> msg; |
|
4705 msg.Copy(_L("SUPL Usage UI completed with ... ")); |
|
4706 msg.AppendNum(aError); |
|
4707 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4708 |
|
4709 iPrevUsageResult = aError; |
|
4710 |
|
4711 |
|
4712 |
|
4713 if (aError == KErrNone) |
|
4714 { |
|
4715 iProtocolManager.UpdateAllSubSessnsInSameSession(iIpcSessionId); |
|
4716 |
|
4717 if (isTimeoutDialogTimerStarted) |
|
4718 { |
|
4719 iTrace->Trace(_L("COMASuplSession::SettingsUsageUICompletedL, stopping timer "), KTraceFileName, __LINE__); |
|
4720 isTimeoutDialogTimerStarted = EFalse; |
|
4721 iDialogTimer->StopTimer(); |
|
4722 |
|
4723 //Compute how log the dialog was on |
|
4724 TTime nowTime; |
|
4725 nowTime.HomeTime(); |
|
4726 nowTime.SecondsFrom(iDlgStartTime, iDiffTime); |
|
4727 } |
|
4728 if (iNwInitError) |
|
4729 { |
|
4730 iNwInitError = EFalse; |
|
4731 HandleSuplInitErrorL(iNwInitCompletionCode); |
|
4732 } |
|
4733 else |
|
4734 InitializeL(iRequestID); |
|
4735 } |
|
4736 else if (aError == KErrCompletion) |
|
4737 CheckForSuplUsageL(); |
|
4738 else |
|
4739 { |
|
4740 TBuf<64> msg; |
|
4741 msg.Copy(_L("Error after SUPL Usage Popup... ")); |
|
4742 msg.AppendNum(aError); |
|
4743 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4744 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
4745 return; |
|
4746 } |
|
4747 } |
4679 |
4748 |
4680 // ----------------------------------------------------------------------------- |
4749 // ----------------------------------------------------------------------------- |
4681 // COMASuplSession::CheckForSuplUsageL |
4750 // COMASuplSession::CheckForSuplUsageL |
4682 // |
4751 // |
4683 // ----------------------------------------------------------------------------- |
4752 // ----------------------------------------------------------------------------- |
4684 void COMASuplSession::CheckForSuplUsageL() |
4753 void COMASuplSession::CheckForSuplUsageL() |
4685 { |
4754 { |
4686 iTrace->Trace(_L("COMASuplSession::CheckForSuplUsageL Start"), KTraceFileName, __LINE__); |
4755 iTrace->Trace(_L("COMASuplSession::CheckForSuplUsageL Start"), KTraceFileName, __LINE__); |
4687 |
4756 |
|
4757 if (iSuplUsage >= 1) |
|
4758 { |
|
4759 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
|
4760 if (usage == CSuplSettings::ESuplUsageDisabled) |
|
4761 { |
|
4762 iTrace->Trace(_L("CheckForSuplUsageL, SUPL disabled"), KTraceFileName, __LINE__); |
|
4763 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
4764 } |
|
4765 else if (usage == CSuplSettings::ESuplUsageAutomatic) |
|
4766 { |
4688 if (iNwInitError) |
4767 if (iNwInitError) |
4689 { |
4768 { |
4690 iNwInitError = EFalse; |
4769 iNwInitError = EFalse; |
4691 HandleSuplInitErrorL(iNwInitCompletionCode); |
4770 HandleSuplInitErrorL(iNwInitCompletionCode); |
4692 } |
4771 } |
4693 else |
4772 else |
4694 { |
4773 { |
4695 if (iRoaming) |
4774 iTrace->Trace(_L("CheckForSuplUsageL, Initializing"), KTraceFileName, __LINE__); |
4696 HandleRoamingCheckCompleteL(KErrNone, EFalse); |
4775 InitializeL(iRequestID); |
4697 else |
4776 } |
4698 { |
4777 } |
4699 iEtelRoamingCheck = ETrue; |
4778 |
4700 iProtocolManager.CheckForRoaming(); |
4779 else if (usage == CSuplSettings::ESuplUsageHomeAutomatic || usage == CSuplSettings::ESuplUsageAlwaysAsk) |
4701 } |
4780 { |
4702 |
4781 if (iRoaming) |
4703 } |
4782 HandleRoamingCheckCompleteL(KErrNone, EFalse); |
4704 |
4783 else |
|
4784 { |
|
4785 iEtelRoamingCheck = ETrue; |
|
4786 iProtocolManager.CheckForRoaming(); |
|
4787 } |
|
4788 } |
|
4789 } |
|
4790 else |
|
4791 InitializeL(iRequestID); |
4705 |
4792 |
4706 } |
4793 } |
4707 |
4794 |
4708 // ----------------------------------------------------------------------------- |
4795 // ----------------------------------------------------------------------------- |
4709 // COMASuplSession::CheckForTimerExpiry |
4796 // COMASuplSession::CheckForTimerExpiry |
4782 iEtelRoamingCheck = EFalse; |
4869 iEtelRoamingCheck = EFalse; |
4783 if (aErrorCode == KErrNone) |
4870 if (aErrorCode == KErrNone) |
4784 { |
4871 { |
4785 iUsageHomeNW = aHomeNw; |
4872 iUsageHomeNW = aHomeNw; |
4786 iConnRequestor->UpdateSLPListForHomeUsage(iUsageHomeNW); |
4873 iConnRequestor->UpdateSLPListForHomeUsage(iUsageHomeNW); |
4787 |
4874 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
4788 |
4875 |
4789 |
4876 if (usage == CSuplSettings::ESuplUsageAlwaysAsk) |
|
4877 { |
|
4878 TInt err; |
|
4879 if (!aHomeNw) |
|
4880 { |
|
4881 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__); |
|
4882 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue); |
|
4883 } |
|
4884 else |
|
4885 { |
|
4886 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is not roaming"), KTraceFileName, __LINE__); |
|
4887 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, EFalse); |
|
4888 } |
|
4889 |
|
4890 if(KErrNone != err && KErrInUse == err) |
|
4891 { |
|
4892 iTrace->Trace(_L("Dialog in use, setting flag"), KTraceFileName, __LINE__); |
|
4893 SetSuplUsageFlag(); |
|
4894 } |
|
4895 if( KErrNone == err && iRequestType == ESUPL_NETWORK ) |
|
4896 { |
|
4897 iTrace->Trace(_L("Network Session , starting timer"), KTraceFileName, __LINE__); |
|
4898 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
4899 TOMASuplQop qop; |
|
4900 TInt retVal = suplInit->Qop(qop); |
|
4901 TInt delay; |
|
4902 qop.Delay(delay); |
|
4903 //if delay is > 7, it is not valid |
|
4904 if (delay > 7) |
|
4905 delay = 0; |
|
4906 if(retVal == KErrNone && delay > 0) |
4790 { |
4907 { |
|
4908 TReal delayReal; |
|
4909 Math::Pow(delayReal, 2, (TReal)delay); |
|
4910 delay = (TInt) delayReal; |
|
4911 TBuf<128> msg(_L("Delay present in message, value is = ")); |
|
4912 msg.AppendNum(delay); |
|
4913 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
4914 isTimeoutDialogTimerStarted = ETrue; |
|
4915 iDialogTimer->StartTimer(delay); |
|
4916 } |
|
4917 else |
|
4918 { |
|
4919 if (iSuplInitTimeOut > 0) |
|
4920 { |
|
4921 TBuf<256> msg(_L("Delay value in CR is")); |
|
4922 msg.AppendNum(iSuplInitTimeOut); |
|
4923 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
4924 iDialogTimer->StartTimer(iSuplInitTimeOut * KSecond); |
|
4925 isTimeoutDialogTimerStarted = ETrue; |
|
4926 } |
|
4927 else |
|
4928 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
4929 } |
|
4930 iDlgStartTime.HomeTime(); |
|
4931 } |
|
4932 else if (KErrNone != err) |
|
4933 { |
|
4934 iTrace->Trace(_L("Invoking HandleSuplErrorL"), KTraceFileName, __LINE__); |
|
4935 HandleSuplErrorL(err); |
|
4936 } |
|
4937 |
|
4938 } |
|
4939 else if (usage == CSuplSettings::ESuplUsageHomeAutomatic) |
|
4940 { |
|
4941 if (!aHomeNw) |
|
4942 { |
|
4943 TInt err; |
|
4944 //if (!iSuplSettings->IsUIActive() ) |
|
4945 { |
|
4946 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__); |
|
4947 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue); |
4791 |
4948 |
4792 if(iSuplMsgType == ESUPL_INIT) |
4949 if(iSuplMsgType == ESUPL_INIT) |
4793 { |
4950 { |
4794 iTrace->Trace(_L("Dialog timer started"), KTraceFileName, __LINE__); |
4951 iTrace->Trace(_L("Dialog timer started"), KTraceFileName, __LINE__); |
4795 |
4952 |
4881 iTrace->Trace(_L("COMASuplSession::CheckForPersistentFailure, listening to IAP change"), KTraceFileName, __LINE__); |
5055 iTrace->Trace(_L("COMASuplSession::CheckForPersistentFailure, listening to IAP change"), KTraceFileName, __LINE__); |
4882 if (!iIapNotifier->IsActive()) |
5056 if (!iIapNotifier->IsActive()) |
4883 iIapNotifier->NotifyIapSettingsChange(); |
5057 iIapNotifier->NotifyIapSettingsChange(); |
4884 } |
5058 } |
4885 } |
5059 } |
4886 } |
5060 } |
4887 |
5061 void COMASuplSession::SetSuplUsageFlag() |
4888 |
5062 { |
|
5063 iUsageDialog = ETrue; |
|
5064 } |
|
5065 |
|
5066 void COMASuplSession::ReSetSuplUsageFlag() |
|
5067 { |
|
5068 iUsageDialog = EFalse; |
|
5069 } |
|
5070 |
|
5071 TBool COMASuplSession::GetSuplUsageFlag() |
|
5072 { |
|
5073 return iUsageDialog; |
|
5074 } |
|
5075 |
|
5076 void COMASuplSession::StartUsageDialogLaunchL() |
|
5077 { |
|
5078 iTrace->Trace(_L("COMASuplSession::StartUsageDialogLaunchL"), KTraceFileName, __LINE__); |
|
5079 ReSetSuplUsageFlag(); |
|
5080 iTrace->Trace(_L("COMASuplSession::StartUsageDialogLaunchL, flag reset done"), KTraceFileName, __LINE__); |
|
5081 |
|
5082 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
|
5083 if (usage == CSuplSettings::ESuplUsageAlwaysAsk) |
|
5084 { |
|
5085 TInt err; |
|
5086 if (!iUsageHomeNW) |
|
5087 { |
|
5088 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__); |
|
5089 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue); |
|
5090 |
|
5091 if(iRequestType == ESUPL_NETWORK && err == KErrNone) |
|
5092 { |
|
5093 iTrace->Trace(_L("starting Dialog timer "), KTraceFileName, __LINE__); |
|
5094 |
|
5095 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
5096 TOMASuplQop qop; |
|
5097 TInt retVal = suplInit->Qop(qop); |
|
5098 TInt delay; |
|
5099 qop.Delay(delay); |
|
5100 //if delay is > 7, it is not valid |
|
5101 if (delay > 7) |
|
5102 delay = 0; |
|
5103 if(retVal == KErrNone && delay > 0) |
|
5104 { |
|
5105 TReal delayReal; |
|
5106 Math::Pow(delayReal, 2, (TReal)delay); |
|
5107 delay = (TInt) delayReal; |
|
5108 TBuf<128> msg(_L("Delay present in message, value is = ")); |
|
5109 msg.AppendNum(delay); |
|
5110 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
5111 isTimeoutDialogTimerStarted = ETrue; |
|
5112 iDialogTimer->StartTimer(delay); |
|
5113 } |
|
5114 else |
|
5115 { |
|
5116 if (iSuplInitTimeOut > 0) |
|
5117 { |
|
5118 iTrace->Trace(_L("Delay not present in message"), KTraceFileName, __LINE__); |
|
5119 TBuf<256> msg(_L("Delay value in CR is ")); |
|
5120 msg.AppendNum(iSuplInitTimeOut); |
|
5121 iDialogTimer->StartTimer(iSuplInitTimeOut * KSecond); |
|
5122 isTimeoutDialogTimerStarted = ETrue; |
|
5123 } |
|
5124 else |
|
5125 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
5126 } |
|
5127 } |
|
5128 } |
|
5129 else |
|
5130 { |
|
5131 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is not roaming"), KTraceFileName, __LINE__); |
|
5132 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, EFalse); |
|
5133 |
|
5134 if( iRequestType == ESUPL_NETWORK && err == KErrNone) |
|
5135 { |
|
5136 iTrace->Trace(_L("starting Dialog timer "), KTraceFileName, __LINE__); |
|
5137 |
|
5138 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
5139 TOMASuplQop qop; |
|
5140 TInt retVal = suplInit->Qop(qop); |
|
5141 TInt delay; |
|
5142 qop.Delay(delay); |
|
5143 //if delay is > 7, it is not valid |
|
5144 if (delay > 7) |
|
5145 delay = 0; |
|
5146 if(retVal == KErrNone && delay > 0) |
|
5147 { |
|
5148 TReal delayReal; |
|
5149 Math::Pow(delayReal, 2, (TReal)delay); |
|
5150 delay = (TInt) delayReal; |
|
5151 TBuf<128> msg(_L("Delay present in message, value is = ")); |
|
5152 msg.AppendNum(delay); |
|
5153 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
5154 isTimeoutDialogTimerStarted = ETrue; |
|
5155 iDialogTimer->StartTimer(delay); |
|
5156 } |
|
5157 else |
|
5158 { |
|
5159 if (iSuplInitTimeOut > 0) |
|
5160 { |
|
5161 iTrace->Trace(_L("Delay not present in message"), KTraceFileName, __LINE__); |
|
5162 TBuf<256> msg(_L("Delay value in CR is")); |
|
5163 msg.AppendNum(iSuplInitTimeOut); |
|
5164 iDialogTimer->StartTimer(iSuplInitTimeOut * KSecond); |
|
5165 isTimeoutDialogTimerStarted = ETrue; |
|
5166 } |
|
5167 else |
|
5168 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
5169 } |
|
5170 } |
|
5171 } |
|
5172 |
|
5173 if(KErrNone != err) |
|
5174 { |
|
5175 iTrace->Trace(_L("Invoking HandleSuplErrorL"), KTraceFileName, __LINE__); |
|
5176 HandleSuplErrorL(err); |
|
5177 } |
|
5178 } |
|
5179 else if (usage == CSuplSettings::ESuplUsageHomeAutomatic) |
|
5180 { |
|
5181 if (!iUsageHomeNW) |
|
5182 { |
|
5183 TInt err; |
|
5184 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__); |
|
5185 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue); |
|
5186 |
|
5187 if(KErrNone != err) |
|
5188 { |
|
5189 iTrace->Trace(_L("Invoking HandleSuplErrorL"), KTraceFileName, __LINE__); |
|
5190 HandleSuplErrorL(err); |
|
5191 } |
|
5192 |
|
5193 if(iRequestType == ESUPL_NETWORK && err == KErrNone) |
|
5194 { |
|
5195 iTrace->Trace(_L("starting Dialog timer "), KTraceFileName, __LINE__); |
|
5196 |
|
5197 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
5198 TOMASuplQop qop; |
|
5199 TInt retVal = suplInit->Qop(qop); |
|
5200 TInt delay; |
|
5201 qop.Delay(delay); |
|
5202 //if delay is > 7, it is not valid |
|
5203 if (delay > 7) |
|
5204 delay = 0; |
|
5205 if(retVal == KErrNone && delay > 0) |
|
5206 { |
|
5207 TReal delayReal; |
|
5208 Math::Pow(delayReal, 2, (TReal)delay); |
|
5209 delay = (TInt) delayReal; |
|
5210 TBuf<128> msg(_L("Delay present in message, value is = ")); |
|
5211 msg.AppendNum(delay); |
|
5212 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
5213 isTimeoutDialogTimerStarted = ETrue; |
|
5214 iDialogTimer->StartTimer(delay); |
|
5215 } |
|
5216 else |
|
5217 { |
|
5218 if (iSuplInitTimeOut > 0) |
|
5219 { |
|
5220 iTrace->Trace(_L("Delay not present in message"), KTraceFileName, __LINE__); |
|
5221 TBuf<256> msg(_L("Delay value in CR is")); |
|
5222 msg.AppendNum(iSuplInitTimeOut); |
|
5223 iDialogTimer->StartTimer(iSuplInitTimeOut * KSecond); |
|
5224 isTimeoutDialogTimerStarted = ETrue; |
|
5225 } |
|
5226 else |
|
5227 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
5228 } |
|
5229 } |
|
5230 } |
|
5231 else |
|
5232 { |
|
5233 if (iNwInitError) |
|
5234 { |
|
5235 iNwInitError = EFalse; |
|
5236 HandleSuplInitErrorL(iNwInitCompletionCode); |
|
5237 } |
|
5238 else |
|
5239 InitializeL(iRequestID); |
|
5240 } |
|
5241 } |
|
5242 } |
4889 |
5243 |
4890 TBool COMASuplSession::IsEtelNotifySet() |
5244 TBool COMASuplSession::IsEtelNotifySet() |
4891 { |
5245 { |
4892 iTrace->Trace(_L("COMASuplSession::IsEtelNotifySet"), KTraceFileName, __LINE__); |
5246 iTrace->Trace(_L("COMASuplSession::IsEtelNotifySet"), KTraceFileName, __LINE__); |
4893 return iEtelNotify; |
5247 return iEtelNotify; |