1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericservices/taskscheduler/SCHSVR/SchTimer.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,85 @@
1.4 +// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __SCHTIMER_H__
1.20 +#define __SCHTIMER_H__
1.21 +
1.22 +// System includes
1.23 +#include <e32base.h>
1.24 +
1.25 +// Classes referenced
1.26 +class TTsTime;
1.27 +class CTaskScheduler;
1.28 +class CScheduleTimer;
1.29 +class CConditionManager;
1.30 +class TTaskSchedulerCondition;
1.31 +class CSchedule;
1.32 +
1.33 +/**
1.34 +Defines the types of schedules changes (condition and/or a time)
1.35 +@internalComponent
1.36 +*/
1.37 +enum TSchChangeType
1.38 + {
1.39 + //Update both condition and a time based schedule
1.40 + EConditionAndTime,
1.41 +
1.42 + //Update only time based schedule
1.43 + EOnlyTime,
1.44 + };
1.45 +
1.46 +// class CScheduleCriteriaManager
1.47 +// This class manages and determines when a schedule is due, based on
1.48 +// either a set of condition and/or a time. The conditions and time
1.49 +// are set and overridden via the ReplaceScheduleL method.
1.50 +NONSHARABLE_CLASS(CScheduleCriteriaManager) : public CActive
1.51 + {
1.52 +public:
1.53 + static CScheduleCriteriaManager* NewL(CTaskScheduler& aOwner);
1.54 + ~CScheduleCriteriaManager();
1.55 +
1.56 +public:
1.57 + void ReplaceScheduleL(CSchedule& aSchedule, TSchChangeType aSchChange = EConditionAndTime, TBool aNotFirstTime = EFalse);
1.58 + void ReplaceScheduleL(const TTsTime& aNextTime,
1.59 + TInt aSchedule);
1.60 + void RemoveSchedule(TInt aSchedule);
1.61 + void DueSchedule(TInt aScheduleHandle);
1.62 +
1.63 +private:
1.64 + CScheduleCriteriaManager(CTaskScheduler& aOwner);
1.65 + // From CActive
1.66 + void RunL();
1.67 + void DoCancel();
1.68 + TInt RunError(TInt aError);
1.69 +
1.70 +private:
1.71 + void CompleteRequest();
1.72 + // Timer handling
1.73 + void RemoveTimer(CScheduleTimer* aTimer);
1.74 + void RemoveTimers();
1.75 + CScheduleTimer* Find(TInt aSchedule);
1.76 + // Condtion handling
1.77 + void RemoveCondition(CConditionManager* aTimer);
1.78 + void RemoveConditions();
1.79 + CConditionManager* FindCondition(TInt aSchedule);
1.80 +
1.81 +private:
1.82 + CTaskScheduler& iTaskScheduler;
1.83 + TSglQue<CScheduleTimer> iTimers;
1.84 + TSglQue<CConditionManager> iConditions;
1.85 + TInt iDueScheduleHandle;
1.86 + };
1.87 +
1.88 +#endif