46 const TInt KCCHThirdRecovery = 30000000; |
46 const TInt KCCHThirdRecovery = 30000000; |
47 const TInt KCCHFourthRecovery = 60000000; |
47 const TInt KCCHFourthRecovery = 60000000; |
48 const TInt KCCHFifthRecovery = 60000000; |
48 const TInt KCCHFifthRecovery = 60000000; |
49 |
49 |
50 const TInt KCCHPluginUnloadTimeout = 5000000; |
50 const TInt KCCHPluginUnloadTimeout = 5000000; |
|
51 |
|
52 const TInt KCCHHandleNotifyDelay = 1000000; |
|
53 |
51 // MACROS |
54 // MACROS |
52 // None |
55 // None |
53 |
56 |
54 // LOCAL CONSTANTS AND MACROS |
57 // LOCAL CONSTANTS AND MACROS |
55 // None |
58 // None |
87 // |
90 // |
88 void CCCHServiceHandler::ConstructL() |
91 void CCCHServiceHandler::ConstructL() |
89 { |
92 { |
90 iNotifier = CSPNotifyChange::NewL( *this ); |
93 iNotifier = CSPNotifyChange::NewL( *this ); |
91 iCchUIHandler = CCchUIHandler::NewL( iServer, *this ); |
94 iCchUIHandler = CCchUIHandler::NewL( iServer, *this ); |
92 iPhoneStartupMonitor = CCchPhoneStartupMonitor::NewL( *iCchUIHandler ); |
|
93 iConnectionRecoveryTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard ); |
95 iConnectionRecoveryTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard ); |
94 iCommDbWatcher = CCCHCommDbWatcher::NewL( *this ); |
96 iCommDbWatcher = CCCHCommDbWatcher::NewL( *this ); |
95 iPluginUnloadTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard ); |
97 iPluginUnloadTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard ); |
|
98 iHandleNotifyDelayTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard ); |
96 iRecoveryInterval.Append( KCCHFirstRecovery ); |
99 iRecoveryInterval.Append( KCCHFirstRecovery ); |
97 iRecoveryInterval.Append( KCCHSecondRecovery ); |
100 iRecoveryInterval.Append( KCCHSecondRecovery ); |
98 iRecoveryInterval.Append( KCCHThirdRecovery ); |
101 iRecoveryInterval.Append( KCCHThirdRecovery ); |
99 iRecoveryInterval.Append( KCCHFourthRecovery ); |
102 iRecoveryInterval.Append( KCCHFourthRecovery ); |
100 iRecoveryInterval.Append( KCCHFifthRecovery ); |
103 iRecoveryInterval.Append( KCCHFifthRecovery ); |
132 if ( iCchUIHandler ) |
135 if ( iCchUIHandler ) |
133 { |
136 { |
134 iCchUIHandler->Destroy(); |
137 iCchUIHandler->Destroy(); |
135 } |
138 } |
136 |
139 |
137 delete iPhoneStartupMonitor; |
|
138 delete iWlanExtension; |
140 delete iWlanExtension; |
139 delete iConnectionRecoveryTimer; |
141 delete iConnectionRecoveryTimer; |
140 delete iPluginUnloadTimer; |
142 delete iPluginUnloadTimer; |
|
143 delete iHandleNotifyDelayTimer; |
141 delete iCommDbWatcher; |
144 delete iCommDbWatcher; |
142 |
145 |
143 if( iNotifier ) |
146 if( iNotifier ) |
144 { |
147 { |
145 iNotifier->Cancel(); |
148 iNotifier->Cancel(); |
521 } |
524 } |
522 CCHLOGSTRING( "CCCHServiceHandler::CancelPluginUnloadTimer; OUT" ); |
525 CCHLOGSTRING( "CCCHServiceHandler::CancelPluginUnloadTimer; OUT" ); |
523 } |
526 } |
524 |
527 |
525 // ----------------------------------------------------------------------------- |
528 // ----------------------------------------------------------------------------- |
|
529 // CCCHServiceHandler::StartHandleNotifyDelayTimer |
|
530 // ----------------------------------------------------------------------------- |
|
531 // |
|
532 void CCCHServiceHandler::StartHandleNotifyDelayTimer( ) |
|
533 { |
|
534 CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::StartHandleNotifyDelayTimer; IN", this ); |
|
535 |
|
536 CancelHandleNotifyDelayTimer(); |
|
537 if( !iHandleNotifyDelayTimer->IsActive() ) |
|
538 { |
|
539 iHandleNotifyDelayTimer->Start( |
|
540 KCCHHandleNotifyDelay , |
|
541 0, |
|
542 TCallBack( CCCHServiceHandler::HandleNotifyEvent, this ) ); |
|
543 |
|
544 CCHLOGSTRING( "CCCHServiceHandler::StartHandleNotifyDelayTimer; timer started"); |
|
545 } |
|
546 |
|
547 CCHLOGSTRING( "CCCHServiceHandler::StartHandleNotifyDelayTimer; OUT" ); |
|
548 } |
|
549 |
|
550 // ----------------------------------------------------------------------------- |
|
551 // CCCHServiceHandler::CancelHandleNotifyDelayTimer |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 void CCCHServiceHandler::CancelHandleNotifyDelayTimer() |
|
555 { |
|
556 CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::CancelHandleNotifyDelayTimer; IN", this ); |
|
557 |
|
558 if( iHandleNotifyDelayTimer->IsActive() ) |
|
559 { |
|
560 iHandleNotifyDelayTimer->Cancel(); |
|
561 } |
|
562 |
|
563 CCHLOGSTRING( "CCCHServiceHandler::CancelHandleNotifyDelayTimer; OUT" ); |
|
564 } |
|
565 |
|
566 // ----------------------------------------------------------------------------- |
526 // CCCHServiceHandler::PluginUnloadEvent |
567 // CCCHServiceHandler::PluginUnloadEvent |
527 // ----------------------------------------------------------------------------- |
568 // ----------------------------------------------------------------------------- |
528 // |
569 // |
529 TInt CCCHServiceHandler::PluginUnloadEvent( TAny* aSelf ) |
570 TInt CCCHServiceHandler::PluginUnloadEvent( TAny* aSelf ) |
530 { |
571 { |
534 CCHLOGSTRING( "CCCHServiceHandler::PluginUnloadEvent; OUT" ); |
575 CCHLOGSTRING( "CCCHServiceHandler::PluginUnloadEvent; OUT" ); |
535 return 0; |
576 return 0; |
536 } |
577 } |
537 |
578 |
538 // ----------------------------------------------------------------------------- |
579 // ----------------------------------------------------------------------------- |
|
580 // CCCHServiceHandler::HandleNotifyEvent |
|
581 // ----------------------------------------------------------------------------- |
|
582 // |
|
583 TInt CCCHServiceHandler::HandleNotifyEvent( TAny* aSelf ) |
|
584 { |
|
585 CCHLOGSTRING( "CCCHServiceHandler::HandleNotifyEvent; IN" ); |
|
586 |
|
587 CCHLOGSTRING( "CCCHServiceHandler::PluginUnloadEvent; IN" ); |
|
588 CCCHServiceHandler* self = static_cast<CCCHServiceHandler*>( aSelf ); |
|
589 self->HandleDelayedNotifyEvent(); |
|
590 CCHLOGSTRING( "CCCHServiceHandler::HandleNotifyEvent; OUT" ); |
|
591 return 0; |
|
592 } |
|
593 |
|
594 // ----------------------------------------------------------------------------- |
539 // CCCHServiceHandler::HandlePluginUnload |
595 // CCCHServiceHandler::HandlePluginUnload |
540 // ----------------------------------------------------------------------------- |
596 // ----------------------------------------------------------------------------- |
541 // |
597 // |
542 void CCCHServiceHandler::HandlePluginUnload() |
598 void CCCHServiceHandler::HandlePluginUnload() |
543 { |
599 { |
545 this ); |
601 this ); |
546 CancelPluginUnloadTimer(); |
602 CancelPluginUnloadTimer(); |
547 TRAP_IGNORE( UnloadDisabledPluginsL( ) ); |
603 TRAP_IGNORE( UnloadDisabledPluginsL( ) ); |
548 |
604 |
549 CCHLOGSTRING( "CCCHServiceHandler::HandlePluginUnload OUT" ); |
605 CCHLOGSTRING( "CCCHServiceHandler::HandlePluginUnload OUT" ); |
|
606 } |
|
607 |
|
608 // ----------------------------------------------------------------------------- |
|
609 // CCCHServiceHandler::HandleDelayedNotifyEvent |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 void CCCHServiceHandler::HandleDelayedNotifyEvent() |
|
613 { |
|
614 CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::HandleDelayedNotifyEvent IN", |
|
615 this ); |
|
616 |
|
617 iDelayedHandleNotifyServiceId = 0; |
|
618 CancelHandleNotifyDelayTimer(); |
|
619 |
|
620 TServiceSelection selection; |
|
621 selection.iServiceId = iDelayedHandleNotifyServiceId; |
|
622 TInt index( ServiceExist( selection ) ); |
|
623 |
|
624 TRAPD( err, |
|
625 { |
|
626 if ( KErrNotFound != index ) |
|
627 { |
|
628 iServices[ index ]->UpdateL( ETrue ); |
|
629 } |
|
630 else |
|
631 { |
|
632 TCCHService service; |
|
633 iServer.SPSHandler().GetServiceInfoL( |
|
634 iDelayedHandleNotifyServiceId, service ); |
|
635 AddServiceL( service ); |
|
636 } |
|
637 } ); |
|
638 |
|
639 //Check if service is already marked as enabled, and enable it |
|
640 if ( KErrNone == err ) |
|
641 { |
|
642 index = ServiceExist( selection ); |
|
643 if ( KErrNotFound != index ) |
|
644 { |
|
645 if( iServices[ index ]->StartupFlagSet() && |
|
646 ECCHEnabled != iServices[ index ]->GetState() ) |
|
647 { |
|
648 iCancelNotify = EFalse; |
|
649 EnableService( selection, EFalse ); |
|
650 iCancelNotify = ETrue; |
|
651 } |
|
652 } |
|
653 } |
|
654 |
|
655 // If service has removed, err must be other than none |
|
656 // and we have to update all services |
|
657 if ( KErrNone != err ) |
|
658 { |
|
659 TRAP_IGNORE( UpdateL( ETrue ) ); |
|
660 } |
|
661 |
|
662 CCHLOGSTRING( "CCCHServiceHandler::HandleDelayedNotifyEvent OUT" ); |
550 } |
663 } |
551 |
664 |
552 // --------------------------------------------------------------------------- |
665 // --------------------------------------------------------------------------- |
553 // CCCHServiceHandler::Exists |
666 // CCCHServiceHandler::Exists |
554 // (other items were commented in a header). |
667 // (other items were commented in a header). |
1520 // (other items were commented in a header). |
1633 // (other items were commented in a header). |
1521 // --------------------------------------------------------------------------- |
1634 // --------------------------------------------------------------------------- |
1522 // |
1635 // |
1523 void CCCHServiceHandler::HandleNotifyChange( TServiceId aServiceId ) |
1636 void CCCHServiceHandler::HandleNotifyChange( TServiceId aServiceId ) |
1524 { |
1637 { |
1525 CCHLOGSTRING( "CCCHServiceHandler::HandleNotifyChange: IN" ); |
1638 CCHLOGSTRING( "CCCHServiceHandler::HandleNotifyChange IN" ); |
1526 TServiceSelection selection; |
1639 |
1527 selection.iServiceId = aServiceId; |
1640 CancelHandleNotifyDelayTimer(); |
1528 TInt index( ServiceExist( selection ) ); |
1641 StartHandleNotifyDelayTimer(); |
1529 TRAPD( err, |
1642 iDelayedHandleNotifyServiceId = aServiceId; |
1530 { |
|
1531 if ( KErrNotFound != index ) |
|
1532 { |
|
1533 iServices[ index ]->UpdateL( ETrue ); |
|
1534 } |
|
1535 else |
|
1536 { |
|
1537 TCCHService service; |
|
1538 iServer.SPSHandler().GetServiceInfoL( aServiceId, service ); |
|
1539 AddServiceL( service ); |
|
1540 } |
|
1541 } ); |
|
1542 |
|
1543 //Check if service is already marked as enabled, and enable it |
|
1544 if ( KErrNone == err ) |
|
1545 { |
|
1546 index = ServiceExist( selection ); |
|
1547 if ( KErrNotFound != index ) |
|
1548 { |
|
1549 CCHLOGSTRING( "CCCHServiceHandler::HandleNotifyChange: service found" ); |
|
1550 if( iServices[ index ]->StartupFlagSet() && |
|
1551 ECCHEnabled != iServices[ index ]->GetState() ) |
|
1552 { |
|
1553 CCHLOGSTRING( "CCCHServiceHandler::HandleNotifyChange: enabling..." ); |
|
1554 iCancelNotify = EFalse; |
|
1555 EnableService( selection, EFalse ); |
|
1556 iCancelNotify = ETrue; |
|
1557 } |
|
1558 } |
|
1559 } |
|
1560 |
|
1561 // If service has removed, err must be other than none |
|
1562 // and we have to update all services |
|
1563 if ( KErrNone != err ) |
|
1564 { |
|
1565 TRAP_IGNORE( UpdateL( ETrue ) ); |
|
1566 } |
|
1567 CCHLOGSTRING( "CCCHServiceHandler::HandleNotifyChange: OUT" ); |
|
1568 } |
1643 } |
1569 |
1644 |
1570 // --------------------------------------------------------------------------- |
1645 // --------------------------------------------------------------------------- |
1571 // CCCHServiceHandler::EnableNotifyChange |
1646 // CCCHServiceHandler::EnableNotifyChange |
1572 // (other items were commented in a header). |
1647 // (other items were commented in a header). |