33 _LIT( KPanicCategory, "EnhancedFeatMgrServer" ); |
33 _LIT( KPanicCategory, "EnhancedFeatMgrServer" ); |
34 #else |
34 #else |
35 _LIT( KPanicCategory, "FeatMgrServer" ); |
35 _LIT( KPanicCategory, "FeatMgrServer" ); |
36 #endif // EXTENDED_FEATURE_MANAGER_TEST |
36 #endif // EXTENDED_FEATURE_MANAGER_TEST |
37 |
37 |
38 // LOCAL FUNCTION PROTOTYPES |
|
39 TInt E32Main(); // Process entry point |
|
40 |
|
41 // ============================ MEMBER FUNCTIONS =============================== |
38 // ============================ MEMBER FUNCTIONS =============================== |
42 |
39 |
43 // ----------------------------------------------------------------------------- |
40 // ----------------------------------------------------------------------------- |
44 // CFeatMgrServer::CFeatMgrServer |
41 // CFeatMgrServer::CFeatMgrServer |
45 // C++ default constructor can NOT contain any code, that |
42 // C++ default constructor can NOT contain any code, that |
47 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
48 // |
45 // |
49 CFeatMgrServer::CFeatMgrServer( const TInt aPriority, const TServerType aType ) |
46 CFeatMgrServer::CFeatMgrServer( const TInt aPriority, const TServerType aType ) |
50 : |
47 : |
51 CPolicyServer( aPriority, KFeatMgrPlatSecPolicy, aType ), iBurState(this), |
48 CPolicyServer( aPriority, KFeatMgrPlatSecPolicy, aType ), iBurState(this), |
52 iBackupInProgress(EFalse), |
49 iBURInProgress(EFalse), |
53 iPluginsReady(EFalse), |
50 iPluginsReady(EFalse), |
54 iPluginsDeleted( EFalse ), |
51 iPluginsDeleted( EFalse ), |
55 iPendingRequests( ETrue ), |
52 iPendingRequests( ETrue ), |
56 iFeaturesReady(EFalse) |
53 iFeaturesReady(EFalse) |
57 |
54 |
442 } |
439 } |
443 |
440 |
444 // ----------------------------------------------------------------------------- |
441 // ----------------------------------------------------------------------------- |
445 // CFeatMgrServer::BackupIsInProgress() |
442 // CFeatMgrServer::BackupIsInProgress() |
446 // ----------------------------------------------------------------------------- |
443 // ----------------------------------------------------------------------------- |
447 TBool CFeatMgrServer::BackupIsInProgress() const |
444 TBool CFeatMgrServer::BURIsInProgress() const |
448 { |
445 { |
449 FUNC_LOG |
446 FUNC_LOG |
450 return(iBackupInProgress); |
447 return(iBURInProgress); |
451 } |
448 } |
452 |
449 |
453 // ----------------------------------------------------------------------------- |
450 // ----------------------------------------------------------------------------- |
454 // CFeatMgrServer::ServicePendingRequests() |
451 // CFeatMgrServer::ServicePendingRequests() |
455 // ----------------------------------------------------------------------------- |
452 // ----------------------------------------------------------------------------- |
679 TInt err( KErrNone ); |
676 TInt err( KErrNone ); |
680 |
677 |
681 switch( aCurrent ) |
678 switch( aCurrent ) |
682 { |
679 { |
683 case( EFeatMgrBURState_BackupStarted ) : |
680 case( EFeatMgrBURState_BackupStarted ) : |
684 iBackupInProgress = EFalse; |
681 iBURInProgress = EFalse; |
685 ServicePendingRequests(); |
682 ServicePendingRequests(); |
686 break; |
683 break; |
687 case( EFeatMgrBURState_RestoreStarted ) : |
684 case( EFeatMgrBURState_RestoreStarted ) : |
688 iPluginsReady = EFalse; |
685 iPluginsReady = EFalse; |
689 iPluginsDeleted = EFalse; |
686 iPluginsDeleted = EFalse; |
709 } |
706 } |
710 |
707 |
711 BURStatus CFeatMgrServer::Goto_StartBackupState( BURStatus /* aCurrent */ ) |
708 BURStatus CFeatMgrServer::Goto_StartBackupState( BURStatus /* aCurrent */ ) |
712 { |
709 { |
713 BURStatus aNewState = EFeatMgrBURState_BackupStarted; // state++ |
710 BURStatus aNewState = EFeatMgrBURState_BackupStarted; // state++ |
714 iBackupInProgress = ETrue; |
711 iBURInProgress = ETrue; |
715 return aNewState; |
712 return aNewState; |
716 } |
713 } |
717 |
714 |
718 BURStatus CFeatMgrServer::Goto_EndBackupState( BURStatus /* aCurrent */ ) |
715 BURStatus CFeatMgrServer::Goto_EndBackupState( BURStatus /* aCurrent */ ) |
719 { |
716 { |
720 BURStatus aNewState = EFeatMgrBURState_BackupEnded; // state++ |
717 BURStatus aNewState = EFeatMgrBURState_BackupEnded; // state++ |
721 |
718 |
722 iBackupInProgress = EFalse; |
719 iBURInProgress = EFalse; |
723 ServicePendingRequests(); |
720 ServicePendingRequests(); |
724 // no error from ServicePendingRequests() is possible |
721 // no error from ServicePendingRequests() is possible |
725 |
722 |
726 return aNewState; |
723 return aNewState; |
727 } |
724 } |
728 |
725 |
729 BURStatus CFeatMgrServer::Goto_StartRestoreState( BURStatus /* aCurrent */ ) |
726 BURStatus CFeatMgrServer::Goto_StartRestoreState( BURStatus /* aCurrent */ ) |
730 { |
727 { |
731 // remarkably like Goto_StartBackupState |
728 // remarkably like Goto_StartBackupState |
732 BURStatus aNewState = EFeatMgrBURState_RestoreStarted; // state++ |
729 BURStatus aNewState = EFeatMgrBURState_RestoreStarted; // state++ |
733 iPluginsReady = EFalse; |
730 iBURInProgress = ETrue; |
734 return aNewState; |
731 return aNewState; |
735 } |
732 } |
736 |
733 |
737 BURStatus CFeatMgrServer::Goto_EndRestoreState( BURStatus /* aCurrent */ ) |
734 BURStatus CFeatMgrServer::Goto_EndRestoreState( BURStatus /* aCurrent */ ) |
738 { |
735 { |
739 BURStatus aNewState = EFeatMgrBURState_Error; // fail safe |
736 BURStatus aNewState = EFeatMgrBURState_Error; // fail safe |
740 TInt err( KErrNone ); |
737 TInt err( KErrNone ); |
|
738 iBURInProgress = EFalse; |
741 iPluginsReady = EFalse; |
739 iPluginsReady = EFalse; |
742 iPluginsDeleted = EFalse; |
740 iPluginsDeleted = EFalse; |
743 iPendingRequests = ETrue; |
741 iPendingRequests = ETrue; |
744 iFeaturesReady = EFalse; |
742 iFeaturesReady = EFalse; |
745 |
743 |
856 } |
854 } |
857 |
855 |
858 return; |
856 return; |
859 } |
857 } |
860 |
858 |
861 |
|
862 // ============================= LOCAL FUNCTIONS =============================== |
|
863 |
|
864 // ----------------------------------------------------------------------------- |
|
865 // Function that starts the FeatMgrServer. |
|
866 // ----------------------------------------------------------------------------- |
|
867 // |
|
868 static void RunServerL() |
|
869 { |
|
870 FUNC_LOG |
|
871 |
|
872 // Naming the server thread after the startup helps to debug panics |
|
873 User::LeaveIfError( User::RenameProcess( KServerProcessName ) ); |
|
874 |
|
875 User::LeaveIfError( User::RenameThread( KServerProcessName ) ); |
|
876 |
|
877 // Create and install the active scheduler we need |
|
878 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
|
879 CleanupStack::PushL( scheduler ); |
|
880 |
|
881 CActiveScheduler::Install( scheduler ); |
|
882 |
|
883 // Now we are ready to instantiate the actual CServer2 instance |
|
884 CFeatMgrServer* server = CFeatMgrServer::NewLC( KServerCActivePriority ); |
|
885 |
|
886 // Initialisation complete, now signal the client |
|
887 RProcess::Rendezvous(KErrNone); |
|
888 |
|
889 INFO_LOG( "RunServerL() - Starting scheduler..." ); |
|
890 |
|
891 // Ready to run |
|
892 CActiveScheduler::Start(); |
|
893 |
|
894 INFO_LOG( "RunServerL() - Scheduler stopped" ); |
|
895 |
|
896 // Cleanup the server and scheduler |
|
897 CleanupStack::PopAndDestroy( server ); |
|
898 CleanupStack::PopAndDestroy( scheduler ); |
|
899 } |
|
900 |
|
901 // ----------------------------------------------------------------------------- |
|
902 // Main function |
|
903 // ----------------------------------------------------------------------------- |
|
904 // |
|
905 TInt E32Main() |
|
906 { |
|
907 FUNC_LOG |
|
908 |
|
909 __UHEAP_MARK; |
|
910 |
|
911 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
912 TInt ret = KErrNoMemory; |
|
913 |
|
914 if ( cleanup ) |
|
915 { |
|
916 TRAP( ret, RunServerL() ); |
|
917 delete cleanup; |
|
918 } |
|
919 |
|
920 __UHEAP_MARKEND; |
|
921 |
|
922 return ret; |
|
923 } |
|
924 |
|
925 // End of File |
859 // End of File |