14 * Description: Class for doing asynchronous service. |
14 * Description: Class for doing asynchronous service. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
|
19 #include <centralrepository.h> |
19 |
20 |
20 #include "epos_comasuplprotocolmanager1.h" |
21 #include "epos_comasuplprotocolmanager1.h" |
21 #include "epos_csuplcommunicationmanager.h" |
22 #include "epos_csuplcommunicationmanager.h" |
22 #include "epos_csuplsettingsinternal.h" |
23 #include "epos_csuplsettingsinternal.h" |
23 |
24 |
24 #include "epos_omasuplconstants.h" |
25 #include "epos_omasuplconstants.h" |
25 #include "epos_comasuplconnrequestor.h" |
26 #include "epos_comasuplconnrequestor.h" |
26 #include "epos_momasuplconnobserver.h" |
27 #include "epos_momasuplconnobserver.h" |
27 #include "epos_comasupltrace.h" |
28 #include "epos_comasupltrace.h" |
28 #include "epos_comasuplfallbackhandler.h" |
29 #include "epos_comasuplfallbackhandler.h" |
|
30 #include "epos_csuplsettingsinternalcrkeys.h" |
|
31 |
29 |
32 |
30 #include "epos_comasupldialogtimer.h" |
33 #include "epos_comasupldialogtimer.h" |
31 _LIT(KTraceFileName,"SUPL_OMA_SESSION::epos_comasuplconnrequestor.cpp"); |
34 _LIT(KTraceFileName,"SUPL_OMA_SESSION::epos_comasuplconnrequestor.cpp"); |
32 |
35 |
33 |
36 |
48 iProtocolManager(aProtoMgr), |
51 iProtocolManager(aProtoMgr), |
49 iPort(aPort), |
52 iPort(aPort), |
50 iObserver( aObserver), |
53 iObserver( aObserver), |
51 iIapDialogShown(EFalse), |
54 iIapDialogShown(EFalse), |
52 iIapDlgTimerExpired(EFalse), |
55 iIapDlgTimerExpired(EFalse), |
53 iIsTimeoutDialogTimerStarted(EFalse) |
56 iIsTimeoutDialogTimerStarted(EFalse),iPrompt(EFalse),iWlanOnly(EFalse),iIsStaleLocIdPresent(EFalse) |
54 { |
57 { |
55 |
58 |
56 } |
59 } |
57 |
60 |
58 // ----------------------------------------------------------------------------- |
61 // ----------------------------------------------------------------------------- |
70 iTrace = COMASuplTrace::NewL(); |
73 iTrace = COMASuplTrace::NewL(); |
71 iIsHSLPGenerated = EFalse; |
74 iIsHSLPGenerated = EFalse; |
72 iHslpAddrFromImsiUsed = EFalse; |
75 iHslpAddrFromImsiUsed = EFalse; |
73 |
76 |
74 iFallBackHandler = COMASuplFallBackHandler::NewL(*iSuplSettings); |
77 iFallBackHandler = COMASuplFallBackHandler::NewL(*iSuplSettings); |
75 |
78 iRepository = CRepository::NewL(KCRUidSuplSettings); |
76 iLastConnectionError = KErrNone; |
79 iLastConnectionError = KErrNone; |
77 |
80 |
78 iCurrentSLPId = KErrNotFound; |
81 iCurrentSLPId = KErrNotFound; |
79 |
82 |
80 iDialogTimer = COMASuplDialogTimer::NewL(*this); |
83 iDialogTimer = COMASuplDialogTimer::NewL(*this); |
114 iDialogTimer = NULL; |
117 iDialogTimer = NULL; |
115 } |
118 } |
116 delete iSuplSettings; |
119 delete iSuplSettings; |
117 delete iTrace; |
120 delete iTrace; |
118 delete iFallBackHandler; |
121 delete iFallBackHandler; |
|
122 delete iRepository; |
|
123 iRepository = NULL; |
119 } |
124 } |
120 |
125 |
121 // ----------------------------------------------------------------------------- |
126 // ----------------------------------------------------------------------------- |
122 // COMASuplConnRequestor::OpenConnection |
127 // COMASuplConnRequestor::OpenConnection |
123 // ----------------------------------------------------------------------------- |
128 // ----------------------------------------------------------------------------- |
179 iObserver.OperationCompleteL(errorCode); |
184 iObserver.OperationCompleteL(errorCode); |
180 } |
185 } |
181 } |
186 } |
182 } |
187 } |
183 |
188 |
|
189 // ----------------------------------------------------------------------------- |
|
190 // COMASuplConnRequestor::CreateConnection for OCC |
|
191 // ----------------------------------------------------------------------------- |
|
192 // |
|
193 void COMASuplConnRequestor::CreateConnectionL(TBool aPrompt,TBool aWlanOnly) |
|
194 { |
|
195 TBuf<30> GeoTagServerName; |
|
196 TBuf<128> buffer; |
|
197 iState = EConnecting; |
|
198 |
|
199 iPrompt = aPrompt; |
|
200 iWlanOnly = aWlanOnly; |
|
201 iIsStaleLocIdPresent = ETrue; |
|
202 iIsTimeoutDialogTimerStarted = EFalse; |
|
203 iDialogTimer->Cancel(); |
|
204 |
|
205 TInt err; |
|
206 err = iRepository->Get(KSuplGeoInfoConvServerName, GeoTagServerName); |
|
207 User::LeaveIfError(err); |
|
208 buffer.Copy(_L("Connecting to")); |
|
209 buffer.Append(GeoTagServerName); |
|
210 iTrace->Trace(buffer,KTraceFileName, __LINE__); |
|
211 iTls = ETrue; |
|
212 iPskTls = EFalse; |
|
213 iIAPId = 0; |
|
214 |
|
215 |
|
216 iConnection = iCommMgr.CreateConnectionL(GeoTagServerName,iTls,iPskTls,iPort,iIAPId); |
|
217 |
|
218 OpenConnection(); |
|
219 |
|
220 } |
|
221 |
184 // ----------------------------------------------------------------------------- |
222 // ----------------------------------------------------------------------------- |
185 // COMASuplConnRequestor::OpenConnection |
223 // COMASuplConnRequestor::OpenConnection |
186 // ----------------------------------------------------------------------------- |
224 // ----------------------------------------------------------------------------- |
187 // |
225 // |
188 void COMASuplConnRequestor::CreateConnectionL(TInt aDialogTimeOutDelay) |
226 void COMASuplConnRequestor::CreateConnectionL(TInt aDialogTimeOutDelay) |
228 void COMASuplConnRequestor::OpenConnection() |
266 void COMASuplConnRequestor::OpenConnection() |
229 { |
267 { |
230 |
268 |
231 if(iIsSettingInitilized) |
269 if(iIsSettingInitilized) |
232 { |
270 { |
233 if(iConnection) |
271 |
|
272 if(iConnection) |
234 { |
273 { |
235 iState = EConnecting; |
274 iState = EConnecting; |
236 iConnection->Connect(iStatus); |
275 if(iIsStaleLocIdPresent) |
237 SetActive(); |
276 { |
|
277 iTrace->Trace(_L("OpenConnection OCC"),KTraceFileName, __LINE__); |
|
278 iConnection->Connect(iStatus,iPrompt,iWlanOnly); |
|
279 } |
|
280 else |
|
281 { |
|
282 iConnection->Connect(iStatus); |
|
283 } |
|
284 SetActive(); |
|
285 |
238 } |
286 } |
239 } |
287 } |
240 else |
288 else |
241 { |
289 { |
242 iState = EInitilizeSetting; |
290 iState = EInitilizeSetting; |
301 { |
349 { |
302 if(iLastConnectionError < 0) |
350 if(iLastConnectionError < 0) |
303 { |
351 { |
304 iHostAddress.Zero(); |
352 iHostAddress.Zero(); |
305 CloseConnection(); |
353 CloseConnection(); |
306 CreateConnectionL(); |
354 if(iIsStaleLocIdPresent) |
|
355 { |
|
356 iTrace->Trace(_L("Request completed with error..."), KTraceFileName, __LINE__); |
|
357 iObserver.OperationCompleteL(iLastConnectionError); |
|
358 } |
|
359 else |
|
360 { |
|
361 iTrace->Trace(_L("Setting API Initilizing Completed..."), KTraceFileName, __LINE__); |
|
362 CreateConnectionL(); |
|
363 } |
|
364 |
307 } |
365 } |
308 else |
366 else |
309 { |
367 { |
310 ListenToMessages(); |
368 ListenToMessages(); |
311 iObserver.OperationCompleteL(iLastConnectionError); |
369 iObserver.OperationCompleteL(iLastConnectionError); |