|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of Session Object in the OMA SUPL Protocol Handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include <barsc2.h> |
|
23 #include <barsread2.h> |
|
24 #include <bautils.h> |
|
25 #include <networking/dnd_err.h> |
|
26 |
|
27 #include <e32def.h> |
|
28 #include <etelmm.h> |
|
29 #include <centralrepository.h> |
|
30 #include <CoreApplicationUIsSDKCRKeys.h> // for network mode (offline) |
|
31 |
|
32 |
|
33 #include <lbspositioninfo.h> |
|
34 #include <lbsfieldids.h> |
|
35 |
|
36 #include "epos_suplterminal.h" |
|
37 #include "epos_suplterminalconstants.h" |
|
38 #include "epos_suplterminalqop.h" |
|
39 |
|
40 #include "epos_comasuplnotification.h" |
|
41 #include "epos_csuplprotocolmanagerbase.h" |
|
42 #include "epos_csuplcommunicationmanager.h" |
|
43 #include "epos_csuplconnection.h" |
|
44 #include "lbs/epos_comasuplpossessionbase.h" |
|
45 #include "lbs/epos_comasuplposhandlerbase.h" |
|
46 #include "lbs/epos_comasuplinforequestlist.h" |
|
47 #include "epos_comasupllocationid.h" |
|
48 #include "epos_comasuplsessionid.h" |
|
49 #include "epos_comasuplresponse.h" |
|
50 #include "epos_comasuplpos.h" |
|
51 #include "epos_comasuplstart.h" |
|
52 #include "epos_comasuplposinit.h" |
|
53 #include "epos_comasuplauthresponse.h" |
|
54 #include "epos_comasuplauthrequest.h" |
|
55 #include "lbs/epos_comasuplposition.h" |
|
56 #include "lbs/epos_comasuplvelocity.h" |
|
57 #include "lbs/epos_comasuplsetcapabilities.h" |
|
58 #include "lbs/epos_eomasuplposerrors.h" |
|
59 #include "epos_comasuplinit.h" |
|
60 #include "epos_csuplsettings.h" |
|
61 #include "epos_csuplsettingsinternal.h" |
|
62 |
|
63 #include "epos_comasuplprotocolmanager1.h" |
|
64 #include "epos_comasuplsettings.h" |
|
65 #include "epos_comasupletelnotifier.h" |
|
66 #include "epos_comasuplsession.h" |
|
67 |
|
68 #include "epos_comasuplconnrequestor.h" |
|
69 #include "epos_comasuplstate.h" |
|
70 #include "epos_comasuplstartstate.h" |
|
71 #include "epos_comasuplposinitstate.h" |
|
72 #include "epos_comasuplresponsestate.h" |
|
73 #include "epos_comasuplendstate.h" |
|
74 #include "epos_comasuplposstate.h" |
|
75 #include "epos_comasuplinitstate.h" |
|
76 #include "epos_comasuplposrequestor.h" |
|
77 #include "epos_omasuplconstants.h" |
|
78 #include "epos_comasupltrace.h" |
|
79 #include "epos_resourceutils.h" |
|
80 #include "epos_comasupltimeouttimer.h" |
|
81 #include "epos_comasupldialogtimer.h" |
|
82 #include "epos_tomasuplposmethod.h" |
|
83 #include "epos_omasuplconfigurationkeys.h" |
|
84 #include "epos_csuplsettingparams.h" |
|
85 #include "epos_comasuplasnbase.h" |
|
86 |
|
87 |
|
88 _LIT(KTraceFileName,"SUPL_OMA_SESSION::EPos_COMASuplSession.cpp"); |
|
89 |
|
90 //Multiplying factor for conversion of ellipsoid to circle |
|
91 //formula used sqrt(-2*natural log(1-Confidence)) |
|
92 // actual value = 1.0107676525947896431381113653917 |
|
93 |
|
94 //const TReal MultiplyFactorOneSigma = 1.01076765; |
|
95 |
|
96 // ============================ MEMBER FUNCTIONS =============================== |
|
97 |
|
98 //Constructor |
|
99 COMASuplSession::COMASuplSession(RMobilePhone& aMobilePhone , |
|
100 TOMASuplReqType aRequestType, |
|
101 COMASuplPosHandlerBase *aPosHandler, |
|
102 MOMASuplSessionObserver& aSessionObserver, |
|
103 COMASuplSettings*& aSettings, |
|
104 COMASUPLProtocolManager1 &aProtoMgr, |
|
105 TInt aIpcSessionId, |
|
106 COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase): |
|
107 |
|
108 iMobilePhone(aMobilePhone), |
|
109 iRequestType(aRequestType), |
|
110 iPosHandler(aPosHandler), |
|
111 iHSLPAddress(aSettings->SLPAddress()), |
|
112 iEncodedSuplInit(NULL), |
|
113 iSessionObserver(aSessionObserver), |
|
114 iSuplSettings(aSettings), |
|
115 iProtocolManager(aProtoMgr), |
|
116 iUIFlag(EFalse), |
|
117 iSessionIDFlag(EFalse), |
|
118 iRoaming(EFalse), |
|
119 iChanged(EFalse), |
|
120 iIpcSessionId(aIpcSessionId), |
|
121 iNwInitError(EFalse), |
|
122 iPersistFail(EFalse), |
|
123 iCapsFail(EFalse), |
|
124 iUsageDialog(EFalse), |
|
125 iUsageHomeNW(EFalse), |
|
126 iEtelNotify(EFalse), |
|
127 iEtelRoamingCheck(EFalse), |
|
128 iIapDialogShown(EFalse), |
|
129 iIapDlgTimerExpired(EFalse), |
|
130 iOMASuplAsnHandlerBaseImpl(aOMASuplAsnHandlerBase) |
|
131 |
|
132 { |
|
133 } |
|
134 |
|
135 //2 nd Phase construction |
|
136 void COMASuplSession::ConstructL(CSuplCommunicationManager &aCommManager, |
|
137 CSuplSettingsInternal* aSettingsStorage, |
|
138 TDes& aIMSI) |
|
139 { |
|
140 iTrace = COMASuplTrace::NewL(); |
|
141 |
|
142 iTrace->Trace(_L("COMASuplSession::ConstructL"), KTraceFileName, __LINE__); |
|
143 |
|
144 |
|
145 iConnRequestor = COMASuplConnRequestor::NewL(aCommManager,iProtocolManager,KOMASuplHSLPPort,*this); |
|
146 TBuf<64> msg; |
|
147 msg.Copy(_L("Port Number is :")); |
|
148 msg.AppendNum(KOMASuplHSLPPort); |
|
149 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
150 |
|
151 |
|
152 iSuplStorageSettings = aSettingsStorage; |
|
153 |
|
154 iSuplSessionId = COMASuplSessionID::NewL(); |
|
155 iCompleteSelfRequestor = COMASuplCompleteSelfRequestor::NewL(*this); |
|
156 |
|
157 iSETCapabilities = COMASuplSETCapabilities::NewL(); |
|
158 |
|
159 //All caps are on...for NET initiated case |
|
160 iAllowedCapabilities = KGpsSETAssisted | KGpsSETBased | KAutonomousGps| KAFLT | KECID | KEOTD | KOTDOA | KCID; |
|
161 |
|
162 //Ownership transfer to iSuplSessionId |
|
163 COMASuplSETSessionID* SETSessionId = COMASuplSETSessionID::NewL(); |
|
164 |
|
165 iSuplSessionId->SetSETSessionID(SETSessionId); |
|
166 |
|
167 //Ownership transfer to iSuplSessionId |
|
168 iSuplSessionId->SetSLPSessionID(NULL); |
|
169 |
|
170 iSuplVersion.SetSuplVersion(KSuplMajorVersion,KSuplMinorVersion,KSuplRevision); |
|
171 |
|
172 if( aIMSI.Length() ) |
|
173 { |
|
174 iIMSI.Create( aIMSI ); |
|
175 } |
|
176 |
|
177 if(iPosHandler) |
|
178 { |
|
179 iTrace->Trace(_L("Creating POSSession..."), KTraceFileName, __LINE__); |
|
180 iPOSSession = iPosHandler->CreateNewSessionL(this); |
|
181 //Don't move this statement else where |
|
182 iOMASuplPOSRequestor = COMASuplPOSRequestor::NewL(this,iPOSSession); |
|
183 } |
|
184 else |
|
185 { |
|
186 iTrace->Trace(_L("No POS plugin exists..."), KTraceFileName, __LINE__); |
|
187 } |
|
188 |
|
189 |
|
190 iTimer = COMASuplTimeoutTimer::NewL(*this); |
|
191 |
|
192 |
|
193 iIapNotifier = COMASuplIapNotifier::NewL(*this); |
|
194 |
|
195 |
|
196 iDialogTimer = COMASuplDialogTimer::NewL(*this); |
|
197 |
|
198 iIsQoPPresent = EFalse; |
|
199 iIsFirstPOSMessage = ETrue; |
|
200 isTimeoutDialogTimerStarted = EFalse; |
|
201 |
|
202 iDiffTime = 0; |
|
203 iSessionCompletionCode = KErrCompletion; |
|
204 |
|
205 iNetworkPrivacy = CPosNetworkPrivacy::NewL(); |
|
206 |
|
207 iTrace->Trace(_L("End of COMASuplSession::ConstructL"), KTraceFileName, __LINE__); |
|
208 } |
|
209 |
|
210 // |
|
211 // ----------------------------------------------------------------------------- |
|
212 // COMASuplSession::NewL |
|
213 // Creates new instance of COMASuplSession |
|
214 // (other items were commented in a header). |
|
215 // ----------------------------------------------------------------------------- |
|
216 // |
|
217 COMASuplSession* COMASuplSession::NewL(CSuplCommunicationManager& aCommManager, |
|
218 RMobilePhone& aMobilePhone, |
|
219 COMASuplSettings*& aSettings, |
|
220 CSuplSettingsInternal* aSettingsStorage, |
|
221 TOMASuplReqType aRequestType, |
|
222 MOMASuplSessionObserver& aSessionObserver, |
|
223 COMASuplPosHandlerBase *aPosHandler, |
|
224 TDes& aIMSI, |
|
225 COMASUPLProtocolManager1 &aProtoMgr, |
|
226 TInt aIpcSessionId, |
|
227 COMASuplAsnHandlerBase* aOMASuplAsnHandlerBase) |
|
228 { |
|
229 COMASuplSession* self = new( ELeave ) |
|
230 COMASuplSession( aMobilePhone,aRequestType, aPosHandler, |
|
231 aSessionObserver, aSettings, aProtoMgr, aIpcSessionId,aOMASuplAsnHandlerBase); |
|
232 CleanupStack::PushL( self ); |
|
233 self->ConstructL( aCommManager, aSettingsStorage, aIMSI ); |
|
234 CleanupStack::Pop(self); |
|
235 return self; |
|
236 } |
|
237 |
|
238 // ----------------------------------------------------------------------------- |
|
239 // COMASuplSession::DestroySession |
|
240 // This method will delete this session..since only protocol manager will delete session object |
|
241 // (other items were commented in a header). |
|
242 // ----------------------------------------------------------------------------- |
|
243 // |
|
244 void COMASuplSession::DestroySession() |
|
245 { |
|
246 iTrace->Trace(_L("COMASuplSession::DestroySession"), KTraceFileName, __LINE__); |
|
247 |
|
248 //This is for sending SUPL_END if session is destroed while RunSession is going on. |
|
249 if(iRequestType == ESUPL_TERMINAL && iSuplSessionState!= ESUPL_TERMINATED) |
|
250 { |
|
251 CancelRunSession(); |
|
252 SessionEnd(); |
|
253 CompleteSession(KErrCancel); |
|
254 } |
|
255 |
|
256 delete this; |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // COMASuplSession::PosPlugInUnloaded |
|
261 // Handles Pos handler unload |
|
262 // ----------------------------------------------------------------------------- |
|
263 void COMASuplSession::PosPlugInUnloaded() |
|
264 { |
|
265 iTrace->Trace(_L("COMASuplSession::PosPlugInUnloaded"), KTraceFileName, __LINE__); |
|
266 |
|
267 // Cancel the Session |
|
268 CancelSession(); |
|
269 |
|
270 // Delete the POS Requestor |
|
271 delete iOMASuplPOSRequestor; |
|
272 iOMASuplPOSRequestor = NULL; |
|
273 |
|
274 // Delete the POS Session |
|
275 delete iPOSSession; |
|
276 iPOSSession = NULL; |
|
277 |
|
278 if(iSuplSessionState == ESUPL_SEND) |
|
279 { |
|
280 CompleteSession(KErrCompletion); |
|
281 } |
|
282 else |
|
283 { |
|
284 //Close Connection : bug Fix. |
|
285 iConnRequestor->CloseConnection(); |
|
286 iPortNum = 0; |
|
287 iSessionObserver.TerminateSession(this, KErrCompletion); |
|
288 } |
|
289 } |
|
290 |
|
291 |
|
292 //Desrtuctor |
|
293 COMASuplSession::~COMASuplSession() |
|
294 { |
|
295 if(iTrace) |
|
296 iTrace->Trace(_L("Start ~COMASuplSession::COMASuplSession"), KTraceFileName, __LINE__); |
|
297 |
|
298 CleanUp(); |
|
299 |
|
300 delete iEncodedBuffer; |
|
301 delete iSuplState; |
|
302 delete iOMASuplPOSRequestor; |
|
303 delete iConnRequestor; |
|
304 delete iSuplSessionId; |
|
305 delete iCompleteSelfRequestor; |
|
306 delete iDecodedAsnMessage; |
|
307 delete iSETCapabilities; |
|
308 delete iPosition; |
|
309 delete iEncodedSuplInit; |
|
310 delete iPOSSession; |
|
311 iPOSSession = NULL; |
|
312 delete iTimer; |
|
313 delete iIapNotifier; |
|
314 iIMSI.Close(); |
|
315 delete iDialogTimer; |
|
316 |
|
317 delete iNetworkPrivacy; |
|
318 |
|
319 if(iTrace) |
|
320 iTrace->Trace(_L("End of ~COMASuplSession::COMASuplSession"), KTraceFileName, __LINE__); |
|
321 |
|
322 delete iTrace; |
|
323 } |
|
324 |
|
325 // ----------------------------------------------------------------------------- |
|
326 // COMASuplSession::Initialize |
|
327 // This method initializes the OMA SUPL Session Object |
|
328 // (other items were commented in a header). |
|
329 // ----------------------------------------------------------------------------- |
|
330 // |
|
331 void COMASuplSession::InitializeL(TInt /*aRequestID*/) |
|
332 { |
|
333 iSuplSessionState = ESUPL_INITIALIZED; |
|
334 |
|
335 if(iPOSSession) |
|
336 { |
|
337 iTrace->Trace(_L("COMASuplSession::InitializeL of POS"), KTraceFileName, __LINE__); |
|
338 iOMASuplPOSRequestor->SetObserver(this); |
|
339 TInt err = iOMASuplPOSRequestor->InitilizePOSSessionL(iRequestID); |
|
340 if(err != KErrNone) |
|
341 { |
|
342 iTrace->Trace(_L("Initilization Failed ..."), KTraceFileName, __LINE__); |
|
343 CompleteSession(KErrNotReady); |
|
344 } |
|
345 } |
|
346 else |
|
347 { |
|
348 OperationCompleteL(KErrNone); |
|
349 } |
|
350 } |
|
351 |
|
352 // ----------------------------------------------------------------------------- |
|
353 // COMASuplSession::CleanUp |
|
354 // Perfomrs clean up operations on the OMA SUPL Session Object |
|
355 // This releases any resource held by the object |
|
356 // (other items were commented in a header). |
|
357 // ----------------------------------------------------------------------------- |
|
358 // |
|
359 void COMASuplSession::CleanUp() |
|
360 { |
|
361 if(iTrace) |
|
362 iTrace->Trace(_L("COMASuplSession::CleanUp"), KTraceFileName, __LINE__); |
|
363 |
|
364 if(iSuplState) |
|
365 { |
|
366 if(iSuplSessionState != ESUPL_SESSION_ERROR) |
|
367 { |
|
368 iSuplState->CancelOperation(); |
|
369 } |
|
370 } |
|
371 |
|
372 iConnRequestor->Cancel(); |
|
373 |
|
374 delete iEncodedBuffer; |
|
375 iEncodedBuffer = NULL; |
|
376 |
|
377 delete iDecodedAsnMessage; |
|
378 iDecodedAsnMessage = NULL; |
|
379 |
|
380 if(iTrace) |
|
381 iTrace->Trace(_L("End of COMASuplSession::CleanUp"), KTraceFileName, __LINE__); |
|
382 } |
|
383 |
|
384 |
|
385 // ----------------------------------------------------------------------------- |
|
386 // COMASuplSession::RequestType |
|
387 // Returns the type of request associated with the session |
|
388 // (other items were commented in a header). |
|
389 // ----------------------------------------------------------------------------- |
|
390 // |
|
391 COMASuplSession::TOMASuplReqType COMASuplSession::RequestType() |
|
392 { |
|
393 return iRequestType; //SET OR NET |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // COMASuplSession::SessionEnd |
|
398 // Cleans up the session and completes |
|
399 // (other items were commented in a header). |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 void COMASuplSession::SessionEnd() |
|
403 { |
|
404 iSuplSessionState = ESUPL_TERMINATED; |
|
405 |
|
406 // Invoke SessionEnd on the POS Session |
|
407 iTrace->Trace(_L("COMASuplSession::SessionEnd"), KTraceFileName, __LINE__); |
|
408 // CleanUp |
|
409 CleanUp(); |
|
410 if(iPOSSession) |
|
411 { |
|
412 iPOSSession->SessionEnd(); |
|
413 iTrace->Trace(_L("POS Session...COMASuplSession::SessionEnd."), KTraceFileName, __LINE__); |
|
414 } |
|
415 } |
|
416 // ----------------------------------------------------------------------------- |
|
417 // COMASuplSession::RunSuplSession |
|
418 // Starts the SUPL Sesssion for Terminal Initiated Location Request |
|
419 // The call to this method will result in the generation of SUPL START |
|
420 // and sending of the SUPL START packet to the SLP. |
|
421 // (other items were commented in a header). |
|
422 // ----------------------------------------------------------------------------- |
|
423 // |
|
424 void COMASuplSession::RunSuplSessionL(TRequestStatus& aStatus, TBool aFirstReq, const TDesC& aHslpAddress, |
|
425 TBool aFallBack, TInt aAllowedCapabilities, |
|
426 TInt aSessionIdSeed,TInt aRequestID) |
|
427 { |
|
428 iRunRequestStatus = & aStatus; |
|
429 *iRunRequestStatus = KRequestPending; |
|
430 |
|
431 iRequestID = aRequestID; |
|
432 |
|
433 iTrace->Trace(_L("Start COMASuplSession::RunSuplSession"), KTraceFileName, __LINE__); |
|
434 |
|
435 // Log Session Id |
|
436 TBuf<64> id; |
|
437 id.Append(_L("Session Id is ")); |
|
438 id.AppendNum(aSessionIdSeed); |
|
439 iTrace->Trace(id,KTraceFileName, __LINE__); |
|
440 |
|
441 // Log Capability from client |
|
442 id.Copy(_L("Received Capability is ")); |
|
443 id.AppendNum(aAllowedCapabilities); |
|
444 iTrace->Trace(id,KTraceFileName, __LINE__); |
|
445 |
|
446 iSETSessionUniqueId = aSessionIdSeed; |
|
447 |
|
448 |
|
449 TInt networkMode = 1; |
|
450 networkMode = GetNetworkModeL(); |
|
451 |
|
452 if ( networkMode == ECoreAppUIsNetworkConnectionNotAllowed ) |
|
453 { |
|
454 id.Copy(_L("The device is in OFFLINE mode.")); |
|
455 iTrace->Trace(id,KTraceFileName, __LINE__); |
|
456 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
457 return; |
|
458 } |
|
459 else |
|
460 { |
|
461 id.Copy(_L("The device is in ON LINE mode.")); |
|
462 iTrace->Trace(id,KTraceFileName, __LINE__); |
|
463 } |
|
464 |
|
465 if(aAllowedCapabilities == 0) |
|
466 { |
|
467 iAllowedCapabilities = KGpsSETAssisted | KGpsSETBased | KAutonomousGps| KAFLT | KECID | KEOTD | KOTDOA | KCID; |
|
468 } |
|
469 else |
|
470 { |
|
471 iAllowedCapabilities = aAllowedCapabilities; |
|
472 } |
|
473 |
|
474 //Ownership transfer to iSuplSessionId |
|
475 iSuplSessionId->SetSLPSessionID(NULL); |
|
476 |
|
477 iConnRequestor->SetDefaultParametersL(aHslpAddress,aFallBack); |
|
478 |
|
479 if (aFirstReq) |
|
480 CheckForSuplUsageL(); |
|
481 else |
|
482 CheckForPreviousResultL(); |
|
483 |
|
484 |
|
485 // Clear Position.... |
|
486 delete iPosition; |
|
487 iPosition = NULL; |
|
488 |
|
489 |
|
490 iTrace->Trace(_L("End of COMASuplSession::RunSuplSession"), KTraceFileName, __LINE__); |
|
491 } |
|
492 |
|
493 // ----------------------------------------------------------------------------- |
|
494 // COMASuplSession::RunSuplSession |
|
495 // Starts the SUPL Sesssion for Terminal Initiated Location Request, with QoP |
|
496 // The call to this method will result in the generation of SUPL START |
|
497 // and sending of the SUPL START packet to the SLP. |
|
498 // (other items were commented in a header). |
|
499 // ----------------------------------------------------------------------------- |
|
500 // |
|
501 void COMASuplSession::RunSuplSessionL(TRequestStatus& aStatus, TBool aFirstReq, |
|
502 const TDesC& aHslpAddress, TBool aFallBack, |
|
503 TInt aAllowedCapabilities,TInt aSessionIdSeed, |
|
504 TSuplTerminalQop& aQop, TInt aRequestID) |
|
505 { |
|
506 |
|
507 |
|
508 iClientQop = aQop; |
|
509 |
|
510 TInt delay; |
|
511 if(iClientQop.GetDelay(delay) != KErrNotFound) |
|
512 { |
|
513 iSessionStartTime.HomeTime(); |
|
514 } |
|
515 |
|
516 iIsQoPPresent = ETrue; |
|
517 RunSuplSessionL(aStatus,aFirstReq, aHslpAddress, aFallBack, aAllowedCapabilities,aSessionIdSeed,aRequestID); |
|
518 } |
|
519 |
|
520 // ----------------------------------------------------------------------------- |
|
521 // CSuplSession::RunInvalidSessionL |
|
522 // Starts the SUPL Sesssion for Invalid Session ID |
|
523 // Completes Self so that protocol Manager can process other stuff |
|
524 // (other items were commented in a header). |
|
525 // ----------------------------------------------------------------------------- |
|
526 // |
|
527 void COMASuplSession::RunInvalidSessionL(COMASuplAsnMessageBase* aDecodedMsg) |
|
528 { |
|
529 |
|
530 // Check if the message type is SUPL END |
|
531 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedMsg->MessageType(); |
|
532 |
|
533 if(messageType == COMASuplAsnMessageBase::ESUPL_END) |
|
534 { |
|
535 return; |
|
536 } |
|
537 |
|
538 COMASuplSessionID* retrivedSessionID = NULL; |
|
539 aDecodedMsg->SessionId(retrivedSessionID); |
|
540 |
|
541 // Set the SessionId. |
|
542 UpdateSLPSessionIDL(retrivedSessionID); |
|
543 UpdateSETSessionIDL(retrivedSessionID); |
|
544 |
|
545 //Set default slp to Conn Requestor... |
|
546 iConnRequestor->UseDefaultServerL(); |
|
547 |
|
548 // Complete Self |
|
549 iCompleteSelfRequestor->CompleteInvalidSession(); |
|
550 |
|
551 } |
|
552 |
|
553 // ----------------------------------------------------------------------------- |
|
554 // CSuplSession::StartInvalidSessionL |
|
555 // Starts the SUPL Sesssion for Invalid Session ID |
|
556 // Generate SUPL End with error state set ti Invalid Session |
|
557 // (other items were commented in a header). |
|
558 // ----------------------------------------------------------------------------- |
|
559 // |
|
560 void COMASuplSession::StartInvalidSessionL() |
|
561 { |
|
562 iTrace->Trace(_L("Start COMASuplSession::StartInvalidSessionL"), KTraceFileName, __LINE__); |
|
563 iErrorStatusCode = COMASuplEnd::EInvalidSessionId; |
|
564 GenerateSuplEndL(); |
|
565 } |
|
566 |
|
567 // ----------------------------------------------------------------------------- |
|
568 // CSuplSession::GenerateSuplMessage |
|
569 // This method generates an appropriate SUPL Message based on the state |
|
570 // of the SUPL object |
|
571 // |
|
572 // (other items were commented in a header). |
|
573 // ----------------------------------------------------------------------------- |
|
574 // |
|
575 void COMASuplSession::GenerateSuplMessageL() |
|
576 { |
|
577 switch(iSuplSessionState) |
|
578 { |
|
579 //case ESUPL_INITIALIZED: |
|
580 case ESUPL_CONNECTING: |
|
581 { |
|
582 if(iRequestType == ESUPL_TERMINAL ) |
|
583 { |
|
584 //SMP Changes - GenerateSuplStartL() is asynchronous and hence state must be set before calling |
|
585 iSuplSessionState = ESUPL_GENERATE; |
|
586 GenerateSuplStartL(); |
|
587 } |
|
588 if(iRequestType == ESUPL_NETWORK ) |
|
589 { |
|
590 //SMP Changes - GenerateSuplPosInitL() is asynchronous and hence state must be set before calling |
|
591 iSuplSessionState = ESUPL_GENERATE; |
|
592 GenerateSuplPosInitL(); |
|
593 } |
|
594 if(iRequestType == ESUPL_INVALID_SESSION ) |
|
595 { |
|
596 //SMP Changes - iSuplSessionState = ESUPL_GENERATE is not required here as SUPL END Generation is synchronous |
|
597 //and iSuplSessionState is set inside GenerateSuplEndL itself |
|
598 GenerateSuplEndL(); |
|
599 } |
|
600 |
|
601 break; |
|
602 } |
|
603 case ESUPL_GENERATE: |
|
604 { |
|
605 switch(iSuplMsgType) |
|
606 { |
|
607 case ESUPL_RESPONSE: |
|
608 case ESUPL_INIT: |
|
609 { |
|
610 //SMP Changes - GenerateSuplPosInitL() is asynchronous and hence state must be set before calling |
|
611 iSuplSessionState = ESUPL_ENCODE; |
|
612 GenerateSuplPosInitL(); |
|
613 } |
|
614 break; |
|
615 case ESUPL_END: |
|
616 GenerateSuplEndL(); |
|
617 break; |
|
618 case ESUPL_POS: |
|
619 { |
|
620 //SMP Changes - GenerateSuplPosL() is asynchronous and hence state must be set before calling |
|
621 iSuplSessionState = ESUPL_ENCODE; |
|
622 GenerateSuplPosL(); |
|
623 } |
|
624 break; |
|
625 default: |
|
626 // Error |
|
627 break; |
|
628 } |
|
629 break; |
|
630 } |
|
631 } |
|
632 } |
|
633 |
|
634 // ----------------------------------------------------------------------------- |
|
635 // COMASuplSession::GenerateSuplStart |
|
636 // Generate SUPL START from session |
|
637 // (other items were commented in a header). |
|
638 // ----------------------------------------------------------------------------- |
|
639 // |
|
640 void COMASuplSession::GenerateSuplStartL() |
|
641 { |
|
642 iTrace->Trace(_L("Start of COMASuplSession::GenerateSuplStartL"), KTraceFileName, __LINE__); |
|
643 |
|
644 // Free the existing state if any |
|
645 delete iSuplState; |
|
646 iSuplState = NULL; |
|
647 |
|
648 iSuplState = COMASuplStartState::NewL(iMobilePhone, iUT1_StartTimer,iOMASuplPOSRequestor,iOMASuplAsnHandlerBaseImpl,iAllowedCapabilities); |
|
649 iSuplState->SetMsgStateObserver(this); |
|
650 if(iIsQoPPresent) |
|
651 { |
|
652 COMASuplStartState* startSuplState = static_cast <COMASuplPosInitState *>(iSuplState); |
|
653 startSuplState->SetQop(iClientQop); |
|
654 } |
|
655 //SMP Changes |
|
656 iSuplMsgType = ESUPL_START; |
|
657 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
|
658 TInt err = iSuplState->GenerateMessageL(); |
|
659 |
|
660 } |
|
661 |
|
662 |
|
663 // ----------------------------------------------------------------------------- |
|
664 // COMASuplSession::GenerateSuplPosInitL |
|
665 // Generate SUPL POS INIT from session |
|
666 // (other items were commented in a header). |
|
667 // ----------------------------------------------------------------------------- |
|
668 // |
|
669 void COMASuplSession::GenerateSuplPosInitL() |
|
670 { |
|
671 iTrace->Trace(_L("Start of COMASuplSession::GenerateSuplPosInitL"), KTraceFileName, __LINE__); |
|
672 |
|
673 // Free the existing state if any |
|
674 iTrace->Trace(_L("Deleting SUPL State"), KTraceFileName, __LINE__); |
|
675 delete iSuplState; |
|
676 iSuplState = NULL; |
|
677 |
|
678 iTrace->Trace(_L("Setting SUPL State to NULL - successful "), KTraceFileName, __LINE__); |
|
679 if(iRequestType == ESUPL_NETWORK) |
|
680 { |
|
681 iTrace->Trace(_L("iRequestType == ESUPL_NETWORK is true"), KTraceFileName, __LINE__); |
|
682 TBuf<256> serverAddress; |
|
683 HBufC8 *hslpAdress = HBufC8::NewL(256); |
|
684 iConnRequestor->GetUsedServerAddress(serverAddress); |
|
685 hslpAdress->Des().Copy(serverAddress); |
|
686 CleanupStack::PushL(hslpAdress); |
|
687 iSuplState = COMASuplPosInitState::NewL(iSETCapabilities, iMobilePhone, iUT2_PosInitTimer, |
|
688 iOMASuplPOSRequestor,iAllowedCapabilities, iRequestType, iPosMethod, iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit, hslpAdress); |
|
689 |
|
690 if(hslpAdress) |
|
691 { |
|
692 CleanupStack::PopAndDestroy(hslpAdress); |
|
693 } |
|
694 } |
|
695 else |
|
696 { |
|
697 TBuf<128> msg(_L("COMASuplSession::GenerateSuplPosInitL() without last 2 params : ")); |
|
698 msg.AppendNum(iPosMethod); |
|
699 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
700 iSuplState = COMASuplPosInitState::NewL(iSETCapabilities, iMobilePhone, iUT2_PosInitTimer, |
|
701 iOMASuplPOSRequestor,iAllowedCapabilities,iRequestType, iPosMethod,iOMASuplAsnHandlerBaseImpl); |
|
702 |
|
703 } |
|
704 iSuplState->SetMsgStateObserver(this); |
|
705 |
|
706 //SMP Changes |
|
707 iSuplMsgType = ESUPL_POSINIT; |
|
708 |
|
709 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
|
710 |
|
711 iSuplState->GenerateMessageL(); |
|
712 |
|
713 |
|
714 } |
|
715 |
|
716 // ----------------------------------------------------------------------------- |
|
717 // COMASuplSession::GenerateSuplPosL |
|
718 // Generate SUPL POS from session |
|
719 // (other items were commented in a header). |
|
720 // ----------------------------------------------------------------------------- |
|
721 // |
|
722 void COMASuplSession::GenerateSuplPosL() |
|
723 { |
|
724 iTrace->Trace(_L("Start of COMASuplSession::GenerateSuplPosL"), KTraceFileName, __LINE__); |
|
725 |
|
726 if(COMASuplState::ESUPL_POS != iSuplState->GetSuplState()) // Check if existing is of POS type. |
|
727 { |
|
728 COMASuplPosPayload* remainingPosPayload = GetRemainingPosPayloadL(); |
|
729 delete iSuplState; |
|
730 iSuplState = NULL; |
|
731 iSuplState = COMASuplPosState::NewL(iPOSSession,iUT3_PosTimer,iSETCapabilities,iOMASuplAsnHandlerBaseImpl); |
|
732 |
|
733 COMASuplPosState* state = static_cast <COMASuplPosState *>(iSuplState); |
|
734 state->SetRemainingPosPayloadFromSuplPosInitL(remainingPosPayload);//ownership transfered to POS state class |
|
735 } |
|
736 |
|
737 iSuplState->SetMsgStateObserver(this); |
|
738 iSuplMsgType = ESUPL_POS; |
|
739 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
|
740 COMASuplPosState* posState = static_cast <COMASuplPosState*>(iSuplState); |
|
741 if(!(posState->IsGenerationInProgress())) |
|
742 { |
|
743 iSuplSessionState = ESUPL_ENCODE; |
|
744 TInt err = iSuplState->GenerateMessageL(); |
|
745 if(err != KErrNone) |
|
746 { |
|
747 iTrace->Trace(_L("COMASuplSession::GenerateSuplPosL Failed..."), KTraceFileName, __LINE__); |
|
748 OperationCompleteL(err);//Error handling. |
|
749 } |
|
750 } |
|
751 |
|
752 } |
|
753 |
|
754 // ----------------------------------------------------------------------------- |
|
755 // COMASuplSession::GenerateSuplEndL |
|
756 // Generate SUPL END from session |
|
757 // (other items were commented in a header). |
|
758 // ----------------------------------------------------------------------------- |
|
759 // |
|
760 void COMASuplSession::GenerateSuplEndL() |
|
761 { |
|
762 iTrace->Trace(_L("Start of COMASuplSession::GenerateSuplEnd..."), KTraceFileName, __LINE__); |
|
763 |
|
764 // Free the existing state if any |
|
765 delete iSuplState; |
|
766 iSuplState = NULL; |
|
767 |
|
768 if(iRequestType == ESUPL_INVALID_SESSION ) |
|
769 { |
|
770 iSuplSessionState = ESUPL_INITIALIZED; |
|
771 } |
|
772 else |
|
773 { |
|
774 iSuplSessionState = ESUPL_ENCODE; //Normal End |
|
775 } |
|
776 |
|
777 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl); |
|
778 iSuplState->SetMsgStateObserver(this); |
|
779 iSuplMsgType = ESUPL_END; |
|
780 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
|
781 iSuplState->GenerateMessageL(); |
|
782 } |
|
783 |
|
784 // ----------------------------------------------------------------------------- |
|
785 //COMASuplSession::CompleteSession |
|
786 //Informs to client about completion of location request, thro' active object |
|
787 void COMASuplSession::CompleteSession(TInt aCompletionCode) |
|
788 { |
|
789 if(iRunRequestStatus) |
|
790 { |
|
791 |
|
792 TTime currentTime; |
|
793 currentTime.HomeTime(); |
|
794 iSessionCompletionCode = aCompletionCode; |
|
795 |
|
796 TBuf<64> errorCode; |
|
797 errorCode.Append(_L("Completing Session with error code : ")); |
|
798 errorCode.AppendNum(aCompletionCode); |
|
799 iTrace->Trace(errorCode, KTraceFileName, __LINE__); |
|
800 |
|
801 iConnRequestor->UpdateNetInfo(currentTime,iCurrentCellId.iMCC,iCurrentCellId.iMNC,iCurrentCellId.iCid,iCurrentCellId.iLac,iNetworkType,aCompletionCode); |
|
802 |
|
803 User::RequestComplete(iRunRequestStatus,aCompletionCode); |
|
804 } |
|
805 } |
|
806 |
|
807 // ----------------------------------------------------------------------------- |
|
808 // COMASuplSession::OperationComplete |
|
809 // Gets control when any of the asynchronous requests are completed |
|
810 // This is a very important method and drives the OMS SUPL |
|
811 // State Machine |
|
812 // (other items were commented in a header). |
|
813 // ----------------------------------------------------------------------------- |
|
814 // |
|
815 void COMASuplSession::OperationCompleteL(TInt aErrorCode) |
|
816 { |
|
817 TBuf<256> msg; |
|
818 if(KErrNone != aErrorCode) |
|
819 { |
|
820 msg.Copy(_L("Actual Error Code : ")); |
|
821 msg.AppendNum(aErrorCode); |
|
822 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
823 |
|
824 if (iSuplSessionState == ESUPL_CONNECTING) |
|
825 CheckForPersistentFailure(aErrorCode); |
|
826 HandleSuplErrorL(aErrorCode); |
|
827 return; |
|
828 } |
|
829 |
|
830 TInt err = KErrNone; |
|
831 |
|
832 switch(iSuplSessionState) |
|
833 { |
|
834 case ESUPL_INITIALIZED: |
|
835 { |
|
836 if (iRequestType == ESUPL_NETWORK) |
|
837 { |
|
838 iIapDialogShown = ETrue; |
|
839 TInt delay ; |
|
840 iTrace->Trace(_L("Dialog timer not started earlier and request is NI, starting now"), KTraceFileName, __LINE__); |
|
841 if (iDiffTime.Int() == 0) |
|
842 { |
|
843 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
844 TOMASuplQop qop; |
|
845 TInt retVal = suplInit->Qop(qop); |
|
846 |
|
847 qop.Delay(delay); |
|
848 //if delay is > 7, it is not valid |
|
849 if (delay > 7) |
|
850 delay = 0; |
|
851 if(retVal == KErrNone && delay > 0) |
|
852 { |
|
853 TReal delayReal; |
|
854 Math::Pow(delayReal, 2, (TReal)delay); |
|
855 delay = (TInt) delayReal; |
|
856 msg.Copy(_L("Delay present in message, value is = ")); |
|
857 msg.AppendNum(delay); |
|
858 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
859 isTimeoutDialogTimerStarted = ETrue; |
|
860 } |
|
861 else |
|
862 { |
|
863 if (iSuplInitTimeOut > 0) |
|
864 { |
|
865 iTrace->Trace(_L("Delay not present in message"), KTraceFileName, __LINE__); |
|
866 msg.Copy(_L("Delay value in CR is")); |
|
867 msg.AppendNum(iSuplInitTimeOut); |
|
868 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
869 isTimeoutDialogTimerStarted = ETrue; |
|
870 delay = iSuplInitTimeOut * KSecond; |
|
871 } |
|
872 else |
|
873 { |
|
874 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
875 } |
|
876 } |
|
877 } |
|
878 else |
|
879 { |
|
880 msg.Copy(_L("Time diff used, diff = ")); |
|
881 msg.AppendNum(iDiffTime.Int()); |
|
882 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
883 isTimeoutDialogTimerStarted = ETrue; |
|
884 delay = iDiffTime.Int(); |
|
885 } |
|
886 TRAP( err, iConnRequestor->CreateConnectionL(delay) ); |
|
887 } |
|
888 else //terminal initiated case |
|
889 { |
|
890 TRAP( err, iConnRequestor->CreateConnectionL() ); |
|
891 } |
|
892 if(KErrNone != err) |
|
893 { |
|
894 HandleSuplErrorL(err); |
|
895 break; |
|
896 } |
|
897 iSuplSessionState = ESUPL_CONNECTING; |
|
898 break; |
|
899 } |
|
900 |
|
901 case ESUPL_CONNECTING: |
|
902 //Retrieve the portnumber being used |
|
903 iPortNum = iConnRequestor->GetPortNumber(); |
|
904 |
|
905 if(iRequestType == ESUPL_INVALID_SESSION) |
|
906 { |
|
907 iTrace->Trace(_L("Handling Invalid Session..."), KTraceFileName, __LINE__); |
|
908 // ::POS:: |
|
909 delete iEncodedBuffer; |
|
910 iEncodedBuffer = NULL; |
|
911 iSuplSessionState = ESUPL_ENCODE; |
|
912 iEncodedBuffer = iSuplState->EncodeMessageL(iSuplVersion, iSuplSessionId, err); |
|
913 if(KErrNone == err) |
|
914 { |
|
915 //SMP Changes |
|
916 iSuplSessionState = ESUPL_SEND; |
|
917 iConnRequestor->SendPacket(*iEncodedBuffer); |
|
918 |
|
919 } |
|
920 } |
|
921 else |
|
922 { |
|
923 GenerateSuplMessageL(); |
|
924 //iSuplSessionState = ESUPL_GENERATE; //SMP Changes |
|
925 } |
|
926 break; |
|
927 |
|
928 case ESUPL_SEND: |
|
929 // Clean up Encoding buffer before filling it up |
|
930 delete iEncodedBuffer; |
|
931 iEncodedBuffer = NULL; |
|
932 |
|
933 if(IsWholeMessageSentL()) |
|
934 { |
|
935 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplSent); |
|
936 } |
|
937 |
|
938 if( (iSuplMsgType == ESUPL_START || iSuplMsgType == ESUPL_POSINIT) && iRequestType == ESUPL_TERMINAL) // Manish : Added this to support Cell filtering... |
|
939 { |
|
940 COMASuplStartState* SuplStartState = static_cast <COMASuplStartState *>(iSuplState); |
|
941 SuplStartState->GetCurrentCellID(iCurrentCellId,iNetworkType); |
|
942 |
|
943 #ifdef PRINT_MESSAGE |
|
944 |
|
945 msg.Copy(_L("After receiving from SUPL START/SUPL POS INIT")); |
|
946 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
947 |
|
948 msg.Copy(_L("cid=")); |
|
949 msg.AppendNum(iCurrentCellId.iCid); |
|
950 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
951 |
|
952 msg.Copy(_L("Lac=")); |
|
953 msg.AppendNum(iCurrentCellId.iLac); |
|
954 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
955 |
|
956 msg.Copy(_L("MCC=")); |
|
957 msg.AppendNum(iCurrentCellId.iMCC); |
|
958 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
959 |
|
960 msg.Copy(_L("MNC=")); |
|
961 msg.AppendNum(iCurrentCellId.iMNC); |
|
962 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
963 #endif |
|
964 |
|
965 } |
|
966 |
|
967 if(iPOSSession && iSuplMsgType == ESUPL_POSINIT) //Added while doing confirmance testing... |
|
968 { |
|
969 COMASuplPosInitState* SuplPosInitState = static_cast <COMASuplPosInitState *>(iSuplState); |
|
970 if(!(SuplPosInitState->IsPosPayloadPresent())) |
|
971 { |
|
972 iTrace->Trace(_L("StartTimer for SUPL_POSINIT..."), KTraceFileName, __LINE__); |
|
973 iTimer->StartTimer(iUT2_PosInitTimer * KSecond); |
|
974 } |
|
975 else |
|
976 { |
|
977 iTrace->Trace(_L("Timer for SUPL_POSINIT not started ..since POS payload is present..."), KTraceFileName, __LINE__); |
|
978 } |
|
979 } |
|
980 else |
|
981 { |
|
982 iSuplState->StartTimer(); |
|
983 } |
|
984 |
|
985 if(iSuplMsgType == ESUPL_END) |
|
986 { |
|
987 iTrace->Trace(_L("COMASuplSession::OperationCompleted...SUPL_END send for Error/cancellation..."), KTraceFileName, __LINE__); |
|
988 //Close Connection : bug Fix. |
|
989 iConnRequestor->CloseConnection(); |
|
990 iPortNum = 0; |
|
991 // Invoke Terminate Session |
|
992 iSessionObserver.TerminateSession(this, KErrCompletion); |
|
993 break; |
|
994 } |
|
995 |
|
996 if( iPOSSession && |
|
997 (iSuplMsgType == ESUPL_POSINIT || (iSuplMsgType == ESUPL_POS && (!IsLastPOSMessage() || IsSegmentationDone()) ) )) |
|
998 { |
|
999 iTrace->Trace(_L("Generating POS ..."), KTraceFileName, __LINE__); |
|
1000 iSuplMsgType = ESUPL_POS; |
|
1001 iSuplSessionState = ESUPL_GENERATE; |
|
1002 GenerateSuplMessageL(); |
|
1003 } |
|
1004 break; |
|
1005 |
|
1006 case ESUPL_GENERATE: |
|
1007 // Set the appropriate state |
|
1008 if(iRequestType == ESUPL_INVALID_SESSION) |
|
1009 { |
|
1010 iTrace->Trace(_L("Handling Invalid Session..."), KTraceFileName, __LINE__); |
|
1011 // ::POS:: |
|
1012 delete iEncodedBuffer; |
|
1013 iEncodedBuffer = NULL; |
|
1014 iSuplSessionState = ESUPL_ENCODE; |
|
1015 iEncodedBuffer = iSuplState->EncodeMessageL(iSuplVersion, iSuplSessionId, err); |
|
1016 if(KErrNone == err) |
|
1017 { |
|
1018 iSuplSessionState = ESUPL_SEND; |
|
1019 iConnRequestor->SendPacket(*iEncodedBuffer); |
|
1020 |
|
1021 } |
|
1022 } |
|
1023 else |
|
1024 { |
|
1025 delete iEncodedBuffer; |
|
1026 iEncodedBuffer = NULL; |
|
1027 if(ConnectionRequired()) |
|
1028 { |
|
1029 err = SetApproriateSETSessionId(); |
|
1030 iSuplSessionState = ESUPL_ENCODE; |
|
1031 CopySETCapabilities();//Copy this before and then & with Allowed Capabilities |
|
1032 iEncodedBuffer = iSuplState->EncodeMessageL(iSuplVersion, iSuplSessionId, err); |
|
1033 //SMP Changes |
|
1034 iSuplSessionState = ESUPL_SEND; |
|
1035 iConnRequestor->SendPacket(*iEncodedBuffer); |
|
1036 iConnRequestor->ListenToMessages(); |
|
1037 } |
|
1038 else |
|
1039 { |
|
1040 //SMP Changes |
|
1041 GenerateSuplMessageL(); |
|
1042 //iSuplSessionState = ESUPL_ENCODE; |
|
1043 } |
|
1044 } |
|
1045 |
|
1046 if(KErrNone != err ) |
|
1047 { |
|
1048 HandleSuplErrorL(err); |
|
1049 } |
|
1050 break; |
|
1051 |
|
1052 case ESUPL_ENCODE: |
|
1053 // Clean up Encoding buffer before filling it up |
|
1054 delete iEncodedBuffer; |
|
1055 iEncodedBuffer = NULL; |
|
1056 |
|
1057 iEncodedBuffer = iSuplState->EncodeMessageL(iSuplVersion, iSuplSessionId, err); |
|
1058 if(KErrNone == err) |
|
1059 { |
|
1060 //SMP Changes |
|
1061 iSuplSessionState = ESUPL_SEND; |
|
1062 iConnRequestor->SendPacket(*iEncodedBuffer); |
|
1063 |
|
1064 } |
|
1065 else |
|
1066 { |
|
1067 HandleSuplErrorL(err); |
|
1068 } |
|
1069 break; |
|
1070 |
|
1071 case ESUPL_RECEIVED: break; |
|
1072 |
|
1073 default: |
|
1074 HandleSuplErrorL(KErrOMAUnknownState); |
|
1075 break; |
|
1076 } |
|
1077 } |
|
1078 // ----------------------------------------------------------------------------- |
|
1079 // COMASuplSession::ConnectionRequired |
|
1080 // Determines of connection should be created |
|
1081 // (other items were commented in a header). |
|
1082 // ----------------------------------------------------------------------------- |
|
1083 // |
|
1084 TBool COMASuplSession::ConnectionRequired() |
|
1085 { |
|
1086 if(iRequestType == ESUPL_INVALID_SESSION ) |
|
1087 { |
|
1088 return ETrue; |
|
1089 } |
|
1090 if(iRequestType == ESUPL_TERMINAL && iSuplMsgType == ESUPL_START) |
|
1091 { |
|
1092 return ETrue; |
|
1093 } |
|
1094 else |
|
1095 { |
|
1096 if(iRequestType == ESUPL_NETWORK) |
|
1097 { |
|
1098 if(iSuplMsgType == ESUPL_POSINIT || iSuplMsgType == ESUPL_END) |
|
1099 { |
|
1100 return ETrue; |
|
1101 } |
|
1102 } |
|
1103 } |
|
1104 return EFalse; |
|
1105 } |
|
1106 |
|
1107 // ----------------------------------------------------------------------------- |
|
1108 // COMASuplSession::ValidatePosition |
|
1109 // Validates position estimate |
|
1110 // (other items were commented in a header). |
|
1111 // ----------------------------------------------------------------------------- |
|
1112 // |
|
1113 TInt COMASuplSession::ValidatePosition(COMASuplPosition *aPosition) |
|
1114 { |
|
1115 TOMASuplUtcTime utcTime; |
|
1116 TOMASuplPositionEstimate pos; |
|
1117 |
|
1118 aPosition->GetPosition(utcTime, pos); |
|
1119 |
|
1120 TOMASuplPositionEstimate::TOMASuplLatitudeSign latSign; |
|
1121 TInt latitude; |
|
1122 TInt longitude; |
|
1123 pos.GetPositionEstimate(latSign,latitude,longitude); |
|
1124 |
|
1125 // Set Position Estimate |
|
1126 if(latitude < KLatitudeMin || latitude > KLatitudeMax) |
|
1127 { |
|
1128 return KErrArgument; |
|
1129 } |
|
1130 if(longitude < KLongitudeMin || longitude > KLongitudeMax) |
|
1131 { |
|
1132 return KErrArgument; |
|
1133 } |
|
1134 |
|
1135 // Retrieve optional parametrs of Position Estimate |
|
1136 // Retrieve Uncertainity |
|
1137 TOMASuplUncertainty uncertainty; |
|
1138 TInt error = pos.GetUncertainty(uncertainty); |
|
1139 if(!error) |
|
1140 { |
|
1141 TInt uncertSemiMajor; |
|
1142 TInt uncertSemiMinor; |
|
1143 TInt orientMajorAxis; |
|
1144 uncertainty.GetUncertainty(uncertSemiMajor,uncertSemiMinor,orientMajorAxis); |
|
1145 if(uncertSemiMajor < KUncertSemiMajorMin || uncertSemiMajor > KUncertSemiMajorMax) |
|
1146 { |
|
1147 return KErrArgument; |
|
1148 } |
|
1149 if (uncertSemiMinor < KUncertSemiMinorMin || uncertSemiMinor > KUncertSemiMinorMax) |
|
1150 { |
|
1151 return KErrArgument; |
|
1152 } |
|
1153 if (orientMajorAxis < KOrientMajorAxisMin || orientMajorAxis > KOrientMajorAxisMax) |
|
1154 { |
|
1155 return KErrArgument; |
|
1156 } |
|
1157 } |
|
1158 |
|
1159 TInt confidence; |
|
1160 error = pos.GetConfidence(confidence); |
|
1161 if(!error) |
|
1162 { |
|
1163 if(confidence < KConfidenceMin || confidence > KConfidenceMax) |
|
1164 { |
|
1165 return KErrArgument; |
|
1166 } |
|
1167 } |
|
1168 // Retrieve AltitudeInfo |
|
1169 TOMASuplAltitudeInfo altitudeInfo; |
|
1170 error = pos.GetAltitudeInfo(altitudeInfo); |
|
1171 if(!error) |
|
1172 { |
|
1173 TOMASuplAltitudeInfo::TOMASuplAltitudeDirection altDirection; |
|
1174 TInt altitude; |
|
1175 TInt altUncert; |
|
1176 altitudeInfo.GetAltitudeInfo(altDirection,altitude,altUncert); |
|
1177 if (altitude < KAltitudeMin || altitude > KAltitudeMax) |
|
1178 { |
|
1179 return KErrArgument; |
|
1180 } |
|
1181 if (altUncert < KAltitudeUncertMin || altUncert > KAltitudeUncertMax) |
|
1182 { |
|
1183 return KErrArgument; |
|
1184 } |
|
1185 } |
|
1186 |
|
1187 return KErrNone; |
|
1188 } |
|
1189 |
|
1190 // ----------------------------------------------------------------------------- |
|
1191 // COMASuplSession::GetPositionComplete |
|
1192 // Handles any errors that may occur during protocol processing |
|
1193 // (other items were commented in a header). |
|
1194 // ----------------------------------------------------------------------------- |
|
1195 // |
|
1196 void COMASuplSession::GetPositionComplete(TInt aError) |
|
1197 { |
|
1198 //Close Connection : bug Fix. |
|
1199 iConnRequestor->CloseConnection(); |
|
1200 iPortNum = 0; |
|
1201 if(aError || iPosition->Status()) |
|
1202 { |
|
1203 delete iPosition; |
|
1204 iPosition = NULL; |
|
1205 // Invoke SessionTerminate |
|
1206 iTrace->Trace(_L("Could not get position from POS Msg Plugin..."), KTraceFileName, __LINE__); |
|
1207 iSessionObserver.TerminateSession(this, KErrNone); |
|
1208 } |
|
1209 else |
|
1210 { |
|
1211 TInt err; |
|
1212 err = ValidatePosition(iPosition); |
|
1213 if (err != KErrNone) |
|
1214 { |
|
1215 delete iPosition; |
|
1216 iPosition = NULL; |
|
1217 iSessionObserver.TerminateSession(this, KErrCompletion); |
|
1218 } |
|
1219 else |
|
1220 iSessionObserver.TerminateSession(this, KErrNone); |
|
1221 } |
|
1222 } |
|
1223 |
|
1224 |
|
1225 |
|
1226 // ----------------------------------------------------------------------------- |
|
1227 // COMASuplSession::HandleSuplErrorL |
|
1228 // Handles any errors that may occur during protocol processing |
|
1229 // (other items were commented in a header). |
|
1230 // ----------------------------------------------------------------------------- |
|
1231 // |
|
1232 void COMASuplSession::HandleSuplErrorL(TInt aErr) |
|
1233 { |
|
1234 // All Possible errors - |
|
1235 // 1. Packet generation failure |
|
1236 // SUPL START - Complete the session with aErr |
|
1237 // SUPL POS INIT - Send SUPL END with appropriate Error code |
|
1238 // SUPL END - Complete Session with aErr and terminate the session |
|
1239 // SUPL POS - Will be handled later |
|
1240 // 2. Secure Socket Connection failure |
|
1241 // Complete the Session with aErr. Terminate the supl session |
|
1242 // 3. Local IP Address retrieval failure |
|
1243 // Complete the session with aErr. Terminate the supl session |
|
1244 // 4. Packet Encoding error |
|
1245 // SUPL START - Complete Session with aErr |
|
1246 // SUPL POS INIT - Generate SUPL END and send to SLP |
|
1247 // SUPL POS - Will be handled later |
|
1248 // SUPL END - Complete session with aErr and terminate the session |
|
1249 // 5. Packet Send Error |
|
1250 // Complete the session with aErr and terminate the session |
|
1251 // 6. Unknown State Error |
|
1252 // SUPL START - Complete Session with invalid state |
|
1253 // SUPL RESPONSE - Send SUPL END with appropriate error |
|
1254 // SUPL POS INIT - Send SUPL END with appropriate error |
|
1255 // SUPL POS - Will be handled later |
|
1256 // SUPL END - Complete session with invalid state and terminate the session |
|
1257 // SUPL INTI - Will be handled later |
|
1258 // 7. Message Processing error |
|
1259 // SUPL RESPONSE - Send SUPL END with appropriate error code |
|
1260 // SUPL POS - Will be handled later |
|
1261 // SUPL END - Complete session with aErr and terminate the session |
|
1262 // 8. Time out Handling |
|
1263 // SUPL START - Send SUPL END with appropriate error code |
|
1264 // SUPL POS INIT - Send SUPL END with appropriate error code |
|
1265 // SUPL END - There should be no timer started in the first place |
|
1266 |
|
1267 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplError); |
|
1268 |
|
1269 switch(iSuplSessionState) |
|
1270 { |
|
1271 |
|
1272 //*************************************************************************************** |
|
1273 |
|
1274 case ESUPL_INITIALIZED: //Initilization error |
|
1275 { |
|
1276 aErr = KErrNotReady; |
|
1277 iTrace->Trace(_L("HandleInitilizationError..."), KTraceFileName, __LINE__); |
|
1278 HandleInitilizationErrorL(aErr); |
|
1279 break; |
|
1280 } |
|
1281 |
|
1282 //*************************************************************************************** |
|
1283 |
|
1284 case ESUPL_CONNECTING: //Error while retriving Local IP address |
|
1285 { |
|
1286 aErr = KErrGeneral; |
|
1287 iTrace->Trace(_L("HandleConnectionError..."), KTraceFileName, __LINE__); |
|
1288 HandleConnectionErrorL(aErr); |
|
1289 break; |
|
1290 } |
|
1291 |
|
1292 //*************************************************************************************** |
|
1293 |
|
1294 case ESUPL_ENCODE: //Encoding failure error |
|
1295 { |
|
1296 |
|
1297 iTrace->Trace(_L("HandleEncodingError..."), KTraceFileName, __LINE__); |
|
1298 HandleEncodingErrorL(aErr); |
|
1299 break; |
|
1300 } |
|
1301 |
|
1302 //*************************************************************************************** |
|
1303 |
|
1304 case ESUPL_GENERATE : //Generation error |
|
1305 { |
|
1306 aErr = KErrGeneral; |
|
1307 iTrace->Trace(_L("HandleGenerationError..."), KTraceFileName, __LINE__); |
|
1308 HandleGenerationErrorL(aErr); |
|
1309 break; |
|
1310 } |
|
1311 |
|
1312 //*************************************************************************************** |
|
1313 |
|
1314 case ESUPL_SEND: //Timeout & packet send error |
|
1315 { |
|
1316 iTrace->Trace(_L("HandleSendError..."), KTraceFileName, __LINE__); |
|
1317 HandleSendErrorL(aErr); |
|
1318 break; |
|
1319 } |
|
1320 |
|
1321 //*************************************************************************************** |
|
1322 |
|
1323 case ESUPL_RECEIVED: //Error while getting wrong message from SLP |
|
1324 { |
|
1325 iTrace->Trace(_L("HandlePacketsError..."), KTraceFileName, __LINE__); |
|
1326 HandlePacketsErrorL(aErr); |
|
1327 break; |
|
1328 } |
|
1329 |
|
1330 //*************************************************************************************** |
|
1331 |
|
1332 default: |
|
1333 { |
|
1334 TBuf<64> msg(_L("Unknown ERROR occured...")); |
|
1335 msg.AppendNum(aErr); |
|
1336 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
1337 break; |
|
1338 } |
|
1339 |
|
1340 //*************************************************************************************** |
|
1341 } |
|
1342 |
|
1343 } |
|
1344 |
|
1345 // ----------------------------------------------------------------------------- |
|
1346 // ReverseString |
|
1347 // Reverse the string |
|
1348 // ----------------------------------------------------------------------------- |
|
1349 // |
|
1350 void ReverseString(TDes8& aLocalIPAddress,TInt aLength) |
|
1351 { |
|
1352 TBuf8<1> temp1; |
|
1353 TBuf8<1> temp2; |
|
1354 for(TInt i =0 ;i < aLength / 2; ++i) |
|
1355 { |
|
1356 temp1.Zero(); |
|
1357 temp2.Zero(); |
|
1358 temp1.Append(aLocalIPAddress[i]); |
|
1359 temp2.Append(aLocalIPAddress[aLength - 1 - i]); |
|
1360 aLocalIPAddress.Replace(i,1,temp2); |
|
1361 aLocalIPAddress.Replace(aLength - 1 - i,1,temp1); |
|
1362 } |
|
1363 } |
|
1364 |
|
1365 // ----------------------------------------------------------------------------- |
|
1366 // COMASuplSession::GetLocalIPAddress |
|
1367 // Gets Local IP address of SET |
|
1368 // (other items were commented in a header). |
|
1369 // ----------------------------------------------------------------------------- |
|
1370 // |
|
1371 TInt COMASuplSession::GetLocalIPAddress() |
|
1372 { |
|
1373 iTrace->Trace(_L("COMASuplSession::GetLocalIPAddress"), KTraceFileName, __LINE__); |
|
1374 |
|
1375 if (iSessionIDFlag) |
|
1376 { |
|
1377 return KErrNone; |
|
1378 } |
|
1379 |
|
1380 TInetAddr address; |
|
1381 TInt err = iConnRequestor->GetLocalIPAddress(address); |
|
1382 if (err != KErrNone) |
|
1383 { |
|
1384 return err; |
|
1385 } |
|
1386 |
|
1387 if ( address.Family() == KAfInet) //This routine will convert IPV4 address in TBuf8<4> |
|
1388 { |
|
1389 TUint32 ipAddress = address.Address(); |
|
1390 TPtr8 ptrIPAddress(reinterpret_cast<TUint8*>(&ipAddress), |
|
1391 sizeof(ipAddress), sizeof(ipAddress)); |
|
1392 TBuf8<KIP4AddressLength> localIPAddress; |
|
1393 localIPAddress.Append(ptrIPAddress); |
|
1394 COMASuplSETSessionID* suplSETSessionId = NULL; |
|
1395 iSuplSessionId->SETSessionID(suplSETSessionId); |
|
1396 ReverseString(localIPAddress,KIP4AddressLength); |
|
1397 suplSETSessionId->SetSuplSETSessionIDIPv4(iSETSessionUniqueId, |
|
1398 localIPAddress); |
|
1399 //#if _DEBUG |
|
1400 TBuf<64> msg; |
|
1401 TBuf<16> ipaddress; |
|
1402 address.Output(ipaddress); |
|
1403 msg.Copy(_L("Its IP4 Address. Local IP Address is ")); |
|
1404 msg.Append(ipaddress); |
|
1405 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1406 //#endif |
|
1407 } |
|
1408 |
|
1409 if ( address.Family() == KAfInet6 ) // This routine will convert IPV6 address in TBuf8<16> |
|
1410 { |
|
1411 TBuf8<KIP6AddressLength> localIP6Address; |
|
1412 const TIp6Addr &ip6Addr = address.Ip6Address(); |
|
1413 for(TInt i = 0;i < 4; ++i ) |
|
1414 { |
|
1415 TUint32 ipAddress = ip6Addr.u.iAddr32[i]; |
|
1416 TPtr8 ptrIPAddress(reinterpret_cast<TUint8*>(&ipAddress), |
|
1417 sizeof(ipAddress), sizeof(ipAddress)); |
|
1418 TBuf8<KIP4AddressLength> localIPAddress; |
|
1419 localIPAddress.Append(ptrIPAddress); |
|
1420 localIP6Address.Append(localIPAddress); |
|
1421 } |
|
1422 |
|
1423 COMASuplSETSessionID* suplSETSessionId = NULL; |
|
1424 iSuplSessionId->SETSessionID(suplSETSessionId); |
|
1425 ReverseString(localIP6Address,KIP6AddressLength); |
|
1426 suplSETSessionId->SetSuplSETSessionIDIPv6(iSETSessionUniqueId, |
|
1427 localIP6Address); |
|
1428 //#if _DEBUG |
|
1429 TBuf<64> msg; |
|
1430 TBuf<16> ipaddress; |
|
1431 address.Output(ipaddress); |
|
1432 msg.Copy(_L("Its IP6 Address. Local IP Address is ")); |
|
1433 msg.Append(ipaddress); |
|
1434 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1435 //#endif |
|
1436 } |
|
1437 |
|
1438 return KErrNone; |
|
1439 } |
|
1440 |
|
1441 |
|
1442 // ----------------------------------------------------------------------------- |
|
1443 // COMASuplSession::SetEncodedSuplInitL |
|
1444 // Sets the Encoded SUPL INIT. This is required |
|
1445 // to compute the VER in SUPL POS INIT |
|
1446 // (other items were commented in a header). |
|
1447 // ----------------------------------------------------------------------------- |
|
1448 // |
|
1449 void COMASuplSession::SetEncodedSuplInitL(HBufC8 *aEncodedSuplInit) |
|
1450 { |
|
1451 TInt len = aEncodedSuplInit->Length(); |
|
1452 if(iEncodedSuplInit) |
|
1453 { |
|
1454 delete iEncodedSuplInit; |
|
1455 iEncodedSuplInit = NULL; |
|
1456 } |
|
1457 |
|
1458 iEncodedSuplInit = HBufC8::NewL(len); |
|
1459 *iEncodedSuplInit = *aEncodedSuplInit; |
|
1460 } |
|
1461 |
|
1462 // ----------------------------------------------------------------------------- |
|
1463 // COMASuplSession::SuplSessionID |
|
1464 // Returns SessionID of Session |
|
1465 // (other items were commented in a header). |
|
1466 // ----------------------------------------------------------------------------- |
|
1467 // |
|
1468 COMASuplSessionID* COMASuplSession::SuplSessionID() const |
|
1469 { |
|
1470 return iSuplSessionId; |
|
1471 } |
|
1472 |
|
1473 // ----------------------------------------------------------------------------- |
|
1474 // COMASuplSession::GetServerAddressL |
|
1475 // Gets the Server Name and returns it back to the client |
|
1476 // (other items were commented in a header). |
|
1477 // ----------------------------------------------------------------------------- |
|
1478 // |
|
1479 EXPORT_C TInt COMASuplSession::GetServerAddressL(TDes& ahslpAddress) |
|
1480 { |
|
1481 if(iSessionCompletionCode == KErrNone) |
|
1482 { |
|
1483 iConnRequestor->GetUsedServerAddress(ahslpAddress); |
|
1484 iTrace->Trace(_L("Session has suceeded...returning address"), KTraceFileName, __LINE__); |
|
1485 iTrace->Trace(ahslpAddress, KTraceFileName, __LINE__); |
|
1486 return KErrNone; |
|
1487 } |
|
1488 else |
|
1489 { |
|
1490 iTrace->Trace(_L("Session has failed...returning Error"), KTraceFileName, __LINE__); |
|
1491 return KErrNotFound; |
|
1492 } |
|
1493 } |
|
1494 |
|
1495 // ----------------------------------------------------------------------------- |
|
1496 // COMASuplSession::GetPosition |
|
1497 // Gets the Position from the SUPL framework and returns it back to the client |
|
1498 // (other items were commented in a header). |
|
1499 // ----------------------------------------------------------------------------- |
|
1500 // |
|
1501 EXPORT_C TInt COMASuplSession::GetPosition(TPositionInfo& aSuplPosInfo) |
|
1502 { |
|
1503 TBool aPositionQualityError=TRUE; |
|
1504 iTrace->Trace(_L("COMASuplSession::GetPosition(TPositionInfo)"), KTraceFileName, __LINE__); |
|
1505 if(!iPosition) |
|
1506 { |
|
1507 iTrace->Trace(_L("COMASuplSession::GetPosition ... Position is Empty"), KTraceFileName, __LINE__); |
|
1508 return KErrNotFound; |
|
1509 } |
|
1510 |
|
1511 TPosition posInfo; |
|
1512 TOMASuplUtcTime UtcTime; |
|
1513 TOMASuplPositionEstimate PosEstimate; |
|
1514 TDateTime TimeStamp; |
|
1515 TInt ZoneCode,Zone,altitude,AltitudeUncertainty, HorizontalAccuracy; |
|
1516 TOMASuplAltitudeInfo AltitudeInfo; |
|
1517 TInt latitude,longitude; |
|
1518 TOMASuplPositionEstimate::TOMASuplLatitudeSign LatSign; |
|
1519 TOMASuplAltitudeInfo::TOMASuplAltitudeDirection altitudeDirection; |
|
1520 TOMASuplUncertainty Uncertainty; |
|
1521 TInt UncertaintySemiMajor, UncertaintySemiMinor, OrientationMajorAxis; |
|
1522 TReal UncertaintySemiMajorReal, UncertaintySemiMinorReal, AltitudeUncertaintyReal; |
|
1523 TInt confidence; |
|
1524 |
|
1525 iPosition->GetPosition(UtcTime,PosEstimate); |
|
1526 UtcTime.GetUtcTime(TimeStamp,ZoneCode,Zone); |
|
1527 TInt altErr = PosEstimate.GetAltitudeInfo(AltitudeInfo); |
|
1528 PosEstimate.GetPositionEstimate(LatSign,latitude,longitude); |
|
1529 TInt err = PosEstimate.GetConfidence(confidence); |
|
1530 altitude = 0; |
|
1531 if (altErr == KErrNone) |
|
1532 AltitudeInfo.GetAltitudeInfo(altitudeDirection,altitude,AltitudeUncertainty); |
|
1533 |
|
1534 TTime time(TimeStamp); |
|
1535 posInfo.SetTime(time); |
|
1536 |
|
1537 if(LatSign == TOMASuplPositionEstimate::ESouth ) |
|
1538 { |
|
1539 latitude = latitude * -1; |
|
1540 } |
|
1541 |
|
1542 // Conversion of latitude and longitude |
|
1543 TReal64 newLat, newLong; |
|
1544 newLat = latitude; |
|
1545 newLong = longitude; |
|
1546 //Conversion as per GAD and OMA Spec |
|
1547 newLat = (newLat/8388608)*90; |
|
1548 newLong = (newLong/16777216)*360; |
|
1549 |
|
1550 if (altErr == KErrOMASuplParamNotSet) |
|
1551 posInfo.SetCoordinate((TReal64)newLat,(TReal64)newLong); |
|
1552 else |
|
1553 posInfo.SetCoordinate((TReal64)newLat,(TReal64)newLong,(float)altitude); |
|
1554 PosEstimate.GetUncertainty(Uncertainty); |
|
1555 Uncertainty.GetUncertainty(UncertaintySemiMajor,UncertaintySemiMinor, |
|
1556 OrientationMajorAxis); |
|
1557 TBuf<64> msg; |
|
1558 msg.Copy(_L("Uncertainty Semi major")); |
|
1559 msg.AppendNum(UncertaintySemiMajor); |
|
1560 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1561 msg.Copy(_L("Uncertainty Semi Minor")); |
|
1562 msg.AppendNum(UncertaintySemiMinor); |
|
1563 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1564 msg.Copy(_L("Orientation to Major axis ")); |
|
1565 msg.AppendNum(OrientationMajorAxis); |
|
1566 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1567 msg.Copy(_L("Altitude ")); |
|
1568 msg.AppendNum(altitude); |
|
1569 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1570 msg.Copy(_L("Altitude uncertainty ")); |
|
1571 msg.AppendNum(AltitudeUncertainty); |
|
1572 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1573 |
|
1574 // Convert uncertainty to meters |
|
1575 TReal pwrMjr, pwrMnr, pwrAlt; |
|
1576 Math::Pow(pwrMjr, 1.1, UncertaintySemiMajor); |
|
1577 Math::Pow(pwrMnr, 1.1, UncertaintySemiMinor); |
|
1578 Math::Pow(pwrAlt, 1.070000, AltitudeUncertainty); |
|
1579 UncertaintySemiMajorReal = 10 * (pwrMjr -1); |
|
1580 UncertaintySemiMinorReal = 10 * (pwrMnr -1); |
|
1581 AltitudeUncertaintyReal = 10 * (pwrAlt -1); |
|
1582 |
|
1583 TReal MultiplyFactor; |
|
1584 |
|
1585 // Default set accuracy values to NaN |
|
1586 TRealX nan; |
|
1587 nan.SetNaN(); |
|
1588 |
|
1589 posInfo.SetHorizontalAccuracy(nan); |
|
1590 posInfo.SetVerticalAccuracy(nan); |
|
1591 if (err == KErrOMASuplParamNotSet||confidence<=0 || confidence>=100) |
|
1592 { |
|
1593 TReal32 horizAccr; |
|
1594 horizAccr = KUncertaintyConversionFactor * ( KCEP68ConversionFactor * (UncertaintySemiMajorReal + UncertaintySemiMinorReal ) ); |
|
1595 posInfo.SetHorizontalAccuracy(horizAccr); |
|
1596 if (AltitudeUncertaintyReal > 0) |
|
1597 posInfo.SetVerticalAccuracy(AltitudeUncertaintyReal); |
|
1598 |
|
1599 } |
|
1600 else |
|
1601 { |
|
1602 |
|
1603 TReal lnResult,a_Sigma,b_Sigma; |
|
1604 Math::Ln(lnResult,(1-confidence/100.0)); |
|
1605 Math::Sqrt(MultiplyFactor,(-2*lnResult)); |
|
1606 |
|
1607 a_Sigma=UncertaintySemiMajorReal/MultiplyFactor; |
|
1608 |
|
1609 b_Sigma=UncertaintySemiMinorReal/MultiplyFactor; |
|
1610 |
|
1611 HorizontalAccuracy=0.7542*(a_Sigma+b_Sigma); |
|
1612 |
|
1613 posInfo.SetHorizontalAccuracy(HorizontalAccuracy); |
|
1614 TReal32 clientHorAcc; |
|
1615 if(iClientQop.GetHorizontalAccuracy(clientHorAcc)!=KErrNotFound) |
|
1616 { |
|
1617 if(HorizontalAccuracy<clientHorAcc) |
|
1618 { |
|
1619 aPositionQualityError=FALSE; |
|
1620 } |
|
1621 |
|
1622 } |
|
1623 |
|
1624 /* Calculation for vertical accuracy */ |
|
1625 /* If confidence is 68, then vertical accuracy = altitude uncertainty */ |
|
1626 if (altitude > 0 && altErr == KErrNone) |
|
1627 { |
|
1628 if (confidence == 68 && AltitudeUncertaintyReal > 0) |
|
1629 posInfo.SetVerticalAccuracy(AltitudeUncertaintyReal); |
|
1630 else |
|
1631 { |
|
1632 TReal32 chiValue=0, verticalAccuracy=0; |
|
1633 if (confidence < 6) |
|
1634 { |
|
1635 chiValue = chisquare[1]; |
|
1636 } |
|
1637 else |
|
1638 { |
|
1639 chiValue = chisquare[confidence/5]; |
|
1640 } |
|
1641 verticalAccuracy = AltitudeUncertaintyReal/chiValue; |
|
1642 if (verticalAccuracy > 0) |
|
1643 { |
|
1644 posInfo.SetVerticalAccuracy(verticalAccuracy); |
|
1645 TReal32 clientVerAcc; |
|
1646 if(iClientQop.GetVerticalAccuracy(clientVerAcc)!=KErrNotFound) |
|
1647 { |
|
1648 if(verticalAccuracy<clientVerAcc) |
|
1649 { |
|
1650 aPositionQualityError=FALSE; |
|
1651 } |
|
1652 } |
|
1653 } |
|
1654 } |
|
1655 } |
|
1656 } |
|
1657 |
|
1658 TInt aClientTime; |
|
1659 if(iClientQop.GetDelay(aClientTime)!=KErrNotFound) |
|
1660 { |
|
1661 TTimeIntervalSeconds aDelay; |
|
1662 |
|
1663 iSessionEndTime.SecondsFrom(iSessionStartTime,aDelay); |
|
1664 |
|
1665 if(aClientTime< aDelay.Int()) |
|
1666 aPositionQualityError=FALSE; |
|
1667 } |
|
1668 |
|
1669 /*Set the position to TPositionInfo*/ |
|
1670 aSuplPosInfo.SetPosition(posInfo); |
|
1671 |
|
1672 if(aPositionQualityError!=TRUE) |
|
1673 return KSuplPositionQualityLoss; |
|
1674 return KErrNone; |
|
1675 } |
|
1676 |
|
1677 // ----------------------------------------------------------------------------- |
|
1678 // COMASuplSession::GetPosition |
|
1679 // Gets the Position from the SUPL framework and returns it back to the client |
|
1680 // (other items were commented in a header). |
|
1681 // ----------------------------------------------------------------------------- |
|
1682 // |
|
1683 EXPORT_C TInt COMASuplSession::GetPosition(HPositionGenericInfo& aSuplPosInfo ) |
|
1684 { |
|
1685 TBool aPositionQualityError=TRUE; |
|
1686 iTrace->Trace(_L("COMASuplSession::GetPosition(HPositionGenericInfo)"), KTraceFileName, __LINE__); |
|
1687 if(!iPosition) |
|
1688 { |
|
1689 iTrace->Trace(_L("COMASuplSession::GetPosition ... Position is Empty"), KTraceFileName, __LINE__); |
|
1690 return KErrNotFound; |
|
1691 } |
|
1692 |
|
1693 TRAP_IGNORE(StoreCurrentCellIDL(aSuplPosInfo)); |
|
1694 |
|
1695 TPosition posInfo; |
|
1696 TOMASuplUtcTime UtcTime; |
|
1697 TOMASuplPositionEstimate PosEstimate; |
|
1698 TDateTime TimeStamp; |
|
1699 TInt ZoneCode,Zone,altitude,AltitudeUncertainty, HorizontalAccuracy; |
|
1700 TOMASuplAltitudeInfo AltitudeInfo; |
|
1701 TInt latitude,longitude; |
|
1702 TOMASuplPositionEstimate::TOMASuplLatitudeSign LatSign; |
|
1703 TOMASuplAltitudeInfo::TOMASuplAltitudeDirection AltitudeDirection; |
|
1704 TOMASuplUncertainty Uncertainty; |
|
1705 TInt UncertaintySemiMajor, UncertaintySemiMinor, OrientationMajorAxis; |
|
1706 TReal UncertaintySemiMajorReal, UncertaintySemiMinorReal, AltitudeUncertaintyReal; |
|
1707 TInt confidence; |
|
1708 |
|
1709 iPosition->GetPosition(UtcTime,PosEstimate); |
|
1710 UtcTime.GetUtcTime(TimeStamp,ZoneCode,Zone); |
|
1711 TInt altErr = PosEstimate.GetAltitudeInfo(AltitudeInfo); |
|
1712 PosEstimate.GetPositionEstimate(LatSign,latitude,longitude); |
|
1713 TInt err = PosEstimate.GetConfidence(confidence); |
|
1714 altitude = 0; |
|
1715 if (altErr == KErrNone) |
|
1716 AltitudeInfo.GetAltitudeInfo(AltitudeDirection,altitude,AltitudeUncertainty); |
|
1717 PosEstimate.GetUncertainty(Uncertainty); |
|
1718 Uncertainty.GetUncertainty(UncertaintySemiMajor,UncertaintySemiMinor, |
|
1719 OrientationMajorAxis); |
|
1720 // Convert uncertainty to meters |
|
1721 TReal pwrMjr, pwrMnr, pwrAlt; |
|
1722 Math::Pow(pwrMjr, 1.1, UncertaintySemiMajor); |
|
1723 Math::Pow(pwrMnr, 1.1, UncertaintySemiMinor); |
|
1724 Math::Pow(pwrAlt, 1.070000, AltitudeUncertainty); |
|
1725 UncertaintySemiMajorReal = 10 * (pwrMjr -1); |
|
1726 UncertaintySemiMinorReal = 10 * (pwrMnr -1); |
|
1727 AltitudeUncertaintyReal = 10 * (pwrAlt -1); |
|
1728 |
|
1729 TReal MultiplyFactor; |
|
1730 |
|
1731 TBuf<64> msg; |
|
1732 msg.Copy(_L("Uncertainty Semi major")); |
|
1733 msg.AppendNum(UncertaintySemiMajor); |
|
1734 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1735 msg.Copy(_L("Uncertainty Semi Minor")); |
|
1736 msg.AppendNum(UncertaintySemiMinor); |
|
1737 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1738 msg.Copy(_L("Orientation to Major axis ")); |
|
1739 msg.AppendNum(OrientationMajorAxis); |
|
1740 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1741 msg.Copy(_L("Altitude ")); |
|
1742 msg.AppendNum(altitude); |
|
1743 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1744 msg.Copy(_L("Altitude uncertainty ")); |
|
1745 msg.AppendNum(AltitudeUncertainty); |
|
1746 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1747 |
|
1748 // Default set accuracy values to NaN |
|
1749 TRealX nan; |
|
1750 nan.SetNaN(); |
|
1751 |
|
1752 posInfo.SetHorizontalAccuracy(nan); |
|
1753 posInfo.SetVerticalAccuracy(nan); |
|
1754 |
|
1755 if (err == KErrOMASuplParamNotSet||confidence<=0 || confidence>=100) |
|
1756 { |
|
1757 iTrace->Trace(_L("Confidance Not Set"), KTraceFileName, __LINE__); |
|
1758 |
|
1759 TReal32 horizAccr; |
|
1760 horizAccr = KUncertaintyConversionFactor * ( KCEP68ConversionFactor * (UncertaintySemiMajorReal + UncertaintySemiMinorReal ) ); |
|
1761 posInfo.SetHorizontalAccuracy(horizAccr); |
|
1762 if (AltitudeUncertaintyReal > 0) |
|
1763 posInfo.SetVerticalAccuracy(AltitudeUncertaintyReal); |
|
1764 } |
|
1765 else |
|
1766 { |
|
1767 iTrace->Trace(_L("Confidance is Set"), KTraceFileName, __LINE__); |
|
1768 |
|
1769 TReal lnResult,a_Sigma,b_Sigma; |
|
1770 Math::Ln(lnResult,(1-confidence/100.0)); |
|
1771 Math::Sqrt(MultiplyFactor,(-2*lnResult)); |
|
1772 |
|
1773 a_Sigma=UncertaintySemiMajorReal/MultiplyFactor; |
|
1774 b_Sigma=UncertaintySemiMinorReal/MultiplyFactor; |
|
1775 |
|
1776 HorizontalAccuracy=0.7542*(a_Sigma+b_Sigma); |
|
1777 |
|
1778 posInfo.SetHorizontalAccuracy(HorizontalAccuracy); |
|
1779 TReal32 clientHorAcc; |
|
1780 if(iClientQop.GetHorizontalAccuracy(clientHorAcc)!=KErrNotFound) |
|
1781 { |
|
1782 if(HorizontalAccuracy<clientHorAcc) |
|
1783 { |
|
1784 aPositionQualityError=FALSE; |
|
1785 } |
|
1786 } |
|
1787 // } |
|
1788 |
|
1789 /* To calculate vertical accuracy */ |
|
1790 //posInfo.SetVerticalAccuracy(AltitudeUncertainty); |
|
1791 |
|
1792 /* If confidence is 68, then vertical accuracy = altitude uncertainty */ |
|
1793 if (altitude > 0 && altErr == KErrNone) |
|
1794 { |
|
1795 if (confidence == 68 && AltitudeUncertaintyReal > 0) |
|
1796 posInfo.SetVerticalAccuracy(AltitudeUncertaintyReal); |
|
1797 else |
|
1798 { |
|
1799 TReal32 chiValue=0, verticalAccuracy=0; |
|
1800 if (confidence < 6) |
|
1801 { |
|
1802 chiValue = chisquare[1]; |
|
1803 } |
|
1804 else |
|
1805 { |
|
1806 chiValue = chisquare[confidence/5]; |
|
1807 } |
|
1808 verticalAccuracy = AltitudeUncertaintyReal/chiValue; |
|
1809 if (verticalAccuracy > 0) |
|
1810 { |
|
1811 posInfo.SetVerticalAccuracy(verticalAccuracy); |
|
1812 TReal32 clientVerAcc; |
|
1813 if(iClientQop.GetVerticalAccuracy(clientVerAcc)!=KErrNotFound) |
|
1814 { |
|
1815 if(verticalAccuracy<clientVerAcc) |
|
1816 { |
|
1817 aPositionQualityError=FALSE; |
|
1818 } |
|
1819 else |
|
1820 aPositionQualityError=FALSE; |
|
1821 } |
|
1822 } |
|
1823 } |
|
1824 } |
|
1825 } |
|
1826 |
|
1827 TTime time(TimeStamp); |
|
1828 posInfo.SetTime(time); |
|
1829 |
|
1830 if(LatSign == TOMASuplPositionEstimate::ESouth ) |
|
1831 { |
|
1832 latitude = latitude * -1; |
|
1833 } |
|
1834 |
|
1835 // Conversion of latitude and longitude |
|
1836 TReal64 newLat, newLong; |
|
1837 newLat = latitude; |
|
1838 newLong = longitude; |
|
1839 newLat = (newLat/8388608)*90; |
|
1840 newLong = (newLong/16777216)*360; |
|
1841 if (altErr == KErrOMASuplParamNotSet) |
|
1842 posInfo.SetCoordinate((TReal64)newLat,(TReal64)newLong); |
|
1843 else |
|
1844 posInfo.SetCoordinate((TReal64)newLat,(TReal64)newLong,(float)altitude); |
|
1845 |
|
1846 /*Set the position to TPositionInfo*/ |
|
1847 aSuplPosInfo.SetPosition(posInfo); |
|
1848 |
|
1849 /* Set GenInfo related fields */ |
|
1850 TOMASuplVelocityType VelType; |
|
1851 COMASuplHorizVelocity* HorizVel; |
|
1852 COMASuplVelocity* SuplVel; |
|
1853 TUint16 HorSpeed; |
|
1854 TUint16 Bearing; |
|
1855 TUint8 VertDirection; |
|
1856 TUint8 VertSpeed; |
|
1857 TUint8 UncertSpeed; |
|
1858 TUint8 HorUncertSpeed,VerUncertSpeed; |
|
1859 |
|
1860 iTrace->Trace(_L("Before iPosition->GetVelocity"), KTraceFileName, __LINE__); |
|
1861 TInt ret = iPosition->GetVelocity(SuplVel); |
|
1862 iTrace->Trace(_L("After iPosition->GetVelocity"), KTraceFileName, __LINE__); |
|
1863 if (ret == KErrNone) |
|
1864 { |
|
1865 |
|
1866 VelType = SuplVel->VelType(); |
|
1867 |
|
1868 HorizVel = SuplVel->Velocity(); |
|
1869 |
|
1870 switch(VelType) |
|
1871 { |
|
1872 case EHorizVelocity: |
|
1873 { |
|
1874 iTrace->Trace(_L("Start of COMASuplSession::GetPosition(HPositionGenericInfo) velType = EHorizVelocity"), KTraceFileName, __LINE__); |
|
1875 aSuplPosInfo.SetRequestedField(EPositionFieldHorizontalSpeed); |
|
1876 HorizVel->GetHorizVel(Bearing, HorSpeed); |
|
1877 aSuplPosInfo.SetValue(EPositionFieldHorizontalSpeed, (TReal32)HorSpeed); |
|
1878 iTrace->Trace(_L("End of COMASuplSession::GetPosition(HPositionGenericInfo) velType = EHorizVelocity"), KTraceFileName, __LINE__); |
|
1879 break; |
|
1880 } |
|
1881 case EHorizAndVertVelocity: |
|
1882 { |
|
1883 iTrace->Trace(_L("Start of COMASuplSession::GetPosition(HPositionGenericInfo) velType = EHorizAndVertVelocity"), KTraceFileName, __LINE__); |
|
1884 COMASuplHorizAndVertVelocity* horizVertVel = (COMASuplHorizAndVertVelocity*)HorizVel; |
|
1885 horizVertVel->GetHorizAndVertVel(Bearing, HorSpeed, VertDirection, |
|
1886 VertSpeed); |
|
1887 aSuplPosInfo.SetRequestedField(EPositionFieldHorizontalSpeed); |
|
1888 aSuplPosInfo.SetValue(EPositionFieldHorizontalSpeed, (TReal32)HorSpeed); |
|
1889 aSuplPosInfo.SetRequestedField(EPositionFieldVerticalSpeed); |
|
1890 aSuplPosInfo.SetValue(EPositionFieldVerticalSpeed, (TReal32)VertSpeed); |
|
1891 iTrace->Trace(_L("End of COMASuplSession::GetPosition(HPositionGenericInfo) velType = EHorizAndVertVelocity"), KTraceFileName, __LINE__); |
|
1892 break; |
|
1893 } |
|
1894 case EHorizUncertVelocity: |
|
1895 { |
|
1896 iTrace->Trace(_L("Start of COMASuplSession::GetPosition(HPositionGenericInfo) velType = EHorizUncertVelocity"), KTraceFileName, __LINE__); |
|
1897 COMASuplHorizUncertVelocity* horizUncertVel = (COMASuplHorizUncertVelocity*)HorizVel; |
|
1898 aSuplPosInfo.SetRequestedField(EPositionFieldHorizontalSpeed); |
|
1899 horizUncertVel->GetHorizUncertVel(Bearing, HorSpeed, UncertSpeed); |
|
1900 aSuplPosInfo.SetValue(EPositionFieldHorizontalSpeed, (TReal32)HorSpeed); |
|
1901 aSuplPosInfo.SetRequestedField(EPositionFieldHorizontalSpeedError); |
|
1902 aSuplPosInfo.SetValue(EPositionFieldHorizontalSpeedError, (TReal32)UncertSpeed); |
|
1903 iTrace->Trace(_L("End of COMASuplSession::GetPosition(HPositionGenericInfo) velType = EHorizUncertVelocity"), KTraceFileName, __LINE__); |
|
1904 break; |
|
1905 } |
|
1906 case EHorizAndVertUncertVelocity: |
|
1907 { |
|
1908 iTrace->Trace(_L("Start of COMASuplSession::GetPosition(HPositionGenericInfo) velType = EHorizAndVertUncertVelocity"), KTraceFileName, __LINE__); |
|
1909 COMASuplHorizAndVertUncertVelocity* horizVertUncertVel = (COMASuplHorizAndVertUncertVelocity*)HorizVel; |
|
1910 aSuplPosInfo.SetRequestedField(EPositionFieldHorizontalSpeed); |
|
1911 horizVertUncertVel->GetHorizVertUncertVel(Bearing, HorSpeed, |
|
1912 VertDirection, |
|
1913 VertSpeed,HorUncertSpeed,VerUncertSpeed); |
|
1914 aSuplPosInfo.SetValue(EPositionFieldHorizontalSpeed, (TReal32)HorSpeed); |
|
1915 aSuplPosInfo.SetRequestedField(EPositionFieldHorizontalSpeedError); |
|
1916 aSuplPosInfo.SetValue(EPositionFieldHorizontalSpeedError, (TReal32)HorUncertSpeed); |
|
1917 aSuplPosInfo.SetRequestedField(EPositionFieldVerticalSpeed); |
|
1918 aSuplPosInfo.SetValue(EPositionFieldVerticalSpeed, (TReal32)VertSpeed); |
|
1919 aSuplPosInfo.SetRequestedField(EPositionFieldVerticalSpeedError); |
|
1920 aSuplPosInfo.SetValue(EPositionFieldVerticalSpeedError, (TReal32)VerUncertSpeed); |
|
1921 iTrace->Trace(_L("End of COMASuplSession::GetPosition(HPositionGenericInfo) velType = EHorizAndVertUncertVelocity"), KTraceFileName, __LINE__); |
|
1922 break; |
|
1923 } |
|
1924 } |
|
1925 } |
|
1926 TInt aClientTime; |
|
1927 if(iClientQop.GetDelay(aClientTime)!=KErrNotFound) |
|
1928 { |
|
1929 TTimeIntervalSeconds aDelay; |
|
1930 iSessionEndTime.SecondsFrom(iSessionStartTime,aDelay); |
|
1931 |
|
1932 if(aClientTime< aDelay.Int()) |
|
1933 aPositionQualityError=FALSE; |
|
1934 } |
|
1935 |
|
1936 if(aPositionQualityError==FALSE) |
|
1937 return KSuplPositionQualityLoss; |
|
1938 return KErrNone; |
|
1939 } |
|
1940 |
|
1941 |
|
1942 // ----------------------------------------------------------------------------- |
|
1943 // COMASuplSession::HandleOMASuplMessage |
|
1944 // Handles OMA Supl messages & starts processing according to state of session. |
|
1945 // (other items were commented in a header). |
|
1946 // ----------------------------------------------------------------------------- |
|
1947 // |
|
1948 void COMASuplSession::HandleOMASuplMessageL(COMASuplAsnMessageBase* aDecodedAsnMessage,TRequestStatus& aStatus,TInt aSessionIdSeed,TInt aErrorCode) |
|
1949 { |
|
1950 delete iSuplState; |
|
1951 iSuplState = NULL; |
|
1952 |
|
1953 iSETSessionUniqueId = aSessionIdSeed; |
|
1954 iRunRequestStatus = & aStatus; |
|
1955 *iRunRequestStatus = KRequestPending; |
|
1956 |
|
1957 TInt networkMode = 1; |
|
1958 networkMode = GetNetworkModeL(); |
|
1959 |
|
1960 TBuf<64> msg; |
|
1961 if ( networkMode == ECoreAppUIsNetworkConnectionNotAllowed ) |
|
1962 { |
|
1963 msg.Copy(_L("The device is in OFFLINE mode.")); |
|
1964 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1965 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
1966 return; |
|
1967 } |
|
1968 else |
|
1969 { |
|
1970 msg.Copy(_L("The device is in ON LINE mode.")); |
|
1971 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1972 } |
|
1973 |
|
1974 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
|
1975 |
|
1976 if (usage == CSuplSettings::ESuplUsageDisabled) |
|
1977 { |
|
1978 msg.Copy(_L("SUPL Usage is disabled")); |
|
1979 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1980 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
1981 return; |
|
1982 } |
|
1983 |
|
1984 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsnMessage->MessageType(); |
|
1985 |
|
1986 if(messageType == COMASuplAsnMessageBase::ESUPL_INIT && aErrorCode == KErrNone) |
|
1987 { |
|
1988 HandleOMASuplMessageL(aDecodedAsnMessage); |
|
1989 } |
|
1990 else //Other messages than SUPL_INIT.... Send End |
|
1991 { |
|
1992 CreateCloneMessageL(aDecodedAsnMessage); |
|
1993 UpdateSuplSessionIDL(); |
|
1994 |
|
1995 iSuplSessionState = ESUPL_INITIALIZED; |
|
1996 iSuplMsgType = ESUPL_END; |
|
1997 |
|
1998 if((aErrorCode == KErrCompletion && messageType == COMASuplAsnMessageBase::ESUPL_INIT) || |
|
1999 (aErrorCode == KErrOMASuplOutOfRangeParameter && messageType == COMASuplAsnMessageBase::ESUPL_INIT) || |
|
2000 (aErrorCode == KErrOMASuplMessageLengthMismatch && messageType == COMASuplAsnMessageBase::ESUPL_INIT) || |
|
2001 (aErrorCode == KErrOMASuplShortFrame && messageType == COMASuplAsnMessageBase::ESUPL_INIT)) |
|
2002 { |
|
2003 iErrorStatusCode = COMASuplEnd::EUnexpectedDataValue; |
|
2004 if(aErrorCode == KErrOMASuplMessageLengthMismatch) |
|
2005 { |
|
2006 iErrorStatusCode = COMASuplEnd::EProtocolError; |
|
2007 } |
|
2008 if(aErrorCode == KErrOMASuplShortFrame) |
|
2009 { |
|
2010 iErrorStatusCode = COMASuplEnd::EDataMissing; |
|
2011 } |
|
2012 TInt len = iHSLPAddress.Length(); |
|
2013 HBufC8 *hslpAdress = NULL; |
|
2014 if(len > 0) |
|
2015 { |
|
2016 hslpAdress = HBufC8::NewL(iHSLPAddress.Length()); |
|
2017 hslpAdress->Des().Copy(iHSLPAddress); |
|
2018 } |
|
2019 |
|
2020 else if(len ==0) |
|
2021 { |
|
2022 iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__); |
|
2023 hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length()); |
|
2024 CleanupStack::PushL(hslpAdress); |
|
2025 hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi()); |
|
2026 CleanupStack::Pop(hslpAdress); |
|
2027 } |
|
2028 CleanupStack::PushL(hslpAdress); |
|
2029 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress); |
|
2030 CleanupStack::PopAndDestroy(hslpAdress); |
|
2031 } |
|
2032 else |
|
2033 { |
|
2034 iErrorStatusCode = COMASuplEnd::EUnexpectedMessage; |
|
2035 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl); |
|
2036 } |
|
2037 |
|
2038 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
|
2039 iSuplState->SetMsgStateObserver(this); |
|
2040 //SMP Changes |
|
2041 iSuplSessionState = ESUPL_GENERATE; |
|
2042 iSuplState->GenerateMessageL(); |
|
2043 |
|
2044 } |
|
2045 } |
|
2046 |
|
2047 // ----------------------------------------------------------------------------- |
|
2048 // COMASuplSession::HandleOMASuplMessage |
|
2049 // Handles OMA Supl messages & starts processing according to state of session. |
|
2050 // (other items were commented in a header). |
|
2051 // ----------------------------------------------------------------------------- |
|
2052 // |
|
2053 void COMASuplSession::HandleOMASuplMessageL(COMASuplAsnMessageBase* aDecodedAsnMessage) |
|
2054 { |
|
2055 if(CheckProtocolVersionL(aDecodedAsnMessage)) //Checks version with supported version |
|
2056 { |
|
2057 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsnMessage->MessageType(); |
|
2058 CreateCloneMessageL(aDecodedAsnMessage); |
|
2059 if(messageType != COMASuplAsnMessageBase::ESUPL_POS) |
|
2060 { |
|
2061 iCompleteSelfRequestor->CompleteSelf(); //This will result in call of RequestCompleted() |
|
2062 } |
|
2063 else |
|
2064 { |
|
2065 RequestCompletedL(); |
|
2066 } |
|
2067 } |
|
2068 } |
|
2069 |
|
2070 // ----------------------------------------------------------------------------- |
|
2071 // COMASuplSession::RequestCompleted |
|
2072 // |
|
2073 // (other items were commented in a header). |
|
2074 // ----------------------------------------------------------------------------- |
|
2075 // |
|
2076 void COMASuplSession::RequestCompletedL() |
|
2077 { |
|
2078 //Start Next Processing...... |
|
2079 iTrace->Trace(_L("COMASuplSession::RequestCompleted...Retriving message type"), KTraceFileName, __LINE__); |
|
2080 |
|
2081 COMASuplAsnMessageBase::TSuplMessageType messageType = iDecodedAsnMessage->MessageType(); |
|
2082 |
|
2083 switch(messageType) |
|
2084 { |
|
2085 case COMASuplAsnMessageBase::ESUPL_RESPONSE: |
|
2086 { |
|
2087 iSuplSessionState = ESUPL_RECEIVED; |
|
2088 iTrace->Trace(_L("Received Message is of SUPL_RESPONSE type..."), KTraceFileName, __LINE__); |
|
2089 CancelAllOperations(); |
|
2090 if(iSuplMsgType == ESUPL_START) |
|
2091 { |
|
2092 iSuplMsgType = ESUPL_RESPONSE; |
|
2093 ProcessSuplResponseL(); |
|
2094 } |
|
2095 else |
|
2096 { |
|
2097 iTrace->Trace(_L("COMASuplSession::RequestCompletedL...Protocol Error..."), KTraceFileName, __LINE__); |
|
2098 // Send SUPL End with Protocol Error |
|
2099 HandleSuplErrorL(KErrOMASuplProtocolError); |
|
2100 } |
|
2101 break; |
|
2102 |
|
2103 } |
|
2104 case COMASuplAsnMessageBase::ESUPL_POS: |
|
2105 { |
|
2106 iTrace->Trace(_L("Received Message is of SUPL_POS type..."), KTraceFileName, __LINE__); |
|
2107 if(iOMASuplPOSRequestor) // |
|
2108 { |
|
2109 //if(((iSuplMsgType == ESUPL_POS || iSuplMsgType == ESUPL_POSINIT)) && !IsLastPOSMessage()) |
|
2110 if(((iSuplMsgType == ESUPL_POS || iSuplMsgType == ESUPL_POSINIT))) //Changed for SUPL_POS after UT3 |
|
2111 { |
|
2112 iSuplMsgType = ESUPL_POS; |
|
2113 iTimer->StopTimer(); // Added by Manish |
|
2114 iSuplState->StopTimer(); |
|
2115 ProcessSuplPosL(); |
|
2116 } |
|
2117 else |
|
2118 { |
|
2119 iSuplSessionState = ESUPL_RECEIVED; |
|
2120 CancelAllOperations(); |
|
2121 iTrace->Trace(_L("COMASuplSession::RequestCompletedL...Protocol Error..."), KTraceFileName, __LINE__); |
|
2122 // Send SUPL End with Protocol Error |
|
2123 HandleSuplErrorL(KErrOMASuplProtocolError); |
|
2124 } |
|
2125 } |
|
2126 else // POS is not there |
|
2127 { |
|
2128 iSuplSessionState = ESUPL_RECEIVED; |
|
2129 CancelAllOperations(); |
|
2130 iTrace->Trace(_L("COMASuplSession::RequestCompletedL...Protocol Error..."), KTraceFileName, __LINE__); |
|
2131 // Send SUPL End with Protocol Error |
|
2132 HandleSuplErrorL(KErrOMASuplProtocolError); |
|
2133 } |
|
2134 break; |
|
2135 } |
|
2136 case COMASuplAsnMessageBase::ESUPL_END: |
|
2137 { |
|
2138 iSuplSessionState = ESUPL_RECEIVED; |
|
2139 iTrace->Trace(_L("Received Message is of SUPL_END type..."), KTraceFileName, __LINE__); |
|
2140 CancelAllOperations(); |
|
2141 //Close Connection--- Bug fix |
|
2142 iConnRequestor->CloseConnection(); |
|
2143 iPortNum = 0; |
|
2144 if(IsGenerationInProgress()) //Check is generation going on |
|
2145 { |
|
2146 // Invoke SessionTerminate |
|
2147 iSessionObserver.TerminateSession(this, KErrCompletion); |
|
2148 break; |
|
2149 } |
|
2150 |
|
2151 if(iSuplMsgType != ESUPL_END) |
|
2152 { |
|
2153 iSuplMsgType = ESUPL_END; //::POS:: |
|
2154 ProcessSuplEndL(); |
|
2155 } |
|
2156 break; |
|
2157 } |
|
2158 |
|
2159 case COMASuplAsnMessageBase::ESUPL_INIT: //::POS:: |
|
2160 { |
|
2161 iTrace->Trace(_L("Received Message is of ESUPL_INIT type..."), KTraceFileName, __LINE__); |
|
2162 iSuplSessionState = ESUPL_RECEIVED; |
|
2163 CancelAllOperations(); |
|
2164 iSuplMsgType = ESUPL_INIT; //::POS:: |
|
2165 ProcessSuplInitL(); |
|
2166 break; |
|
2167 } |
|
2168 |
|
2169 case COMASuplAsnMessageBase::ESUPL_AUTH_REQ: |
|
2170 case COMASuplAsnMessageBase::ESUPL_AUTH_RESP: |
|
2171 { |
|
2172 iTrace->Trace(_L("Received Message is of ESUPL_AUTH_RESPONCE/ESUPL_AUTH_REQ type..."), KTraceFileName, __LINE__); |
|
2173 iSuplSessionState = ESUPL_RECEIVED; |
|
2174 CancelAllOperations(); |
|
2175 iSuplMsgType = ESUPL_AUTH_RESP; |
|
2176 ProcessSuplAuthResponceL(); |
|
2177 break; |
|
2178 } |
|
2179 |
|
2180 default: |
|
2181 { |
|
2182 iSuplSessionState = ESUPL_RECEIVED; |
|
2183 iTrace->Trace(_L("Received Message is of UNKNOWN type..."), KTraceFileName, __LINE__); |
|
2184 CancelAllOperations(); |
|
2185 HandleSuplErrorL(KErrOMASuplProtocolError); |
|
2186 break; |
|
2187 |
|
2188 } |
|
2189 } |
|
2190 } |
|
2191 |
|
2192 |
|
2193 // ----------------------------------------------------------------------------- |
|
2194 // COMASuplSession::CancelAllOperations |
|
2195 // |
|
2196 // (other items were commented in a header). |
|
2197 // ----------------------------------------------------------------------------- |
|
2198 // |
|
2199 void COMASuplSession::CancelAllOperations() |
|
2200 { |
|
2201 if(iSuplState) |
|
2202 { |
|
2203 iSuplState->CancelOperation(); |
|
2204 } |
|
2205 |
|
2206 iConnRequestor->Cancel(); |
|
2207 iCompleteSelfRequestor->Cancel(); |
|
2208 |
|
2209 if(iOMASuplPOSRequestor) |
|
2210 iOMASuplPOSRequestor->Cancel(); |
|
2211 |
|
2212 iTimer->StopTimer(); |
|
2213 } |
|
2214 |
|
2215 // ----------------------------------------------------------------------------- |
|
2216 // COMASuplSession::ProcessSuplResponse |
|
2217 // Process SUPL RESPONSE |
|
2218 // (other items were commented in a header). |
|
2219 // ----------------------------------------------------------------------------- |
|
2220 // |
|
2221 void COMASuplSession::ProcessSuplResponseL() |
|
2222 { |
|
2223 iTrace->Trace(_L("Processing SUPL Response..."), KTraceFileName, __LINE__); |
|
2224 |
|
2225 // Recreate SUPL STATE |
|
2226 delete iSuplState; |
|
2227 iSuplState = NULL; |
|
2228 |
|
2229 iSuplState = COMASuplResponseState::NewL(); |
|
2230 iSuplState->SetVersion(iSuplVersion); |
|
2231 TInt err = iSuplState->ProcessMessageL(iDecodedAsnMessage); |
|
2232 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplReceived); |
|
2233 iSuplMsgType = ESUPL_RESPONSE; |
|
2234 |
|
2235 iPosMethod = static_cast<COMASuplResponseState *>(iSuplState)->GetPosMethod(); |
|
2236 |
|
2237 TBuf<128> msg(_L("ProcessSuplResponseL() got iPosMethod: ")); |
|
2238 msg.AppendNum(iPosMethod); |
|
2239 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
2240 if(KErrNone == err) |
|
2241 { |
|
2242 iSuplSessionState = ESUPL_GENERATE; |
|
2243 UpdateSuplSessionIDL(); |
|
2244 OperationCompleteL(KErrNone); |
|
2245 } |
|
2246 else |
|
2247 { |
|
2248 HandleSuplErrorL(err); |
|
2249 } |
|
2250 |
|
2251 } |
|
2252 |
|
2253 // ----------------------------------------------------------------------------- |
|
2254 // COMASuplSession::ProcessSuplPosL |
|
2255 // Process SUPL POS |
|
2256 // (other items were commented in a header). |
|
2257 // ----------------------------------------------------------------------------- |
|
2258 // |
|
2259 void COMASuplSession::ProcessSuplPosL() |
|
2260 { |
|
2261 iTrace->Trace(_L("Processing SUPL Pos..."), KTraceFileName, __LINE__); |
|
2262 TInt error = KErrNone; |
|
2263 |
|
2264 // Recreate SUPL STATE if the previous state was not ESUPL_POS |
|
2265 if(iSuplState) |
|
2266 { |
|
2267 if(COMASuplState::ESUPL_POS != iSuplState->GetSuplState()) |
|
2268 { |
|
2269 delete iSuplState; |
|
2270 iSuplState = NULL; |
|
2271 |
|
2272 iSuplState = COMASuplPosState::NewL(iPOSSession,iUT3_PosTimer,iSETCapabilities,iOMASuplAsnHandlerBaseImpl); |
|
2273 } |
|
2274 |
|
2275 iSuplState->SetVersion(iSuplVersion); |
|
2276 error = iSuplState->ProcessMessageL(iDecodedAsnMessage); |
|
2277 |
|
2278 //This is for generating SUPL_POS, after UT3 timer started & received SUPL_POS. |
|
2279 |
|
2280 //!iIsFirstPOSMessage this is for putting new request if we |
|
2281 //gets SUPL_POS even if first POS message from SET failed to generate data |
|
2282 if( KErrNone == error && ( IsLastPOSMessage() || !iIsFirstPOSMessage )) |
|
2283 { |
|
2284 iTrace->Trace(_L("Generating POS ... After starting UT3 OR After failing of Generation of first POS message..."), KTraceFileName, __LINE__); |
|
2285 iSuplMsgType = ESUPL_POS; |
|
2286 iSuplSessionState = ESUPL_GENERATE; |
|
2287 GenerateSuplMessageL(); |
|
2288 iSuplSessionState = ESUPL_ENCODE; |
|
2289 } |
|
2290 } |
|
2291 |
|
2292 if(KErrNone != error) |
|
2293 { |
|
2294 TBuf<64> msg(_L("Error while Processing SUPL Pos is : ")); |
|
2295 msg.AppendNum(error); |
|
2296 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
2297 HandleSuplErrorL(error); |
|
2298 } |
|
2299 |
|
2300 } |
|
2301 |
|
2302 // ----------------------------------------------------------------------------- |
|
2303 // COMASuplSession::ProcessSuplEndL |
|
2304 // Process SUPL RESPONSE |
|
2305 // (other items were commented in a header). |
|
2306 // ----------------------------------------------------------------------------- |
|
2307 // |
|
2308 void COMASuplSession::ProcessSuplEndL() |
|
2309 { |
|
2310 iTrace->Trace(_L("COMASuplSession::ProcessSuplEndL..."), KTraceFileName, __LINE__); |
|
2311 |
|
2312 // Recreate SUPL STATE |
|
2313 delete iSuplState; |
|
2314 iSuplState = NULL; |
|
2315 |
|
2316 iSuplState = COMASuplEndState::NewL(COMASuplEnd::EUnspecified,iOMASuplAsnHandlerBaseImpl); |
|
2317 iSuplState->SetVersion(iSuplVersion); |
|
2318 TInt err = iSuplState->ProcessMessageL(iDecodedAsnMessage); |
|
2319 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplReceived); |
|
2320 |
|
2321 LogEndTime(); //Log end time if QoP & delay in Qop is present. |
|
2322 |
|
2323 if(KErrOMASuplVersionNotMatching != err) //KErrNone == err)..changed for new requirement... |
|
2324 // Even if there is status code in SUPL_END ... still process SUPL_END |
|
2325 { |
|
2326 if(iRequestType == COMASuplSession::ESUPL_TERMINAL) |
|
2327 { |
|
2328 // Delete Position |
|
2329 delete iPosition; |
|
2330 iPosition = NULL; |
|
2331 |
|
2332 COMASuplEndState *currState = static_cast <COMASuplEndState *>(iSuplState); |
|
2333 COMASuplEnd::TOMASuplStatusCode statusCode = currState->GetStatusCode(); |
|
2334 |
|
2335 if (statusCode == COMASuplEnd::EPosMethodMismatch) |
|
2336 { |
|
2337 iFailedCaps = iAllowedCapabilities; |
|
2338 iCapsFail = ETrue; |
|
2339 } |
|
2340 |
|
2341 // Retrieve Position |
|
2342 COMASuplPosition *currPosition = currState->GetPosition(); |
|
2343 if(currPosition) //Position is in SUPL_END |
|
2344 { |
|
2345 |
|
2346 iPosition =static_cast <COMASuplPosition *>(currPosition->CloneL()); |
|
2347 |
|
2348 if(KErrNone == err) |
|
2349 { |
|
2350 iTrace->Trace(_L("Received SUPL_END Without Status Code"), KTraceFileName, __LINE__); |
|
2351 // Invoke SessionTerminate |
|
2352 iSessionObserver.TerminateSession(this,KErrNone); |
|
2353 } |
|
2354 else // Position & status code is present...thats why completing with KErrCompletion. |
|
2355 { |
|
2356 iTrace->Trace(_L("Received SUPL_END With Status Code"), KTraceFileName, __LINE__); |
|
2357 // Invoke SessionTerminate |
|
2358 // Changed error code as location Fw uses position if it completes with +ve value. //KErrCompletion |
|
2359 iSessionObserver.TerminateSession(this,KSuplPositionPresent); |
|
2360 } |
|
2361 } |
|
2362 else |
|
2363 { |
|
2364 if(iOMASuplPOSRequestor) |
|
2365 { |
|
2366 iPosition = COMASuplPosition::NewL(); |
|
2367 iOMASuplPOSRequestor->SetObserver(this); |
|
2368 err = iOMASuplPOSRequestor->GetPositionL(iPosition); |
|
2369 if(err != KErrNone) |
|
2370 { |
|
2371 delete iPosition; |
|
2372 iPosition = NULL; |
|
2373 // Invoke SessionTerminate |
|
2374 iSessionObserver.TerminateSession(this, err); |
|
2375 } |
|
2376 } |
|
2377 |
|
2378 else //Position && iOMASuplPOSRequestor are not there |
|
2379 { |
|
2380 // Invoke SessionTerminate |
|
2381 iSessionObserver.TerminateSession(this, KErrNone); |
|
2382 } |
|
2383 |
|
2384 } |
|
2385 } |
|
2386 else |
|
2387 { |
|
2388 // Invoke SessionTerminate //Close session |
|
2389 iSessionObserver.TerminateSession(this, KErrNone); |
|
2390 } |
|
2391 } |
|
2392 else |
|
2393 { |
|
2394 // Handle Error |
|
2395 HandleSuplErrorL(err); |
|
2396 } |
|
2397 } |
|
2398 |
|
2399 |
|
2400 // ----------------------------------------------------------------------------- |
|
2401 // COMASuplSession::ProcessSuplInitL |
|
2402 // Process SUPL INIT |
|
2403 // (other items were commented in a header). |
|
2404 // ----------------------------------------------------------------------------- |
|
2405 // |
|
2406 void COMASuplSession::ProcessSuplInitL() |
|
2407 { |
|
2408 iTrace->Trace(_L("COMASuplSession::ProcessSuplInitL..."), KTraceFileName, __LINE__); |
|
2409 |
|
2410 TInt ret = ServerAddressCheckForSuplInitL(); |
|
2411 if(ret != KErrNone) |
|
2412 { |
|
2413 HandleSuplErrorL(KErrGeneral); |
|
2414 return; |
|
2415 } |
|
2416 |
|
2417 // Recreate SUPL STATE |
|
2418 delete iSuplState; |
|
2419 iSuplState = NULL; |
|
2420 UpdateSuplSessionIDL(); |
|
2421 iSuplState = COMASuplInitState::NewL(iPrivacyTimer,iHSLPAddress,*this,iSETMode,iNetworkPrivacy); |
|
2422 iSuplState->SetVersion(iSuplVersion); |
|
2423 TInt err = iSuplState->ProcessMessageL(iDecodedAsnMessage);//will result in PrivacyCheckCompleteL |
|
2424 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplReceived); |
|
2425 |
|
2426 iPosMethod = static_cast<COMASuplInitState*>(iSuplState)->GetPosMethod(); |
|
2427 |
|
2428 TBuf<128> msg(_L("COMASuplSession::ProcessSuplInitL() got iPosMethod : ")); |
|
2429 msg.AppendNum(iPosMethod); |
|
2430 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
2431 if(KErrOMASuplNoPosition == err) |
|
2432 { |
|
2433 HandleSuplInitErrorL(KErrOMASuplNoPosition); |
|
2434 return; |
|
2435 } |
|
2436 |
|
2437 if(KErrNone != err) |
|
2438 { |
|
2439 HandleSuplErrorL(err); |
|
2440 } |
|
2441 } |
|
2442 |
|
2443 // ----------------------------------------------------------------------------- |
|
2444 // COMASuplSession::ProcessSuplAuthResponceL |
|
2445 // Process SUPL AUTH RESPONSE |
|
2446 // (other items were commented in a header). |
|
2447 // ----------------------------------------------------------------------------- |
|
2448 // |
|
2449 void COMASuplSession::ProcessSuplAuthResponceL() |
|
2450 { |
|
2451 // No need to create state class object for now.... |
|
2452 // if needed in future ... we can write it...since it will add more code which is |
|
2453 //equivalent to current implementation. |
|
2454 |
|
2455 delete iSuplState; |
|
2456 iSuplState = NULL; |
|
2457 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplReceived); // inform to POS |
|
2458 HandleSuplErrorL(KErrOMASuplProtocolError); |
|
2459 } |
|
2460 // ----------------------------------------------------------------------------- |
|
2461 // COMASuplSession::UpdateSuplSessionIDL |
|
2462 // Update SLP Sesssion ID with rececived slp id. |
|
2463 // (other items were commented in a header). |
|
2464 // ----------------------------------------------------------------------------- |
|
2465 // |
|
2466 void COMASuplSession::UpdateSuplSessionIDL() |
|
2467 { |
|
2468 iTrace->Trace(_L("COMASuplSession::UpdateSuplSessionIDL"), KTraceFileName, __LINE__); |
|
2469 COMASuplSessionID* retrivedSessionID = NULL; |
|
2470 |
|
2471 if(!iDecodedAsnMessage) |
|
2472 return; |
|
2473 |
|
2474 iDecodedAsnMessage->SessionId(retrivedSessionID); |
|
2475 UpdateSLPSessionIDL(retrivedSessionID); |
|
2476 |
|
2477 } |
|
2478 |
|
2479 // ----------------------------------------------------------------------------- |
|
2480 // COMASuplSession::UpdateSessionID |
|
2481 // Update SLP Sesssion ID with received session ID. |
|
2482 // (other items were commented in a header). |
|
2483 // ----------------------------------------------------------------------------- |
|
2484 // |
|
2485 void COMASuplSession::UpdateSLPSessionIDL(COMASuplSessionID *aSessionID) |
|
2486 { |
|
2487 iTrace->Trace(_L("Start of COMASuplSession::UpdateSLPSessionIDL"), KTraceFileName, __LINE__); |
|
2488 if(aSessionID) |
|
2489 { |
|
2490 COMASuplSLPSessionID* suplSLPID = NULL; |
|
2491 aSessionID->SLPSessionID(suplSLPID); |
|
2492 |
|
2493 if(suplSLPID) |
|
2494 { |
|
2495 TBuf8<KSLPSessionID> sessionId; |
|
2496 COMASuplSLPSessionID* slpNewSessionId = COMASuplSLPSessionID::NewL(); |
|
2497 CleanupStack::PushL(slpNewSessionId); |
|
2498 COMASuplSLPAddress* slpNewIPAddress = COMASuplSLPAddress::NewL(); |
|
2499 CleanupStack::Pop(slpNewSessionId); |
|
2500 |
|
2501 COMASuplSLPAddress* slpIPAddress = NULL; |
|
2502 suplSLPID->SuplSLPSessionID(sessionId,slpIPAddress); |
|
2503 slpNewSessionId->SetSuplSLPSessionID(sessionId,slpNewIPAddress); |
|
2504 |
|
2505 if(slpIPAddress) |
|
2506 { |
|
2507 COMASuplSLPAddress::TSuplSLPAddressType addressType = slpIPAddress->SLPAddressType(); |
|
2508 if(addressType == COMASuplSLPAddress::EFqdn) |
|
2509 { |
|
2510 HBufC8* fqdn = NULL; |
|
2511 TInt err = slpIPAddress->Fqdn(fqdn); |
|
2512 if(err == KErrNone) |
|
2513 { |
|
2514 //Ownership transfer towords COMASuplSLPAddress |
|
2515 HBufC8* newFqdn = fqdn->AllocL(); |
|
2516 slpNewIPAddress->SetFqdn(newFqdn); |
|
2517 } |
|
2518 } |
|
2519 |
|
2520 if( addressType == COMASuplSLPAddress::EIPv4Address ) |
|
2521 { |
|
2522 TBuf8<KIPv4Address> ipAddress; |
|
2523 TInt err = slpIPAddress->IPvAddress(ipAddress); |
|
2524 if(err == KErrNone) |
|
2525 slpNewIPAddress->SetIPv4Address(ipAddress); |
|
2526 } |
|
2527 |
|
2528 if(addressType == COMASuplSLPAddress::EIPv6Address ) |
|
2529 { |
|
2530 TBuf8<KIPv6Address> ipAddress; |
|
2531 TInt err = slpIPAddress->IPvAddress(ipAddress); |
|
2532 if(err == KErrNone) |
|
2533 slpNewIPAddress->SetIPv6Address(ipAddress); |
|
2534 } |
|
2535 } |
|
2536 |
|
2537 iSuplSessionId->SetSLPSessionID(slpNewSessionId); |
|
2538 } |
|
2539 |
|
2540 ///////////log ////////////////// |
|
2541 |
|
2542 #if defined(_DEBUG) //This is only for logging purpose. |
|
2543 iTrace->Trace(_L("After UpdateSuplSessionIDL"), KTraceFileName, __LINE__); |
|
2544 TBuf<128> msg; |
|
2545 COMASuplSETSessionID* suplSETID = NULL; |
|
2546 iSuplSessionId->SETSessionID(suplSETID); |
|
2547 |
|
2548 COMASuplSLPSessionID* suplSlpID = NULL; |
|
2549 iSuplSessionId->SLPSessionID(suplSlpID); |
|
2550 |
|
2551 //SET Part |
|
2552 if(suplSETID) |
|
2553 { |
|
2554 msg.Copy(_L("SET Session ID : ")); |
|
2555 TBuf<4> id; |
|
2556 TInt SETSessionID; |
|
2557 TBuf8<32> IPvAddress8; |
|
2558 TBuf<32> ipAddress; |
|
2559 suplSETID->SuplSETSessionID(SETSessionID,IPvAddress8); |
|
2560 |
|
2561 TLex8 lex(IPvAddress8); |
|
2562 TChar chr; |
|
2563 |
|
2564 chr = lex.Get(); |
|
2565 TUint i = chr; |
|
2566 ipAddress.AppendNum(i); |
|
2567 ipAddress.Append(_L(".")); |
|
2568 |
|
2569 chr = lex.Get(); |
|
2570 i = chr; |
|
2571 ipAddress.AppendNum(i); |
|
2572 ipAddress.Append(_L(".")); |
|
2573 |
|
2574 chr = lex.Get(); |
|
2575 i = chr; |
|
2576 ipAddress.AppendNum(i); |
|
2577 ipAddress.Append(_L(".")); |
|
2578 |
|
2579 chr = lex.Get(); |
|
2580 i = chr; |
|
2581 ipAddress.AppendNum(i); |
|
2582 |
|
2583 id.AppendNum(SETSessionID); |
|
2584 msg.Append(id); |
|
2585 msg.Append(_L(" IPAddress/IMSI :")); |
|
2586 msg.Append(ipAddress); |
|
2587 } |
|
2588 else |
|
2589 { |
|
2590 msg.Copy(_L("SET Session Id is not set.")); |
|
2591 } |
|
2592 |
|
2593 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
2594 |
|
2595 //SLP Part |
|
2596 if(suplSlpID) |
|
2597 { |
|
2598 msg.Copy(_L("SLP Session ID : ")); |
|
2599 TBuf8<4> sessionId8; |
|
2600 TBuf<32> sessionId; |
|
2601 TBuf8<64> ipAddress8(_L8("No Address field in SLP Session ID")); |
|
2602 TBuf<64> ipAddress; |
|
2603 |
|
2604 COMASuplSLPAddress* slpIPAddress = NULL; |
|
2605 suplSlpID->SuplSLPSessionID(sessionId8,slpIPAddress); |
|
2606 |
|
2607 if(slpIPAddress) |
|
2608 { |
|
2609 TInt err = slpIPAddress->IPvAddress(ipAddress8); |
|
2610 if(err != KErrNone) |
|
2611 { |
|
2612 msg.Copy(_L("SLP Address is not set.")); |
|
2613 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
2614 return; |
|
2615 } |
|
2616 } |
|
2617 |
|
2618 TLex8 lex(ipAddress8); |
|
2619 TChar chr; |
|
2620 |
|
2621 chr = lex.Get(); |
|
2622 TUint i = chr; |
|
2623 ipAddress.AppendNum(i); |
|
2624 ipAddress.Append(_L(".")); |
|
2625 |
|
2626 chr = lex.Get(); |
|
2627 i = chr; |
|
2628 ipAddress.AppendNum(i); |
|
2629 ipAddress.Append(_L(".")); |
|
2630 |
|
2631 chr = lex.Get(); |
|
2632 i = chr; |
|
2633 ipAddress.AppendNum(i); |
|
2634 ipAddress.Append(_L(".")); |
|
2635 |
|
2636 chr = lex.Get(); |
|
2637 i = chr; |
|
2638 ipAddress.AppendNum(i); |
|
2639 |
|
2640 TLex8 lex1(sessionId8); |
|
2641 for(i = 0; i < 4; ++i) |
|
2642 { |
|
2643 chr = lex1.Get(); |
|
2644 TUint num = chr; |
|
2645 sessionId.Append(chr); |
|
2646 } |
|
2647 |
|
2648 msg.Append(sessionId); |
|
2649 msg.Append(_L(" IPAddress : ")); |
|
2650 msg.Append(ipAddress); |
|
2651 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
2652 |
|
2653 } |
|
2654 else |
|
2655 { |
|
2656 msg.Copy(_L("SLP Session Id is not set.")); |
|
2657 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
2658 } |
|
2659 |
|
2660 #endif |
|
2661 //////////////////////////////// |
|
2662 } |
|
2663 } |
|
2664 |
|
2665 // ----------------------------------------------------------------------------- |
|
2666 // COMASuplSession::UpdateSETSessionID |
|
2667 // Update SET Sesssion ID with received session ID. |
|
2668 // (other items were commented in a header). |
|
2669 // ----------------------------------------------------------------------------- |
|
2670 // |
|
2671 void COMASuplSession::UpdateSETSessionIDL(COMASuplSessionID *aSessionID) |
|
2672 { |
|
2673 |
|
2674 iTrace->Trace(_L("Start of COMASuplSession::UpdateSETSessionIDL"), KTraceFileName, __LINE__); |
|
2675 if(aSessionID) |
|
2676 { |
|
2677 COMASuplSETSessionID* retrivedSETSessionId = NULL; |
|
2678 aSessionID->SETSessionID(retrivedSETSessionId); |
|
2679 |
|
2680 if(retrivedSETSessionId) |
|
2681 { |
|
2682 COMASuplSETSessionID::TSuplSETIDType addressType = retrivedSETSessionId->SuplSETIDType(); |
|
2683 |
|
2684 if(addressType == COMASuplSETSessionID::EIPv4Address) |
|
2685 { |
|
2686 TInt sessionUniqueNo; |
|
2687 TBuf8<KIP4AddressLength> IPvAddress; |
|
2688 retrivedSETSessionId->SuplSETSessionID(sessionUniqueNo,IPvAddress); |
|
2689 |
|
2690 COMASuplSETSessionID* suplSETSessionId = NULL; |
|
2691 iSuplSessionId->SETSessionID(suplSETSessionId); |
|
2692 suplSETSessionId->SetSuplSETSessionIDIPv4(sessionUniqueNo,IPvAddress); |
|
2693 iSessionIDFlag = ETrue; |
|
2694 } |
|
2695 else if(addressType == COMASuplSETSessionID::EIPv6Address) |
|
2696 { |
|
2697 TInt sessionUniqueNo; |
|
2698 TBuf8<KIP6AddressLength> IPvAddress; |
|
2699 retrivedSETSessionId->SuplSETSessionID(sessionUniqueNo,IPvAddress); |
|
2700 |
|
2701 COMASuplSETSessionID* suplSETSessionId = NULL; |
|
2702 iSuplSessionId->SETSessionID(suplSETSessionId); |
|
2703 suplSETSessionId->SetSuplSETSessionIDIPv6(sessionUniqueNo,IPvAddress); |
|
2704 iSessionIDFlag = ETrue; |
|
2705 } |
|
2706 else // IMSI |
|
2707 { |
|
2708 TInt sessionUniqueNo; |
|
2709 TBuf8<KIMSILength> IMSI; |
|
2710 retrivedSETSessionId->SuplSETSessionID(sessionUniqueNo, IMSI); |
|
2711 |
|
2712 COMASuplSETSessionID* suplSETSessionId = NULL; |
|
2713 iSuplSessionId->SETSessionID(suplSETSessionId); |
|
2714 suplSETSessionId->SetSuplSETSessionIDIMSI(sessionUniqueNo, IMSI); |
|
2715 iSessionIDFlag = ETrue; |
|
2716 } |
|
2717 } |
|
2718 } |
|
2719 iTrace->Trace(_L("End of COMASuplSession::UpdateSETSessionIDL"), KTraceFileName, __LINE__); |
|
2720 } |
|
2721 |
|
2722 // ----------------------------------------------------------------------------- |
|
2723 // COMASuplSession::CreateCloneMessageL |
|
2724 // Creates Clone of COMASuplAsnMessageBase |
|
2725 // (other items were commented in a header). |
|
2726 // ----------------------------------------------------------------------------- |
|
2727 // |
|
2728 void COMASuplSession::CreateCloneMessageL(COMASuplAsnMessageBase* aDecodedAsnMessage) |
|
2729 { |
|
2730 iTrace->Trace(_L("COMASuplSession::CreateCloneMessageL"), KTraceFileName, __LINE__); |
|
2731 delete iDecodedAsnMessage; |
|
2732 iDecodedAsnMessage = NULL; |
|
2733 |
|
2734 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsnMessage->MessageType(); |
|
2735 TInt error; |
|
2736 switch(messageType) |
|
2737 { |
|
2738 case COMASuplAsnMessageBase::ESUPL_START: |
|
2739 iTrace->Trace(_L("COMASuplSession::CreateCloneMessageL : ESUPL_START"), KTraceFileName, __LINE__); |
|
2740 iDecodedAsnMessage = COMASuplStart::NewL(); |
|
2741 iDecodedAsnMessage->Clone(aDecodedAsnMessage,error); |
|
2742 break; |
|
2743 case COMASuplAsnMessageBase::ESUPL_RESPONSE: |
|
2744 iTrace->Trace(_L("COMASuplSession::CreateCloneMessageL : ESUPL_RESPONSE"), KTraceFileName, __LINE__); |
|
2745 iDecodedAsnMessage = COMASuplResponse::NewL(); |
|
2746 iDecodedAsnMessage->Clone(aDecodedAsnMessage,error); |
|
2747 break; |
|
2748 case COMASuplAsnMessageBase::ESUPL_POSINIT: |
|
2749 iTrace->Trace(_L("COMASuplSession::CreateCloneMessageL : ESUPL_POSINIT"), KTraceFileName, __LINE__); |
|
2750 iDecodedAsnMessage = COMASuplPosInit::NewL(); |
|
2751 iDecodedAsnMessage->Clone(aDecodedAsnMessage,error); |
|
2752 break; |
|
2753 case COMASuplAsnMessageBase::ESUPL_POS: |
|
2754 iTrace->Trace(_L("COMASuplSession::CreateCloneMessageL : SUPL_POS"), KTraceFileName, __LINE__); |
|
2755 iDecodedAsnMessage = COMASuplPos::NewL(); |
|
2756 iDecodedAsnMessage->Clone(aDecodedAsnMessage,error); |
|
2757 break; |
|
2758 |
|
2759 case COMASuplAsnMessageBase::ESUPL_END: |
|
2760 iTrace->Trace(_L("COMASuplSession::CreateCloneMessageL : ESUPL_END"), KTraceFileName, __LINE__); |
|
2761 iDecodedAsnMessage = COMASuplEnd::NewL(); |
|
2762 iDecodedAsnMessage->Clone(aDecodedAsnMessage,error); |
|
2763 break; |
|
2764 case COMASuplAsnMessageBase::ESUPL_INIT: |
|
2765 iTrace->Trace(_L("COMASuplSession::CreateCloneMessageL : ESUPL_INIT"), KTraceFileName, __LINE__); |
|
2766 iDecodedAsnMessage = COMASuplInit::NewL(); |
|
2767 iDecodedAsnMessage->Clone(aDecodedAsnMessage,error); |
|
2768 break; |
|
2769 case COMASuplAsnMessageBase::ESUPL_AUTH_RESP: |
|
2770 iTrace->Trace(_L("COMASuplSession::CreateCloneMessageL : ESUPL_AUTH_RESP"), KTraceFileName, __LINE__); |
|
2771 iDecodedAsnMessage = COMASuplAuthResponse::NewL(); |
|
2772 iDecodedAsnMessage->Clone(aDecodedAsnMessage,error); |
|
2773 break; |
|
2774 case COMASuplAsnMessageBase::ESUPL_AUTH_REQ: |
|
2775 iTrace->Trace(_L("COMASuplSession::CreateCloneMessageL : ESUPL_AUTH_RESP"), KTraceFileName, __LINE__); |
|
2776 iDecodedAsnMessage = COMASuplAuthRequest::NewL(); |
|
2777 iDecodedAsnMessage->Clone(aDecodedAsnMessage,error); |
|
2778 break; |
|
2779 |
|
2780 default: |
|
2781 break; |
|
2782 } |
|
2783 } |
|
2784 |
|
2785 // ----------------------------------------------------------------------------- |
|
2786 // COMASuplSession::CancelSession |
|
2787 // Cancels an in-progress RunSession on the Session |
|
2788 // What action to be taken for cancelRunSession will be depend on State of session. |
|
2789 // (other items were commented in a header). |
|
2790 // ----------------------------------------------------------------------------- |
|
2791 // |
|
2792 void COMASuplSession::CancelSession() |
|
2793 { |
|
2794 iTrace->Trace(_L("COMASuplSession::CancelRunSession"), KTraceFileName, __LINE__); |
|
2795 CancelAllOperations(); |
|
2796 iConnRequestor->CancelReadOperation(); |
|
2797 |
|
2798 switch(iSuplSessionState) |
|
2799 { |
|
2800 case ESUPL_INITIALIZED: |
|
2801 case ESUPL_CONNECTING: |
|
2802 case ESUPL_SESSION_ERROR: |
|
2803 { |
|
2804 iSuplSessionState = ESUPL_SESSION_ERROR; |
|
2805 break; |
|
2806 } |
|
2807 |
|
2808 case ESUPL_RECEIVED: |
|
2809 { |
|
2810 iSuplSessionState = ESUPL_SESSION_ERROR; |
|
2811 if(iSuplMsgType == ESUPL_END) |
|
2812 { |
|
2813 if(iOMASuplPOSRequestor) |
|
2814 iOMASuplPOSRequestor->Cancel(); |
|
2815 } |
|
2816 |
|
2817 break; |
|
2818 } |
|
2819 |
|
2820 case ESUPL_GENERATE: |
|
2821 case ESUPL_ENCODE: |
|
2822 { |
|
2823 if(iSuplMsgType == ESUPL_START) //No need to send SUPL_END to SLP |
|
2824 { |
|
2825 iSuplSessionState = ESUPL_SESSION_ERROR; |
|
2826 break; |
|
2827 } |
|
2828 } |
|
2829 case ESUPL_SEND: |
|
2830 { |
|
2831 iErrorStatusCode = COMASuplEnd::EUnspecified; |
|
2832 iSuplSessionState = ESUPL_GENERATE; |
|
2833 iSuplMsgType = ESUPL_END; |
|
2834 if(iOMASuplPOSRequestor) //Reset observer |
|
2835 { |
|
2836 iOMASuplPOSRequestor->SetObserver(NULL); |
|
2837 } |
|
2838 TRAP_IGNORE(GenerateSuplMessageL()); |
|
2839 //iSuplSessionState = ESUPL_SESSION_ERROR; Cancel Bug |
|
2840 break; |
|
2841 } |
|
2842 default: break; |
|
2843 } |
|
2844 |
|
2845 |
|
2846 } |
|
2847 |
|
2848 // ----------------------------------------------------------------------------- |
|
2849 // COMASuplSession::CancelRunSession |
|
2850 // Cancels an in-progress RunSession on the Session |
|
2851 // What action to be taken for cancelRunSession will be depend on State of session. |
|
2852 // (other items were commented in a header). |
|
2853 // ----------------------------------------------------------------------------- |
|
2854 // |
|
2855 void COMASuplSession::CancelRunSession() |
|
2856 { |
|
2857 CancelSession(); |
|
2858 if(iSuplSessionState == ESUPL_SEND) |
|
2859 { |
|
2860 CompleteSession(KErrCancel); |
|
2861 } |
|
2862 else |
|
2863 { |
|
2864 //Close Connection : bug Fix. |
|
2865 iConnRequestor->CloseConnection(); |
|
2866 iPortNum = 0; |
|
2867 iSessionObserver.TerminateSession(this, KErrCancel); |
|
2868 } |
|
2869 |
|
2870 } |
|
2871 // ----------------------------------------------------------------------------- |
|
2872 // COMASuplSession::CancelRunSession |
|
2873 // Cancels an in-progress RunSession on the Session |
|
2874 // What action to be taken for cancelRunSession will be depend on State of session. |
|
2875 // (other items were commented in a header). |
|
2876 // ----------------------------------------------------------------------------- |
|
2877 // |
|
2878 void COMASuplSession::HandleGenerationErrorL(TInt aErr) |
|
2879 { |
|
2880 TBool cancelSendRequestor = ETrue; |
|
2881 if(iSuplState) |
|
2882 { |
|
2883 switch(iSuplState->GetSuplState()) |
|
2884 { |
|
2885 case COMASuplState::ESUPL_START: |
|
2886 { |
|
2887 break; |
|
2888 } |
|
2889 case COMASuplState::ESUPL_POS: |
|
2890 case COMASuplState::ESUPL_POS_INIT: |
|
2891 { |
|
2892 iErrorStatusCode = COMASuplEnd::EUnspecified; |
|
2893 if(aErr == KErrSuplposMethodMismatch) |
|
2894 iErrorStatusCode = COMASuplEnd::EPosProtocolMismatch;//COMASuplEnd::EPosMethodMismatch; |
|
2895 cancelSendRequestor = EFalse; |
|
2896 iSuplSessionState = ESUPL_GENERATE; |
|
2897 iSuplMsgType = ESUPL_END; |
|
2898 GenerateSuplMessageL(); |
|
2899 break; |
|
2900 } |
|
2901 case COMASuplState::ESUPL_END: |
|
2902 { |
|
2903 //Close Connection : bug Fix. |
|
2904 iConnRequestor->CloseConnection(); |
|
2905 iPortNum = 0; |
|
2906 iSessionObserver.TerminateSession(this, aErr); |
|
2907 cancelSendRequestor = EFalse; |
|
2908 break; |
|
2909 } |
|
2910 default: break; |
|
2911 } |
|
2912 } |
|
2913 |
|
2914 if(cancelSendRequestor) |
|
2915 { |
|
2916 CancelAllOperations(); |
|
2917 CleanUp(); |
|
2918 CompleteSession(aErr); |
|
2919 } |
|
2920 |
|
2921 } |
|
2922 // ----------------------------------------------------------------------------- |
|
2923 // COMASuplSession::CancelRunSession |
|
2924 // Cancels an in-progress RunSession on the Session |
|
2925 // What action to be taken for cancelRunSession will be depend on State of session. |
|
2926 // (other items were commented in a header). |
|
2927 // ----------------------------------------------------------------------------- |
|
2928 // |
|
2929 void COMASuplSession::HandleInitilizationErrorL(TInt aErr) |
|
2930 { |
|
2931 CancelAllOperations(); |
|
2932 CleanUp(); |
|
2933 CompleteSession(aErr); |
|
2934 } |
|
2935 |
|
2936 // ----------------------------------------------------------------------------- |
|
2937 // COMASuplSession::CancelRunSession |
|
2938 // Cancels an in-progress RunSession on the Session |
|
2939 // What action to be taken for cancelRunSession will be depend on State of session. |
|
2940 // (other items were commented in a header). |
|
2941 // ----------------------------------------------------------------------------- |
|
2942 // |
|
2943 void COMASuplSession::HandleConnectionErrorL(TInt aErr) |
|
2944 { |
|
2945 CancelAllOperations(); |
|
2946 //Close Connection |
|
2947 iConnRequestor->CloseConnection(); |
|
2948 iPortNum = 0; |
|
2949 iSessionObserver.TerminateSession(this, aErr); |
|
2950 } |
|
2951 |
|
2952 // ----------------------------------------------------------------------------- |
|
2953 // COMASuplSession::CancelRunSession |
|
2954 // Cancels an in-progress RunSession on the Session |
|
2955 // What action to be taken for cancelRunSession will be depend on State of session. |
|
2956 // (other items were commented in a header). |
|
2957 // ----------------------------------------------------------------------------- |
|
2958 // |
|
2959 void COMASuplSession::HandleEncodingErrorL(TInt aErr) |
|
2960 { |
|
2961 TBool cancelSendRequestor = ETrue; |
|
2962 if(iSuplState) |
|
2963 { |
|
2964 iErrorStatusCode = COMASuplEnd::EUnspecified; |
|
2965 |
|
2966 if(aErr == KErrOMASETCapMisMatch ) |
|
2967 { |
|
2968 iErrorStatusCode = COMASuplEnd::EPosMethodMismatch; |
|
2969 iFailedCaps = iAllowedCapabilities; |
|
2970 iCapsFail = ETrue; |
|
2971 } |
|
2972 |
|
2973 if(aErr == KErrSuplposMethodMismatch) |
|
2974 { |
|
2975 iErrorStatusCode = COMASuplEnd::EPosProtocolMismatch; |
|
2976 } |
|
2977 if(aErr == KErrOMAManParamMissing) |
|
2978 { |
|
2979 iErrorStatusCode = COMASuplEnd::EDataMissing; |
|
2980 } |
|
2981 |
|
2982 if(aErr == KErrArgument) |
|
2983 { |
|
2984 iErrorStatusCode = COMASuplEnd::EUnexpectedDataValue; |
|
2985 } |
|
2986 |
|
2987 if(aErr == KErrOMASuplPosInfo || aErr == KErrOMASuplPosInActive || aErr == KErrOMASuplDataMissing) |
|
2988 { |
|
2989 iErrorStatusCode = COMASuplEnd::EDataMissing; |
|
2990 } |
|
2991 |
|
2992 switch(iSuplState->GetSuplState()) |
|
2993 { |
|
2994 case COMASuplState::ESUPL_START:break; |
|
2995 case COMASuplState::ESUPL_POS: |
|
2996 { |
|
2997 //This is for,even though we gets error(no pos payload data) for first POS message from plugin |
|
2998 // Just ignore it ... Don't put new pending request for POS message plugin. |
|
2999 if(iIsFirstPOSMessage && ( aErr == KErrOMAManParamMissing || aErr == KErrOMASuplParamNotSet || aErr == KErrOMASuplPosInfo)) |
|
3000 { |
|
3001 iTrace->Trace(_L("Failed to Generate First messsage from POS...still continueing.."), KTraceFileName, __LINE__); |
|
3002 iIsFirstPOSMessage = EFalse; |
|
3003 return; |
|
3004 } |
|
3005 } |
|
3006 case COMASuplState::ESUPL_POS_INIT: |
|
3007 { |
|
3008 cancelSendRequestor = EFalse; |
|
3009 iSuplSessionState = ESUPL_GENERATE; |
|
3010 iSuplMsgType = ESUPL_END; |
|
3011 GenerateSuplMessageL(); |
|
3012 break; |
|
3013 } |
|
3014 |
|
3015 case COMASuplState::ESUPL_END: |
|
3016 { |
|
3017 iConnRequestor->CloseConnection(); |
|
3018 iPortNum = 0; |
|
3019 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
3020 return; |
|
3021 } |
|
3022 |
|
3023 default: break; |
|
3024 } |
|
3025 } |
|
3026 |
|
3027 if(cancelSendRequestor) |
|
3028 { |
|
3029 CancelAllOperations(); |
|
3030 CleanUp(); |
|
3031 CompleteSession(KErrGeneral); |
|
3032 } |
|
3033 |
|
3034 } |
|
3035 // ----------------------------------------------------------------------------- |
|
3036 // COMASuplSession::CancelRunSession |
|
3037 // Cancels an in-progress RunSession on the Session |
|
3038 // What action to be taken for cancelRunSession will be depend on State of session. |
|
3039 // (other items were commented in a header). |
|
3040 // ----------------------------------------------------------------------------- |
|
3041 // |
|
3042 void COMASuplSession::HandleSendErrorL(TInt aErr) |
|
3043 { |
|
3044 |
|
3045 // if error code is KErrDisconnected, then close connection |
|
3046 // and set the state accordingly |
|
3047 if (aErr == KErrDisconnected) |
|
3048 { |
|
3049 //Close Connection |
|
3050 iConnRequestor->CloseConnection(); |
|
3051 iSessionObserver.TerminateSession(this, aErr); |
|
3052 } |
|
3053 else |
|
3054 { |
|
3055 TBool cancelSendRequestor = ETrue; |
|
3056 if(aErr == KErrTimedOut) |
|
3057 { |
|
3058 iErrorStatusCode = COMASuplEnd::EUnspecified; |
|
3059 cancelSendRequestor = EFalse; |
|
3060 iSuplSessionState = ESUPL_GENERATE; |
|
3061 iSuplMsgType = ESUPL_END; |
|
3062 GenerateSuplMessageL(); |
|
3063 } |
|
3064 |
|
3065 if(aErr == KErrSuplposMethodMismatch) |
|
3066 { |
|
3067 iErrorStatusCode = COMASuplEnd::EPosProtocolMismatch; |
|
3068 cancelSendRequestor = EFalse; |
|
3069 iSuplSessionState = ESUPL_GENERATE; |
|
3070 iSuplMsgType = ESUPL_END; |
|
3071 GenerateSuplMessageL(); |
|
3072 } |
|
3073 |
|
3074 aErr = KErrCompletion; |
|
3075 |
|
3076 if(cancelSendRequestor) |
|
3077 { |
|
3078 CancelAllOperations(); |
|
3079 CleanUp(); |
|
3080 CompleteSession(aErr); |
|
3081 } |
|
3082 } |
|
3083 |
|
3084 } |
|
3085 // ----------------------------------------------------------------------------- |
|
3086 // COMASuplSession::HandlePacketsErrorL |
|
3087 // HandlePacketsErrorL |
|
3088 // |
|
3089 // (other items were commented in a header). |
|
3090 // ----------------------------------------------------------------------------- |
|
3091 // |
|
3092 void COMASuplSession::HandlePacketsErrorL(TInt aErr) |
|
3093 { |
|
3094 TBool cancelSendRequestor = ETrue; |
|
3095 |
|
3096 if(iSuplMsgType == ESUPL_INIT) |
|
3097 { |
|
3098 HandleSuplInitErrorL(aErr); |
|
3099 return; |
|
3100 } |
|
3101 |
|
3102 if(aErr == KErrSuplEndProtocolError ) |
|
3103 { |
|
3104 aErr = KErrCompletion; |
|
3105 switch(iSuplMsgType) |
|
3106 { |
|
3107 case ESUPL_START: |
|
3108 case ESUPL_RESPONSE: |
|
3109 case ESUPL_END: |
|
3110 { |
|
3111 //Close Connection |
|
3112 iConnRequestor->CloseConnection(); |
|
3113 iPortNum = 0; |
|
3114 iSessionObserver.TerminateSession(this, aErr); |
|
3115 break; |
|
3116 } |
|
3117 default: break; |
|
3118 } |
|
3119 } |
|
3120 |
|
3121 if(aErr == KErrOMASuplProtocolError ) |
|
3122 { |
|
3123 aErr = KErrCompletion; |
|
3124 switch(iSuplMsgType) |
|
3125 { |
|
3126 case ESUPL_START: |
|
3127 case ESUPL_INIT: |
|
3128 case ESUPL_POS: |
|
3129 case ESUPL_RESPONSE: |
|
3130 case ESUPL_POSINIT: |
|
3131 case ESUPL_AUTH_RESP: |
|
3132 { |
|
3133 iErrorStatusCode = COMASuplEnd::EUnexpectedMessage; |
|
3134 cancelSendRequestor = EFalse; |
|
3135 iSuplSessionState = ESUPL_GENERATE; |
|
3136 iSuplMsgType = ESUPL_END; |
|
3137 GenerateSuplMessageL(); |
|
3138 break; |
|
3139 } |
|
3140 |
|
3141 case ESUPL_END: |
|
3142 { |
|
3143 //Close Connection |
|
3144 iConnRequestor->CloseConnection(); |
|
3145 iPortNum = 0; |
|
3146 iSessionObserver.TerminateSession(this, aErr); |
|
3147 break; |
|
3148 } |
|
3149 |
|
3150 default: break; |
|
3151 } |
|
3152 } |
|
3153 |
|
3154 if( aErr == KErrOMANonProxyModeNotSupported) //aErr == KErrOMASuplVersionNotMatching || |
|
3155 { |
|
3156 iErrorStatusCode = COMASuplEnd::ENonProxyModeNotSupported; |
|
3157 |
|
3158 aErr = KErrCompletion; |
|
3159 |
|
3160 if(iSuplState) |
|
3161 { |
|
3162 switch(iSuplState->GetSuplState()) |
|
3163 { |
|
3164 case COMASuplState::ESUPL_RESPONSE: |
|
3165 { |
|
3166 cancelSendRequestor = EFalse; |
|
3167 iSuplSessionState = ESUPL_GENERATE; |
|
3168 iSuplMsgType = ESUPL_END; |
|
3169 GenerateSuplMessageL(); |
|
3170 break; |
|
3171 } |
|
3172 default: break; |
|
3173 } |
|
3174 } |
|
3175 } |
|
3176 |
|
3177 if(cancelSendRequestor) |
|
3178 { |
|
3179 CancelAllOperations(); |
|
3180 CleanUp(); |
|
3181 CompleteSession(aErr); |
|
3182 } |
|
3183 } |
|
3184 |
|
3185 // ----------------------------------------------------------------------------- |
|
3186 // COMASuplSession::HandleSuplInitErrorL |
|
3187 // Handle Init related error |
|
3188 // (other items were commented in a header). |
|
3189 // ----------------------------------------------------------------------------- |
|
3190 // |
|
3191 void COMASuplSession::HandleSuplInitErrorL(TInt aErr) |
|
3192 { |
|
3193 iTrace->Trace(_L("Start COMASuplSession::HandleSuplInitError"), KTraceFileName, __LINE__); |
|
3194 |
|
3195 if(aErr == KErrOMAInvalidHSLPAddress) |
|
3196 { |
|
3197 iTrace->Trace(_L("COMASuplSession::HandleSuplInitError HSLP Address is not matching..."), KTraceFileName, __LINE__); |
|
3198 //Close Connection : bug Fix. |
|
3199 iConnRequestor->CloseConnection(); |
|
3200 iPortNum = 0; |
|
3201 iSessionObserver.TerminateSession(this, KErrCompletion); |
|
3202 return; |
|
3203 } |
|
3204 |
|
3205 TBool setStatusCode = ETrue; |
|
3206 |
|
3207 |
|
3208 |
|
3209 if(aErr == KErrSuplInvalidSessionID) |
|
3210 { |
|
3211 iTrace->Trace(_L("COMASuplSession::HandleSuplInitError Received SET Session ID"), KTraceFileName, __LINE__); |
|
3212 iErrorStatusCode = COMASuplEnd::EInvalidSessionId; |
|
3213 |
|
3214 COMASuplSessionID* retrivedSessionID = NULL; |
|
3215 iDecodedAsnMessage->SessionId(retrivedSessionID); |
|
3216 |
|
3217 // Set the SessionId. |
|
3218 iTrace->Trace(_L("COMASuplSession::HandleSuplInitError Update SET Session ID"), KTraceFileName, __LINE__); |
|
3219 UpdateSETSessionIDL(retrivedSessionID); |
|
3220 |
|
3221 } |
|
3222 |
|
3223 if(aErr == KErrOMANonProxyModeNotSupported) |
|
3224 { |
|
3225 iTrace->Trace(_L("COMASuplSession::HandleSuplInitError Received Nonproxymode data"), KTraceFileName, __LINE__); |
|
3226 iErrorStatusCode = COMASuplEnd::ENonProxyModeNotSupported; |
|
3227 } |
|
3228 |
|
3229 if(KErrAccessDenied == aErr || KErrOMASuplDenied == aErr) |
|
3230 { |
|
3231 iTrace->Trace(_L("COMASuplSession::HandleSuplInitError KErrAccessDenied|| KErrOMASuplDenied"), KTraceFileName, __LINE__); |
|
3232 iErrorStatusCode = COMASuplEnd::EConsentDeniedByUser; |
|
3233 } |
|
3234 |
|
3235 if(aErr == KErrOMASuplNoPosition || KErrOMASuplInformationOnly == aErr) |
|
3236 { |
|
3237 //Supl End with No Position |
|
3238 iTrace->Trace(_L("COMASuplSession::HandleSuplInitError KErrOMASuplNoPosition || KErrOMASuplInformationOnly"), KTraceFileName, __LINE__); |
|
3239 setStatusCode = EFalse; |
|
3240 } |
|
3241 |
|
3242 if(KErrOMASuplAccepted == aErr) |
|
3243 { |
|
3244 iTrace->Trace(_L("COMASuplSession::HandleSuplInitError EConsentGrantedByUser"), KTraceFileName, __LINE__); |
|
3245 iErrorStatusCode = COMASuplEnd::EConsentGrantedByUser; |
|
3246 } |
|
3247 |
|
3248 TInt len = iHSLPAddress.Length(); |
|
3249 HBufC8 *hslpAdress = NULL; |
|
3250 if(len > 0) |
|
3251 { |
|
3252 hslpAdress = HBufC8::NewL(iHSLPAddress.Length()); |
|
3253 hslpAdress->Des().Copy(iHSLPAddress); |
|
3254 } |
|
3255 |
|
3256 else if(len ==0) |
|
3257 { |
|
3258 iTrace->Trace(_L("HSLP generated frm IMSI"), KTraceFileName, __LINE__); |
|
3259 hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length()); |
|
3260 CleanupStack::PushL(hslpAdress); |
|
3261 hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi()); |
|
3262 CleanupStack::Pop(hslpAdress); |
|
3263 |
|
3264 } |
|
3265 CleanupStack::PushL(hslpAdress); |
|
3266 |
|
3267 delete iSuplState; |
|
3268 iSuplState = NULL; |
|
3269 |
|
3270 if(setStatusCode) |
|
3271 { |
|
3272 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress); |
|
3273 } |
|
3274 else |
|
3275 { |
|
3276 iSuplState = COMASuplEndState::NewL(iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress ); |
|
3277 } |
|
3278 |
|
3279 CleanupStack::PopAndDestroy(hslpAdress); |
|
3280 |
|
3281 iTrace->Trace(_L("COMASuplSession::HandleSuplInitError Send SUPL_END for SUPL_INIT"), KTraceFileName, __LINE__); |
|
3282 |
|
3283 //iSuplSessionState = ESUPL_GENERATE; |
|
3284 iSuplSessionState = ESUPL_INITIALIZED; |
|
3285 iSuplState->SetMsgStateObserver(this); |
|
3286 iSuplMsgType = ESUPL_END; |
|
3287 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
|
3288 //SMP Changes |
|
3289 iSuplSessionState = ESUPL_GENERATE; |
|
3290 iSuplState->GenerateMessageL(); |
|
3291 |
|
3292 } |
|
3293 |
|
3294 // ----------------------------------------------------------------------------- |
|
3295 // COMASuplSession::HandleInvalidParameterErrorL |
|
3296 // Handles error occured related invalid parameter. |
|
3297 // (other items were commented in a header). |
|
3298 // ----------------------------------------------------------------------------- |
|
3299 // |
|
3300 void COMASuplSession::HandleInvalidParameterErrorL(COMASuplAsnMessageBase* aDecodedAsnMessage) |
|
3301 { |
|
3302 if(CheckProtocolVersionL(aDecodedAsnMessage)) //Checks version with supported version |
|
3303 { |
|
3304 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsnMessage->MessageType(); |
|
3305 CancelAllOperations(); |
|
3306 if(messageType == COMASuplAsnMessageBase::ESUPL_END) |
|
3307 { |
|
3308 //Close Connection : bug Fix. |
|
3309 iConnRequestor->CloseConnection(); |
|
3310 iPortNum = 0; |
|
3311 iSessionObserver.TerminateSession(this, KErrCompletion); |
|
3312 } |
|
3313 else |
|
3314 { |
|
3315 |
|
3316 iErrorStatusCode = COMASuplEnd::EUnexpectedDataValue; |
|
3317 |
|
3318 if((messageType == COMASuplAsnMessageBase::ESUPL_POSINIT || |
|
3319 messageType == COMASuplAsnMessageBase::ESUPL_START || |
|
3320 messageType == COMASuplAsnMessageBase::ESUPL_RESPONSE) |
|
3321 && (iRequestType == ESUPL_NETWORK)) |
|
3322 { |
|
3323 iErrorStatusCode = COMASuplEnd::EUnexpectedMessage; |
|
3324 } |
|
3325 |
|
3326 if(iRequestType == ESUPL_TERMINAL ) //Protocol errors |
|
3327 { |
|
3328 if( ! (iSuplMsgType == ESUPL_START && messageType == COMASuplAsnMessageBase::ESUPL_RESPONSE) |
|
3329 || |
|
3330 (iSuplMsgType == ESUPL_POSINIT && messageType == COMASuplAsnMessageBase::ESUPL_POS) |
|
3331 ) |
|
3332 |
|
3333 { |
|
3334 iErrorStatusCode = COMASuplEnd::EUnexpectedMessage; |
|
3335 } |
|
3336 } |
|
3337 |
|
3338 iSuplSessionState = ESUPL_GENERATE; |
|
3339 iSuplMsgType = ESUPL_END; |
|
3340 GenerateSuplMessageL(); |
|
3341 } |
|
3342 } |
|
3343 } |
|
3344 // ----------------------------------------------------------------------------- |
|
3345 // COMASuplSession::TerminateSession |
|
3346 // Terminates session |
|
3347 // (other items were commented in a header). |
|
3348 // ----------------------------------------------------------------------------- |
|
3349 // |
|
3350 void COMASuplSession::TerminateSession() |
|
3351 { |
|
3352 iTrace->Trace(_L("COMASuplSession::TerminateSession"), KTraceFileName, __LINE__); |
|
3353 if(iSuplSessionState != ESUPL_SESSION_ERROR) |
|
3354 { |
|
3355 CancelRunSession(); |
|
3356 } |
|
3357 else |
|
3358 { |
|
3359 SessionEnd(); |
|
3360 CompleteSession(KErrCancel); |
|
3361 } |
|
3362 return; |
|
3363 } |
|
3364 |
|
3365 // ----------------------------------------------------------------------------- |
|
3366 // COMASuplSession::SuplVersion |
|
3367 // returns SUPL Version |
|
3368 // (other items were commented in a header). |
|
3369 // ----------------------------------------------------------------------------- |
|
3370 // |
|
3371 TReal COMASuplSession::SuplVersion() |
|
3372 { |
|
3373 return KSuplPOSPluginVersion; |
|
3374 } |
|
3375 |
|
3376 // ----------------------------------------------------------------------------- |
|
3377 // COMASuplSession::SetPOSMsgPluginState |
|
3378 // Informs Protocol state to POS if present |
|
3379 // (other items were commented in a header). |
|
3380 // ----------------------------------------------------------------------------- |
|
3381 // |
|
3382 void COMASuplSession::SetPOSMsgPluginState(COMASuplPosSessionBase::TOMASuplMsgState aSuplMsgState) |
|
3383 { |
|
3384 if(iPOSSession != NULL) |
|
3385 { |
|
3386 iTrace->Trace(_L("Setting State of POS Msg Plugin"), KTraceFileName, __LINE__); |
|
3387 |
|
3388 COMASuplPosSessionBase::TOMASuplMsg SuplMsg = COMASuplPosSessionBase::EOMASuplStart; |
|
3389 |
|
3390 switch(iSuplMsgType) |
|
3391 { |
|
3392 case ESUPL_START: |
|
3393 SuplMsg = COMASuplPosSessionBase::EOMASuplStart; |
|
3394 break; |
|
3395 case ESUPL_RESPONSE: |
|
3396 SuplMsg = COMASuplPosSessionBase::EOMASuplResponse; |
|
3397 break; |
|
3398 case ESUPL_INIT: |
|
3399 SuplMsg = COMASuplPosSessionBase::EOMASuplInit; |
|
3400 break; |
|
3401 case ESUPL_POSINIT: |
|
3402 SuplMsg = COMASuplPosSessionBase::EOMASuplPosInit; |
|
3403 break; |
|
3404 case ESUPL_POS: |
|
3405 SuplMsg = COMASuplPosSessionBase::EOMASuplPos; |
|
3406 break; |
|
3407 case ESUPL_END: |
|
3408 SuplMsg = COMASuplPosSessionBase::EOMASuplEnd; |
|
3409 break; |
|
3410 default: |
|
3411 break; |
|
3412 } |
|
3413 |
|
3414 iPOSSession->SetSuplState(SuplMsg,aSuplMsgState); |
|
3415 } |
|
3416 |
|
3417 } |
|
3418 // ----------------------------------------------------------------------------- |
|
3419 // COMASuplSession::IsLastPOSMessage |
|
3420 // Checks about last POS message with POS handler |
|
3421 // (other items were commented in a header). |
|
3422 // ----------------------------------------------------------------------------- |
|
3423 // |
|
3424 TBool COMASuplSession::IsLastPOSMessage() |
|
3425 { |
|
3426 if( iPOSSession && iSuplState) |
|
3427 { |
|
3428 COMASuplPosState* state = static_cast <COMASuplPosState *>(iSuplState); |
|
3429 TBool ret = state->IsLastMessage(); |
|
3430 return ret; |
|
3431 } |
|
3432 else |
|
3433 { |
|
3434 return EFalse; |
|
3435 } |
|
3436 } |
|
3437 // ----------------------------------------------------------------------------- |
|
3438 // COMASuplSession::IsSegmentedDone() |
|
3439 // Checks about segmentation of pospayload |
|
3440 // (other items were commented in a header). |
|
3441 // ----------------------------------------------------------------------------- |
|
3442 // |
|
3443 TBool COMASuplSession::IsSegmentationDone() |
|
3444 { |
|
3445 if( iPOSSession && iSuplState) |
|
3446 { |
|
3447 COMASuplPosState* state = static_cast <COMASuplPosState *>(iSuplState); |
|
3448 TBool ret = state->IsSegmentationDone(); |
|
3449 return ret; |
|
3450 } |
|
3451 else |
|
3452 { |
|
3453 return EFalse; |
|
3454 } |
|
3455 } |
|
3456 |
|
3457 |
|
3458 // ----------------------------------------------------------------------------- |
|
3459 // COMASuplSession::CopySETCapabilities |
|
3460 // (other items were commented in a header). |
|
3461 // ----------------------------------------------------------------------------- |
|
3462 void COMASuplSession::CopySETCapabilities() |
|
3463 { |
|
3464 if(iSuplMsgType == ESUPL_START) |
|
3465 { |
|
3466 COMASuplStartState *startState = static_cast <COMASuplStartState *>(iSuplState); |
|
3467 COMASuplSETCapabilities *setCaps = startState->Capabilities(); |
|
3468 |
|
3469 TOMASuplPosTechnology posTech; |
|
3470 COMASuplSETCapabilities::TOMASuplPrefMethod prefMethod; |
|
3471 TOMASuplPosProtocol posProtocol; |
|
3472 |
|
3473 setCaps->GetSETCapabilities(posTech,prefMethod,posProtocol); |
|
3474 |
|
3475 iSETCapabilities->SetSETCapabilities(posTech,prefMethod, posProtocol); |
|
3476 } |
|
3477 |
|
3478 if(iSuplMsgType == ESUPL_POSINIT && iRequestType == ESUPL_NETWORK) |
|
3479 { |
|
3480 TOMASuplPosTechnology posTechnology; |
|
3481 COMASuplSETCapabilities::TOMASuplPrefMethod prefMethod; |
|
3482 TOMASuplPosProtocol posProtocol; |
|
3483 |
|
3484 TBool GpsSETAssisted = EFalse; |
|
3485 TBool GpsSETBased = EFalse; |
|
3486 TBool AutonomousGps = EFalse; |
|
3487 TBool FLT = EFalse; |
|
3488 TBool eOTD = EFalse; |
|
3489 TBool oTDOA = EFalse; |
|
3490 |
|
3491 TBool TIA801 = EFalse; |
|
3492 TBool RRLP = EFalse; |
|
3493 TBool RRC = EFalse; |
|
3494 |
|
3495 posTechnology.SetPosTechnology(GpsSETAssisted,GpsSETBased,AutonomousGps,FLT, |
|
3496 eOTD,oTDOA); |
|
3497 posProtocol.SetPosProtocol(TIA801,RRLP,RRC); |
|
3498 prefMethod = COMASuplSETCapabilities::EOMANoPreferred; |
|
3499 iSETCapabilities->SetSETCapabilities(posTechnology,prefMethod,posProtocol); |
|
3500 } |
|
3501 } |
|
3502 |
|
3503 // ----------------------------------------------------------------------------- |
|
3504 // COMASuplSession::PrivacyCheckCompleteL |
|
3505 // (other items were commented in a header). |
|
3506 // ----------------------------------------------------------------------------- |
|
3507 void COMASuplSession::PrivacyCheckCompleteL(TInt aCompletionCode) |
|
3508 { |
|
3509 if(aCompletionCode == KErrNone) |
|
3510 { |
|
3511 iTrace->Trace(_L("COMASuplSession::PrivacyCheckCompleteL No Error"), KTraceFileName, __LINE__); |
|
3512 static_cast<COMASuplInitState*>(iSuplState)->GetRequestorID(iRequestID); //APE Centric |
|
3513 iSuplSessionState = ESUPL_INITIALIZED; |
|
3514 iSuplMsgType = ESUPL_POSINIT; |
|
3515 if (iSuplUsage >= 2) |
|
3516 { |
|
3517 COMASuplInit* suplInit = static_cast <COMASuplInit *>(iDecodedAsnMessage); |
|
3518 COMASuplNotification* notif; |
|
3519 TInt error = suplInit->Notification(notif); |
|
3520 COMASuplNotification::TOMASuplNotificationType notifType = notif->SuplNotification(); |
|
3521 if (notifType == COMASuplNotification::ENotificationOnly) |
|
3522 { |
|
3523 InitializeL(iRequestID); |
|
3524 } |
|
3525 else |
|
3526 { |
|
3527 // iRequestID = 0; //APE Centric |
|
3528 CheckForSuplUsageL(); |
|
3529 } |
|
3530 } |
|
3531 else |
|
3532 InitializeL(iRequestID); //APE Centric |
|
3533 } |
|
3534 else |
|
3535 { |
|
3536 iTrace->Trace(_L("COMASuplSession::PrivacyCheckCompleteL with Error "), KTraceFileName, __LINE__); |
|
3537 if (iSuplUsage >= 2) |
|
3538 { |
|
3539 iNwInitError = ETrue; |
|
3540 iNwInitCompletionCode = aCompletionCode; |
|
3541 CheckForSuplUsageL(); |
|
3542 } |
|
3543 else |
|
3544 HandleSuplInitErrorL(aCompletionCode); |
|
3545 } |
|
3546 } |
|
3547 |
|
3548 // ----------------------------------------------------------------------------- |
|
3549 // COMASuplSession::SetConfigurationParameters...sets configuration parameters |
|
3550 // (other items were commented in a header). |
|
3551 // ----------------------------------------------------------------------------- |
|
3552 void COMASuplSession::SetConfigurationParameters(TInt& aUT1_StartTimer,TInt& aUT2_PosInitTimer, |
|
3553 TInt& aUT3_PosTimer,TInt& aPrivacyTimer, |
|
3554 TInt& aSETMode, |
|
3555 TInt& aSuplUsage, |
|
3556 TInt& aPersistFailTimer, |
|
3557 TInt& aSuplInitTimeOut) |
|
3558 { |
|
3559 iUT1_StartTimer = aUT1_StartTimer; |
|
3560 iUT2_PosInitTimer = aUT2_PosInitTimer; |
|
3561 iUT3_PosTimer = aUT3_PosTimer; |
|
3562 iPrivacyTimer = aPrivacyTimer; |
|
3563 iSETMode = aSETMode; |
|
3564 iSuplUsage = aSuplUsage; |
|
3565 iPersistFailTimer = aPersistFailTimer; |
|
3566 iSuplInitTimeOut = aSuplInitTimeOut; |
|
3567 } |
|
3568 |
|
3569 // ----------------------------------------------------------------------------- |
|
3570 // COMASuplSession::IsGenerationInProgress...check about status of generation of message |
|
3571 // (other items were commented in a header). |
|
3572 // ----------------------------------------------------------------------------- |
|
3573 TBool COMASuplSession::IsGenerationInProgress() |
|
3574 { |
|
3575 if( iSuplMsgType == ESUPL_POSINIT && iSuplState) |
|
3576 { |
|
3577 COMASuplPosInitState* state = static_cast <COMASuplPosInitState *>(iSuplState); |
|
3578 TBool ret = state->IsGenerationInProgress(); |
|
3579 return ret; |
|
3580 } |
|
3581 else |
|
3582 { |
|
3583 return EFalse; |
|
3584 } |
|
3585 } |
|
3586 |
|
3587 // ----------------------------------------------------------------------------- |
|
3588 // COMASuplSession::LogEndTime...log the end time if delay is present in QoP |
|
3589 // (other items were commented in a header). |
|
3590 // ----------------------------------------------------------------------------- |
|
3591 void COMASuplSession::LogEndTime() |
|
3592 { |
|
3593 if(!iIsQoPPresent) |
|
3594 { |
|
3595 return; |
|
3596 } |
|
3597 |
|
3598 TInt delay; |
|
3599 if(iClientQop.GetDelay(delay) != KErrNotFound) |
|
3600 { |
|
3601 iSessionEndTime.HomeTime(); |
|
3602 } |
|
3603 } |
|
3604 |
|
3605 // ----------------------------------------------------------------------------- |
|
3606 // COMASuplSession::SetIMSIL |
|
3607 // Updates IMSI value in SET Session ID |
|
3608 // ----------------------------------------------------------------------------- |
|
3609 void COMASuplSession::SetIMSI() |
|
3610 { |
|
3611 |
|
3612 //if( IsIMSIVariant() ) |
|
3613 { |
|
3614 iTrace->Trace(_L("COMASuplSession::SetIMSIL Start"), KTraceFileName, __LINE__); |
|
3615 TInt length = iIMSI.Length(); |
|
3616 TBuf8<KIMSILength> imsi; |
|
3617 TUint8 val; |
|
3618 TInt index = 0; |
|
3619 |
|
3620 while ( index <= length ) |
|
3621 { |
|
3622 val = 0; |
|
3623 if (index == length) |
|
3624 { |
|
3625 val = 15 << 4; |
|
3626 val |= 15; |
|
3627 imsi.Append(val); |
|
3628 break; |
|
3629 } |
|
3630 const TUint16& t = iIMSI[index]; |
|
3631 TInt8 i = t - 48; |
|
3632 if ( ++index != length ) |
|
3633 { |
|
3634 const TUint16& h = iIMSI[index]; |
|
3635 TInt8 j = h - 48; |
|
3636 val = j << 4; |
|
3637 val |= i; |
|
3638 } |
|
3639 else |
|
3640 { |
|
3641 val = 15 << 4; |
|
3642 val |= i; |
|
3643 } |
|
3644 |
|
3645 imsi.Append(val); |
|
3646 index++; |
|
3647 } |
|
3648 |
|
3649 if (!iSessionIDFlag) |
|
3650 { |
|
3651 COMASuplSETSessionID* suplSETSessionId = NULL; |
|
3652 iSuplSessionId->SETSessionID( suplSETSessionId ); |
|
3653 suplSETSessionId->SetSuplSETSessionIDIMSI( iSETSessionUniqueId, imsi ); |
|
3654 } |
|
3655 |
|
3656 iTrace->Trace(_L("COMASuplSession::SetIMSI End"), KTraceFileName, __LINE__); |
|
3657 } |
|
3658 |
|
3659 } |
|
3660 |
|
3661 // ----------------------------------------------------------------------------- |
|
3662 // COMASuplSession::IsIMSIVariant |
|
3663 // Checks to determine if IMSI needs to be included in the SUPL message |
|
3664 // ----------------------------------------------------------------------------- |
|
3665 TBool COMASuplSession::IsIMSIVariant() |
|
3666 { |
|
3667 if(iIMSI.Length() && |
|
3668 ( |
|
3669 (iRequestType == ESUPL_TERMINAL && iSuplMsgType == ESUPL_START) || |
|
3670 (iRequestType == ESUPL_NETWORK && iSuplMsgType == ESUPL_POSINIT) || |
|
3671 (iRequestType == ESUPL_NETWORK && iSuplMsgType == ESUPL_END) |
|
3672 )) |
|
3673 { |
|
3674 return ETrue; |
|
3675 } |
|
3676 else |
|
3677 { |
|
3678 return EFalse; |
|
3679 } |
|
3680 } |
|
3681 |
|
3682 |
|
3683 // ----------------------------------------------------------------------------- |
|
3684 // COMASuplSession::SettingsUICompleted |
|
3685 // |
|
3686 // ----------------------------------------------------------------------------- |
|
3687 |
|
3688 void COMASuplSession::SettingsUICompletedL(TInt /*aError*/) |
|
3689 { |
|
3690 |
|
3691 } |
|
3692 |
|
3693 |
|
3694 // ----------------------------------------------------------------------------- |
|
3695 // COMASuplSession::HandleInvalidMessageL |
|
3696 // Sends SUPL_END with status code with wrong message |
|
3697 // ----------------------------------------------------------------------------- |
|
3698 void COMASuplSession::HandleInvalidMessageL(COMASuplAsnMessageBase* aDecodedAsnMessage) |
|
3699 { |
|
3700 |
|
3701 if(CheckProtocolVersionL(aDecodedAsnMessage)) //Checks version with supported version |
|
3702 { |
|
3703 iTrace->Trace(_L("COMASuplSession::HandleInvalidMessageL...Sending SUPL_END for invalid message"), KTraceFileName, __LINE__); |
|
3704 iErrorStatusCode = COMASuplEnd::EUnexpectedMessage; |
|
3705 iSuplSessionState = ESUPL_GENERATE; |
|
3706 iSuplMsgType = ESUPL_END; |
|
3707 GenerateSuplMessageL(); |
|
3708 } |
|
3709 } |
|
3710 |
|
3711 // ----------------------------------------------------------------------------- |
|
3712 // COMASuplSession::HandleInvalidMessageLengthL |
|
3713 // Sends SUPL_END with status code with protocol error |
|
3714 // ----------------------------------------------------------------------------- |
|
3715 void COMASuplSession::HandleInvalidMessageLengthL() |
|
3716 { |
|
3717 iTrace->Trace(_L("COMASuplSession::HandleInvalidMessageLengthL...Sending SUPL_END for invalid message length"), KTraceFileName, __LINE__); |
|
3718 iErrorStatusCode = COMASuplEnd::EProtocolError; |
|
3719 iSuplSessionState = ESUPL_GENERATE; |
|
3720 iSuplMsgType = ESUPL_END; |
|
3721 GenerateSuplMessageL(); |
|
3722 } |
|
3723 |
|
3724 // ----------------------------------------------------------------------------- |
|
3725 // COMASuplSession::CheckProtocolVersion |
|
3726 // Returns true if its matching else false |
|
3727 // ----------------------------------------------------------------------------- |
|
3728 TBool COMASuplSession::CheckProtocolVersionL(COMASuplAsnMessageBase* aDecodedAsn) |
|
3729 { |
|
3730 TOMASuplVersion version; |
|
3731 COMASuplSessionID* SessionID = NULL; |
|
3732 aDecodedAsn->MessageBase(version,SessionID); |
|
3733 |
|
3734 TInt recMajor,recMinor,recServInd; |
|
3735 version.SuplVersion(recMajor,recMinor,recServInd); |
|
3736 |
|
3737 if(recMajor == KSuplMajorVersion ) |
|
3738 { |
|
3739 return ETrue; |
|
3740 } |
|
3741 else |
|
3742 { |
|
3743 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsn->MessageType(); |
|
3744 if(messageType == COMASuplAsnMessageBase::ESUPL_END) |
|
3745 { |
|
3746 iTrace->Trace(_L("Received message is SUPL_END...with wrong Version.Terminating session"), KTraceFileName, __LINE__); |
|
3747 iSessionObserver.TerminateSession(this, KErrCompletion); |
|
3748 } |
|
3749 else |
|
3750 { |
|
3751 iTrace->Trace(_L("Received message with wrong version."), KTraceFileName, __LINE__); |
|
3752 |
|
3753 delete iSuplState; |
|
3754 iSuplMsgType = ESUPL_END; |
|
3755 iErrorStatusCode = COMASuplEnd::EVersionNotSupported; |
|
3756 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
|
3757 |
|
3758 if(iRequestType == ESUPL_NETWORK ) |
|
3759 { |
|
3760 |
|
3761 iSuplSessionState = ESUPL_INITIALIZED; |
|
3762 TInt len = iHSLPAddress.Length(); |
|
3763 HBufC8 *hslpAdress = NULL; |
|
3764 if(len > 0) |
|
3765 { |
|
3766 hslpAdress = HBufC8::NewL(iHSLPAddress.Length()); |
|
3767 hslpAdress->Des().Copy(iHSLPAddress); |
|
3768 } |
|
3769 else if(len ==0) |
|
3770 { |
|
3771 iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__); |
|
3772 hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length()); |
|
3773 CleanupStack::PushL(hslpAdress); |
|
3774 hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi()); |
|
3775 CleanupStack::Pop(hslpAdress); |
|
3776 } |
|
3777 |
|
3778 CleanupStack::PushL(hslpAdress); |
|
3779 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress); |
|
3780 CleanupStack::PopAndDestroy(hslpAdress); |
|
3781 |
|
3782 // Set the SessionId. |
|
3783 iTrace->Trace(_L("COMASuplSession::CheckProtocolVersionL Update SLP Session ID"), KTraceFileName, __LINE__); |
|
3784 UpdateSLPSessionIDL(SessionID); |
|
3785 |
|
3786 iTrace->Trace(_L("COMASuplSession::CheckProtocolVersionL Update SET Session ID"), KTraceFileName, __LINE__); |
|
3787 UpdateSETSessionIDL(SessionID); |
|
3788 iSuplState->SetMsgStateObserver(this); |
|
3789 iSuplState->GenerateMessageL(); |
|
3790 iSuplSessionState = ESUPL_GENERATE; |
|
3791 |
|
3792 } |
|
3793 else |
|
3794 { |
|
3795 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl); |
|
3796 iSuplSessionState = ESUPL_ENCODE; |
|
3797 iSuplState->SetMsgStateObserver(this); |
|
3798 iSuplState->GenerateMessageL(); |
|
3799 } |
|
3800 } |
|
3801 |
|
3802 return EFalse; |
|
3803 } |
|
3804 |
|
3805 } |
|
3806 |
|
3807 // ----------------------------------------------------------------------------- |
|
3808 // COMASuplSession::GetRemainingPosPayloadL |
|
3809 // Returns remaining pos payload |
|
3810 // ----------------------------------------------------------------------------- |
|
3811 COMASuplPosPayload* COMASuplSession::GetRemainingPosPayloadL() |
|
3812 { |
|
3813 if( iSuplState && COMASuplState::ESUPL_POS_INIT == iSuplState->GetSuplState()) |
|
3814 { |
|
3815 COMASuplPosInitState* state = static_cast <COMASuplPosInitState *>(iSuplState); |
|
3816 return state->GetRemainingPospayLoadL(); |
|
3817 } |
|
3818 else |
|
3819 { |
|
3820 return NULL; |
|
3821 } |
|
3822 } |
|
3823 |
|
3824 // ----------------------------------------------------------------------------- |
|
3825 // COMASuplSession::IsWholeMessageSent |
|
3826 // Is whole message get sent |
|
3827 // ----------------------------------------------------------------------------- |
|
3828 TBool COMASuplSession::IsWholeMessageSentL() |
|
3829 { |
|
3830 COMASuplState::TSuplMessageType msgType = iSuplState->GetSuplState(); |
|
3831 switch(msgType) |
|
3832 { |
|
3833 case COMASuplState::ESUPL_POS_INIT: |
|
3834 { |
|
3835 COMASuplPosPayload* remainingPosPayload = GetRemainingPosPayloadL(); |
|
3836 if(remainingPosPayload ) |
|
3837 return EFalse; |
|
3838 else |
|
3839 return ETrue; |
|
3840 } |
|
3841 |
|
3842 case COMASuplState::ESUPL_POS: |
|
3843 { |
|
3844 return !IsSegmentationDone(); |
|
3845 } |
|
3846 default : //For Start , End |
|
3847 { |
|
3848 return ETrue; |
|
3849 } |
|
3850 } |
|
3851 } |
|
3852 |
|
3853 // ----------------------------------------------------------------------------- |
|
3854 // COMASuplSession::GetNetworkModeL() |
|
3855 // Checks wheather phone is online or Offline mode... |
|
3856 // ----------------------------------------------------------------------------- |
|
3857 |
|
3858 TInt COMASuplSession::GetNetworkModeL() |
|
3859 { |
|
3860 |
|
3861 TInt networkMode; |
|
3862 // get network mode |
|
3863 CRepository* centralRepository = CRepository::NewLC(KCRUidCoreApplicationUIs); |
|
3864 User::LeaveIfError(centralRepository->Get(KCoreAppUIsNetworkConnectionAllowed, networkMode)); |
|
3865 CleanupStack::PopAndDestroy(centralRepository); |
|
3866 return networkMode; |
|
3867 } |
|
3868 |
|
3869 // ----------------------------------------------------------------------------- |
|
3870 // COMASuplSession::SetSessionUIFlag |
|
3871 // Sets/Resets the Session UI flag |
|
3872 // ----------------------------------------------------------------------------- |
|
3873 void COMASuplSession::SetSessionUIFlag(TBool aValue) |
|
3874 { |
|
3875 iUIFlag = aValue; |
|
3876 } |
|
3877 |
|
3878 // ----------------------------------------------------------------------------- |
|
3879 // COMASuplSession::GetSessionUIFlag |
|
3880 // Returns Session UI flag |
|
3881 // ----------------------------------------------------------------------------- |
|
3882 TBool COMASuplSession::GetSessionUIFlag() |
|
3883 { |
|
3884 return iUIFlag; |
|
3885 } |
|
3886 |
|
3887 |
|
3888 |
|
3889 // ----------------------------------------------------------------------------- |
|
3890 // ----------------------------------------------------------------------------- |
|
3891 // COMASuplSession::CloseAllOperations |
|
3892 // Close all operations...from here we will stop all processing releated with session and will |
|
3893 // not send SUPL_END |
|
3894 // ----------------------------------------------------------------------------- |
|
3895 void COMASuplSession::CloseAllOperations() |
|
3896 { |
|
3897 iCompleteSelfRequestor->CompleteInvalidSLPSession(); |
|
3898 } |
|
3899 |
|
3900 // ----------------------------------------------------------------------------- |
|
3901 // COMASuplSession::HandleInvalidSLPSessionL |
|
3902 // Relinquish control to Communication manager.... |
|
3903 // |
|
3904 // ----------------------------------------------------------------------------- |
|
3905 void COMASuplSession::HandleInvalidSLPSession() |
|
3906 { |
|
3907 iTrace->Trace(_L("Cancelling All operations..since received invalid SLP session..."), KTraceFileName, __LINE__); |
|
3908 iConnRequestor->CancelReadOperation(); |
|
3909 CancelAllOperations(); |
|
3910 iConnRequestor->CloseConnection(); |
|
3911 iPortNum = 0; |
|
3912 iSessionObserver.TerminateSession(this, KErrCompletion);//// Invoke Terminate Session |
|
3913 } |
|
3914 |
|
3915 // ----------------------------------------------------------------------------- |
|
3916 // COMASuplSession::IsUIDisplayedL |
|
3917 // Checks whether UI is displayed or not previously |
|
3918 // |
|
3919 // ----------------------------------------------------------------------------- |
|
3920 |
|
3921 TBool COMASuplSession::IsUIDisplayedL() |
|
3922 { |
|
3923 return EFalse; |
|
3924 } |
|
3925 |
|
3926 |
|
3927 // ----------------------------------------------------------------------------- |
|
3928 // COMASuplSession::SetSETSessionIdL |
|
3929 // Sets the proper SET Session id depending on the type of Varient. |
|
3930 // |
|
3931 // ----------------------------------------------------------------------------- |
|
3932 |
|
3933 TInt COMASuplSession::SetApproriateSETSessionId() |
|
3934 { |
|
3935 TInt err = KErrNone; |
|
3936 if( IsIMSIVariant() ) |
|
3937 { |
|
3938 SetIMSI(); |
|
3939 } |
|
3940 else |
|
3941 { |
|
3942 err = GetLocalIPAddress(); |
|
3943 } |
|
3944 |
|
3945 return err; |
|
3946 } |
|
3947 |
|
3948 // ----------------------------------------------------------------------------- |
|
3949 // COMASuplSession::TimerExpiredL |
|
3950 // Checks whether UI is displayed or not previously |
|
3951 // |
|
3952 // ----------------------------------------------------------------------------- |
|
3953 void COMASuplSession::TimerExpiredL() |
|
3954 { |
|
3955 iTrace->Trace(_L("Timer Expired for SUPL_POSINIT"), KTraceFileName, __LINE__); |
|
3956 OperationCompleteL(KErrTimedOut); |
|
3957 } |
|
3958 |
|
3959 // ----------------------------------------------------------------------------- |
|
3960 // COMASuplSession::SettingsUsageUICompletedL |
|
3961 // |
|
3962 // ----------------------------------------------------------------------------- |
|
3963 void COMASuplSession::SettingsUsageUICompletedL(TInt aError) |
|
3964 { |
|
3965 iUIFlag = EFalse; |
|
3966 TBuf<64> msg; |
|
3967 msg.Copy(_L("SUPL Usage UI completed with ... ")); |
|
3968 msg.AppendNum(aError); |
|
3969 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
3970 |
|
3971 iPrevUsageResult = aError; |
|
3972 |
|
3973 |
|
3974 if (aError == KErrNone) |
|
3975 { |
|
3976 iProtocolManager.UpdateAllSubSessnsInSameSession(iIpcSessionId); |
|
3977 |
|
3978 if (isTimeoutDialogTimerStarted) |
|
3979 { |
|
3980 iTrace->Trace(_L("COMASuplSession::SettingsUsageUICompletedL, stopping timer "), KTraceFileName, __LINE__); |
|
3981 isTimeoutDialogTimerStarted = EFalse; |
|
3982 iDialogTimer->StopTimer(); |
|
3983 |
|
3984 //Compute how log the dialog was on |
|
3985 TTime nowTime; |
|
3986 nowTime.HomeTime(); |
|
3987 nowTime.SecondsFrom(iDlgStartTime, iDiffTime); |
|
3988 } |
|
3989 if (iNwInitError) |
|
3990 { |
|
3991 iNwInitError = EFalse; |
|
3992 HandleSuplInitErrorL(iNwInitCompletionCode); |
|
3993 } |
|
3994 else |
|
3995 InitializeL(iRequestID); |
|
3996 } |
|
3997 else if (aError == KErrCompletion) |
|
3998 CheckForSuplUsageL(); |
|
3999 else |
|
4000 { |
|
4001 TBuf<64> msg; |
|
4002 msg.Copy(_L("Error after SUPL Usage Popup... ")); |
|
4003 msg.AppendNum(aError); |
|
4004 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4005 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
4006 return; |
|
4007 } |
|
4008 } |
|
4009 |
|
4010 // ----------------------------------------------------------------------------- |
|
4011 // COMASuplSession::CheckForSuplUsageL |
|
4012 // |
|
4013 // ----------------------------------------------------------------------------- |
|
4014 void COMASuplSession::CheckForSuplUsageL() |
|
4015 { |
|
4016 |
|
4017 if (iSuplUsage >= 1) |
|
4018 { |
|
4019 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
|
4020 if (usage == CSuplSettings::ESuplUsageDisabled) |
|
4021 { |
|
4022 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
4023 } |
|
4024 else if (usage == CSuplSettings::ESuplUsageAutomatic) |
|
4025 { |
|
4026 if (iNwInitError) |
|
4027 { |
|
4028 iNwInitError = EFalse; |
|
4029 HandleSuplInitErrorL(iNwInitCompletionCode); |
|
4030 } |
|
4031 else |
|
4032 InitializeL(iRequestID); |
|
4033 } |
|
4034 |
|
4035 else if (usage == CSuplSettings::ESuplUsageHomeAutomatic || usage == CSuplSettings::ESuplUsageAlwaysAsk) |
|
4036 { |
|
4037 if (iRoaming) |
|
4038 HandleRoamingCheckCompleteL(KErrNone, EFalse); |
|
4039 else |
|
4040 { |
|
4041 iEtelRoamingCheck = ETrue; |
|
4042 iProtocolManager.CheckForRoaming(); |
|
4043 } |
|
4044 } |
|
4045 } |
|
4046 else |
|
4047 InitializeL(iRequestID); |
|
4048 |
|
4049 } |
|
4050 |
|
4051 // ----------------------------------------------------------------------------- |
|
4052 // COMASuplSession::CheckForTimerExpiry |
|
4053 // |
|
4054 // ----------------------------------------------------------------------------- |
|
4055 void COMASuplSession::CheckForTimerExpiry() |
|
4056 { |
|
4057 if (iPersistFail) |
|
4058 { |
|
4059 TTime nowTime; |
|
4060 nowTime.HomeTime(); |
|
4061 TTimeIntervalMicroSeconds diff = nowTime.MicroSecondsFrom(iFailTime); |
|
4062 |
|
4063 if (diff > (iPersistFailTimer * KSecond) ) |
|
4064 iChanged = ETrue; |
|
4065 } |
|
4066 } |
|
4067 // ----------------------------------------------------------------------------- |
|
4068 // COMASuplSession::CheckForPreviousResultL |
|
4069 // |
|
4070 // ----------------------------------------------------------------------------- |
|
4071 void COMASuplSession::CheckForPreviousResultL() |
|
4072 { |
|
4073 CheckForTimerExpiry(); |
|
4074 if (iChanged) |
|
4075 { |
|
4076 iProtocolManager.CancelNotify(); |
|
4077 iEtelNotify = EFalse; |
|
4078 iPersistFail = EFalse; |
|
4079 iCapsFail = EFalse; |
|
4080 iChanged = EFalse; |
|
4081 CheckForSuplUsageL(); |
|
4082 return; |
|
4083 } |
|
4084 |
|
4085 // Check for previous request result |
|
4086 if (iPrevUsageResult == KErrNone && !iPersistFail && !iCapsFail) |
|
4087 { |
|
4088 InitializeL(iRequestID); |
|
4089 } |
|
4090 else if (iCapsFail && iAllowedCapabilities != iFailedCaps) |
|
4091 { |
|
4092 InitializeL(iRequestID); |
|
4093 } |
|
4094 else |
|
4095 { |
|
4096 //iSessionObserver.TerminateSession(this, iPrevUsageResult); |
|
4097 if (iPrevUsageResult != KErrNone) |
|
4098 iSessionObserver.TerminateSession(this, iPrevUsageResult); |
|
4099 else if (iPersistFail) |
|
4100 iSessionObserver.TerminateSession(this, iPrevReqResult); |
|
4101 else if (iCapsFail) |
|
4102 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
4103 } |
|
4104 } |
|
4105 |
|
4106 void COMASuplSession::HandleCurrentNetworkChangeL(TInt aErrorCode, TBool aHomeNw) |
|
4107 { |
|
4108 iTrace->Trace(_L("COMASuplSession::HandleCurrentNetworkChangeL"), KTraceFileName, __LINE__); |
|
4109 iEtelNotify = EFalse; |
|
4110 if (aErrorCode == KErrNone) |
|
4111 { |
|
4112 iChanged = ETrue; |
|
4113 if (!aHomeNw) |
|
4114 { |
|
4115 iRoaming = ETrue; |
|
4116 } |
|
4117 else |
|
4118 iRoaming = EFalse; |
|
4119 } |
|
4120 } |
|
4121 |
|
4122 void COMASuplSession::HandleRoamingCheckCompleteL(TInt aErrorCode, TBool aHomeNw) |
|
4123 { |
|
4124 iTrace->Trace(_L("COMASuplSession::HandleRoamingCheckCompleteL"), KTraceFileName, __LINE__); |
|
4125 iEtelRoamingCheck = EFalse; |
|
4126 if (aErrorCode == KErrNone) |
|
4127 { |
|
4128 iUsageHomeNW = aHomeNw; |
|
4129 iConnRequestor->UpdateSLPListForHomeUsage(iUsageHomeNW); |
|
4130 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
|
4131 |
|
4132 if (usage == CSuplSettings::ESuplUsageAlwaysAsk) |
|
4133 { |
|
4134 TInt err; |
|
4135 if (!aHomeNw) |
|
4136 { |
|
4137 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__); |
|
4138 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue); |
|
4139 } |
|
4140 else |
|
4141 { |
|
4142 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is not roaming"), KTraceFileName, __LINE__); |
|
4143 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, EFalse); |
|
4144 } |
|
4145 |
|
4146 if(KErrNone != err && KErrInUse == err) |
|
4147 { |
|
4148 iTrace->Trace(_L("Dialog in use, setting flag"), KTraceFileName, __LINE__); |
|
4149 SetSuplUsageFlag(); |
|
4150 } |
|
4151 if( KErrNone == err && iRequestType == ESUPL_NETWORK ) |
|
4152 { |
|
4153 iTrace->Trace(_L("Network Session , starting timer"), KTraceFileName, __LINE__); |
|
4154 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
4155 TOMASuplQop qop; |
|
4156 TInt retVal = suplInit->Qop(qop); |
|
4157 TInt delay; |
|
4158 qop.Delay(delay); |
|
4159 //if delay is > 7, it is not valid |
|
4160 if (delay > 7) |
|
4161 delay = 0; |
|
4162 if(retVal == KErrNone && delay > 0) |
|
4163 { |
|
4164 TReal delayReal; |
|
4165 Math::Pow(delayReal, 2, (TReal)delay); |
|
4166 delay = (TInt) delayReal; |
|
4167 TBuf<128> msg(_L("Delay present in message, value is = ")); |
|
4168 msg.AppendNum(delay); |
|
4169 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
4170 isTimeoutDialogTimerStarted = ETrue; |
|
4171 iDialogTimer->StartTimer(delay); |
|
4172 } |
|
4173 else |
|
4174 { |
|
4175 if (iSuplInitTimeOut > 0) |
|
4176 { |
|
4177 TBuf<256> msg(_L("Delay value in CR is")); |
|
4178 msg.AppendNum(iSuplInitTimeOut); |
|
4179 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
4180 iDialogTimer->StartTimer(iSuplInitTimeOut * KSecond); |
|
4181 isTimeoutDialogTimerStarted = ETrue; |
|
4182 } |
|
4183 else |
|
4184 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
4185 } |
|
4186 iDlgStartTime.HomeTime(); |
|
4187 } |
|
4188 else if (KErrNone != err) |
|
4189 { |
|
4190 iTrace->Trace(_L("Invoking HandleSuplErrorL"), KTraceFileName, __LINE__); |
|
4191 HandleSuplErrorL(err); |
|
4192 } |
|
4193 |
|
4194 } |
|
4195 else if (usage == CSuplSettings::ESuplUsageHomeAutomatic) |
|
4196 { |
|
4197 if (!aHomeNw) |
|
4198 { |
|
4199 TInt err; |
|
4200 //if (!iSuplSettings->IsUIActive() ) |
|
4201 { |
|
4202 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__); |
|
4203 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue); |
|
4204 |
|
4205 if(iSuplMsgType == ESUPL_INIT) |
|
4206 { |
|
4207 iTrace->Trace(_L("Dialog timer started"), KTraceFileName, __LINE__); |
|
4208 |
|
4209 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
4210 TOMASuplQop qop; |
|
4211 TInt retVal = suplInit->Qop(qop); |
|
4212 TInt delay; |
|
4213 qop.Delay(delay); |
|
4214 //if delay is > 7, it is not valid |
|
4215 if (delay > 7) |
|
4216 delay = 0; |
|
4217 if(retVal == KErrNone && delay > 0) |
|
4218 { |
|
4219 TReal delayReal; |
|
4220 Math::Pow(delayReal, 2, (TReal)delay); |
|
4221 delay = (TInt) delayReal; |
|
4222 TBuf<128> msg(_L("Delay present in message, value is = ")); |
|
4223 msg.AppendNum(delay); |
|
4224 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
4225 isTimeoutDialogTimerStarted = ETrue; |
|
4226 iDialogTimer->StartTimer(delay); |
|
4227 } |
|
4228 else |
|
4229 { |
|
4230 if (iSuplInitTimeOut > 0) |
|
4231 { |
|
4232 isTimeoutDialogTimerStarted = ETrue; |
|
4233 iDialogTimer->StartTimer(iSuplInitTimeOut * KSecond); |
|
4234 } |
|
4235 else |
|
4236 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
4237 } |
|
4238 } |
|
4239 } |
|
4240 |
|
4241 if(!iSuplSettings->IsUIActive() && KErrNone != err) |
|
4242 { |
|
4243 SetSuplUsageFlag(); |
|
4244 } |
|
4245 else |
|
4246 { |
|
4247 iTrace->Trace(_L("Invoking HandleSuplErrorL"), KTraceFileName, __LINE__); |
|
4248 HandleSuplErrorL(err); |
|
4249 } |
|
4250 } |
|
4251 else |
|
4252 { |
|
4253 if (iNwInitError) |
|
4254 { |
|
4255 iNwInitError = EFalse; |
|
4256 HandleSuplInitErrorL(iNwInitCompletionCode); |
|
4257 } |
|
4258 else |
|
4259 InitializeL(iRequestID); |
|
4260 } |
|
4261 } |
|
4262 } |
|
4263 else |
|
4264 { |
|
4265 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
4266 } |
|
4267 } |
|
4268 TInt COMASuplSession::SuplIpcSessionID() |
|
4269 { |
|
4270 return iIpcSessionId; |
|
4271 } |
|
4272 |
|
4273 void COMASuplSession::UpdateSuplUsage() |
|
4274 { |
|
4275 iPrevUsageResult = KErrNone; |
|
4276 } |
|
4277 |
|
4278 void COMASuplSession::SettingsChanged() |
|
4279 { |
|
4280 iChanged = ETrue; |
|
4281 } |
|
4282 |
|
4283 void COMASuplSession::HandleIapSettingsChangeL(TInt aErrorCode) |
|
4284 { |
|
4285 iTrace->Trace(_L("COMASuplSession::HandleIapSettingsChangeL"), KTraceFileName, __LINE__); |
|
4286 if (aErrorCode >= 0) |
|
4287 iChanged = ETrue; |
|
4288 } |
|
4289 |
|
4290 void COMASuplSession::CheckForPersistentFailure(TInt aErrorCode) |
|
4291 { |
|
4292 if (iRequestType == ESUPL_TERMINAL) |
|
4293 { |
|
4294 if ( |
|
4295 (aErrorCode <= KErrDndNameNotFound && aErrorCode >= KErrDndServerUnusable) || // DNS errors |
|
4296 (aErrorCode <= KErrGprsAndNonGprsServicesNotAllowed && aErrorCode >= KErrGprsFeatureNotSupported) || // GPRS errors |
|
4297 (aErrorCode <= KErrSSLNoSharedCipher && aErrorCode >= KErrSSLDllLeave) || // TLS errors |
|
4298 (aErrorCode == KErrCouldNotConnect) // Server does not exist |
|
4299 ) |
|
4300 { |
|
4301 iPersistFail = ETrue; |
|
4302 iPrevReqResult = KErrGeneral; |
|
4303 |
|
4304 iFailTime.HomeTime(); |
|
4305 |
|
4306 iTrace->Trace(_L("COMASuplSession::CheckForPersistentFailure, listening to network change"), KTraceFileName, __LINE__); |
|
4307 iEtelNotify = ETrue; |
|
4308 iProtocolManager.NotifyCurrentNetworkChange(); |
|
4309 |
|
4310 iTrace->Trace(_L("COMASuplSession::CheckForPersistentFailure, listening to IAP change"), KTraceFileName, __LINE__); |
|
4311 if (!iIapNotifier->IsActive()) |
|
4312 iIapNotifier->NotifyIapSettingsChange(); |
|
4313 } |
|
4314 } |
|
4315 } |
|
4316 void COMASuplSession::SetSuplUsageFlag() |
|
4317 { |
|
4318 iUsageDialog = ETrue; |
|
4319 } |
|
4320 |
|
4321 void COMASuplSession::ReSetSuplUsageFlag() |
|
4322 { |
|
4323 iUsageDialog = EFalse; |
|
4324 } |
|
4325 |
|
4326 TBool COMASuplSession::GetSuplUsageFlag() |
|
4327 { |
|
4328 return iUsageDialog; |
|
4329 } |
|
4330 |
|
4331 void COMASuplSession::StartUsageDialogLaunchL() |
|
4332 { |
|
4333 iTrace->Trace(_L("COMASuplSession::StartUsageDialogLaunchL"), KTraceFileName, __LINE__); |
|
4334 ReSetSuplUsageFlag(); |
|
4335 iTrace->Trace(_L("COMASuplSession::StartUsageDialogLaunchL, flag reset done"), KTraceFileName, __LINE__); |
|
4336 |
|
4337 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
|
4338 if (usage == CSuplSettings::ESuplUsageAlwaysAsk) |
|
4339 { |
|
4340 TInt err; |
|
4341 if (!iUsageHomeNW) |
|
4342 { |
|
4343 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__); |
|
4344 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue); |
|
4345 |
|
4346 if(iRequestType == ESUPL_NETWORK && err == KErrNone) |
|
4347 { |
|
4348 iTrace->Trace(_L("starting Dialog timer "), KTraceFileName, __LINE__); |
|
4349 |
|
4350 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
4351 TOMASuplQop qop; |
|
4352 TInt retVal = suplInit->Qop(qop); |
|
4353 TInt delay; |
|
4354 qop.Delay(delay); |
|
4355 //if delay is > 7, it is not valid |
|
4356 if (delay > 7) |
|
4357 delay = 0; |
|
4358 if(retVal == KErrNone && delay > 0) |
|
4359 { |
|
4360 TReal delayReal; |
|
4361 Math::Pow(delayReal, 2, (TReal)delay); |
|
4362 delay = (TInt) delayReal; |
|
4363 TBuf<128> msg(_L("Delay present in message, value is = ")); |
|
4364 msg.AppendNum(delay); |
|
4365 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
4366 isTimeoutDialogTimerStarted = ETrue; |
|
4367 iDialogTimer->StartTimer(delay); |
|
4368 } |
|
4369 else |
|
4370 { |
|
4371 if (iSuplInitTimeOut > 0) |
|
4372 { |
|
4373 iTrace->Trace(_L("Delay not present in message"), KTraceFileName, __LINE__); |
|
4374 TBuf<256> msg(_L("Delay value in CR is ")); |
|
4375 msg.AppendNum(iSuplInitTimeOut); |
|
4376 iDialogTimer->StartTimer(iSuplInitTimeOut * KSecond); |
|
4377 isTimeoutDialogTimerStarted = ETrue; |
|
4378 } |
|
4379 else |
|
4380 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
4381 } |
|
4382 } |
|
4383 } |
|
4384 else |
|
4385 { |
|
4386 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is not roaming"), KTraceFileName, __LINE__); |
|
4387 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, EFalse); |
|
4388 |
|
4389 if( iRequestType == ESUPL_NETWORK && err == KErrNone) |
|
4390 { |
|
4391 iTrace->Trace(_L("starting Dialog timer "), KTraceFileName, __LINE__); |
|
4392 |
|
4393 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
4394 TOMASuplQop qop; |
|
4395 TInt retVal = suplInit->Qop(qop); |
|
4396 TInt delay; |
|
4397 qop.Delay(delay); |
|
4398 //if delay is > 7, it is not valid |
|
4399 if (delay > 7) |
|
4400 delay = 0; |
|
4401 if(retVal == KErrNone && delay > 0) |
|
4402 { |
|
4403 TReal delayReal; |
|
4404 Math::Pow(delayReal, 2, (TReal)delay); |
|
4405 delay = (TInt) delayReal; |
|
4406 TBuf<128> msg(_L("Delay present in message, value is = ")); |
|
4407 msg.AppendNum(delay); |
|
4408 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
4409 isTimeoutDialogTimerStarted = ETrue; |
|
4410 iDialogTimer->StartTimer(delay); |
|
4411 } |
|
4412 else |
|
4413 { |
|
4414 if (iSuplInitTimeOut > 0) |
|
4415 { |
|
4416 iTrace->Trace(_L("Delay not present in message"), KTraceFileName, __LINE__); |
|
4417 TBuf<256> msg(_L("Delay value in CR is")); |
|
4418 msg.AppendNum(iSuplInitTimeOut); |
|
4419 iDialogTimer->StartTimer(iSuplInitTimeOut * KSecond); |
|
4420 isTimeoutDialogTimerStarted = ETrue; |
|
4421 } |
|
4422 else |
|
4423 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
4424 } |
|
4425 } |
|
4426 } |
|
4427 |
|
4428 if(KErrNone != err) |
|
4429 { |
|
4430 iTrace->Trace(_L("Invoking HandleSuplErrorL"), KTraceFileName, __LINE__); |
|
4431 HandleSuplErrorL(err); |
|
4432 } |
|
4433 } |
|
4434 else if (usage == CSuplSettings::ESuplUsageHomeAutomatic) |
|
4435 { |
|
4436 if (!iUsageHomeNW) |
|
4437 { |
|
4438 TInt err; |
|
4439 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__); |
|
4440 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue); |
|
4441 |
|
4442 if(KErrNone != err) |
|
4443 { |
|
4444 iTrace->Trace(_L("Invoking HandleSuplErrorL"), KTraceFileName, __LINE__); |
|
4445 HandleSuplErrorL(err); |
|
4446 } |
|
4447 |
|
4448 if(iRequestType == ESUPL_NETWORK && err == KErrNone) |
|
4449 { |
|
4450 iTrace->Trace(_L("starting Dialog timer "), KTraceFileName, __LINE__); |
|
4451 |
|
4452 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
4453 TOMASuplQop qop; |
|
4454 TInt retVal = suplInit->Qop(qop); |
|
4455 TInt delay; |
|
4456 qop.Delay(delay); |
|
4457 //if delay is > 7, it is not valid |
|
4458 if (delay > 7) |
|
4459 delay = 0; |
|
4460 if(retVal == KErrNone && delay > 0) |
|
4461 { |
|
4462 TReal delayReal; |
|
4463 Math::Pow(delayReal, 2, (TReal)delay); |
|
4464 delay = (TInt) delayReal; |
|
4465 TBuf<128> msg(_L("Delay present in message, value is = ")); |
|
4466 msg.AppendNum(delay); |
|
4467 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
4468 isTimeoutDialogTimerStarted = ETrue; |
|
4469 iDialogTimer->StartTimer(delay); |
|
4470 } |
|
4471 else |
|
4472 { |
|
4473 if (iSuplInitTimeOut > 0) |
|
4474 { |
|
4475 iTrace->Trace(_L("Delay not present in message"), KTraceFileName, __LINE__); |
|
4476 TBuf<256> msg(_L("Delay value in CR is")); |
|
4477 msg.AppendNum(iSuplInitTimeOut); |
|
4478 iDialogTimer->StartTimer(iSuplInitTimeOut * KSecond); |
|
4479 isTimeoutDialogTimerStarted = ETrue; |
|
4480 } |
|
4481 else |
|
4482 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
4483 } |
|
4484 } |
|
4485 } |
|
4486 else |
|
4487 { |
|
4488 if (iNwInitError) |
|
4489 { |
|
4490 iNwInitError = EFalse; |
|
4491 HandleSuplInitErrorL(iNwInitCompletionCode); |
|
4492 } |
|
4493 else |
|
4494 InitializeL(iRequestID); |
|
4495 } |
|
4496 } |
|
4497 } |
|
4498 |
|
4499 TBool COMASuplSession::IsEtelNotifySet() |
|
4500 { |
|
4501 iTrace->Trace(_L("COMASuplSession::IsEtelNotifySet"), KTraceFileName, __LINE__); |
|
4502 return iEtelNotify; |
|
4503 } |
|
4504 |
|
4505 TBool COMASuplSession::IsEtelRoamingSet() |
|
4506 { |
|
4507 iTrace->Trace(_L("COMASuplSession::IsEtelRoamingSet"), KTraceFileName, __LINE__); |
|
4508 return iEtelRoamingCheck; |
|
4509 } |
|
4510 |
|
4511 // ----------------------------------------------------------------------------- |
|
4512 // COMASuplSession::DialogTimerExpiredL |
|
4513 // Checks whether UI is displayed or not previously |
|
4514 // |
|
4515 // ----------------------------------------------------------------------------- |
|
4516 void COMASuplSession::DialogTimerExpiredL() |
|
4517 { |
|
4518 iTrace->Trace(_L("Timer Expired for SUPL Dialog"), KTraceFileName, __LINE__); |
|
4519 |
|
4520 if (!iIapDialogShown) |
|
4521 iProtocolManager.LaunchSuplDialogTimeoutUI(this); |
|
4522 else |
|
4523 iIapDlgTimerExpired = ETrue; |
|
4524 |
|
4525 return; |
|
4526 } |
|
4527 |
|
4528 // ----------------------------------------------------------------------------- |
|
4529 // COMASuplSession::SettingsTimeOutUICompletedL |
|
4530 // |
|
4531 // ----------------------------------------------------------------------------- |
|
4532 void COMASuplSession::SettingsTimeOutUICompletedL(TInt aError) |
|
4533 { |
|
4534 |
|
4535 TBuf<64> msg; |
|
4536 msg.Copy(_L("SUPL Timeout UI completed with ... ")); |
|
4537 msg.AppendNum(aError); |
|
4538 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4539 iSessionObserver.TerminateSession(this, KErrGeneral); |
|
4540 return; |
|
4541 |
|
4542 } |
|
4543 |
|
4544 // ----------------------------------------------------------------------------- |
|
4545 // COMASuplSession::StoreCurrentCellIDL |
|
4546 // Stores current cell id in CR |
|
4547 // |
|
4548 // ----------------------------------------------------------------------------- |
|
4549 void COMASuplSession::StoreCurrentCellIDL(HPositionGenericInfo& /*aSuplPosInfo*/) |
|
4550 { |
|
4551 iTrace->Trace(_L("Calling StoreCurrentCellIDL"),KTraceFileName, __LINE__); |
|
4552 TPckg<TCellIdInfo> cellPkg(iCurrentCellId); |
|
4553 |
|
4554 #ifdef PRINT_MESSAGE |
|
4555 TBuf<64> msg; |
|
4556 msg.Copy(_L("cid=:")); |
|
4557 msg.AppendNum(iCurrentCellId.iCid); |
|
4558 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4559 |
|
4560 msg.Copy(_L("Lac=:")); |
|
4561 msg.AppendNum(iCurrentCellId.iLac); |
|
4562 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4563 |
|
4564 msg.Copy(_L("MCC=:")); |
|
4565 msg.AppendNum(iCurrentCellId.iMCC); |
|
4566 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4567 |
|
4568 msg.Copy(_L("MNC=:")); |
|
4569 msg.AppendNum(iCurrentCellId.iMNC); |
|
4570 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4571 #endif |
|
4572 |
|
4573 CRepository* ConfigurationCenRepSession = CRepository::NewL(KCRUidOMASuplConfiguration); |
|
4574 CleanupStack::PushL(ConfigurationCenRepSession); |
|
4575 User::LeaveIfError(ConfigurationCenRepSession->Set(KOMASuplCurrentCellid, cellPkg)); |
|
4576 |
|
4577 CleanupStack::PopAndDestroy(ConfigurationCenRepSession); |
|
4578 } |
|
4579 |
|
4580 // ----------------------------------------------------------------------------- |
|
4581 // COMASuplSession::ServerAddressCheckForSuplInitL() |
|
4582 // Stores current cell id in CR |
|
4583 // |
|
4584 // ----------------------------------------------------------------------------- |
|
4585 TInt COMASuplSession::ServerAddressCheckForSuplInitL() |
|
4586 { |
|
4587 TBuf<256> serverName; |
|
4588 TBuf<64> msg; |
|
4589 |
|
4590 COMASuplSLPAddress* slpAddress = NULL; |
|
4591 COMASuplInit* SuplInit = static_cast <COMASuplInit *>(iDecodedAsnMessage); |
|
4592 TInt err = SuplInit->SLPAddress(slpAddress); |
|
4593 |
|
4594 if(err == KErrOMASuplParamNotSet) |
|
4595 { |
|
4596 msg.Copy(_L("SLP address is NOT PRESENT in SUPL_INIT.")); |
|
4597 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4598 |
|
4599 //Set default slp to Conn Requestor... |
|
4600 iConnRequestor->UseDefaultServerL(); |
|
4601 return KErrNone; |
|
4602 } |
|
4603 |
|
4604 COMASuplSLPAddress::TSuplSLPAddressType addressType = slpAddress->SLPAddressType(); |
|
4605 if(addressType == COMASuplSLPAddress::EFqdn) |
|
4606 { |
|
4607 HBufC8* fqdn; |
|
4608 TInt err = slpAddress->Fqdn(fqdn); |
|
4609 serverName.Copy(fqdn->Des()); |
|
4610 msg.Copy(_L("SLP address as FQDN is PRESENT in SUPL_INIT:")); |
|
4611 msg.Append(serverName); |
|
4612 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4613 } |
|
4614 else |
|
4615 { |
|
4616 TBuf8<256> IPslpaddress; |
|
4617 slpAddress->IPvAddress(IPslpaddress); |
|
4618 serverName.Copy(IPslpaddress); |
|
4619 msg.Copy(_L("SLP address as IP is PRESENT in SUPL_INIT:")); |
|
4620 msg.Append(serverName); |
|
4621 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4622 |
|
4623 } |
|
4624 |
|
4625 TBool isExist = iSuplStorageSettings->IsSlpExists(serverName); |
|
4626 if(isExist) |
|
4627 { |
|
4628 //Set to Conn Requestor... |
|
4629 iConnRequestor->UseServerL(serverName); |
|
4630 return KErrNone; |
|
4631 } |
|
4632 else |
|
4633 { |
|
4634 msg.Copy(_L("Dropping Packet.SLP absent in server List:")); |
|
4635 msg.Append(serverName); |
|
4636 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
4637 return KErrNotFound; |
|
4638 } |
|
4639 |
|
4640 } |
|
4641 |
|
4642 void COMASuplSession::CancelTriggerSession() |
|
4643 { |
|
4644 |
|
4645 } |
|
4646 |
|
4647 TUint COMASuplSession::GetPortNumUsed() |
|
4648 { |
|
4649 return iPortNum; |
|
4650 } |
|
4651 |