genericservices/taskscheduler/SCHSVR/SchTimer.h
changeset 0 e4d67989cc36
child 67 a1e347446159
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __SCHTIMER_H__
       
    17 #define __SCHTIMER_H__
       
    18 
       
    19 // System includes
       
    20 #include <e32base.h>
       
    21 
       
    22 // Classes referenced
       
    23 class TTsTime;
       
    24 class CTaskScheduler;
       
    25 class CScheduleTimer;
       
    26 class CConditionManager;
       
    27 class TTaskSchedulerCondition;
       
    28 class CSchedule;
       
    29 
       
    30 /**
       
    31 Defines the types of schedules changes (condition and/or a time)
       
    32 @internalComponent
       
    33 */
       
    34 enum TSchChangeType
       
    35 	{
       
    36 	//Update both condition and a time based schedule
       
    37 	EConditionAndTime,
       
    38 	
       
    39 	//Update only time based schedule
       
    40 	EOnlyTime,	
       
    41 	};
       
    42 
       
    43 // class CScheduleCriteriaManager
       
    44 // This class manages and determines when a schedule is due, based on 
       
    45 // either a set of condition and/or a time.  The conditions and time
       
    46 // are set and overridden via the ReplaceScheduleL method.
       
    47 NONSHARABLE_CLASS(CScheduleCriteriaManager) : public CActive
       
    48 	{
       
    49 public:
       
    50 	static CScheduleCriteriaManager* NewL(CTaskScheduler& aOwner);
       
    51 	~CScheduleCriteriaManager();
       
    52 
       
    53 public:	
       
    54 	void ReplaceScheduleL(CSchedule& aSchedule, TSchChangeType aSchChange = EConditionAndTime, TBool aNotFirstTime = EFalse);
       
    55 	void ReplaceScheduleL(const TTsTime& aNextTime, 
       
    56 						TInt aSchedule);
       
    57 	void RemoveSchedule(TInt aSchedule);
       
    58 	void DueSchedule(TInt aScheduleHandle);
       
    59 
       
    60 private:
       
    61 	CScheduleCriteriaManager(CTaskScheduler& aOwner);
       
    62 	// From CActive
       
    63 	void RunL();
       
    64 	void DoCancel();
       
    65 	
       
    66 private:
       
    67 	void CompleteRequest();
       
    68 	// Timer handling
       
    69 	void RemoveTimer(CScheduleTimer* aTimer);		
       
    70 	void RemoveTimers();
       
    71 	CScheduleTimer* Find(TInt aSchedule);		
       
    72 	// Condtion handling
       
    73 	void RemoveCondition(CConditionManager* aTimer);		
       
    74 	void RemoveConditions();
       
    75 	CConditionManager* FindCondition(TInt aSchedule);		
       
    76 
       
    77 private:
       
    78 	CTaskScheduler& iTaskScheduler;
       
    79 	TSglQue<CScheduleTimer> iTimers;
       
    80 	TSglQue<CConditionManager> iConditions;
       
    81 	TInt iDueScheduleHandle;
       
    82 	};
       
    83 
       
    84 #endif