|
1 /* |
|
2 * Copyright (c) 2005-2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "scpsubservice.h" |
|
20 #include "scpservice.h" |
|
21 #include "scplogger.h" |
|
22 #include "scputility.h" |
|
23 #include "scpservicehandlerbase.h" |
|
24 #include "scpprofilehandler.h" |
|
25 #include "scpservicestorage.h" |
|
26 #include "scpstatecontainer.h" |
|
27 #include "scpvoiphandler.h" |
|
28 #include "scpvmbxhandler.h" |
|
29 #include "scppresencehandler.h" |
|
30 #include "scpimhandler.h" |
|
31 #include "scpsubserviceobserver.h" |
|
32 #include "scppresencehandler.h" |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CScpSubService::NewL |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CScpSubService* CScpSubService::NewL( TInt aId, |
|
39 TInt aSubServiceId, |
|
40 TCCHSubserviceType aSubServiceType, |
|
41 CScpService& aService ) |
|
42 { |
|
43 SCPLOGSTRING( "CScpSubService::CScpSubService" ); |
|
44 |
|
45 CScpSubService* self = new ( ELeave ) CScpSubService( aId, |
|
46 aSubServiceId, |
|
47 aSubServiceType, |
|
48 aService ); |
|
49 CleanupStack::PushL( self ); |
|
50 self->ConstructL(); |
|
51 CleanupStack::Pop( self ); |
|
52 return self; |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CScpSubService::ConstructL |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 void CScpSubService::ConstructL() |
|
60 { |
|
61 SCPLOGSTRING2( "CScpSubService[0x%x]::ConstructL", this ); |
|
62 |
|
63 switch( iSubServiceType ) |
|
64 { |
|
65 case ECCHVoIPSub: |
|
66 iServiceHandler = CScpVoipHandler::NewL( *this ); |
|
67 SetPresenceToObserveVoIP(); |
|
68 break; |
|
69 |
|
70 case ECCHVMBxSub: |
|
71 iServiceHandler = CScpVmbxHandler::NewL( *this ); |
|
72 break; |
|
73 |
|
74 case ECCHIMSub: |
|
75 iServiceHandler = CScpImHandler::NewL( *this ); |
|
76 break; |
|
77 |
|
78 case ECCHPresenceSub: |
|
79 iServiceHandler = CScpPresenceHandler::NewL( *this ); |
|
80 break; |
|
81 |
|
82 default: |
|
83 __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) ); |
|
84 User::Leave( KErrNotFound ); |
|
85 break; |
|
86 } |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CScpSubService::CScpSubService |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 CScpSubService::CScpSubService( TInt aId, |
|
94 TInt aSubServiceId, |
|
95 TCCHSubserviceType aSubServiceType, |
|
96 CScpService& aService ) : |
|
97 iId( aId ), |
|
98 iSubServiceId( aSubServiceId ), |
|
99 iSubServiceType( aSubServiceType ), |
|
100 iService( aService ), |
|
101 iSipProfileId( 0 ), |
|
102 iEnableRequestedState( EScpNoRequest ), |
|
103 iSubServiceDisconnected( EFalse ), |
|
104 iApId( 0 ), |
|
105 iSnapId( 0 ), |
|
106 iLastReportedError( KErrNone ), |
|
107 iReserved( EFalse ), |
|
108 iSubServiceState( TScpStateContainer::Instance( ECCHDisabled ) ) |
|
109 { |
|
110 SCPLOGSTRING3( "CScpSubService[0x%x]::CScpSubService type: %d", |
|
111 this, aSubServiceType ); |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CScpSubService::~CScpSubService |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 CScpSubService::~CScpSubService() |
|
119 { |
|
120 SCPLOGSTRING2( "CScpSubService[0x%x]::~CScpSubService", this ); |
|
121 |
|
122 delete iServiceHandler; |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CScpSubService::EnableL |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 void CScpSubService::EnableL() |
|
130 { |
|
131 SCPLOGSTRING2( "CScpSubService[0x%x]::EnableL", this ); |
|
132 |
|
133 iSubServiceState->EnableL( *this ); |
|
134 EnableOccured(); |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CScpSubService::EnableOccured |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 void CScpSubService::EnableOccured() |
|
142 { |
|
143 switch ( iSubServiceType ) |
|
144 { |
|
145 case ECCHPresenceSub: |
|
146 { |
|
147 iEnableCounter++; |
|
148 } |
|
149 break; |
|
150 |
|
151 case ECCHVoIPSub: |
|
152 case ECCHIMSub: |
|
153 case ECCHVMBxSub: |
|
154 case ECCHUnknown: |
|
155 default: |
|
156 break; |
|
157 } |
|
158 |
|
159 SCPLOGSTRING3( "CScpSubService[0x%x]::EnableOccured : %d", this, iEnableCounter ); |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CScpSubService::EnableCounter |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 TInt CScpSubService::EnableCounter() |
|
167 { |
|
168 SCPLOGSTRING3( "CScpSubService[0x%x]::EnableCounter : %d", this, iEnableCounter ); |
|
169 return iEnableCounter; |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CScpSubService::ResetEnableCounter |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 void CScpSubService::ResetEnableCounter() |
|
177 { |
|
178 SCPLOGSTRING2( "CScpSubService[0x%x]::ResetEnableCounter", this ); |
|
179 iEnableCounter = 0; |
|
180 } |
|
181 |
|
182 // ----------------------------------------------------------------------------- |
|
183 // CScpSubService::Disable |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 TInt CScpSubService::Disable() |
|
187 { |
|
188 SCPLOGSTRING2( "CScpSubService[0x%x]::Disable", this ); |
|
189 |
|
190 return iSubServiceState->Disable( *this ); |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CScpSubService::Id |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 TInt CScpSubService::Id() const |
|
198 { |
|
199 SCPLOGSTRING2( "CScpSubService[0x%x]::Id", this ); |
|
200 |
|
201 return iId; |
|
202 } |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // CScpSubService::SubServiceId |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 TInt CScpSubService::SubServiceId() const |
|
209 { |
|
210 SCPLOGSTRING2( "CScpSubService[0x%x]::SubServiceId", this ); |
|
211 |
|
212 return iSubServiceId; |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CScpSubService::ServiceStorage |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 CScpServiceStorage& CScpSubService::ServiceStorage() const |
|
220 { |
|
221 SCPLOGSTRING2( "CScpSubService[0x%x]::ServiceStorage", this ); |
|
222 |
|
223 return iService.ServiceStorage(); |
|
224 } |
|
225 |
|
226 // ----------------------------------------------------------------------------- |
|
227 // CScpSubService::ProfileHandler |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 CScpProfileHandler& CScpSubService::ProfileHandler() const |
|
231 { |
|
232 SCPLOGSTRING2( "CScpSubService[0x%x]::ProfileHandler", this ); |
|
233 |
|
234 return iService.ProfileHandler(); |
|
235 } |
|
236 |
|
237 // ----------------------------------------------------------------------------- |
|
238 // CScpSubService::State |
|
239 // ----------------------------------------------------------------------------- |
|
240 // |
|
241 TCCHSubserviceState CScpSubService::State() const |
|
242 { |
|
243 SCPLOGSTRING2( "CScpSubService[0x%x]::State: %d", this ); |
|
244 |
|
245 return iSubServiceState->State(); |
|
246 } |
|
247 |
|
248 // ----------------------------------------------------------------------------- |
|
249 // CScpSubService::SubServiceType |
|
250 // ----------------------------------------------------------------------------- |
|
251 // |
|
252 TCCHSubserviceType CScpSubService::SubServiceType() const |
|
253 { |
|
254 SCPLOGSTRING2( "CScpSubService[0x%x]::Type", this ); |
|
255 |
|
256 return iSubServiceType; |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CScpSubService::SetSipProfileId |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 void CScpSubService::SetSipProfileId( TInt aSipProfileId ) |
|
264 { |
|
265 SCPLOGSTRING3( "CScpSubService[0x%x]::SetSipProfileId profile id", |
|
266 this, aSipProfileId ); |
|
267 |
|
268 iSipProfileId = aSipProfileId; |
|
269 } |
|
270 |
|
271 // ----------------------------------------------------------------------------- |
|
272 // CScpSubService::SipProfileId |
|
273 // ----------------------------------------------------------------------------- |
|
274 // |
|
275 TInt CScpSubService::SipProfileId() const |
|
276 { |
|
277 SCPLOGSTRING2( "CScpSubService[0x%x]::SipProfileId", this ); |
|
278 |
|
279 return iSipProfileId; |
|
280 } |
|
281 |
|
282 // ----------------------------------------------------------------------------- |
|
283 // CScpSubService::EnableRequestedState |
|
284 // ----------------------------------------------------------------------------- |
|
285 // |
|
286 void CScpSubService::SetEnableRequestedState( TEnableState aEnableRequestedState ) |
|
287 { |
|
288 SCPLOGSTRING2( "CScpSubService[0x%x]::SetEnableRequestedState", this ); |
|
289 |
|
290 iEnableRequestedState = aEnableRequestedState; |
|
291 } |
|
292 |
|
293 // ----------------------------------------------------------------------------- |
|
294 // CScpSubService::EnableRequestedState |
|
295 // ----------------------------------------------------------------------------- |
|
296 // |
|
297 CScpSubService::TEnableState CScpSubService::EnableRequestedState() const |
|
298 { |
|
299 SCPLOGSTRING2( "CScpSubService[0x%x]::EnableRequestedState", this ); |
|
300 |
|
301 return iEnableRequestedState; |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CScpSubService::SetSubServiceDisconnected |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 void CScpSubService::SetSubServiceDisconnected( TBool aSubServiceDisconnected ) |
|
309 { |
|
310 SCPLOGSTRING3( "CScpSubService[0x%x]::SetSubServiceDisconnected: %d", this, |
|
311 aSubServiceDisconnected ); |
|
312 |
|
313 iSubServiceDisconnected = aSubServiceDisconnected; |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CScpSubService::SubServiceDisconnected |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 TBool CScpSubService::SubServiceDisconnected() const |
|
321 { |
|
322 SCPLOGSTRING3( "CScpSubService[0x%x]::SubServiceDisconnected: %d", this, |
|
323 iSubServiceDisconnected ); |
|
324 |
|
325 return iSubServiceDisconnected; |
|
326 } |
|
327 |
|
328 // ----------------------------------------------------------------------------- |
|
329 // CScpSubService::SetApId |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 void CScpSubService::SetApId( TUint32 aApId ) |
|
333 { |
|
334 SCPLOGSTRING3( "CScpSubService[0x%x]::SetApId ap id: %d", this, aApId ); |
|
335 |
|
336 iApId = aApId; |
|
337 } |
|
338 |
|
339 // ----------------------------------------------------------------------------- |
|
340 // CScpSubService::ApId |
|
341 // ----------------------------------------------------------------------------- |
|
342 // |
|
343 TUint32 CScpSubService::ApId() const |
|
344 { |
|
345 SCPLOGSTRING2( "CScpSubService[0x%x]::ApId", this ); |
|
346 |
|
347 return iApId; |
|
348 } |
|
349 |
|
350 // ----------------------------------------------------------------------------- |
|
351 // CScpSubService::SetSnapId |
|
352 // ----------------------------------------------------------------------------- |
|
353 // |
|
354 void CScpSubService::SetSnapId( TUint32 aSnapId ) |
|
355 { |
|
356 SCPLOGSTRING3( "CScpSubService[0x%x]::SetSnapId snap id: %d", this, aSnapId ); |
|
357 |
|
358 iSnapId = aSnapId; |
|
359 } |
|
360 |
|
361 // ----------------------------------------------------------------------------- |
|
362 // CScpSubService::SnapId |
|
363 // ----------------------------------------------------------------------------- |
|
364 // |
|
365 TUint32 CScpSubService::SnapId() const |
|
366 { |
|
367 SCPLOGSTRING2( "CScpSubService[0x%x]::SnapId", this ); |
|
368 |
|
369 return iSnapId; |
|
370 } |
|
371 |
|
372 // ----------------------------------------------------------------------------- |
|
373 // CScpSubService::GetIapType |
|
374 // ----------------------------------------------------------------------------- |
|
375 // |
|
376 TScpIapType CScpSubService::GetIapType() const |
|
377 { |
|
378 SCPLOGSTRING2( "CScpSubService[0x%x]::GetIapType", this ); |
|
379 |
|
380 TScpIapType type = EScpUnknownType; |
|
381 |
|
382 // Check that the sip profile is not using WLAN iap |
|
383 CScpProfileHandler& profileHandler = iService.ProfileHandler(); |
|
384 |
|
385 CScpSipConnection* sipConnection = NULL; |
|
386 |
|
387 if( profileHandler.SipConnectionExists( iSipProfileId ) ) |
|
388 { |
|
389 sipConnection = profileHandler.GetSipConnection( iSipProfileId ); |
|
390 } |
|
391 else |
|
392 { |
|
393 TRAP_IGNORE( sipConnection = |
|
394 profileHandler.CreateSipConnectionL( iSipProfileId ) ); |
|
395 } |
|
396 |
|
397 __ASSERT_DEBUG( sipConnection, User::Panic( KNullDesC, KErrGeneral ) ); |
|
398 |
|
399 if( sipConnection ) |
|
400 { |
|
401 TRAP_IGNORE( type = sipConnection->GetIapTypeL() ); |
|
402 } |
|
403 |
|
404 return type; |
|
405 } |
|
406 |
|
407 // ----------------------------------------------------------------------------- |
|
408 // CScpSubService::ServiceHandler |
|
409 // ----------------------------------------------------------------------------- |
|
410 // |
|
411 CScpServiceHandlerBase& CScpSubService::ServiceHandler() const |
|
412 { |
|
413 SCPLOGSTRING2( "CScpSubService[0x%x]::ServiceHandler", this ); |
|
414 |
|
415 return *iServiceHandler; |
|
416 } |
|
417 |
|
418 // ----------------------------------------------------------------------------- |
|
419 // CScpSubService::LastReportedError |
|
420 // ----------------------------------------------------------------------------- |
|
421 // |
|
422 TInt CScpSubService::LastReportedError() const |
|
423 { |
|
424 SCPLOGSTRING3( "CScpSubService[0x%x]::LastReportedError: %d", |
|
425 this, iLastReportedError ); |
|
426 |
|
427 return iLastReportedError; |
|
428 } |
|
429 |
|
430 // ----------------------------------------------------------------------------- |
|
431 // CScpSubService::SetLastReportedError |
|
432 // ----------------------------------------------------------------------------- |
|
433 // |
|
434 void CScpSubService::SetLastReportedError( |
|
435 const TInt aError ) |
|
436 { |
|
437 SCPLOGSTRING3( "CScpSubService[0x%x]::SetLastReportedError: %d", |
|
438 this, aError ); |
|
439 |
|
440 iLastReportedError = aError; |
|
441 } |
|
442 |
|
443 // ----------------------------------------------------------------------------- |
|
444 // CScpSubService::SetReserved |
|
445 // ----------------------------------------------------------------------------- |
|
446 // |
|
447 void CScpSubService::SetReserved( TBool aReserved ) |
|
448 { |
|
449 SCPLOGSTRING3( "CScpSubService[0x%x]::SetReserved: %d", this, aReserved ); |
|
450 |
|
451 iReserved = aReserved; |
|
452 |
|
453 CScpProfileHandler& profileHandler = iService.ProfileHandler(); |
|
454 profileHandler.SetSipProfileReserved( iSipProfileId, iReserved ); |
|
455 } |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // CScpSubService::IsReserved |
|
459 // ----------------------------------------------------------------------------- |
|
460 // |
|
461 TBool CScpSubService::IsReserved() const |
|
462 { |
|
463 SCPLOGSTRING3( "CScpSubService[0x%x]::IsReserved: %d", this, iReserved ); |
|
464 |
|
465 return iReserved; |
|
466 } |
|
467 |
|
468 // ----------------------------------------------------------------------------- |
|
469 // CScpSubService::IsRoaming |
|
470 // ----------------------------------------------------------------------------- |
|
471 // |
|
472 TBool CScpSubService::IsRoaming() const |
|
473 { |
|
474 SCPLOGSTRING3( "CScpSubService[0x%x]::IsRoaming: %d", this, iRoaming ); |
|
475 |
|
476 return iRoaming; |
|
477 } |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // CScpSubService::ChangeState |
|
481 // ----------------------------------------------------------------------------- |
|
482 // |
|
483 void CScpSubService::ChangeState( TCCHSubserviceState aState, TInt aError ) |
|
484 { |
|
485 SCPLOGSTRING5( "CScpSubService[0x%x]::ChangeState from %d to %d error: %d", this, |
|
486 iSubServiceState->State(), aState, aError ); |
|
487 SCPLOGSTRING3( "CScpSubService[0x%x]::ChangeState type %d", this, iSubServiceType ); |
|
488 __ASSERT_DEBUG( aState != ECCHUninitialized, User::Panic( KNullDesC, KErrGeneral ) ); |
|
489 |
|
490 __ASSERT_DEBUG( iSubServiceState->State() == ECCHDisabled ? |
|
491 aState != ECCHDisconnecting : ETrue, |
|
492 User::Panic( KNullDesC, KErrGeneral ) ); |
|
493 __ASSERT_DEBUG( iSubServiceState->State() == ECCHConnecting ? |
|
494 aState != ECCHDisabled || KErrCancel == aError : ETrue, |
|
495 User::Panic( KNullDesC, KErrGeneral ) ); |
|
496 __ASSERT_DEBUG( iSubServiceState->State() == ECCHDisconnecting ? |
|
497 aState == ECCHDisabled : ETrue, |
|
498 User::Panic( KNullDesC, KErrGeneral ) ); |
|
499 __ASSERT_DEBUG( iSubServiceState->State() == ECCHEnabled ? |
|
500 aState != ECCHDisabled : ETrue, |
|
501 User::Panic( KNullDesC, KErrGeneral ) ); |
|
502 |
|
503 if ( aState != iSubServiceState->State() || |
|
504 ( aState == iSubServiceState->State() && iLastReportedError != aError ) ) |
|
505 { |
|
506 iLastReportedError = aError; |
|
507 |
|
508 switch( aState ) |
|
509 { |
|
510 case ECCHConnecting: |
|
511 { |
|
512 iSubServiceState = |
|
513 TScpStateContainer::Instance( ECCHConnecting ); |
|
514 } |
|
515 break; |
|
516 |
|
517 case ECCHEnabled: |
|
518 { |
|
519 iSubServiceState = |
|
520 TScpStateContainer::Instance( ECCHEnabled ); |
|
521 |
|
522 if ( ECCHVoIPSub == iSubServiceType ) |
|
523 { |
|
524 if ( iService.ContainsSubServiceType( ECCHPresenceSub ) ) |
|
525 { |
|
526 CScpPresenceHandler* presenceHandler = static_cast<CScpPresenceHandler*>( |
|
527 &iService.GetSubServiceByType( ECCHPresenceSub )->ServiceHandler() ); |
|
528 |
|
529 TRAP_IGNORE( presenceHandler->UpdateXdmSettingsL() ); |
|
530 } |
|
531 } |
|
532 } |
|
533 break; |
|
534 |
|
535 case ECCHDisconnecting: |
|
536 { |
|
537 iSubServiceState = |
|
538 TScpStateContainer::Instance( ECCHDisconnecting ); |
|
539 } |
|
540 break; |
|
541 |
|
542 case ECCHDisabled: |
|
543 { |
|
544 iSubServiceState = |
|
545 TScpStateContainer::Instance( ECCHDisabled ); |
|
546 } |
|
547 break; |
|
548 |
|
549 default: |
|
550 __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) ); |
|
551 break; |
|
552 |
|
553 } |
|
554 |
|
555 TBool sendEvent = ETrue; |
|
556 |
|
557 // During connection refreshing we don't send events about disabling |
|
558 if ( iEnableRequestedState == EScpRefreshed ) |
|
559 { |
|
560 if ( aState == ECCHDisconnecting || aState == ECCHDisabled ) |
|
561 { |
|
562 sendEvent = EFalse; |
|
563 } |
|
564 } |
|
565 |
|
566 if ( sendEvent ) |
|
567 { |
|
568 TServiceSelection selection( iSubServiceId, iSubServiceType ); |
|
569 |
|
570 MCchServiceObserver& observer = iService.ServiceObserver(); |
|
571 observer.ServiceStateChanged( selection, |
|
572 aState, |
|
573 aError ); |
|
574 |
|
575 if ( ECCHDisabled == aState ) |
|
576 { |
|
577 ResetEnableCounter(); |
|
578 // No need to hold the last reported error, if all |
|
579 // subservices are in disabled state |
|
580 if ( iService.IsAllSubservicesDisabled() ) |
|
581 { |
|
582 iService.ChangeLastReportedErrors( KErrNone ); |
|
583 } |
|
584 } |
|
585 } |
|
586 |
|
587 if ( iSubServiceObserver ) |
|
588 { |
|
589 SCPLOGSTRING2( "CScpSubService[0x%x]::ChangeState HandleSubServiceChange", this ); |
|
590 iSubServiceObserver->HandleSubServiceChange( aState, aError ); |
|
591 } |
|
592 } |
|
593 } |
|
594 |
|
595 // ----------------------------------------------------------------------------- |
|
596 // CScpSubService::HandleConnectionEvent |
|
597 // ----------------------------------------------------------------------------- |
|
598 // |
|
599 void CScpSubService::HandleConnectionEvent( TScpConnectionEvent aEvent ) |
|
600 { |
|
601 SCPLOGSTRING4( "CScpSubService[0x%x]::HandleConnectionEvent event: %d state: %d", |
|
602 this, aEvent, iSubServiceState->State() ); |
|
603 __ASSERT_DEBUG( aEvent != EScpUnknown, User::Panic( KNullDesC, KErrGeneral ) ); |
|
604 |
|
605 // All other events than EScpRoaming finish roaming |
|
606 iRoaming = EFalse; |
|
607 |
|
608 switch ( aEvent ) |
|
609 { |
|
610 case EScpNetworkFound: |
|
611 { |
|
612 iSubServiceState->NetworkFound( *this ); |
|
613 } |
|
614 break; |
|
615 |
|
616 case EScpNetworkNotFound: |
|
617 { |
|
618 iSubServiceState->NetworkNotFound( *this ); |
|
619 } |
|
620 break; |
|
621 |
|
622 case EScpNetworkLost: |
|
623 { |
|
624 iSubServiceState->NetworkLost( *this ); |
|
625 } |
|
626 break; |
|
627 |
|
628 case EScpRegistered: |
|
629 { |
|
630 iSubServiceState->ServiceConnected( *this ); |
|
631 } |
|
632 break; |
|
633 |
|
634 case EScpRegistrationFailed: |
|
635 { |
|
636 iSubServiceState->ServiceConnectionFailed( *this ); |
|
637 } |
|
638 break; |
|
639 case EScpInvalidSettings: |
|
640 { |
|
641 iSubServiceState->ServiceInvalidSettings( *this ); |
|
642 } |
|
643 break; |
|
644 case EScpDeregistered: |
|
645 { |
|
646 iSubServiceState->ServiceDisconnected( *this ); |
|
647 } |
|
648 break; |
|
649 |
|
650 case EScpAuthenticationFailed: |
|
651 { |
|
652 iSubServiceState->AuthenticationFailed( *this ); |
|
653 } |
|
654 break; |
|
655 |
|
656 case EScpRoaming: |
|
657 { |
|
658 iRoaming = ETrue; |
|
659 iSubServiceState->Roaming( *this ); |
|
660 } |
|
661 break; |
|
662 |
|
663 case EScpRegistrationCanceled: |
|
664 { |
|
665 iSubServiceState->ServiceConnectionCanceled( *this ); |
|
666 } |
|
667 break; |
|
668 |
|
669 case EScpRegistrationPending: |
|
670 { |
|
671 iSubServiceState->RegistrationPending( *this ); |
|
672 } |
|
673 break; |
|
674 |
|
675 default: |
|
676 __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) ); |
|
677 break; |
|
678 } |
|
679 |
|
680 // Remove user disabled sub services if correct |
|
681 // network event received |
|
682 if ( iEnableRequestedState == EScpDisabled && |
|
683 ( aEvent == EScpDeregistered || |
|
684 aEvent == EScpRegistrationFailed || |
|
685 aEvent == EScpNetworkLost || |
|
686 aEvent == EScpNetworkNotFound ) ) |
|
687 { |
|
688 CScpServiceStorage& storage = ServiceStorage(); |
|
689 storage.RemoveDisabledServices(); |
|
690 } |
|
691 else if ( iEnableRequestedState == EScpRefreshed && |
|
692 aEvent == EScpDeregistered ) |
|
693 { |
|
694 // We can only ingnore the error |
|
695 TRAP_IGNORE( EnableL() ); |
|
696 } |
|
697 } |
|
698 |
|
699 // ----------------------------------------------------------------------------- |
|
700 // CScpSubService::SetSubServiceObserver |
|
701 // ----------------------------------------------------------------------------- |
|
702 // |
|
703 void CScpSubService::SetSubServiceObserver( MScpSubServiceObserver* aSubServiceObserver ) |
|
704 { |
|
705 SCPLOGSTRING3( "CScpSubService[0x%x]::SetSubServiceObserver aSubServiceObserver[0x%x]", |
|
706 this, aSubServiceObserver ); |
|
707 |
|
708 iSubServiceObserver = aSubServiceObserver; |
|
709 } |
|
710 |
|
711 // ----------------------------------------------------------------------------- |
|
712 // CScpSubService::SetPresenceToObserveVoIPL |
|
713 // ----------------------------------------------------------------------------- |
|
714 // |
|
715 void CScpSubService::SetPresenceToObserveVoIP() |
|
716 { |
|
717 SCPLOGSTRING2( "CScpSubService[0x%x]::SetPresenceToObserveVoIP", this ); |
|
718 CScpSubService* presenceSubService = iService.GetSubServiceByType( ECCHPresenceSub ); |
|
719 if ( presenceSubService ) |
|
720 { |
|
721 SCPLOGSTRING( "CScpSubService::SetPresenceToObserveVoIPL - presenceSubService exists" ); |
|
722 CScpPresenceHandler* presenceHandler = |
|
723 static_cast<CScpPresenceHandler*>( &presenceSubService->ServiceHandler() ); |
|
724 SetSubServiceObserver( presenceHandler ); |
|
725 } |
|
726 } |
|
727 |
|
728 // End of file |