|
1 /* |
|
2 * Copyright (c) 2009 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: SUPL protocol manager implementation.i.e. OMA SUPL implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Includes |
|
20 |
|
21 #include <centralrepository.h> |
|
22 #include <commdb.h> |
|
23 #include <etelmm.h> |
|
24 #include <ecom/ecom.h> |
|
25 #include <in_sock.h> |
|
26 #include <bautils.h> |
|
27 #include <flogger.h> |
|
28 #include <CoreApplicationUIsSDKCRKeys.h> |
|
29 |
|
30 #include "epos_comasuplasnmessagebase.h" |
|
31 #include "epos_comasuplsessionid.h" |
|
32 #include "lbs/epos_comasuplposhandlerbase.h" |
|
33 #include "epos_suplconstants.h" |
|
34 #include "epos_csuplsettings.h" |
|
35 #include "epos_comasupletelnotifier.h" |
|
36 #include "epos_csuplsettingsinternal.h" |
|
37 #include "epos_suplterminalconstants.h" |
|
38 |
|
39 #include "epos_comasuplprotocolmanager2.h" |
|
40 #include "epos_csuplcommunicationmanager.h" |
|
41 #include "epos_comasuplcompleteselfrequestor.h" |
|
42 #include "epos_comasuplecomeventwatcher.h" |
|
43 #include "epos_comasuplsettings.h" |
|
44 #include "epos_omasuplconstants.h" |
|
45 #include "epos_omasuplconfigurationkeys.h" |
|
46 #include "epos_comasupltrace.h" |
|
47 #include "epos_comasupltimeouttimer.h" |
|
48 #include "epos_omasuplconstants.h" |
|
49 #include "epos_comasuplcommonconfig.h" |
|
50 |
|
51 // Constants |
|
52 _LIT(KTraceFileName,"SUPL_OMA_PH::EPos_COMASUPLProtocolManager2.cpp"); |
|
53 |
|
54 const TInt KMaxIMSILen = 20; |
|
55 const TInt KMaxDelay = 128; |
|
56 const TInt KDefaultHorizontalAccuracy = 0; |
|
57 const TInt KQueuedBufferTimeout = 11; |
|
58 |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // ResetAndDestroy() |
|
62 // Resets & destroys array if leave occurs |
|
63 // ----------------------------------------------------------------------------- |
|
64 void ResetAndDestroy(TAny* aArray) |
|
65 { |
|
66 ((RImplInfoPtrArray*)aArray)->ResetAndDestroy(); |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // FindNearestN |
|
71 // ----------------------------------------------------------------------------- |
|
72 TInt FindNearestN(TInt n) |
|
73 { |
|
74 TInt count = 0; |
|
75 TInt originalNumber = n; |
|
76 while(n) |
|
77 { |
|
78 n = n >> 1; |
|
79 count++; |
|
80 } |
|
81 |
|
82 TInt previousNumber = count - 1; |
|
83 TReal min,max; |
|
84 Math::Pow(min,2,previousNumber); |
|
85 Math::Pow(max,2,count); |
|
86 TInt avg = (min + max ) / 2; |
|
87 if (avg < originalNumber) |
|
88 return max; |
|
89 else |
|
90 return min; |
|
91 } |
|
92 |
|
93 // ============================ MEMBER FUNCTIONS =============================== |
|
94 // Create instance of concrete ECOM interface implementation |
|
95 EXPORT_C COMASUPLProtocolManager2* COMASUPLProtocolManager2::NewL() |
|
96 { |
|
97 COMASUPLProtocolManager2* self = new(ELeave) COMASUPLProtocolManager2(); |
|
98 CleanupStack::PushL(self); |
|
99 self->ConstructL(); |
|
100 CleanupStack::Pop(self); |
|
101 return self; |
|
102 } |
|
103 |
|
104 // Destructor. |
|
105 EXPORT_C COMASUPLProtocolManager2::~COMASUPLProtocolManager2() |
|
106 { |
|
107 if(iSettingsLauncher) |
|
108 { |
|
109 iSettingsLauncher->CancelLaunch(); |
|
110 } |
|
111 iSuplSettings->SetUIActive( EFalse ); |
|
112 |
|
113 DeleteAllSessions(); |
|
114 iSuplSessions.Reset(); |
|
115 iSuplSessions.Close(); |
|
116 |
|
117 iTelServer.UnloadPhoneModule(iTsyName); |
|
118 |
|
119 |
|
120 iQueuedPacket.Close(); |
|
121 |
|
122 delete iTimer; |
|
123 |
|
124 if(iSuplStorageSettings) |
|
125 { |
|
126 iSuplStorageSettings->RemoveObserver(); |
|
127 iSuplStorageSettings->RemoveSessionObserver(); |
|
128 } |
|
129 |
|
130 delete iSuplStorageSettings; |
|
131 delete iSettingsLauncher; |
|
132 delete iNotifier; |
|
133 iMobilePhone.Close(); |
|
134 iTelServer.Close(); |
|
135 iIMSI.Close(); |
|
136 iUIRequestArray.Close(); |
|
137 delete iOMASuplAsnHandlerBaseImpl; |
|
138 iTrace->Trace(_L("At the End of COMASUPLProtocolManager2::~COMASUPLProtocolManager2"), |
|
139 KTraceFileName, __LINE__); |
|
140 delete iTrace; |
|
141 } |
|
142 |
|
143 // Constructor |
|
144 COMASUPLProtocolManager2::COMASUPLProtocolManager2() : |
|
145 iRunningSessionCount(0), |
|
146 iSessnUIObserver(NULL), |
|
147 iDeInitDone(EFalse), |
|
148 iNotifyStarted(EFalse), |
|
149 iTimeOutDialogPresent(EFalse) |
|
150 { |
|
151 // no implementation required |
|
152 } |
|
153 |
|
154 // Second phase construction. |
|
155 void COMASUPLProtocolManager2::ConstructL() |
|
156 { |
|
157 iTrace = COMASuplTrace::NewL(); |
|
158 iTrace->Trace(_L("COMASUPLProtocolManager2::ConstructL"), KTraceFileName, __LINE__); |
|
159 |
|
160 iSuplStorageSettings = CSuplSettingsInternal::NewL(); |
|
161 iSuplStorageSettings->SetObserverL(*this); |
|
162 iSuplStorageSettings->SetSessionObserverL(*this); |
|
163 |
|
164 iSettingsLauncher = COMASuplSettingsLauncher::NewL( *this ); |
|
165 |
|
166 TRAPD(err,iOMASuplAsnHandlerBaseImpl = COMASuplAsnHandlerBase::NewL(2);) |
|
167 TBuf<64> buf(_L("ASN Plugin 2.0 loaded with error : ")); |
|
168 buf.AppendNum(err); |
|
169 iTrace->Trace(buf,KTraceFileName, __LINE__); |
|
170 User::LeaveIfError(err); |
|
171 |
|
172 iIMSI.CreateL( KMaxIMSILen ); |
|
173 |
|
174 iIsPreviouslyDecodingFailed = EFalse; |
|
175 iTimer = COMASuplTimeoutTimer::NewL(*this); |
|
176 } |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // COMASUPLProtocolManager2::CreateNewSessionL, |
|
180 // Creates new session |
|
181 // it transfers ownership to callee |
|
182 // |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 EXPORT_C CSuplSessionBase* COMASUPLProtocolManager2::CreateNewSessionL( |
|
186 CSUPLProtocolManagerBase::TSuplReqType aRequestType, |
|
187 TInt aIpcSessionId, |
|
188 RSuplTerminalSubSession::TSuplServiceType aSuplService) |
|
189 { |
|
190 // Map the type before creating the session object |
|
191 COMASuplSession::TOMASuplReqType requestType = COMASuplSession::ESUPL_TERMINAL; |
|
192 switch(aRequestType) |
|
193 { |
|
194 case CSUPLProtocolManagerBase::ENetwork: |
|
195 requestType = COMASuplSession::ESUPL_NETWORK; |
|
196 break; |
|
197 case CSUPLProtocolManagerBase::ETerminal: |
|
198 requestType = COMASuplSession::ESUPL_TERMINAL; |
|
199 default: |
|
200 break; |
|
201 } |
|
202 return CreateNewSessionL(requestType, aIpcSessionId,aSuplService); |
|
203 } |
|
204 |
|
205 // ----------------------------------------------------------------------------- |
|
206 // COMASUPLProtocolManager2::CreateNewSessionL |
|
207 // An overloaded CreateNewSession to take care of Invalid session ID |
|
208 // |
|
209 // ----------------------------------------------------------------------------- |
|
210 // |
|
211 CSuplSessionBase* COMASUPLProtocolManager2::CreateNewSessionL( |
|
212 COMASuplSession::TOMASuplReqType aRequestType, |
|
213 TInt aIpcSessionId, |
|
214 RSuplTerminalSubSession::TSuplServiceType /*aSuplService*/) |
|
215 { |
|
216 iTrace->Trace(_L("Creating New OMA SUPL Session"), KTraceFileName, __LINE__); |
|
217 CSuplSessionBase* SuplSession = COMASuplSession::NewL( |
|
218 *iCommManager, |
|
219 iMobilePhone, |
|
220 iSuplSettings, |
|
221 iSuplStorageSettings, |
|
222 aRequestType, |
|
223 *this, |
|
224 iPosHandler, |
|
225 iIMSI, |
|
226 *this, |
|
227 aIpcSessionId, |
|
228 iOMASuplAsnHandlerBaseImpl); |
|
229 |
|
230 User::LeaveIfError(iSuplSessions.Append(SuplSession)); |
|
231 return SuplSession; |
|
232 } |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // COMASUPLProtocolManager2::InitializeL |
|
236 // Does the connect to ETel. |
|
237 // Intilize POS if present |
|
238 // |
|
239 // ----------------------------------------------------------------------------- |
|
240 // |
|
241 EXPORT_C void COMASUPLProtocolManager2::InitializeL( |
|
242 CSuplCommunicationManager* aCommManager, |
|
243 TRequestStatus& /*aInitilizationRequestStatus*/) |
|
244 { |
|
245 iTrace->Trace(_L("COMASUPLProtocolManager2::InitializeL"), KTraceFileName, __LINE__); |
|
246 |
|
247 iCommManager = aCommManager; |
|
248 |
|
249 //Connect to ETel |
|
250 User::LeaveIfError(ConnectToETelL()); |
|
251 |
|
252 ReadSuplUsage(); |
|
253 |
|
254 if(iSuplEcomEventWatcher) |
|
255 { |
|
256 iTrace->Trace(_L("NotifyOnPlugInUnInstallation starting"), KTraceFileName, __LINE__); |
|
257 iSuplEcomEventWatcher->NotifyOnPlugInUnInstallation(); |
|
258 } |
|
259 iNotifier = COMASuplETelNotifier::NewL(*this,iMobilePhone); |
|
260 |
|
261 iTrace->Trace(_L("ETEL Notifier created"), KTraceFileName, __LINE__); |
|
262 iTrace->Trace(_L("COMASUPLProtocolManager2::InitializeL completed"), KTraceFileName, __LINE__); |
|
263 } |
|
264 |
|
265 // ----------------------------------------------------------------------------- |
|
266 // COMASUPLProtocolManager2::InitializeL |
|
267 // Cancel Initilization of Protocol manager |
|
268 // |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 EXPORT_C void COMASUPLProtocolManager2::CancelInitialize() |
|
272 { |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // COMASUPLProtocolManager2::RunSessionL |
|
277 // Starts the SUPL Sesssion for Terminal Initiated Location Request |
|
278 // |
|
279 // ----------------------------------------------------------------------------- |
|
280 // |
|
281 EXPORT_C void COMASUPLProtocolManager2::RunSessionL( |
|
282 CSuplSessionBase *const aSuplSession, |
|
283 TRequestStatus& aStatus, |
|
284 const TDesC& aHslpAddress, |
|
285 TBool aFallBack, |
|
286 TBool aFirstReq, |
|
287 TInt aAllowedCapabilities, |
|
288 TInt aRequestID) |
|
289 { |
|
290 iTrace->Trace(_L("COMASUPLProtocolManager2::RunSessionL"), KTraceFileName, __LINE__); |
|
291 |
|
292 #ifdef PRINT_MESSAGE |
|
293 TBuf<255> tempBuf; |
|
294 tempBuf.Append(_L("Server name in Protocol Handler is : ")); |
|
295 tempBuf.Append(aHslpAddress); |
|
296 |
|
297 iTrace->Trace(tempBuf, KTraceFileName, __LINE__); |
|
298 |
|
299 |
|
300 if (aFallBack) |
|
301 { |
|
302 tempBuf.Copy(_L("Fallback is set as TRUE.")); |
|
303 } |
|
304 else |
|
305 { |
|
306 tempBuf.Copy(_L("Fallback is set as False")); |
|
307 } |
|
308 iTrace->Trace(tempBuf, KTraceFileName, __LINE__); |
|
309 #endif |
|
310 iTrace->Trace(_L("COMASUPLProtocolManager2::RunSessionL"), KTraceFileName, __LINE__); |
|
311 |
|
312 if ( iSuplSessions.Find(aSuplSession) == KErrNotFound ) |
|
313 { |
|
314 TRequestStatus *status = &aStatus; |
|
315 User::RequestComplete(status,KErrNotFound ); |
|
316 return; |
|
317 } |
|
318 |
|
319 CheckForSessionCount(); |
|
320 iRunningSessionCount++; |
|
321 |
|
322 COMASuplSession* OMASession = static_cast<COMASuplSession*>(aSuplSession); |
|
323 OMASession->SetConfigurationParameters( |
|
324 iUT1_StartTimer, |
|
325 iUT2_PosInitTimer, |
|
326 iUT3_PosTimer, |
|
327 iPrivacyTimer, |
|
328 iSETMode, |
|
329 iSuplUsage, |
|
330 iPersistFailTimer, |
|
331 iSuplInitTimeOut); |
|
332 |
|
333 OMASession->RunSuplSessionL( |
|
334 aStatus, |
|
335 aFirstReq, |
|
336 aHslpAddress, |
|
337 aFallBack, |
|
338 aAllowedCapabilities, |
|
339 iRunningSessionCount, |
|
340 aRequestID); |
|
341 } |
|
342 |
|
343 |
|
344 // ----------------------------------------------------------------------------- |
|
345 // COMASUPLProtocolManager2::RunSessionL |
|
346 // Starts the SUPL Sesssion for Terminal Initiated Location Request,with QoP support |
|
347 // |
|
348 // ----------------------------------------------------------------------------- |
|
349 // |
|
350 EXPORT_C void COMASUPLProtocolManager2::RunSessionL( |
|
351 CSuplSessionBase *const aSuplSession, |
|
352 TRequestStatus& aStatus, |
|
353 const TDesC& aHslpAddress, |
|
354 TBool aFallBack, |
|
355 TBool aFirstReq, |
|
356 TInt aAllowedCapabilities, |
|
357 TSuplTerminalQop& aQop, |
|
358 TInt aRequestID) |
|
359 { |
|
360 iTrace->Trace(_L("COMASUPLProtocolManager2::RunSessionL"), KTraceFileName, __LINE__); |
|
361 #ifdef PRINT_MESSAGE |
|
362 TBuf<255> tempBuf; |
|
363 tempBuf.Append(_L("Server name in Protocol Handler is : ")); |
|
364 tempBuf.Append(aHslpAddress); |
|
365 |
|
366 iTrace->Trace(tempBuf, KTraceFileName, __LINE__); |
|
367 if (aFallBack) |
|
368 { |
|
369 tempBuf.Copy(_L("Fallback is set as TRUE.")); |
|
370 } |
|
371 else |
|
372 { |
|
373 tempBuf.Copy(_L("Fallback is set as False")); |
|
374 } |
|
375 iTrace->Trace(tempBuf, KTraceFileName, __LINE__); |
|
376 #endif |
|
377 |
|
378 |
|
379 |
|
380 iTrace->Trace(_L("COMASUPLProtocolManager2::RunSessionL"), KTraceFileName, __LINE__); |
|
381 |
|
382 if ( iSuplSessions.Find(aSuplSession) == KErrNotFound ) |
|
383 { |
|
384 TRequestStatus *status = &aStatus; |
|
385 User::RequestComplete(status,KErrNotFound ); |
|
386 return; |
|
387 } |
|
388 |
|
389 TReal32 horizonatalAccuracy; |
|
390 if(aQop.GetHorizontalAccuracy(horizonatalAccuracy) == KErrNotFound) |
|
391 { |
|
392 aQop.SetHorizontalAccuracy(KDefaultHorizontalAccuracy); |
|
393 } |
|
394 |
|
395 TReal32 verticalAccuracy; |
|
396 if(aQop.GetVerticalAccuracy(verticalAccuracy) == KErrNone) |
|
397 { |
|
398 if (verticalAccuracy > KOMAMaxVerticalAccuracy) |
|
399 aQop.SetVerticalAccuracy(KOMAMaxVerticalAccuracy); |
|
400 } |
|
401 |
|
402 TInt delay; |
|
403 |
|
404 if(aQop.GetDelay(delay) != KErrNotFound) |
|
405 { |
|
406 if(delay < 1 ) |
|
407 { |
|
408 TRequestStatus *status = &aStatus; |
|
409 User::RequestComplete(status,KErrArgument); |
|
410 return; |
|
411 } |
|
412 |
|
413 if( delay > 128 ) |
|
414 { |
|
415 aQop.SetDelay(KMaxDelay); |
|
416 } |
|
417 else |
|
418 { |
|
419 switch(delay) |
|
420 { |
|
421 case 1: |
|
422 case 2: |
|
423 case 4: |
|
424 case 8: |
|
425 case 16: |
|
426 case 32: |
|
427 case 64: |
|
428 case 128: |
|
429 break; |
|
430 default: |
|
431 { |
|
432 aQop.SetDelay(FindNearestN(delay)); |
|
433 } |
|
434 } |
|
435 } |
|
436 } |
|
437 |
|
438 CheckForSessionCount(); |
|
439 iRunningSessionCount++; |
|
440 |
|
441 COMASuplSession* OMASession = static_cast<COMASuplSession*>(aSuplSession); |
|
442 OMASession->SetConfigurationParameters( |
|
443 iUT1_StartTimer, |
|
444 iUT2_PosInitTimer, |
|
445 iUT3_PosTimer, |
|
446 iPrivacyTimer, |
|
447 iSETMode, |
|
448 iSuplUsage, |
|
449 iPersistFailTimer, |
|
450 iSuplInitTimeOut); |
|
451 |
|
452 OMASession->RunSuplSessionL( |
|
453 aStatus, |
|
454 aFirstReq, |
|
455 aHslpAddress, |
|
456 aFallBack, |
|
457 aAllowedCapabilities, |
|
458 iRunningSessionCount, |
|
459 aQop, |
|
460 aRequestID); |
|
461 |
|
462 } |
|
463 |
|
464 // ----------------------------------------------------------------------------- |
|
465 // COMASUPLProtocolManager2::CheckForSessionCount |
|
466 // Check for MAximum session count..if it reaches to MAX,it resets to zero |
|
467 // ----------------------------------------------------------------------------- |
|
468 // |
|
469 void COMASUPLProtocolManager2::CheckForSessionCount() |
|
470 { |
|
471 if (iRunningSessionCount == KMaxSessionCount) |
|
472 iRunningSessionCount = 0; |
|
473 } |
|
474 |
|
475 // ----------------------------------------------------------------------------- |
|
476 // COMASUPLProtocolManager2::ConnectToETelL |
|
477 // Connects to Telephony server & RMobilePhone |
|
478 // Returns System wide error,if any occurs |
|
479 // ----------------------------------------------------------------------------- |
|
480 // |
|
481 TInt COMASUPLProtocolManager2::ConnectToETelL() |
|
482 { |
|
483 iTrace->Trace(_L("Start of COMASUPLProtocolManager2::ConnectToETelL"), KTraceFileName, __LINE__); |
|
484 TInt err = iTelServer.Connect(); |
|
485 if(err != KErrNone) |
|
486 { |
|
487 TBuf<8> errrorCode; |
|
488 errrorCode.AppendNum(err); |
|
489 TBuf<64> msg(_L("Failed to Connect ETel with Reason Code ")); |
|
490 msg.Append(errrorCode); |
|
491 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
492 return err; |
|
493 } |
|
494 |
|
495 iTrace->Trace(_L("Opening CommsDatabase..."), KTraceFileName, __LINE__); |
|
496 CCommsDatabase* const db = CCommsDatabase::NewL(EDatabaseTypeUnspecified); |
|
497 CleanupStack::PushL(db); |
|
498 |
|
499 TUint32 modemId = 0; |
|
500 db->GetGlobalSettingL(TPtrC(MODEM_PHONE_SERVICES_SMS), modemId); |
|
501 iTrace->Trace(_L("Retriving TSY Name..."), KTraceFileName, __LINE__); |
|
502 CCommsDbTableView* const view = db->OpenViewMatchingUintLC(TPtrC(MODEM), TPtrC(COMMDB_ID), |
|
503 modemId); |
|
504 err = view->GotoFirstRecord(); |
|
505 if(err != KErrNone) |
|
506 { |
|
507 CleanupStack::PopAndDestroy(2,db); |
|
508 return err; |
|
509 } |
|
510 |
|
511 view->ReadTextL(TPtrC(MODEM_TSY_NAME), iTsyName); |
|
512 err = iTelServer.LoadPhoneModule(iTsyName); |
|
513 |
|
514 if(err != KErrNone) |
|
515 { |
|
516 CleanupStack::PopAndDestroy(2,db); |
|
517 return err; |
|
518 } |
|
519 |
|
520 // For the phone information |
|
521 RTelServer::TPhoneInfo info; |
|
522 |
|
523 iTelServer.GetPhoneInfo(0, info); |
|
524 iTrace->Trace(_L("Opening RMobilePhone..."), KTraceFileName, __LINE__); |
|
525 err = iMobilePhone.Open(iTelServer, info.iName); |
|
526 |
|
527 CleanupStack::PopAndDestroy(2,db); |
|
528 if(err != KErrNone) |
|
529 { |
|
530 return err; |
|
531 } |
|
532 |
|
533 iTrace->Trace(_L("End of COMASUPLProtocolManager2::ConnectToETelL"), KTraceFileName, __LINE__); |
|
534 return err; |
|
535 } |
|
536 |
|
537 // ----------------------------------------------------------------------------- |
|
538 // COMASUPLProtocolManager2::DestroySession |
|
539 // Deletes specified session & removes from array. |
|
540 // Returns System wide error,if any occurs |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 EXPORT_C TInt COMASUPLProtocolManager2::DestroySession(CSuplSessionBase* aSuplSession) |
|
544 { |
|
545 // Log |
|
546 iTrace->Trace(_L("COMASUPLProtocolManager2::DestroySession"), KTraceFileName, __LINE__); |
|
547 |
|
548 // Check if the Session is valid |
|
549 TInt index = iSuplSessions.Find(aSuplSession); |
|
550 |
|
551 if(KErrNotFound == index) |
|
552 { |
|
553 iTrace->Trace(_L("Cannot found Supl session."), KTraceFileName, __LINE__); |
|
554 return KErrArgument; |
|
555 } |
|
556 |
|
557 // Remove from Array |
|
558 iTrace->Trace(_L("COMASUPLProtocolManager2::DestroySession Remove Session"), KTraceFileName, __LINE__); |
|
559 iSuplSessions.Remove(index); |
|
560 |
|
561 //Last Session invoking Destroy |
|
562 iTrace->Trace(_L("COMASUPLProtocolManager2::DestroySession Destroy Session"), KTraceFileName, __LINE__); |
|
563 |
|
564 COMASuplSession* OMASession = static_cast<COMASuplSession*>(aSuplSession); |
|
565 if (OMASession->GetSessionUIFlag()) |
|
566 { |
|
567 OMASession->DestroySession(); |
|
568 iSessnUIObserver = NULL; |
|
569 } |
|
570 else |
|
571 OMASession->DestroySession(); |
|
572 |
|
573 return KErrNone; |
|
574 } |
|
575 |
|
576 |
|
577 // ----------------------------------------------------------------------------- |
|
578 // COMASUPLProtocolManager2::DeleteAllSessions |
|
579 // Delets all session & removes from array. |
|
580 // |
|
581 // ----------------------------------------------------------------------------- |
|
582 // |
|
583 void COMASUPLProtocolManager2::DeleteAllSessions() |
|
584 { |
|
585 iTrace->Trace(_L("COMASUPLProtocolManager2::DeleteAllSessions"), KTraceFileName, __LINE__); |
|
586 while(iSuplSessions.Count() > 0) |
|
587 { |
|
588 DestroySession(iSuplSessions[0]); |
|
589 } |
|
590 } |
|
591 |
|
592 // ----------------------------------------------------------------------------- |
|
593 // COMASUPLProtocolManager2::HandlePacket |
|
594 // Handles Supl packets , received from SLP |
|
595 // |
|
596 // ----------------------------------------------------------------------------- |
|
597 // |
|
598 EXPORT_C void COMASUPLProtocolManager2::HandlePacket(const TDesC8& aPacket, TUint aPortNum) |
|
599 { |
|
600 iTrace->Trace(_L("Start of COMASUPLProtocolManager2::HandlePacket"), KTraceFileName, __LINE__); |
|
601 |
|
602 TRAPD(err,HandleOMASuplPacketsL(aPacket, aPortNum)); |
|
603 |
|
604 if(err!= KErrNone) |
|
605 { |
|
606 ResetBufferingParameters(); |
|
607 TBuf<64> msg(_L("HandleOMASuplPacketsL Leaved with error code : ")); |
|
608 msg.AppendNum(err); |
|
609 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
610 } |
|
611 } |
|
612 |
|
613 // ----------------------------------------------------------------------------- |
|
614 // COMASUPLProtocolManager2::HandlePacketError |
|
615 // Handles Supl packet receiving errors |
|
616 // |
|
617 // ----------------------------------------------------------------------------- |
|
618 // |
|
619 EXPORT_C void COMASUPLProtocolManager2::HandlePacketError(TInt /*aError*/) |
|
620 { |
|
621 // Do nothing for now |
|
622 } |
|
623 |
|
624 // ----------------------------------------------------------------------------- |
|
625 // COMASUPLProtocolManager2::TerminateSession |
|
626 // Terminate the session specified by the parameter |
|
627 // |
|
628 // ----------------------------------------------------------------------------- |
|
629 // |
|
630 void COMASUPLProtocolManager2::TerminateSession(CSuplSessionBase *aSession, TInt aError) |
|
631 { |
|
632 // Check if the Session is valid |
|
633 TInt index = iSuplSessions.Find(aSession); |
|
634 |
|
635 if(KErrNotFound == index) |
|
636 { |
|
637 return; |
|
638 } |
|
639 |
|
640 COMASuplSession *omaSuplSession = static_cast <COMASuplSession *> (aSession); |
|
641 |
|
642 // Check the type of Session |
|
643 if(omaSuplSession->RequestType() == COMASuplSession::ESUPL_TERMINAL) |
|
644 { |
|
645 // For Terminal initiated session, do not delete the session |
|
646 omaSuplSession->SessionEnd(); |
|
647 |
|
648 // Complete the client request |
|
649 omaSuplSession->CompleteSession(aError); |
|
650 } |
|
651 else |
|
652 { |
|
653 // For Network Initiated session and invalid session, delete the session |
|
654 omaSuplSession->SessionEnd(); |
|
655 // Complete the client request |
|
656 omaSuplSession->CompleteSession(aError); |
|
657 DestroySession(omaSuplSession); |
|
658 } |
|
659 } |
|
660 |
|
661 // ----------------------------------------------------------------------------- |
|
662 // COMASUPLProtocolManager2::HandleOMASuplPacketsL |
|
663 // Handles Supl packets , received from SLP |
|
664 // |
|
665 // ----------------------------------------------------------------------------- |
|
666 // |
|
667 void COMASUPLProtocolManager2::HandleOMASuplPacketsL(const TDesC8& aPacket, TUint aPortNum) |
|
668 { |
|
669 RBuf8 Packet; |
|
670 TBool isDecodingRequired = ETrue; |
|
671 TInt errorCode = KErrNone; |
|
672 TInt unConsumedBytes = aPacket.Length(); |
|
673 TBuf<64> msg(_L("Length of Received message is : ")); |
|
674 msg.AppendNum(unConsumedBytes); |
|
675 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
676 COMASuplAsnMessageBase* decodedAsn = NULL; |
|
677 CleanupClosePushL(Packet); |
|
678 |
|
679 iTimer->StopTimer(); |
|
680 |
|
681 if(iIsPreviouslyDecodingFailed) //Previous decoding Failed... |
|
682 { |
|
683 User::LeaveIfError(iQueuedPacket.ReAlloc(unConsumedBytes + iQueuedPacket.Length())); |
|
684 iQueuedPacket.Append(aPacket); |
|
685 if( iQueuedPacket.Length() >= iPreviousMessageLength ) // Message length is enough to decode |
|
686 { |
|
687 isDecodingRequired = ETrue; |
|
688 User::LeaveIfError(Packet.ReAlloc(iQueuedPacket.Length())); |
|
689 Packet.Append(iQueuedPacket); |
|
690 unConsumedBytes = iQueuedPacket.Length(); |
|
691 |
|
692 msg.Copy(_L("Length of Combined buffer is : ")); |
|
693 msg.AppendNum(unConsumedBytes); |
|
694 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
695 } |
|
696 else |
|
697 { |
|
698 isDecodingRequired = EFalse; |
|
699 } |
|
700 } |
|
701 else |
|
702 { |
|
703 User::LeaveIfError(Packet.ReAlloc(unConsumedBytes)); |
|
704 Packet.Append(aPacket); |
|
705 } |
|
706 |
|
707 while(unConsumedBytes != 0 && errorCode == KErrNone && isDecodingRequired) |
|
708 { |
|
709 msg.Copy(_L("Unconsumed bytes are : ")); |
|
710 msg.AppendNum(unConsumedBytes); |
|
711 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
712 |
|
713 TRAPD(trapErr,decodedAsn = iOMASuplAsnHandlerBaseImpl->DecodeL(Packet.Right(unConsumedBytes),errorCode,unConsumedBytes)); |
|
714 LogPacket(aPacket,decodedAsn); |
|
715 |
|
716 if(trapErr!= KErrNone ) //Decoding leaved...clear everything. |
|
717 { |
|
718 TBuf<64> msg(_L("COMASuplAsnDecoder::DecodeL() Leaved with error code : ")); |
|
719 msg.AppendNum(trapErr); |
|
720 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
721 ResetBufferingParameters(); |
|
722 CleanupStack::PopAndDestroy(); //Packet |
|
723 return; |
|
724 } |
|
725 |
|
726 if(!decodedAsn) |
|
727 { |
|
728 CleanupStack::PopAndDestroy(); //Packet |
|
729 return; |
|
730 } |
|
731 |
|
732 if(errorCode == KErrOMASuplDecodeSessionFailed) //Decoding failed...drop packet |
|
733 { |
|
734 ResetBufferingParameters(); |
|
735 delete decodedAsn; |
|
736 CleanupStack::PopAndDestroy(); //Packet |
|
737 iTrace->Trace(_L("Decoding failed..."), KTraceFileName, __LINE__); |
|
738 return; |
|
739 } |
|
740 |
|
741 iPreviousMessageLength = decodedAsn->MessageLength(); |
|
742 msg.Copy(_L("Message Length of Received SUPL message is : ")); |
|
743 msg.AppendNum(iPreviousMessageLength ); |
|
744 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
745 |
|
746 if(iPreviousMessageLength <= 0) //Could not found message length... |
|
747 { |
|
748 ResetBufferingParameters(); |
|
749 delete decodedAsn; |
|
750 CleanupStack::PopAndDestroy(); //Packet |
|
751 iTrace->Trace(_L("Negative/Zero message length..."), KTraceFileName, __LINE__); |
|
752 return; |
|
753 } |
|
754 |
|
755 CleanupStack::PushL(decodedAsn); |
|
756 COMASuplSessionID* retrivedSessionID = NULL; |
|
757 decodedAsn->SessionId(retrivedSessionID); |
|
758 LogReceivedSessionIdL(retrivedSessionID); |
|
759 TBool isInvalidSLPID; |
|
760 TBool isInvalidSETID; |
|
761 COMASuplSession* suplSession = FindSession( |
|
762 retrivedSessionID, |
|
763 isInvalidSLPID, |
|
764 isInvalidSETID); |
|
765 |
|
766 if((isInvalidSETID && suplSession) || (isInvalidSLPID && suplSession)) |
|
767 { |
|
768 iTrace->Trace(_L("Running invalid session"), KTraceFileName, __LINE__); |
|
769 suplSession->RunInvalidSessionL(decodedAsn); |
|
770 ResetBufferingParameters(); |
|
771 CleanupStack::PopAndDestroy(decodedAsn); // decodedAsn |
|
772 CleanupStack::PopAndDestroy(); //Packet |
|
773 return; |
|
774 } |
|
775 |
|
776 if(errorCode == KErrOMASuplShortFrame ) // Newly added code for Short Frame... |
|
777 { |
|
778 if(suplSession) |
|
779 { |
|
780 if(suplSession->CheckProtocolVersionL(decodedAsn)) //Check for version & will send SUPL_END if mismatch |
|
781 { |
|
782 msg.Copy(_L("ASN returned Short Frame error.")); |
|
783 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
784 User::LeaveIfError(iQueuedPacket.ReAlloc(iQueuedPacket.Length() + aPacket.Length())); |
|
785 iQueuedPacket.Append(aPacket); |
|
786 iIsPreviouslyDecodingFailed = ETrue; |
|
787 iTimer->StartTimer(KQueuedBufferTimeout * KSecond); |
|
788 } |
|
789 else |
|
790 { |
|
791 ResetBufferingParameters(); //After sending SUPL_END ....clearing all variables needed for TCP Buffering. |
|
792 } |
|
793 |
|
794 CleanupStack::PopAndDestroy(decodedAsn); // decodedAsn |
|
795 CleanupStack::PopAndDestroy(); //Packet |
|
796 return; |
|
797 } |
|
798 } |
|
799 |
|
800 if(suplSession) //Session Found |
|
801 { |
|
802 if(errorCode == KErrOMASuplMessageLengthMismatch) //Added after Confirmance test cases (invalid message) |
|
803 { |
|
804 iTrace->Trace(_L("Received Message with wrong message length..."), KTraceFileName, __LINE__); |
|
805 ResetBufferingParameters(); |
|
806 suplSession->HandleInvalidMessageLengthL(); |
|
807 } |
|
808 if(errorCode == KErrOMASuplInvalidMessage) //Checks for invalid message |
|
809 { |
|
810 iTrace->Trace(_L("Received Invalid Message..."), KTraceFileName, __LINE__); |
|
811 ResetBufferingParameters(); |
|
812 suplSession->HandleInvalidMessageL(decodedAsn); |
|
813 } |
|
814 |
|
815 if(errorCode == KErrNone) //Successful decoding of message |
|
816 { |
|
817 ResetBufferingParameters(); |
|
818 iTrace->Trace(_L("Message decoded successfully...passing to appropriate session..."), KTraceFileName, __LINE__); |
|
819 suplSession->HandleOMASuplMessageL(decodedAsn); |
|
820 } |
|
821 |
|
822 if(errorCode == KErrCompletion) //Only session id retrived from message,Send error code |
|
823 { |
|
824 iTrace->Trace(_L("Retrived sessionid.Decoding failed.Handling Invalid Parameter."), KTraceFileName, __LINE__); |
|
825 suplSession->HandleInvalidParameterErrorL(decodedAsn); |
|
826 unConsumedBytes = 0; //Drop packet |
|
827 } |
|
828 } |
|
829 else //Session Not Found....Sending SUPL_END with invalidsession |
|
830 { |
|
831 //Check if session can be found based on port number |
|
832 suplSession = FindSessionOnPortNum(aPortNum); |
|
833 |
|
834 if (suplSession) |
|
835 { |
|
836 iTrace->Trace(_L("Running invalid session"), KTraceFileName, __LINE__); |
|
837 suplSession->RunInvalidSessionL(decodedAsn); |
|
838 ResetBufferingParameters(); |
|
839 CleanupStack::PopAndDestroy(decodedAsn); // decodedAsn |
|
840 CleanupStack::PopAndDestroy(); //Packet |
|
841 return; |
|
842 } |
|
843 else |
|
844 { |
|
845 ResetBufferingParameters(); |
|
846 iTrace->Trace(_L("Received Invalid Session."), KTraceFileName, __LINE__); |
|
847 ProcessInvalidSessionL(decodedAsn); |
|
848 unConsumedBytes = 0; //Drop packet |
|
849 } |
|
850 } |
|
851 |
|
852 CleanupStack::PopAndDestroy(decodedAsn); |
|
853 } |
|
854 |
|
855 CleanupStack::PopAndDestroy(); //Packet |
|
856 } |
|
857 |
|
858 // ----------------------------------------------------------------------------- |
|
859 // COMASUPLProtocolManager2::FindSession |
|
860 // Finds perticuler session from session array. |
|
861 // |
|
862 // ----------------------------------------------------------------------------- |
|
863 // |
|
864 COMASuplSession* COMASUPLProtocolManager2::FindSession( |
|
865 COMASuplSessionID* aRetrivedSessionID, |
|
866 TBool& aInvalidSLPId, |
|
867 TBool& aInvalidSETId) const |
|
868 { |
|
869 |
|
870 /* |
|
871 Algorithm for matching session ID |
|
872 For each session we are going to follow, following preocedure... |
|
873 if session in array haves SET id then we are going to compare SET id and at the same time if SLP id |
|
874 also present in session then we will also compare SLP id. |
|
875 If both matches then we are going to return session id. |
|
876 & if SLP Id does not matches then comparasion will be done for next session. |
|
877 If SLP id does not present in session id, in this case we will compare only SET id. |
|
878 */ |
|
879 |
|
880 aInvalidSLPId = EFalse; |
|
881 aInvalidSETId = EFalse; |
|
882 COMASuplSession* OMAsuplSession = NULL; |
|
883 COMASuplSessionID* suplSessionID = NULL; |
|
884 |
|
885 TInt TotalSession = iSuplSessions.Count(); |
|
886 |
|
887 COMASuplSETSessionID* retrivedSuplSETID = GetSETSessionID(aRetrivedSessionID); |
|
888 COMASuplSLPSessionID* retrivedSuplSLPID = GetSLPSessionID(aRetrivedSessionID); |
|
889 iTrace->Trace(_L("COMASUPLProtocolManager2::FindSession Searching in availble Sessions... "), KTraceFileName, __LINE__); |
|
890 for(TInt cnt = 0; cnt < TotalSession; ++cnt) |
|
891 { |
|
892 OMAsuplSession = static_cast<COMASuplSession*>(iSuplSessions[cnt]); |
|
893 suplSessionID = OMAsuplSession->SuplSessionID(); |
|
894 COMASuplSETSessionID* suplSETID = GetSETSessionID(suplSessionID); |
|
895 LogAvailableSessions(suplSETID,GetSLPSessionID(suplSessionID),cnt); |
|
896 |
|
897 if(suplSETID) |
|
898 { |
|
899 iTrace->Trace(_L("FindSession, SET ID Present ... "), KTraceFileName, __LINE__); |
|
900 if(CompareSETSessionID(suplSETID, retrivedSuplSETID)) |
|
901 { |
|
902 COMASuplSLPSessionID* suplSLPID = GetSLPSessionID(suplSessionID); |
|
903 if(suplSLPID) |
|
904 { |
|
905 if(CompareSLPSessionID(suplSLPID, retrivedSuplSLPID)) |
|
906 { |
|
907 iTrace->Trace(_L("COMASUPLProtocolManager2::FindSession Searching Done...Session Found"), KTraceFileName, __LINE__); |
|
908 return OMAsuplSession; |
|
909 } |
|
910 else |
|
911 { |
|
912 aInvalidSLPId = ETrue;//means we have received message with incorrect SLP session id. |
|
913 //continue; changed after Confirmance test.... |
|
914 return OMAsuplSession; |
|
915 } |
|
916 } |
|
917 |
|
918 iTrace->Trace(_L("COMASUPLProtocolManager2::FindSession Searching Done...Session Found"), KTraceFileName, __LINE__); |
|
919 return OMAsuplSession; |
|
920 } |
|
921 else |
|
922 { |
|
923 iTrace->Trace(_L("FindSession, SET ID comp failed ... "), KTraceFileName, __LINE__); |
|
924 COMASuplSLPSessionID* suplSLPID = GetSLPSessionID(suplSessionID); |
|
925 if(suplSLPID) |
|
926 { |
|
927 iTrace->Trace(_L("FindSession, SLP ID present... "), KTraceFileName, __LINE__); |
|
928 if (CompareSLPSessionID(suplSLPID, retrivedSuplSLPID)) |
|
929 { |
|
930 iTrace->Trace(_L("FindSession, SLP ID comp succeeded... "), KTraceFileName, __LINE__); |
|
931 aInvalidSETId = ETrue;//means we have received message with incorrect SET session id. |
|
932 //continue; changed after Confirmance test.... |
|
933 return OMAsuplSession; |
|
934 } |
|
935 } |
|
936 } |
|
937 } |
|
938 } |
|
939 |
|
940 iTrace->Trace(_L("COMASUPLProtocolManager2::FindSession Searching Done...Session Not Found."), KTraceFileName, __LINE__); |
|
941 return NULL; |
|
942 } |
|
943 |
|
944 // ----------------------------------------------------------------------------- |
|
945 // COMASUPLProtocolManager::FindSessionOnPortNum |
|
946 // Finds perticuler session from session array. |
|
947 // |
|
948 // ----------------------------------------------------------------------------- |
|
949 // |
|
950 COMASuplSession* COMASUPLProtocolManager2::FindSessionOnPortNum(TUint aPortNum) const |
|
951 { |
|
952 iTrace->Trace(_L("COMASUPLProtocolManager2::FindSessionOnPortNum start"), KTraceFileName, __LINE__); |
|
953 |
|
954 COMASuplSession* OMAsuplSession = NULL; |
|
955 TInt TotalSession = iSuplSessions.Count(); |
|
956 TUint portNum=0; |
|
957 |
|
958 iTrace->Trace(_L("COMASUPLProtocolManager2::FindSessionOnPortNum Searching in availble Sessions"), KTraceFileName, __LINE__); |
|
959 for(TInt cnt = 0; cnt < TotalSession; ++cnt) |
|
960 { |
|
961 OMAsuplSession = static_cast<COMASuplSession*>(iSuplSessions[cnt]); |
|
962 portNum = OMAsuplSession->GetPortNumUsed(); |
|
963 if (portNum != 0 && portNum == aPortNum) |
|
964 { |
|
965 iTrace->Trace(_L("COMASUPLProtocolManager2::FindSessionOnPortNum Searching Done...Session Found"), KTraceFileName, __LINE__); |
|
966 return OMAsuplSession; |
|
967 } |
|
968 } |
|
969 |
|
970 iTrace->Trace(_L("COMASUPLProtocolManager2::FindSessionOnPortNum Searching Done...Session Not Found."), KTraceFileName, __LINE__); |
|
971 return NULL; |
|
972 } |
|
973 // ----------------------------------------------------------------------------- |
|
974 // COMASUPLProtocolManager::GetSETSession |
|
975 // Retrives COMASuplSETSessionID from COMASuplSessionID. |
|
976 // |
|
977 // ----------------------------------------------------------------------------- |
|
978 // |
|
979 COMASuplSETSessionID* COMASUPLProtocolManager2::GetSETSessionID(COMASuplSessionID* |
|
980 aOMAsuplSessionID) const |
|
981 { |
|
982 if(aOMAsuplSessionID) |
|
983 { |
|
984 COMASuplSETSessionID* suplSETID = NULL; |
|
985 aOMAsuplSessionID->SETSessionID(suplSETID); |
|
986 return suplSETID; |
|
987 } |
|
988 else |
|
989 return NULL; |
|
990 } |
|
991 |
|
992 // ----------------------------------------------------------------------------- |
|
993 // COMASUPLProtocolManager2::GetSLPSession |
|
994 // Retrives COMASuplSLPSessionID from COMASuplSessionID. |
|
995 // |
|
996 // ----------------------------------------------------------------------------- |
|
997 // |
|
998 COMASuplSLPSessionID* COMASUPLProtocolManager2::GetSLPSessionID(COMASuplSessionID* |
|
999 aOMAsuplSessionID) const |
|
1000 { |
|
1001 if(aOMAsuplSessionID) |
|
1002 { |
|
1003 COMASuplSLPSessionID* suplSLPID = NULL; |
|
1004 aOMAsuplSessionID->SLPSessionID(suplSLPID); |
|
1005 return suplSLPID; |
|
1006 } |
|
1007 else |
|
1008 return NULL; |
|
1009 } |
|
1010 |
|
1011 // ----------------------------------------------------------------------------- |
|
1012 // COMASUPLProtocolManager2::CompareSETSessionID |
|
1013 // Compares two SET session IDs |
|
1014 // |
|
1015 // ----------------------------------------------------------------------------- |
|
1016 // |
|
1017 TBool COMASUPLProtocolManager2::CompareSETSessionID(COMASuplSETSessionID* aSuplSETID, |
|
1018 COMASuplSETSessionID* aRetrivedSuplSETID) const |
|
1019 { |
|
1020 if ( aRetrivedSuplSETID && aSuplSETID) |
|
1021 return *aRetrivedSuplSETID == *aSuplSETID; |
|
1022 else |
|
1023 return EFalse; |
|
1024 } |
|
1025 |
|
1026 // ----------------------------------------------------------------------------- |
|
1027 // COMASUPLProtocolManager2::CompareSLPSessionID |
|
1028 // Compares two SLP session IDs |
|
1029 // |
|
1030 // ----------------------------------------------------------------------------- |
|
1031 // |
|
1032 TBool COMASUPLProtocolManager2::CompareSLPSessionID(COMASuplSLPSessionID* aSuplSLPID, |
|
1033 COMASuplSLPSessionID* aRetrivedSuplSLPID) const |
|
1034 { |
|
1035 if ( aRetrivedSuplSLPID && aSuplSLPID) |
|
1036 return *aRetrivedSuplSLPID == *aSuplSLPID; |
|
1037 else |
|
1038 return EFalse; |
|
1039 } |
|
1040 |
|
1041 // ----------------------------------------------------------------------------- |
|
1042 // COMASUPLProtocolManager2::ProcessInvalidSessionL |
|
1043 // Processes invalid session .. creates new session & sends SUPL_END |
|
1044 // |
|
1045 // ----------------------------------------------------------------------------- |
|
1046 // |
|
1047 void COMASUPLProtocolManager2::ProcessInvalidSessionL(COMASuplAsnMessageBase* aDecodedMsg) |
|
1048 { |
|
1049 // 1. Create a new session for handling the invalid session case |
|
1050 CSuplSessionBase* suplSession = NULL; |
|
1051 |
|
1052 TRAPD(err, suplSession = CreateNewSessionL( |
|
1053 COMASuplSession::ESUPL_INVALID_SESSION, |
|
1054 0, |
|
1055 RSuplTerminalSubSession::ESUPL_2_0)) |
|
1056 |
|
1057 COMASuplSession* invalidSession = static_cast<COMASuplSession*>(suplSession); |
|
1058 |
|
1059 if(KErrNone == err) |
|
1060 { |
|
1061 invalidSession->RunInvalidSessionL(aDecodedMsg); |
|
1062 } |
|
1063 } |
|
1064 |
|
1065 |
|
1066 |
|
1067 // ----------------------------------------------------------------------------- |
|
1068 // COMASUPLProtocolManager1::CancelRunSession |
|
1069 // Cancels run session operation if its going on. |
|
1070 // |
|
1071 // ----------------------------------------------------------------------------- |
|
1072 // |
|
1073 EXPORT_C void COMASUPLProtocolManager2::CancelRunSession(CSuplSessionBase* aSuplSession) |
|
1074 { |
|
1075 // Log |
|
1076 iTrace->Trace(_L("COMASUPLProtocolManager2::CancelRunSession"), KTraceFileName, __LINE__); |
|
1077 |
|
1078 // Check if the Session is valid |
|
1079 TInt index = iSuplSessions.Find(aSuplSession); |
|
1080 |
|
1081 if(KErrNotFound == index) |
|
1082 { |
|
1083 iTrace->Trace(_L("Cannot found Supl session."), KTraceFileName, __LINE__); |
|
1084 return; |
|
1085 } |
|
1086 aSuplSession->CancelRunSession(); |
|
1087 return ; |
|
1088 } |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 // ----------------------------------------------------------------------------- |
|
1095 // COMASUPLProtocolManager2::HandleSuplMessageL |
|
1096 // Informs to client about Initilization of POS ,thro' active object |
|
1097 // |
|
1098 // ----------------------------------------------------------------------------- |
|
1099 // |
|
1100 EXPORT_C void COMASUPLProtocolManager2::HandleSuplMessageL( |
|
1101 CSuplSessionBase *const aSuplSession, |
|
1102 TRequestStatus& aStatus, |
|
1103 HBufC8* aMessage) |
|
1104 { |
|
1105 iTrace->Trace(_L("COMASUPLProtocolManager2::HandleSuplMessageL"), KTraceFileName, __LINE__); |
|
1106 TInt index = iSuplSessions.Find(aSuplSession); |
|
1107 TRequestStatus* status = &aStatus; |
|
1108 |
|
1109 if(KErrNotFound == index) |
|
1110 { |
|
1111 iTrace->Trace(_L("Cannot found Supl session."), KTraceFileName, __LINE__); |
|
1112 if(status) |
|
1113 User::RequestComplete(status,KErrNotFound); |
|
1114 return; |
|
1115 } |
|
1116 |
|
1117 if(!aMessage) |
|
1118 { |
|
1119 iTrace->Trace(_L("Received packet is Empty."), KTraceFileName, __LINE__); |
|
1120 if(status) |
|
1121 User::RequestComplete(status,KErrBadDescriptor); |
|
1122 return; |
|
1123 } |
|
1124 |
|
1125 #ifdef PRINT_MESSAGE |
|
1126 RFile file; |
|
1127 RFs fs; |
|
1128 TInt cErr=fs.Connect(); |
|
1129 TInt fErr = file.Open(fs,_L("c:\\logs\\epos\\packet.txt"),EFileWrite|EFileShareAny); |
|
1130 if (fErr == KErrNotFound || fErr == KErrPathNotFound) |
|
1131 { |
|
1132 TBool ret = BaflUtils::FolderExists(fs,_L("c:\\logs\\epos\\")); |
|
1133 if(!ret) |
|
1134 { |
|
1135 fs.MkDirAll(_L("c:\\logs\\epos\\")); |
|
1136 } |
|
1137 file.Create(fs, _L("c:\\logs\\epos\\packet.txt"), EFileWrite|EFileShareAny); |
|
1138 fErr = file.Open(fs,_L("c:\\logs\\epos\\packet.txt"),EFileWrite|EFileShareAny); |
|
1139 } |
|
1140 |
|
1141 _LIT8(KMsgType, "SUPL INIT"); |
|
1142 file.Write(KMsgType); |
|
1143 file.Write(_L8("\r \n")); |
|
1144 file.Write(*aMessage); |
|
1145 file.Write(_L8("\r \n")); |
|
1146 file.Close(); |
|
1147 fs.Close(); |
|
1148 #endif |
|
1149 |
|
1150 TInt unConsumedBytes = aMessage->Length(); |
|
1151 COMASuplAsnMessageBase* decodedAsn = NULL; |
|
1152 TInt errorCode; |
|
1153 TRAP_IGNORE(decodedAsn = iOMASuplAsnHandlerBaseImpl->DecodeL(aMessage->Right(unConsumedBytes),errorCode,unConsumedBytes)); |
|
1154 |
|
1155 if(errorCode == KErrOMASuplDecodeSessionFailed || errorCode == KErrCompletion) //Decoding failed...drop packet |
|
1156 { |
|
1157 delete decodedAsn; |
|
1158 iTrace->Trace(_L("COMASUPLProtocolManager2::HandleSuplMessageL::Decoding failed..."), KTraceFileName, __LINE__); |
|
1159 if(status) |
|
1160 User::RequestComplete(status,KErrGeneral); |
|
1161 return; |
|
1162 } |
|
1163 |
|
1164 if(errorCode == KErrNone || errorCode == KErrOMASuplOutOfRangeParameter |
|
1165 || errorCode == KErrOMASuplMessageLengthMismatch |
|
1166 || errorCode == KErrOMASuplShortFrame) |
|
1167 // Successful decoding of message |
|
1168 // KErrOMASuplOutOfRangeParameter added this for supporting |
|
1169 // handling of out of range parameters. |
|
1170 { |
|
1171 if(!decodedAsn) |
|
1172 { |
|
1173 if(status) |
|
1174 User::RequestComplete(status,KErrGeneral); |
|
1175 return; |
|
1176 } |
|
1177 |
|
1178 COMASuplAsnMessageBase::TSuplMessageType messageType = decodedAsn->MessageType(); |
|
1179 if(messageType == COMASuplAsnMessageBase::ESUPL_END ) |
|
1180 { |
|
1181 delete decodedAsn; |
|
1182 iTrace->Trace(_L("Received SUPL_END thro' Netinitiated Lib...."), KTraceFileName, __LINE__); |
|
1183 if(status) |
|
1184 User::RequestComplete(status,KErrGeneral); |
|
1185 return; |
|
1186 } |
|
1187 |
|
1188 CleanupStack::PushL(decodedAsn); |
|
1189 COMASuplSession* suplSession = static_cast<COMASuplSession*>(aSuplSession); |
|
1190 if(suplSession) |
|
1191 { |
|
1192 CheckForSessionCount(); |
|
1193 iRunningSessionCount++; |
|
1194 suplSession->SetEncodedSuplInitL(aMessage); |
|
1195 suplSession->SetConfigurationParameters(iUT1_StartTimer,iUT2_PosInitTimer, iUT3_PosTimer,iPrivacyTimer,iSETMode, |
|
1196 iSuplUsage, iPersistFailTimer,iSuplInitTimeOut); |
|
1197 suplSession->HandleOMASuplMessageL(decodedAsn,aStatus,iRunningSessionCount,errorCode); |
|
1198 } |
|
1199 CleanupStack::PopAndDestroy(decodedAsn); |
|
1200 } |
|
1201 else |
|
1202 { |
|
1203 delete decodedAsn; |
|
1204 iTrace->Trace(_L("COMASUPLProtocolManager2::HandleSuplMessageL::Error occured after decoding..."), KTraceFileName, __LINE__); |
|
1205 if(status) |
|
1206 User::RequestComplete(status,KErrGeneral); |
|
1207 } |
|
1208 } |
|
1209 |
|
1210 |
|
1211 // ----------------------------------------------------------------------------- |
|
1212 // COMASUPLProtocolManager2::PlugInUninstalled |
|
1213 // Handles Pos handler unload event |
|
1214 // ----------------------------------------------------------------------------- |
|
1215 void COMASUPLProtocolManager2::PlugInUninstalled() // change here --- Subhra |
|
1216 { |
|
1217 iTrace->Trace(_L("COMASUPLProtocolManager2::PlugInUninstalled"), KTraceFileName, __LINE__); |
|
1218 |
|
1219 TInt suplSessionCount = iSuplSessions.Count(); |
|
1220 |
|
1221 for(TInt loop = 0; loop < suplSessionCount;loop++) |
|
1222 { |
|
1223 iTrace->Trace(_L("COMASUPLProtocolManager2::PlugInUninstalled Session retrieved"), KTraceFileName, __LINE__); |
|
1224 |
|
1225 COMASuplSession* suplSession = REINTERPRET_CAST(COMASuplSession*, iSuplSessions[loop]); |
|
1226 suplSession->PosPlugInUnloaded(); |
|
1227 } |
|
1228 |
|
1229 iTrace->Trace(_L("COMASUPLProtocolManager2::PlugInUninstalled removing PosH"), KTraceFileName, __LINE__); |
|
1230 |
|
1231 iTrace->Trace(_L("COMASUPLProtocolManager2::PlugInUninstalled PosH removed"), KTraceFileName, __LINE__); |
|
1232 } |
|
1233 |
|
1234 // ----------------------------------------------------------------------------- |
|
1235 // COMASUPLProtocolManager2::HandleSuplSettingsChangeL |
|
1236 // notifier for settings changes. |
|
1237 // ----------------------------------------------------------------------------- |
|
1238 void COMASUPLProtocolManager2::HandleSuplSettingsChangeL(TSuplSettingsEventType aEvent,TInt /*aSlpId*/) |
|
1239 { |
|
1240 if( aEvent == MSuplSettingsObserver::ESuplSettingsEventSuplUsageChange) |
|
1241 { |
|
1242 iTrace->Trace(_L("Setting Changed.SUPL Usage changed.. Reeading once again..."), KTraceFileName, __LINE__); |
|
1243 ReadSuplUsage(); |
|
1244 } |
|
1245 else if( aEvent == MSuplSettingsObserver::ESuplSettingsEventCommParameterChange) |
|
1246 { |
|
1247 iTrace->Trace(_L("Setting Changed.Communication Parameters changed.. Reeading once again..."), KTraceFileName, __LINE__); |
|
1248 |
|
1249 } |
|
1250 } |
|
1251 |
|
1252 // ----------------------------------------------------------------------------- |
|
1253 // COMASUPLProtocolManager2::LogPacket |
|
1254 // Logs |
|
1255 // ----------------------------------------------------------------------------- |
|
1256 /* |
|
1257 # if 0 |
|
1258 void COMASUPLProtocolManager2::LogPacket(const TDesC8& aPacket,COMASuplAsnMessageBase* decodedAsn) |
|
1259 { |
|
1260 #ifdef PRINT_MESSAGE |
|
1261 RFile file; |
|
1262 RFs fs; |
|
1263 TInt cErr=fs.Connect(); |
|
1264 |
|
1265 TInt fErr = file.Open(fs,_L("c:\\logs\\epos\\packet.txt"),EFileWrite|EFileShareAny); |
|
1266 if (fErr == KErrNotFound) |
|
1267 { |
|
1268 file.Create(fs, _L("c:\\logs\\epos\\packet.txt"), EFileWrite|EFileShareAny); |
|
1269 fErr = file.Open(fs,_L("c:\\logs\\epos\\packet.txt"), EFileWrite|EFileShareAny); |
|
1270 } |
|
1271 |
|
1272 TInt aPos; |
|
1273 file.Seek(ESeekEnd, aPos); |
|
1274 |
|
1275 if(decodedAsn) |
|
1276 { |
|
1277 COMASuplAsnMessageBase::TSuplMessageType messageType = decodedAsn->MessageType(); |
|
1278 |
|
1279 switch(messageType) |
|
1280 { |
|
1281 case COMASuplAsnMessageBase::ESUPL_RESPONSE: |
|
1282 _LIT8(KMsgType1, "SUPL RESPONSE"); |
|
1283 file.Write(KMsgType1); |
|
1284 break; |
|
1285 case COMASuplAsnMessageBase::ESUPL_POS: |
|
1286 _LIT8(KMsgType2, "SUPL POS"); |
|
1287 file.Write(KMsgType2); |
|
1288 break; |
|
1289 case COMASuplAsnMessageBase::ESUPL_END: |
|
1290 _LIT8(KMsgType3, "SUPL END"); |
|
1291 file.Write(KMsgType3); |
|
1292 break; |
|
1293 case COMASuplAsnMessageBase::ESUPL_AUTH_RESP: |
|
1294 _LIT8(KMsgType4, "SUPL AUTH RESPONSE"); |
|
1295 file.Write(KMsgType4); |
|
1296 break; |
|
1297 default: |
|
1298 break; |
|
1299 } |
|
1300 } |
|
1301 else |
|
1302 { |
|
1303 _LIT8(KMsgTypeUnknown, "Decoding Failed."); |
|
1304 file.Write(KMsgTypeUnknown); |
|
1305 } |
|
1306 file.Write(_L8("\r \n")); |
|
1307 file.Write(aPacket); |
|
1308 file.Write(_L8("\r \n")); |
|
1309 file.Close(); |
|
1310 fs.Close(); |
|
1311 #endif |
|
1312 |
|
1313 } |
|
1314 #endif |
|
1315 */ |
|
1316 |
|
1317 void COMASUPLProtocolManager2::LogPacket(const TDesC8& |
|
1318 #if defined(PRINT_MESSAGE) |
|
1319 aPacket |
|
1320 #endif |
|
1321 ,COMASuplAsnMessageBase* |
|
1322 #if defined(PRINT_MESSAGE) |
|
1323 decodedAsn |
|
1324 #endif |
|
1325 ) |
|
1326 { |
|
1327 |
|
1328 #ifdef PRINT_MESSAGE |
|
1329 RFileLogger iLogger; |
|
1330 |
|
1331 TInt err = iLogger.Connect(); |
|
1332 if(err != KErrNone) |
|
1333 return; |
|
1334 |
|
1335 const TText* hdr1 = _S("Header"); |
|
1336 const TText* mrg1 = _S("End"); |
|
1337 if(decodedAsn) |
|
1338 { |
|
1339 COMASuplAsnMessageBase::TSuplMessageType messageType = decodedAsn->MessageType(); |
|
1340 |
|
1341 switch(messageType) |
|
1342 { |
|
1343 case COMASuplAsnMessageBase::ESUPL_RESPONSE: |
|
1344 { |
|
1345 _LIT(KMsgType1, "SUPL_RESPONSE.txt"); |
|
1346 iLogger.CreateLog(_L("epos"),KMsgType1,EFileLoggingModeAppend); |
|
1347 iLogger.HexDump(hdr1, mrg1, aPacket.Ptr(), aPacket.Length() ); |
|
1348 break; |
|
1349 } |
|
1350 case COMASuplAsnMessageBase::ESUPL_POS: |
|
1351 { |
|
1352 _LIT(KMsgType2, "SUPL_POS.txt"); |
|
1353 iLogger.CreateLog(_L("epos"),KMsgType2,EFileLoggingModeAppend); |
|
1354 iLogger.HexDump(hdr1, mrg1, aPacket.Ptr(), aPacket.Length() ); |
|
1355 break; |
|
1356 } |
|
1357 case COMASuplAsnMessageBase::ESUPL_END: |
|
1358 { |
|
1359 _LIT(KMsgType3, "SUPL_END.txt"); |
|
1360 iLogger.CreateLog(_L("epos"),KMsgType3,EFileLoggingModeAppend); |
|
1361 iLogger.HexDump(hdr1, mrg1, aPacket.Ptr(), aPacket.Length() ); |
|
1362 break; |
|
1363 } |
|
1364 case COMASuplAsnMessageBase::ESUPL_AUTH_RESP: |
|
1365 { |
|
1366 _LIT(KMsgType4, "SUPL_AUTH_RESPONSE.txt"); |
|
1367 iLogger.CreateLog(_L("epos"),KMsgType4,EFileLoggingModeAppend); |
|
1368 iLogger.HexDump(hdr1, mrg1, aPacket.Ptr(), aPacket.Length() ); |
|
1369 break; |
|
1370 } |
|
1371 default: |
|
1372 break; |
|
1373 } |
|
1374 } |
|
1375 else |
|
1376 { |
|
1377 _LIT(KMsgTypeUnknown, "Decode_Failed.txt"); |
|
1378 iLogger.CreateLog(_L("epos"),KMsgTypeUnknown,EFileLoggingModeAppend); |
|
1379 iLogger.HexDump(hdr1, mrg1, aPacket.Ptr(), aPacket.Length() ); |
|
1380 } |
|
1381 iLogger.Close(); |
|
1382 #endif |
|
1383 } |
|
1384 |
|
1385 // ----------------------------------------------------------------------------- |
|
1386 // COMASUPLProtocolManager2::LogAvailableSessions |
|
1387 // Logs |
|
1388 // ----------------------------------------------------------------------------- |
|
1389 void COMASUPLProtocolManager2::LogAvailableSessions( COMASuplSETSessionID* |
|
1390 #if defined(PRINT_MESSAGE) |
|
1391 aSuplSETID |
|
1392 #endif |
|
1393 ,COMASuplSLPSessionID* |
|
1394 #if defined(PRINT_MESSAGE) |
|
1395 aSuplSLPID |
|
1396 #endif |
|
1397 ,TInt |
|
1398 #if defined(PRINT_MESSAGE) |
|
1399 aCount |
|
1400 #endif |
|
1401 ) const |
|
1402 |
|
1403 { |
|
1404 #ifdef PRINT_MESSAGE //This is only for logging purpose. |
|
1405 |
|
1406 TBuf<128> msg(_L("Session Ids For Session No : ")); |
|
1407 msg.AppendNum(aCount); |
|
1408 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1409 |
|
1410 if(!aSuplSETID) |
|
1411 { |
|
1412 iTrace->Trace(_L("No SET Session ID present..."),KTraceFileName, __LINE__); |
|
1413 } |
|
1414 else |
|
1415 { |
|
1416 msg.Copy(_L("Comparing with Session ID : ")); |
|
1417 TBuf<4> id; |
|
1418 TInt SETSessionID; |
|
1419 TBuf8<64> IPvAddress8; |
|
1420 TBuf<64> IPvAddress; |
|
1421 |
|
1422 aSuplSETID->SuplSETSessionID(SETSessionID,IPvAddress8); |
|
1423 COMASuplSETSessionID::TSuplSETIDType setIDType = aSuplSETID->SuplSETIDType(); |
|
1424 if(setIDType == COMASuplSETSessionID::EIMSI ) |
|
1425 { |
|
1426 iTrace->Trace(_L("SET ID is of type IMSI"),KTraceFileName, __LINE__); |
|
1427 iTrace->Trace(_L("IMSI Value :"),KTraceFileName, __LINE__); |
|
1428 msg.Copy(IPvAddress8); |
|
1429 } |
|
1430 else |
|
1431 { |
|
1432 TLex8 lex(IPvAddress8); |
|
1433 |
|
1434 TChar chr; |
|
1435 |
|
1436 chr = lex.Get(); |
|
1437 TUint i = chr; |
|
1438 IPvAddress.AppendNum(i); |
|
1439 IPvAddress.Append(_L(".")); |
|
1440 |
|
1441 chr = lex.Get(); |
|
1442 i = chr; |
|
1443 IPvAddress.AppendNum(i); |
|
1444 IPvAddress.Append(_L(".")); |
|
1445 |
|
1446 chr = lex.Get(); |
|
1447 i = chr; |
|
1448 IPvAddress.AppendNum(i); |
|
1449 IPvAddress.Append(_L(".")); |
|
1450 |
|
1451 chr = lex.Get(); |
|
1452 i = chr; |
|
1453 IPvAddress.AppendNum(i); |
|
1454 |
|
1455 id.AppendNum(SETSessionID); |
|
1456 msg.Append(id); |
|
1457 msg.Append(_L(" IPAddress :")); |
|
1458 msg.Append(IPvAddress); |
|
1459 } |
|
1460 |
|
1461 } |
|
1462 #endif |
|
1463 |
|
1464 #ifdef PRINT_MESSAGE //This is only for logging purpose. |
|
1465 if(!aSuplSLPID) |
|
1466 { |
|
1467 iTrace->Trace(_L("No SLP Session ID present..."),KTraceFileName, __LINE__); |
|
1468 } |
|
1469 else |
|
1470 { |
|
1471 TBuf8<4> sessionId8; |
|
1472 TBuf<32> sessionId; |
|
1473 TBuf8<64> ipAddress8(_L8("No Address field in SLP Session ID")); |
|
1474 TBuf<64> ipAddress; |
|
1475 |
|
1476 COMASuplSLPAddress* slpIPAddress = NULL; |
|
1477 aSuplSLPID->SuplSLPSessionID(sessionId8,slpIPAddress); |
|
1478 |
|
1479 if(slpIPAddress) |
|
1480 { |
|
1481 COMASuplSLPAddress::TSuplSLPAddressType slpAddType = slpIPAddress->SLPAddressType(); |
|
1482 if(slpAddType == COMASuplSLPAddress::EFqdn) |
|
1483 { |
|
1484 TBuf<128> msg(_L("Comparing with SLP Session ID : ")); |
|
1485 HBufC8* fqdn = NULL; |
|
1486 slpIPAddress->Fqdn(fqdn); |
|
1487 TLex8 lex1(sessionId8); |
|
1488 TChar chr; |
|
1489 for(TInt i = 0; i < 4; i++) |
|
1490 { |
|
1491 chr = lex1.Get(); |
|
1492 TUint num = chr; |
|
1493 sessionId.AppendNum(num); |
|
1494 } |
|
1495 msg.Append(sessionId); |
|
1496 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1497 iTrace->Trace(_L("SLP Address is FQDN"),KTraceFileName, __LINE__); |
|
1498 iTrace->Trace(_L("FQDN Value"),KTraceFileName, __LINE__); |
|
1499 if(fqdn) |
|
1500 { |
|
1501 HBufC* fqdnBuffer = NULL; |
|
1502 TInt err; |
|
1503 TRAP(err,fqdnBuffer = HBufC::NewL(fqdn->Length())); |
|
1504 err = 0; |
|
1505 fqdnBuffer->Des().Copy(fqdn->Des()); |
|
1506 iTrace->Trace(fqdnBuffer->Des(),KTraceFileName, __LINE__); |
|
1507 delete fqdnBuffer; |
|
1508 fqdnBuffer = NULL; |
|
1509 } |
|
1510 } |
|
1511 else |
|
1512 { |
|
1513 TBuf<128> msg(_L("Comparing with SLP Session ID : ")); |
|
1514 TInt err = slpIPAddress->IPvAddress(ipAddress8); |
|
1515 if(err != KErrNone) |
|
1516 { |
|
1517 msg.Copy(_L("SLP Address is not set.")); |
|
1518 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1519 } |
|
1520 else |
|
1521 { |
|
1522 TLex8 lex(ipAddress8); |
|
1523 TChar chr; |
|
1524 |
|
1525 chr = lex.Get(); |
|
1526 TUint i = chr; |
|
1527 ipAddress.AppendNum(i); |
|
1528 ipAddress.Append(_L(".")); |
|
1529 |
|
1530 chr = lex.Get(); |
|
1531 i = chr; |
|
1532 ipAddress.AppendNum(i); |
|
1533 ipAddress.Append(_L(".")); |
|
1534 |
|
1535 chr = lex.Get(); |
|
1536 i = chr; |
|
1537 ipAddress.AppendNum(i); |
|
1538 ipAddress.Append(_L(".")); |
|
1539 |
|
1540 chr = lex.Get(); |
|
1541 i = chr; |
|
1542 ipAddress.AppendNum(i); |
|
1543 |
|
1544 TLex8 lex1(sessionId8); |
|
1545 for(TInt i = 0; i < 4; i++) |
|
1546 { |
|
1547 chr = lex1.Get(); |
|
1548 TUint num = chr; |
|
1549 sessionId.AppendNum(num); |
|
1550 } |
|
1551 msg.Append(sessionId); |
|
1552 msg.Append(_L(" IPAddress : ")); |
|
1553 msg.Append(ipAddress); |
|
1554 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1555 } |
|
1556 } |
|
1557 } |
|
1558 } |
|
1559 #endif |
|
1560 } |
|
1561 |
|
1562 void COMASUPLProtocolManager2::LogReceivedSessionIdL(COMASuplSessionID* |
|
1563 #if defined(PRINT_MESSAGE) |
|
1564 aRetrivedSessionID |
|
1565 #endif |
|
1566 ) |
|
1567 { |
|
1568 |
|
1569 #ifdef PRINT_MESSAGE //This is only for logging purpose. |
|
1570 if(! aRetrivedSessionID) |
|
1571 return; |
|
1572 |
|
1573 TBuf<128> msg(_L("Received Session Id is...")); |
|
1574 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1575 |
|
1576 COMASuplSETSessionID* suplSETID = NULL; |
|
1577 aRetrivedSessionID->SETSessionID(suplSETID); |
|
1578 |
|
1579 COMASuplSLPSessionID* suplSLPID = NULL; |
|
1580 aRetrivedSessionID->SLPSessionID(suplSLPID); |
|
1581 |
|
1582 //SET Part |
|
1583 if(suplSETID) |
|
1584 { |
|
1585 msg.Copy(_L("SET Session ID : ")); |
|
1586 TBuf<8> id; |
|
1587 TInt SETSessionID; |
|
1588 TBuf8<64> IPvAddress8; |
|
1589 TBuf<64> IPvAddress; |
|
1590 |
|
1591 suplSETID->SuplSETSessionID(SETSessionID,IPvAddress8); |
|
1592 COMASuplSETSessionID::TSuplSETIDType setIDType = suplSETID->SuplSETIDType(); |
|
1593 if(setIDType == COMASuplSETSessionID::EIMSI ) |
|
1594 { |
|
1595 iTrace->Trace(_L("SET ID is of type IMSI"),KTraceFileName, __LINE__); |
|
1596 iTrace->Trace(_L("IMSI Value :"),KTraceFileName, __LINE__); |
|
1597 msg.Copy(IPvAddress8); |
|
1598 } |
|
1599 else |
|
1600 { |
|
1601 TLex8 lex(IPvAddress8); |
|
1602 |
|
1603 TChar chr; |
|
1604 |
|
1605 chr = lex.Get(); |
|
1606 TUint i = chr; |
|
1607 IPvAddress.AppendNum(i); |
|
1608 IPvAddress.Append(_L(".")); |
|
1609 |
|
1610 chr = lex.Get(); |
|
1611 i = chr; |
|
1612 IPvAddress.AppendNum(i); |
|
1613 IPvAddress.Append(_L(".")); |
|
1614 |
|
1615 chr = lex.Get(); |
|
1616 i = chr; |
|
1617 IPvAddress.AppendNum(i); |
|
1618 IPvAddress.Append(_L(".")); |
|
1619 |
|
1620 chr = lex.Get(); |
|
1621 i = chr; |
|
1622 IPvAddress.AppendNum(i); |
|
1623 |
|
1624 id.AppendNum(SETSessionID); |
|
1625 msg.Append(id); |
|
1626 msg.Append(_L(" IPAddress :")); |
|
1627 msg.Append(IPvAddress); |
|
1628 } |
|
1629 } |
|
1630 else |
|
1631 { |
|
1632 msg.Copy(_L("SET Session Id is not set.")); |
|
1633 } |
|
1634 |
|
1635 //SLP Part |
|
1636 if(suplSLPID) |
|
1637 { |
|
1638 msg.Copy(_L("SLP Session ID : ")); |
|
1639 TBuf8<4> sessionId8; |
|
1640 TBuf<32> sessionId; |
|
1641 TBuf8<64> ipAddress8(_L8("No Address field in SLP Session ID")); |
|
1642 TBuf<64> ipAddress; |
|
1643 |
|
1644 COMASuplSLPAddress* slpIPAddress = NULL; |
|
1645 suplSLPID->SuplSLPSessionID(sessionId8,slpIPAddress); |
|
1646 |
|
1647 if(slpIPAddress) |
|
1648 { |
|
1649 COMASuplSLPAddress::TSuplSLPAddressType slpAddType = slpIPAddress->SLPAddressType(); |
|
1650 if(slpAddType == COMASuplSLPAddress::EFqdn) |
|
1651 { |
|
1652 HBufC8* fqdn = NULL; |
|
1653 slpIPAddress->Fqdn(fqdn); |
|
1654 iTrace->Trace(_L("SLP Address is FQDN"),KTraceFileName, __LINE__); |
|
1655 iTrace->Trace(_L("FQDN Value"),KTraceFileName, __LINE__); |
|
1656 if(fqdn) |
|
1657 { |
|
1658 HBufC* fqdnBuffer = NULL; |
|
1659 fqdnBuffer = HBufC::NewL(fqdn->Length()); |
|
1660 fqdnBuffer->Des().Copy(fqdn->Des()); |
|
1661 iTrace->Trace(fqdnBuffer->Des(),KTraceFileName, __LINE__); |
|
1662 delete fqdnBuffer; |
|
1663 fqdnBuffer = NULL; |
|
1664 } |
|
1665 } |
|
1666 else |
|
1667 { |
|
1668 TInt err = slpIPAddress->IPvAddress(ipAddress8); |
|
1669 if(err != KErrNone) |
|
1670 { |
|
1671 msg.Copy(_L("SLP Address is not set.")); |
|
1672 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1673 } |
|
1674 } |
|
1675 } |
|
1676 |
|
1677 TLex8 lex(ipAddress8); |
|
1678 TChar chr; |
|
1679 |
|
1680 chr = lex.Get(); |
|
1681 TUint i = chr; |
|
1682 ipAddress.AppendNum(i); |
|
1683 ipAddress.Append(_L(".")); |
|
1684 |
|
1685 chr = lex.Get(); |
|
1686 i = chr; |
|
1687 ipAddress.AppendNum(i); |
|
1688 ipAddress.Append(_L(".")); |
|
1689 |
|
1690 chr = lex.Get(); |
|
1691 i = chr; |
|
1692 ipAddress.AppendNum(i); |
|
1693 ipAddress.Append(_L(".")); |
|
1694 |
|
1695 chr = lex.Get(); |
|
1696 i = chr; |
|
1697 ipAddress.AppendNum(i); |
|
1698 |
|
1699 TLex8 lex1(sessionId8); |
|
1700 for(TInt i = 0; i < 4; i++) |
|
1701 { |
|
1702 chr = lex1.Get(); |
|
1703 TUint num = chr; |
|
1704 sessionId.AppendNum(num); |
|
1705 } |
|
1706 |
|
1707 msg.Append(sessionId); |
|
1708 msg.Append(_L(" IPAddress : ")); |
|
1709 msg.Append(ipAddress); |
|
1710 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1711 } |
|
1712 else |
|
1713 { |
|
1714 msg.Copy(_L("SLP Session Id is not set.")); |
|
1715 iTrace->Trace(msg,KTraceFileName, __LINE__); |
|
1716 } |
|
1717 #endif |
|
1718 |
|
1719 } |
|
1720 |
|
1721 void COMASUPLProtocolManager2::TimerExpiredL() |
|
1722 { |
|
1723 ResetBufferingParameters(); |
|
1724 } |
|
1725 |
|
1726 void COMASUPLProtocolManager2::ResetBufferingParameters() |
|
1727 { |
|
1728 iQueuedPacket.Zero(); //Reset all parameters |
|
1729 iPreviousMessageLength = 0 ; |
|
1730 iIsPreviouslyDecodingFailed = EFalse; |
|
1731 } |
|
1732 |
|
1733 |
|
1734 // ----------------------------------------------------------------------------- |
|
1735 // COMASUPLProtocolManager2::LaunchSettingsUI |
|
1736 // |
|
1737 // |
|
1738 // ----------------------------------------------------------------------------- |
|
1739 // |
|
1740 TInt COMASUPLProtocolManager2::LaunchSettingsUI(MOMASuplUICompletionObserver* aObserver,const TDesC& aForHslp) |
|
1741 { |
|
1742 iTrace->Trace(_L("COMASUPLProtocolManager2::LaunchSettingsUI"), KTraceFileName, __LINE__); |
|
1743 |
|
1744 if (iSuplSettings->IsUIActive()) |
|
1745 return KErrInUse; |
|
1746 iSessnUIObserver = aObserver; |
|
1747 iSuplSettings->SetUIActive(ETrue); |
|
1748 |
|
1749 if(iUIRequestArray.Count() <= 0 ) |
|
1750 { |
|
1751 iTrace->Trace(_L("COMASUPLProtocolManager2::LaunchSettingsUI"), KTraceFileName, __LINE__); |
|
1752 iUIRequestArray.Append(aObserver); |
|
1753 iSuplSettings->SetUIActive(ETrue); |
|
1754 iCurrentlyUsedHslp.Copy(aForHslp); |
|
1755 return iSettingsLauncher->LaunchSettings(); |
|
1756 } |
|
1757 else if(iCurrentlyUsedHslp.Compare(aForHslp) == KErrNone) |
|
1758 { |
|
1759 iUIRequestArray.Append(aObserver); |
|
1760 } |
|
1761 else |
|
1762 { |
|
1763 return KErrInUse; |
|
1764 } |
|
1765 |
|
1766 return KErrNone; |
|
1767 } |
|
1768 |
|
1769 // ----------------------------------------------------------------------------- |
|
1770 // COMASUPLProtocolManager2::SettingsUICompletedL |
|
1771 // |
|
1772 // |
|
1773 // ----------------------------------------------------------------------------- |
|
1774 // |
|
1775 void COMASUPLProtocolManager2::SettingsUICompletedL(TInt aError) |
|
1776 { |
|
1777 iTrace->Trace(_L("COMASUPLProtocolManager2::SettingsUICompletedL"), KTraceFileName, __LINE__); |
|
1778 iSuplSettings->SetUIActive(EFalse); |
|
1779 |
|
1780 if (iDeInitDone) |
|
1781 { |
|
1782 iTrace->Trace(_L("COMASUPLProtocolManager2::SettingsUICompletedL, de-init done. Completing request"), KTraceFileName, __LINE__); |
|
1783 iDeInitDone = EFalse; |
|
1784 User::RequestComplete(iDeInitRequestStatus,KErrNone); |
|
1785 } |
|
1786 else |
|
1787 { |
|
1788 for(TInt i = 0; i < iUIRequestArray.Count(); i++) |
|
1789 { |
|
1790 iTrace->Trace(_L("COMASUPLProtocolManager2::SettingsUICompletedL,Forwarding ConnRerquestor "), KTraceFileName, __LINE__); |
|
1791 MOMASuplUICompletionObserver* observer = iUIRequestArray[i]; |
|
1792 observer->SettingsUICompletedL(aError); |
|
1793 } |
|
1794 } |
|
1795 |
|
1796 iCurrentlyUsedHslp.Copy(_L("")); |
|
1797 iUIRequestArray.Reset(); |
|
1798 } |
|
1799 |
|
1800 |
|
1801 // ----------------------------------------------------------------------------- |
|
1802 // COMASUPLProtocolManager2::DeInitialize |
|
1803 // |
|
1804 // |
|
1805 // ----------------------------------------------------------------------------- |
|
1806 // |
|
1807 void COMASUPLProtocolManager2::DeInitialize(TRequestStatus& aDeInitRequestStatus) |
|
1808 { |
|
1809 iTrace->Trace(_L("COMASUPLProtocolManager2::DeInitialize"), KTraceFileName, __LINE__); |
|
1810 |
|
1811 iTrace->Trace(_L("COMASUPLProtocolManager2::DeInitialize"), KTraceFileName, __LINE__); |
|
1812 iDeInitRequestStatus = & aDeInitRequestStatus; |
|
1813 *iDeInitRequestStatus = KRequestPending; |
|
1814 |
|
1815 |
|
1816 // If settings UI is not active, complete the request immediately |
|
1817 if (!iSuplSettings->IsUIActive()) |
|
1818 { |
|
1819 iTrace->Trace(_L("COMASUPLProtocolManager2::DeInitialize, UI is not active, Completing request"), KTraceFileName, __LINE__); |
|
1820 User::RequestComplete(iDeInitRequestStatus,KErrNone); |
|
1821 } |
|
1822 else |
|
1823 { |
|
1824 iDeInitDone = ETrue; |
|
1825 } |
|
1826 } |
|
1827 |
|
1828 // ----------------------------------------------------------------------------- |
|
1829 // COMASUPLProtocolManager2::CancelDeInitialize |
|
1830 // |
|
1831 // |
|
1832 // ----------------------------------------------------------------------------- |
|
1833 // |
|
1834 void COMASUPLProtocolManager2::CancelDeInitialize() |
|
1835 { |
|
1836 iTrace->Trace(_L("COMASUPLProtocolManager2::CancelDeInitialize"), KTraceFileName, __LINE__); |
|
1837 iDeInitDone = EFalse; |
|
1838 if(iDeInitRequestStatus) |
|
1839 User::RequestComplete(iDeInitRequestStatus,KErrCancel); |
|
1840 } |
|
1841 |
|
1842 // ----------------------------------------------------------------------------- |
|
1843 // COMASUPLProtocolManager2::GetNetworkModeL |
|
1844 // Logs |
|
1845 // ----------------------------------------------------------------------------- |
|
1846 TInt COMASUPLProtocolManager2::GetNetworkModeL() |
|
1847 { |
|
1848 TInt networkMode; |
|
1849 // get network mode |
|
1850 CRepository* centralRepository = CRepository::NewLC(KCRUidCoreApplicationUIs); |
|
1851 User::LeaveIfError(centralRepository->Get(KCoreAppUIsNetworkConnectionAllowed, networkMode)); |
|
1852 CleanupStack::PopAndDestroy(centralRepository); |
|
1853 return networkMode; |
|
1854 } |
|
1855 |
|
1856 // ----------------------------------------------------------------------------- |
|
1857 // COMASUPLProtocolManager2::LaunchSuplUsageSettingsUI |
|
1858 // |
|
1859 // |
|
1860 // ----------------------------------------------------------------------------- |
|
1861 // |
|
1862 |
|
1863 TInt COMASUPLProtocolManager2::LaunchSuplUsageSettingsUI(MOMASuplUICompletionObserver* aObserver, TBool aRoaming) |
|
1864 { |
|
1865 iTrace->Trace(_L("COMASUPLProtocolManager2::LaunchSuplUsageSettingsUI"), KTraceFileName, __LINE__); |
|
1866 if (iSuplSettings->IsUIActive() && !iTimeOutDialogPresent) |
|
1867 return KErrInUse; |
|
1868 // If timeout dialog is present, close it |
|
1869 if (iTimeOutDialogPresent) |
|
1870 { |
|
1871 iTimeOutDialogPresent = EFalse; |
|
1872 iSuplSettings->SetUIActive(EFalse); |
|
1873 iSettingsLauncher->Cancel(); |
|
1874 } |
|
1875 iSessnUIObserver = aObserver; |
|
1876 iSuplSettings->SetUIActive(ETrue); |
|
1877 return iSettingsLauncher->LaunchSuplUsageSettingsUI(aRoaming); |
|
1878 } |
|
1879 |
|
1880 // ----------------------------------------------------------------------------- |
|
1881 // COMASUPLProtocolManager2::SettingsUsageUICompletedL |
|
1882 // |
|
1883 // |
|
1884 // ----------------------------------------------------------------------------- |
|
1885 // |
|
1886 void COMASUPLProtocolManager2::SettingsUsageUICompletedL(TInt aError) |
|
1887 { |
|
1888 iTrace->Trace(_L("COMASUPLProtocolManager2::SettingsUsageUICompletedL"), KTraceFileName, __LINE__); |
|
1889 iSuplSettings->SetUIActive(EFalse); |
|
1890 |
|
1891 if (iDeInitDone) |
|
1892 { |
|
1893 iTrace->Trace(_L("COMASUPLProtocolManager2::SettingsUsageUICompletedL, de-init done. Completing request"), KTraceFileName, __LINE__); |
|
1894 iDeInitDone = EFalse; |
|
1895 User::RequestComplete(iDeInitRequestStatus,KErrNone); |
|
1896 } |
|
1897 else |
|
1898 { |
|
1899 if (iSessnUIObserver) |
|
1900 iSessnUIObserver->SettingsUsageUICompletedL(aError); |
|
1901 } |
|
1902 |
|
1903 CheckOutstandingUsageUIRequestsL(); |
|
1904 } |
|
1905 |
|
1906 // ----------------------------------------------------------------------------- |
|
1907 // COMASUPLProtocolManager2::ReadSuplUsage |
|
1908 // Reads Supl Usage from Central Repository |
|
1909 // |
|
1910 // ----------------------------------------------------------------------------- |
|
1911 // |
|
1912 void COMASUPLProtocolManager2::ReadSuplUsage() |
|
1913 { |
|
1914 iTrace->Trace(_L("COMASUPLProtocolManager2::ReadSuplUsage start"), KTraceFileName, __LINE__); |
|
1915 CSuplSettings::TSuplSettingsUsage suplUsage; |
|
1916 TInt err = iSuplStorageSettings->GetSuplUsage(suplUsage); |
|
1917 if(err == KErrNone ) |
|
1918 { |
|
1919 iSuplSettings->SetSUPLUsage(suplUsage); |
|
1920 } |
|
1921 iTrace->Trace(_L("COMASUPLProtocolManager2::ReadSuplUsage end"), KTraceFileName, __LINE__); |
|
1922 } |
|
1923 |
|
1924 void COMASUPLProtocolManager2::UpdateAllSubSessnsInSameSession(TInt aIpcSessionId) |
|
1925 { |
|
1926 TInt TotalSession = iSuplSessions.Count(); |
|
1927 COMASuplSession* OMAsuplSession = NULL; |
|
1928 |
|
1929 for(TInt cnt = 0; cnt < TotalSession; ++cnt) |
|
1930 { |
|
1931 OMAsuplSession = static_cast<COMASuplSession*>(iSuplSessions[cnt]); |
|
1932 TInt ipcSessnId = OMAsuplSession->SuplIpcSessionID(); |
|
1933 |
|
1934 if (ipcSessnId > 0 && ipcSessnId == aIpcSessionId) |
|
1935 OMAsuplSession->UpdateSuplUsage(); |
|
1936 } |
|
1937 } |
|
1938 |
|
1939 |
|
1940 void COMASUPLProtocolManager2::SettingsChanged() |
|
1941 { |
|
1942 TInt TotalSession = iSuplSessions.Count(); |
|
1943 COMASuplSession* OMAsuplSession = NULL; |
|
1944 |
|
1945 for(TInt cnt = 0; cnt < TotalSession; ++cnt) |
|
1946 { |
|
1947 OMAsuplSession = static_cast<COMASuplSession*>(iSuplSessions[cnt]); |
|
1948 OMAsuplSession->SettingsChanged(); |
|
1949 } |
|
1950 } |
|
1951 |
|
1952 void COMASUPLProtocolManager2::CheckOutstandingUsageUIRequestsL() |
|
1953 { |
|
1954 TInt TotalSession = iSuplSessions.Count(); |
|
1955 COMASuplSession* OMAsuplSession = NULL; |
|
1956 |
|
1957 for(TInt cnt = 0; cnt < TotalSession; ++cnt) |
|
1958 { |
|
1959 OMAsuplSession = static_cast<COMASuplSession*>(iSuplSessions[cnt]); |
|
1960 |
|
1961 if (OMAsuplSession->GetSuplUsageFlag()) |
|
1962 { |
|
1963 OMAsuplSession->StartUsageDialogLaunchL(); |
|
1964 break; |
|
1965 } |
|
1966 } |
|
1967 } |
|
1968 |
|
1969 void COMASUPLProtocolManager2::CheckForRoaming() |
|
1970 { |
|
1971 iTrace->Trace(_L("COMASUPLProtocolManager2::CheckForRoaming"), KTraceFileName, __LINE__); |
|
1972 if (iRoamingCheckStarted) |
|
1973 return; |
|
1974 iNotifier->CheckForRoaming(); |
|
1975 iRoamingCheckStarted = ETrue; |
|
1976 } |
|
1977 |
|
1978 void COMASUPLProtocolManager2::NotifyCurrentNetworkChange() |
|
1979 { |
|
1980 iTrace->Trace(_L("COMASUPLProtocolManager2::NotifyCurrentNetworkChange"), KTraceFileName, __LINE__); |
|
1981 if (iNotifyStarted) |
|
1982 return; |
|
1983 iNotifier->NotifyCurrentNetworkChange(); |
|
1984 iNotifyStarted = ETrue; |
|
1985 } |
|
1986 |
|
1987 void COMASUPLProtocolManager2::CancelNotify() |
|
1988 { |
|
1989 iTrace->Trace(_L("COMASUPLProtocolManager2::CancelNotify"), KTraceFileName, __LINE__); |
|
1990 // Cancel only none of the the sessions currently requested |
|
1991 // for network change notification |
|
1992 TInt TotalSession = iSuplSessions.Count(); |
|
1993 TInt notifyCount=0; |
|
1994 COMASuplSession* OMAsuplSession = NULL; |
|
1995 |
|
1996 for(TInt cnt = 0; cnt < TotalSession; ++cnt) |
|
1997 { |
|
1998 OMAsuplSession = static_cast<COMASuplSession*>(iSuplSessions[cnt]); |
|
1999 if (OMAsuplSession->IsEtelNotifySet()) |
|
2000 { |
|
2001 notifyCount++; |
|
2002 break; |
|
2003 } |
|
2004 } |
|
2005 if (notifyCount == 0) |
|
2006 { |
|
2007 iNotifier->Cancel(); |
|
2008 iNotifyStarted = EFalse; |
|
2009 } |
|
2010 } |
|
2011 |
|
2012 void COMASUPLProtocolManager2::HandleCurrentNetworkChangeL(TInt aErrorCode, TBool aHomeNw) |
|
2013 { |
|
2014 iTrace->Trace(_L("COMASUPLProtocolManager2::HandleCurrentNetworkChangeL"), KTraceFileName, __LINE__); |
|
2015 TInt TotalSession = iSuplSessions.Count(); |
|
2016 COMASuplSession* OMAsuplSession = NULL; |
|
2017 |
|
2018 for(TInt cnt = 0; cnt < TotalSession; ++cnt) |
|
2019 { |
|
2020 OMAsuplSession = static_cast<COMASuplSession*>(iSuplSessions[cnt]); |
|
2021 if (OMAsuplSession->IsEtelNotifySet()) |
|
2022 { |
|
2023 OMAsuplSession->HandleCurrentNetworkChangeL(aErrorCode, aHomeNw); |
|
2024 break; |
|
2025 } |
|
2026 } |
|
2027 } |
|
2028 |
|
2029 void COMASUPLProtocolManager2::HandleRoamingCheckCompleteL(TInt aErrorCode, TBool aHomeNw) |
|
2030 { |
|
2031 iTrace->Trace(_L("COMASUPLProtocolManager2::HandleRoamingCheckCompleteL"), KTraceFileName, __LINE__); |
|
2032 iRoamingCheckStarted = EFalse; |
|
2033 TInt TotalSession = iSuplSessions.Count(); |
|
2034 COMASuplSession* OMAsuplSession = NULL; |
|
2035 |
|
2036 for(TInt cnt = 0; cnt < TotalSession; ++cnt) |
|
2037 { |
|
2038 OMAsuplSession = static_cast<COMASuplSession*>(iSuplSessions[cnt]); |
|
2039 if (OMAsuplSession->IsEtelRoamingSet()) |
|
2040 { |
|
2041 OMAsuplSession->HandleRoamingCheckCompleteL(aErrorCode, aHomeNw); |
|
2042 break; |
|
2043 } |
|
2044 } |
|
2045 } |
|
2046 |
|
2047 // ----------------------------------------------------------------------------- |
|
2048 // COMASUPLProtocolManager2::LaunchSuplDialogTimeoutUI |
|
2049 // |
|
2050 // |
|
2051 // ----------------------------------------------------------------------------- |
|
2052 // |
|
2053 TInt COMASUPLProtocolManager2::LaunchSuplDialogTimeoutUI(MOMASuplUICompletionObserver* aObserver ) |
|
2054 { |
|
2055 iTrace->Trace(_L("COMASUPLProtocolManager2::LaunchTimeOutUI"), KTraceFileName, __LINE__); |
|
2056 |
|
2057 iSessnUIObserver = aObserver; |
|
2058 if (iSuplSettings->IsUIActive()) |
|
2059 { |
|
2060 iSuplSettings->SetUIActive(EFalse); |
|
2061 iSettingsLauncher->Cancel(); |
|
2062 } |
|
2063 |
|
2064 iSuplSettings->SetUIActive(ETrue); |
|
2065 iTimeOutDialogPresent = ETrue; |
|
2066 return iSettingsLauncher->LaunchSessionTimeOutDialog(); |
|
2067 } |
|
2068 |
|
2069 // ----------------------------------------------------------------------------- |
|
2070 // COMASUPLProtocolManager2::SettingsTimeOutUICompletedL |
|
2071 // |
|
2072 // |
|
2073 // ----------------------------------------------------------------------------- |
|
2074 // |
|
2075 void COMASUPLProtocolManager2::SettingsTimeOutUICompletedL(TInt aError) |
|
2076 { |
|
2077 iTrace->Trace(_L("COMASUPLProtocolManager2::SettingsTimeOutUICompletedL"), KTraceFileName, __LINE__); |
|
2078 iSuplSettings->SetUIActive(EFalse); |
|
2079 iTimeOutDialogPresent = EFalse; |
|
2080 |
|
2081 if (iDeInitDone) |
|
2082 { |
|
2083 iTrace->Trace(_L("COMASUPLProtocolManager2::SettingsTimeOutUICompletedL, Completing request"), KTraceFileName, __LINE__); |
|
2084 iDeInitDone = EFalse; |
|
2085 User::RequestComplete(iDeInitRequestStatus,KErrNone); |
|
2086 } |
|
2087 else |
|
2088 { |
|
2089 if (iSessnUIObserver) |
|
2090 iSessnUIObserver->SettingsTimeOutUICompletedL(aError); |
|
2091 } |
|
2092 } |
|
2093 |
|
2094 // ----------------------------------------------------------------------------- |
|
2095 // COMASUPLProtocolManager2::GetLastUsedAccessPoint |
|
2096 // |
|
2097 // |
|
2098 // ----------------------------------------------------------------------------- |
|
2099 // |
|
2100 TInt COMASUPLProtocolManager2::GetLastUsedAccessPoint(TDes& aLastlyUsedAccessPoint,TUint32& iIAPId) |
|
2101 { |
|
2102 return iSettingsLauncher->GetIAPName(aLastlyUsedAccessPoint,iIAPId); |
|
2103 } |
|
2104 |
|
2105 // ----------------------------------------------------------------------------- |
|
2106 // COMASUPLProtocolManager2::PrintHex |
|
2107 // |
|
2108 // ----------------------------------------------------------------------------- |
|
2109 // |
|
2110 void COMASUPLProtocolManager2::PrintHex(const TDesC8& aBuffer,TInt aLine) |
|
2111 { |
|
2112 TBuf<128> buffer; |
|
2113 TBuf<8> buff; |
|
2114 _LIT16(KFormat1,"%02x"); |
|
2115 TInt len = aBuffer.Length(); |
|
2116 for(TInt i = 0 ; i <len; i++) |
|
2117 { |
|
2118 buff.Zero(); |
|
2119 buff.Format(KFormat1,aBuffer[i]); |
|
2120 iTrace->Trace(buff, KTraceFileName, aLine); |
|
2121 } |
|
2122 } |
|
2123 |
|
2124 // ----------------------------------------------------------------------------- |
|
2125 // COMASUPLProtocolManager2::RunSuplTriggerSessionL |
|
2126 // |
|
2127 // |
|
2128 // ----------------------------------------------------------------------------- |
|
2129 // |
|
2130 EXPORT_C void COMASUPLProtocolManager2::RunSuplTriggerSessionL( |
|
2131 CSuplSessionBase *const aSuplSession, |
|
2132 TRequestStatus& aStatus, |
|
2133 TSuplTerminalPeriodicTrigger& aPTrigger, |
|
2134 const TDesC& aHslpAddress, |
|
2135 TBool aFallBack, |
|
2136 TInt aAllowedCapabilities, |
|
2137 TInt aRequestID |
|
2138 ) |
|
2139 { |
|
2140 iTrace->Trace(_L("COMASUPLProtocolManager2::RunSuplTriggerSessionL"), |
|
2141 KTraceFileName, __LINE__); |
|
2142 aStatus = KRequestPending; |
|
2143 if ( iSuplSessions.Find(aSuplSession) == KErrNotFound ) |
|
2144 { |
|
2145 TRequestStatus *status = &aStatus; |
|
2146 User::RequestComplete(status,KErrNotFound ); |
|
2147 return; |
|
2148 } |
|
2149 |
|
2150 CheckForSessionCount(); |
|
2151 iRunningSessionCount++; |
|
2152 |
|
2153 COMASuplSession* OMASession = static_cast<COMASuplSession*>(aSuplSession); |
|
2154 |
|
2155 OMASession->SetConfigurationParameters( |
|
2156 iUT1_StartTimer, |
|
2157 iUT2_PosInitTimer, |
|
2158 iUT3_PosTimer, |
|
2159 iPrivacyTimer, |
|
2160 iSETMode, |
|
2161 iSuplUsage, |
|
2162 iPersistFailTimer, |
|
2163 iSuplInitTimeOut); |
|
2164 |
|
2165 OMASession->RunTriggerSessionL( |
|
2166 aStatus, |
|
2167 aPTrigger, |
|
2168 aHslpAddress, |
|
2169 aFallBack, |
|
2170 aAllowedCapabilities, |
|
2171 iRunningSessionCount, |
|
2172 aRequestID); |
|
2173 } |
|
2174 |
|
2175 // ----------------------------------------------------------------------------- |
|
2176 // COMASUPLProtocolManager2::CancelPeriodicTriggerSession |
|
2177 // |
|
2178 // |
|
2179 // ----------------------------------------------------------------------------- |
|
2180 // |
|
2181 EXPORT_C void COMASUPLProtocolManager2::CancelSuplTriggerSession(CSuplSessionBase* aSuplSession) |
|
2182 { |
|
2183 iTrace->Trace(_L("COMASUPLProtocolManager2::CancelTriggerSession"), KTraceFileName, __LINE__); |
|
2184 |
|
2185 // Check if the Session is valid |
|
2186 TInt index = iSuplSessions.Find(aSuplSession); |
|
2187 |
|
2188 if(KErrNotFound == index) |
|
2189 { |
|
2190 iTrace->Trace(_L("Cannot found Supl session."), KTraceFileName, __LINE__); |
|
2191 return; |
|
2192 } |
|
2193 aSuplSession->CancelTriggerSession(); |
|
2194 return ; |
|
2195 } |
|
2196 |
|
2197 // ----------------------------------------------------------------------------- |
|
2198 // COMASUPLProtocolManager2::NotifyTriggerFiredL |
|
2199 // |
|
2200 // |
|
2201 // ----------------------------------------------------------------------------- |
|
2202 // |
|
2203 EXPORT_C void COMASUPLProtocolManager2::NotifyTriggerFiredL( |
|
2204 CSuplSessionBase *const aSuplSession, |
|
2205 TRequestStatus& aStatus, |
|
2206 TSuplTriggerFireInfo& aFireInfo) |
|
2207 { |
|
2208 iTrace->Trace(_L("COMASUPLProtocolManager2::NotifyTriggerFiredL"), KTraceFileName, __LINE__); |
|
2209 |
|
2210 aStatus = KRequestPending; |
|
2211 if ( iSuplSessions.Find(aSuplSession) == KErrNotFound ) |
|
2212 { |
|
2213 iTrace->Trace(_L("Cannot find Supl session.Completing with KErrNotFound"), KTraceFileName, __LINE__); |
|
2214 TRequestStatus *status = &aStatus; |
|
2215 User::RequestComplete(status,KErrNotFound ); |
|
2216 return; |
|
2217 } |
|
2218 COMASuplSession* OMASession = static_cast<COMASuplSession*>(aSuplSession); |
|
2219 OMASession->NotifyTriggerFiredL(aStatus, aFireInfo); |
|
2220 } |
|
2221 |
|
2222 // ----------------------------------------------------------------------------- |
|
2223 // COMASUPLProtocolManager2::InitilizationCompletedL |
|
2224 // Informs to client about Initilization of POS ,thro' active object |
|
2225 // |
|
2226 // ----------------------------------------------------------------------------- |
|
2227 // |
|
2228 void COMASUPLProtocolManager2::InitilizationCompletedL(TInt /*aError*/) |
|
2229 { |
|
2230 |
|
2231 } |
|
2232 |
|
2233 // ----------------------------------------------------------------------------- |
|
2234 // COMASUPLProtocolManager::DeInitilizationCompletedL |
|
2235 // Informs to client about Initilization of POS ,thro' active object |
|
2236 // |
|
2237 // ----------------------------------------------------------------------------- |
|
2238 // |
|
2239 void COMASUPLProtocolManager2::DeInitilizationCompletedL(TInt /*aError*/) |
|
2240 { |
|
2241 |
|
2242 } |
|
2243 |
|
2244 // ----------------------------------------------------------------------------- |
|
2245 // COMASUPLProtocolManager1::SetCommoniCommonConfig |
|
2246 // |
|
2247 // |
|
2248 // ----------------------------------------------------------------------------- |
|
2249 // |
|
2250 void COMASUPLProtocolManager2::SetCommonConfig(COMASuplCommonConfig*& aCommmonConfig) |
|
2251 { |
|
2252 iSuplSettings = aCommmonConfig->iSuplSettings; |
|
2253 iPosHandler = aCommmonConfig->iPosHandler; |
|
2254 iIMSI = aCommmonConfig->iIMSI; |
|
2255 iUT1_StartTimer = aCommmonConfig->iUT1_StartTimer; |
|
2256 iUT2_PosInitTimer = aCommmonConfig->iUT2_PosInitTimer; |
|
2257 iUT3_PosTimer = aCommmonConfig->iUT3_PosTimer; |
|
2258 iPrivacyTimer = aCommmonConfig->iPrivacyTimer; |
|
2259 iSETMode = aCommmonConfig->iSETMode; |
|
2260 iSuplUsage = aCommmonConfig->iSuplUsage; |
|
2261 iSuplInitTimeOut = aCommmonConfig->iSuplInitTimeOut; |
|
2262 iPersistFailTimer = aCommmonConfig->iPersistFailTimer; |
|
2263 } |
|
2264 |
|
2265 // ----------------------------------------------------------------------------- |
|
2266 // COMASUPLProtocolManager1::HandleSuplSessionChangeL |
|
2267 // |
|
2268 // |
|
2269 // ----------------------------------------------------------------------------- |
|
2270 // |
|
2271 void COMASUPLProtocolManager2::HandleSuplSessionChangeL(MSuplSessionObserver::TSuplSessionEventType aEvent,TInt64 aSessionId) |
|
2272 { |
|
2273 TBuf<64> buf(_L("Received Notification : ")); |
|
2274 buf.AppendNum(aEvent); |
|
2275 iTrace->Trace(buf,KTraceFileName, __LINE__); |
|
2276 |
|
2277 if(aEvent != MSuplSessionObserver::ESuplSessionDBDeleteEvent) |
|
2278 return; |
|
2279 |
|
2280 buf.Copy(_L("Received Notification to cancel trigger id : ")); |
|
2281 buf.AppendNum(aSessionId); |
|
2282 iTrace->Trace(buf,KTraceFileName, __LINE__); |
|
2283 |
|
2284 |
|
2285 TInt TotalSession = iSuplSessions.Count(); |
|
2286 for(TInt cnt = 0; cnt < TotalSession; ++cnt) |
|
2287 { |
|
2288 COMASuplSession* OMAsuplSession = static_cast<COMASuplSession*>(iSuplSessions[cnt]); |
|
2289 if(OMAsuplSession->AreYouHandlingThisSession(aSessionId)) |
|
2290 { |
|
2291 buf.Copy(_L("Session Found to cancel trigger id : ")); |
|
2292 buf.AppendNum(aSessionId); |
|
2293 iTrace->Trace(buf,KTraceFileName, __LINE__); |
|
2294 OMAsuplSession->CancelTriggerSession(); |
|
2295 break; |
|
2296 } |
|
2297 } |
|
2298 } |
|
2299 |
|
2300 // end of file |