sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __SCHMAN_H__ sl@0: #define __SCHMAN_H__ sl@0: sl@0: // System includes sl@0: #include sl@0: sl@0: // User includes sl@0: #include "SCHINFO.H" sl@0: #include "SchSSAObserver.h" sl@0: sl@0: #include sl@0: sl@0: // Classes referenced sl@0: class CSchedule; sl@0: class TScheduledTask; sl@0: class CScheduleCriteriaManager; sl@0: class CClientProxy; sl@0: class TScheduleEntryInfo2; sl@0: class CSchBackupManager; sl@0: class CEnvironmentChangeNotifier; sl@0: class CSchLogManager; sl@0: class TTaskSchedulerCondition; sl@0: sl@0: enum TBUROperation sl@0: { sl@0: EBUROperationNoActivity = 0, sl@0: EBUROperationBackup, sl@0: EBUROperationRestore sl@0: }; sl@0: sl@0: enum TBUROperationResult sl@0: { sl@0: EBUROperationAbort = 0, sl@0: EBUROperationSuccess sl@0: }; sl@0: sl@0: NONSHARABLE_CLASS(CTaskScheduler) : public CBase, public MSchStartupStateObserver, private MBackupOperationObserver sl@0: { sl@0: public: sl@0: static CTaskScheduler* NewL(); sl@0: static CTaskScheduler* NewLC(); sl@0: ~CTaskScheduler(); sl@0: sl@0: public: sl@0: // Client, Schedule and Task functions sl@0: CClientProxy* AddClientL(const TDesC& aFilename, TInt aPriority); sl@0: void AddScheduleL(CSchedule& aSchedule); sl@0: void RemoveScheduleL(TInt aHandle); sl@0: void EditScheduleL(TInt aScheduleHandle, sl@0: CArrayFixFlat& aEntryList); sl@0: void EditScheduleL(TInt aScheduleHandle, sl@0: CArrayFixFlat& aEntryList, sl@0: const TTsTime& aDefaultTime); sl@0: void EnableScheduleL(TInt aHandle); sl@0: void DisableScheduleL(TInt aHandle); sl@0: void ScheduleTaskL(CSchedule& aSchedule, sl@0: CClientProxy& aClient); sl@0: void DeleteTaskL(TInt aScheduleHandle, TInt aTaskHandle); sl@0: sl@0: TInt GetScheduleRefsL(CArrayFixFlat* aRefArray, sl@0: TScheduleFilter aFilter, sl@0: const RMessagePtr2& aMessage); sl@0: TInt GetTaskRefsL(CArrayFixFlat* aRefArray, sl@0: TScheduleFilter aScheduleFilter, sl@0: TTaskFilter aTaskFilter, sl@0: CClientProxy* aClient, sl@0: const RMessagePtr2& aMessage); sl@0: // Utility functions sl@0: CSchedule* FindL(TInt aHandle); sl@0: TInt GenerateId(); sl@0: void DueTaskNotifyL(TInt aScheduleHandle); //called when some task is due sl@0: sl@0: // from MSchStartupStateObserver sl@0: void ProcessSSAEventL(TStartupStateIdentifier aKnownState); sl@0: TBool IsScheduleReadyForUpdate(CSchedule& aSchedule); sl@0: TBool IsStartupStateNonCritical(); sl@0: sl@0: inline TBUROperation BUROperationInProgress() { return iBUROperationInProgress; } sl@0: sl@0: // from MBackupOperationObserver sl@0: virtual void HandleBackupOperationEventL(const TBackupOperationAttributes &aBackupOperationAttributes); sl@0: sl@0: private: sl@0: // Construction functions sl@0: CTaskScheduler(); sl@0: void ConstructL(); sl@0: sl@0: //Environment change functions sl@0: static TInt EnvironmentChanged(TAny* aScheduler); sl@0: void HandleEnvironmentChange(); sl@0: sl@0: // Utility functions sl@0: CSchedule* Find(TInt aHandle); sl@0: void DoRemoveL(CSchedule* aSchedule); sl@0: void ExecuteClients(TBool aUpdateClient=ETrue); sl@0: void DoEditScheduleL(CSchedule& aSchedule, sl@0: CArrayFixFlat& aConditionList, sl@0: const TTsTime& aDefaultTime); sl@0: void AddSchedulesToTimerL(); sl@0: void CleanupScheduledTasksL(); sl@0: void UpdateClients(); sl@0: sl@0: void BURBeginningL(TBUROperation aOperationType); sl@0: void BURCompleteL(TBUROperation aOperationType, TBUROperationResult aBURResult); sl@0: sl@0: private: sl@0: RFs iFsSession; sl@0: // sl@0: TSglQue iSchedules; sl@0: TPriQue iClients; sl@0: // sl@0: CScheduleCriteriaManager* iScheduleCriteriaManager; sl@0: CSchBackupManager* iBackupManager; sl@0: CEnvironmentChangeNotifier* iNotifier; sl@0: CSchLogManager* iSchLogManager; sl@0: TBool iStartupStatePassNonCritical; sl@0: sl@0: TBUROperation iBUROperationInProgress; sl@0: TBool iTaskExecutedDuringBUR; sl@0: CBaBackupSessionWrapper* iBackupNotification; sl@0: }; sl@0: sl@0: #endif