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: // Various T-classes for client input to scheduler, scheduler output to client sl@0: // These classes comprise part of the interface (the rest is defined in RScheduler) sl@0: // sl@0: // sl@0: sl@0: #if !defined (__SCHINFO_H__) sl@0: #define __SCHINFO_H__ sl@0: sl@0: #if !defined (__SCHTIME_H__) sl@0: #include sl@0: #endif sl@0: sl@0: #if !defined(__E32BASE_H__) sl@0: #include sl@0: #endif sl@0: sl@0: #include sl@0: sl@0: sl@0: sl@0: /** sl@0: Contains detailed information for a single task. sl@0: sl@0: A schedule can have any number of tasks. An object of this type is passed sl@0: to RScheduler::ScheduleTask(). Objects of this type are also returned by functions sl@0: within RScheduler that retrieve information about tasks. sl@0: sl@0: @see RScheduler::ScheduleTask() sl@0: @see RScheduler::GetScheduleL() sl@0: @see RScheduler::GetTaskInfoL() sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TTaskInfo sl@0: { sl@0: public: sl@0: //ctors sl@0: IMPORT_C TTaskInfo (TInt aTaskId, TName& aName, TInt aPriority, TInt aRepeat); sl@0: IMPORT_C TTaskInfo();// sl@0: //assignment sl@0: IMPORT_C TTaskInfo& operator=(const TTaskInfo& aTaskInfo); sl@0: IMPORT_C void ExternalizeL(RWriteStream& aStream) const; sl@0: IMPORT_C void InternalizeL(RReadStream& aStream); sl@0: //needs a copy ctor sl@0: //TTaskInfo (TTaskInfo& aTaskInfo); sl@0: sl@0: //data sl@0: /** Specifies how often the task is to be repeated. sl@0: sl@0: This is defined by the client. sl@0: sl@0: A value of 1 means once, a value of 2 means twice etc. sl@0: sl@0: Note that zero is interpreted to mean once, and a negative value is interpreted sl@0: to mean that the task will be repeated until it is explicitly deleted. */ sl@0: TInt iRepeat; sl@0: sl@0: /** The unique Id for the task. sl@0: sl@0: This is generated by the Task Scheduler. Clients should use the generated sl@0: Id to refer to the task in future transactions. */ sl@0: TInt iTaskId; sl@0: sl@0: /** The name of the task. sl@0: sl@0: This is defined by the client. sl@0: sl@0: @see TName */ sl@0: TName iName; sl@0: sl@0: /** The priority of the task. sl@0: sl@0: This is defined by the client. sl@0: sl@0: Determines the order in which a client's tasks are executed. Where a client sl@0: has two tasks with different priorities, the task with the higher priority sl@0: will be executed first. */ sl@0: TInt iPriority; sl@0: }; sl@0: sl@0: /** sl@0: Defines a filter to be used when listing tasks scheduled in a call to RScheduler::GetTaskRefsL(). sl@0: sl@0: @see RScheduler::GetTaskRefsL() sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: enum TTaskFilter sl@0: { sl@0: /** Indicates that all tasks are to be selected. */ sl@0: EAllTasks, sl@0: /** Indicates those tasks associated with the executing program with which the sl@0: calling client is associated, are to be selected. */ sl@0: EMyTasks sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Defines a filter to be used when listing schedules in a call to RScheduler::GetScheduleRefsL(), sl@0: and when listing tasks in a call to RScheduler::GetTaskRefsL(). sl@0: sl@0: @see RScheduler::GetScheduleRefsL() sl@0: @see RScheduler::GetTaskRefsL() sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: enum TScheduleFilter sl@0: { sl@0: /** Indicates that all schedules are to be selected. */ sl@0: EAllSchedules, sl@0: /** Indicates that only pending schedules are to be selected. sl@0: sl@0: Note that pending schedules are those that are enabled and have tasks associated sl@0: with them. */ sl@0: EPendingSchedules sl@0: }; sl@0: sl@0: /** sl@0: Defines the type of interval used by a schedule entry. sl@0: sl@0: @see TScheduleEntryInfo sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: enum TIntervalType sl@0: { sl@0: /** The interval is based on hours. */ sl@0: EHourly, sl@0: /** The interval is based on days. */ sl@0: EDaily, sl@0: /** The interval is based on months. */ sl@0: EMonthly, sl@0: /** The interval is based on years. */ sl@0: EYearly sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Defines the types of schedules supported by the task scheduler API sl@0: @internalAll sl@0: */ sl@0: // Not for Client use , only to be used internally sl@0: enum TScheduleType sl@0: { sl@0: /** Indicates a time based schedule. */ sl@0: ETimeSchedule, sl@0: /** Indicates a conditon based schedule. */ sl@0: EConditionSchedule sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Defines, and uniquely identifies a schedule. sl@0: sl@0: @see RScheduler::CreatePersistentSchedule() sl@0: @see RScheduler::ScheduleTask() sl@0: @see RScheduler::GetScheduleRefsL() sl@0: @see RScheduler::GetTaskRefsL() sl@0: @see RScheduler::GetTaskInfoL() sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TSchedulerItemRef sl@0: { sl@0: public: sl@0: /** The unique Id for the schedule. sl@0: sl@0: This is generated by the Task Scheduler when the schedule is created. Clients sl@0: should use this Id to refer to the schedule in future transactions. */ sl@0: TInt iHandle; sl@0: sl@0: /** The name of the schedule. sl@0: sl@0: This is defined by the client. */ sl@0: TName iName; sl@0: }; sl@0: sl@0: /** sl@0: Contains detailed information for a single schedule entry. sl@0: sl@0: A schedule can have any number of schedule entries. A client passes one or sl@0: more of these objects, contained within an array, to the RScheduler functions sl@0: that create or amend a schedule. sl@0: sl@0: @see RScheduler::CreatePersistentSchedule() sl@0: @see RScheduler::EditSchedule() sl@0: @see RScheduler::ScheduleTask() sl@0: @see RScheduler::GetScheduleL() sl@0: @publishedAll sl@0: @deprecated and replaced by TScheduleEntryInfo2 sl@0: */ sl@0: class TScheduleEntryInfo sl@0: { sl@0: public: sl@0: void ExternalizeL(RWriteStream& aStream) const; sl@0: void InternalizeL(RReadStream& aStream); sl@0: sl@0: /** Defines the type of time-frame relative to which execution of tasks is timed; sl@0: for example, EHourly implies relative to the current hour, EDaily implies sl@0: relative to the current day. sl@0: sl@0: @see TIntervalType */ sl@0: TIntervalType iIntervalType; sl@0: sl@0: /** The first time that the entry will cause execution of tasks. */ sl@0: TTime iStartTime; sl@0: sl@0: /** The interval between execution of tasks. sl@0: sl@0: The way that this value is interpreted depends on the value of iIntervalType. sl@0: For example, if the interval is 2 and iIntervalType has a value of EMonthly, sl@0: then the interval is 2 months. sl@0: sl@0: The interval must have a minimum value of 1. sl@0: sl@0: @see TIntervalType sl@0: @see iIntervalType */ sl@0: TInt iInterval; sl@0: sl@0: /** The period for which the entry is valid. sl@0: sl@0: After the validity period has expired, tasks associated with the entry will sl@0: not be eligible for execution. sl@0: sl@0: @see TTimeIntervalMinutes */ sl@0: TTimeIntervalMinutes iValidityPeriod; sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: Contains detailed information for a single schedule entry. sl@0: sl@0: A schedule can have any number of schedule entries. A client passes one or sl@0: more of these objects, contained within an array, to the RScheduler functions sl@0: that create or amend a schedule. sl@0: sl@0: @see RScheduler::CreatePersistentSchedule() sl@0: @see RScheduler::EditSchedule() sl@0: @see RScheduler::ScheduleTask() sl@0: @see RScheduler::GetScheduleL() sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TScheduleEntryInfo2 sl@0: { sl@0: public: sl@0: //constructors sl@0: IMPORT_C TScheduleEntryInfo2(); sl@0: IMPORT_C TScheduleEntryInfo2(const TScheduleEntryInfo2& aEntryInfo); sl@0: IMPORT_C TScheduleEntryInfo2(const TTsTime& aStartTime, TIntervalType aIntervalType, TInt aInterval, TTimeIntervalMinutes aValidityPeriod); sl@0: sl@0: //utility Get and Set methods sl@0: IMPORT_C TIntervalType IntervalType() const; sl@0: IMPORT_C void SetIntervalType(TIntervalType aIntervalType); sl@0: sl@0: IMPORT_C const TTsTime& StartTime() const; sl@0: IMPORT_C void SetStartTime(const TTsTime& aStartTime); sl@0: sl@0: IMPORT_C TInt Interval() const; sl@0: IMPORT_C void SetInterval(TInt aInterval); sl@0: sl@0: IMPORT_C TTimeIntervalMinutes ValidityPeriod() const; sl@0: IMPORT_C void SetValidityPeriod(TTimeIntervalMinutes aValidityPeriod); sl@0: sl@0: //assignment operator sl@0: IMPORT_C TScheduleEntryInfo2& operator=(const TScheduleEntryInfo2& aEntryInfo); sl@0: sl@0: sl@0: public: sl@0: // APIs for use within the Task Scheduler server sl@0: TScheduleEntryInfo2(const TScheduleEntryInfo& aEntryInfo); sl@0: void ProcessOffsetEvent(); sl@0: sl@0: void ExternalizeL(RWriteStream& aStream) const; sl@0: void InternalizeL(RReadStream& aStream); sl@0: sl@0: private: sl@0: /** The interval between execution of tasks. sl@0: The way that this value is interpreted depends on the value of iIntervalType. sl@0: For example, if the interval is 2 and iIntervalType has a value of EMonthly, sl@0: then the interval is 2 months. sl@0: The interval must have a minimum value of 1. sl@0: */ sl@0: TInt iInterval; sl@0: sl@0: /** Defines the type of interval between the execution of tasks. sl@0: May be EHourly, EDaily, EMonthly or EYearly. sl@0: */ sl@0: TIntervalType iIntervalType; sl@0: sl@0: /** The first time that the entry will cause execution of tasks. */ sl@0: TTsTime iStartTime; sl@0: sl@0: /** The period for which the entry is valid. sl@0: After the validity period has expired, tasks associated with the entry will sl@0: not be eligible for execution. sl@0: */ sl@0: TTimeIntervalMinutes iValidityPeriod; sl@0: sl@0: /** For future use sl@0: */ sl@0: TAny* iReserved; sl@0: sl@0: // Declare the test accessor as a friend sl@0: friend class TScheduleEntryInfo2_StateAccessor; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Defines the state of a schedule. sl@0: sl@0: An object of this type is passed to, and populated by, a call to RScheduler::GetScheduleL(). sl@0: sl@0: @see RScheduler::GetScheduleL() sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TScheduleState2 sl@0: { sl@0: public: sl@0: sl@0: //constructors sl@0: IMPORT_C TScheduleState2(); sl@0: IMPORT_C TScheduleState2(const TScheduleState2& aScheduleState); sl@0: IMPORT_C TScheduleState2(const TName& aName, const TTsTime& aDueTime, TBool aPersists, TBool aEnabled); sl@0: sl@0: //get, set methods sl@0: IMPORT_C const TName& Name() const; sl@0: IMPORT_C void SetName(const TName& aName); sl@0: sl@0: IMPORT_C const TTsTime& DueTime() const; sl@0: IMPORT_C void SetDueTime(const TTsTime& aDueTime); sl@0: sl@0: IMPORT_C TBool Persists() const; sl@0: IMPORT_C void SetPersists(TBool aPersists); sl@0: sl@0: IMPORT_C TBool Enabled() const; sl@0: IMPORT_C void SetEnabled(TBool aEnabled); sl@0: sl@0: IMPORT_C TScheduleState2& operator=(const TScheduleState2& aScheduleState); sl@0: sl@0: private: sl@0: /** The name of the schedule. */ sl@0: TName iName; sl@0: sl@0: /** The time when the schedule is next due. sl@0: This only has meaning if the schedule is pending, i.e. it is enabled and has sl@0: tasks associated with it. */ sl@0: TTsTime iDueTime; sl@0: sl@0: /** Flags used to indicate: sl@0: 1. Whether the schedule is enabled or not. (bit 0) sl@0: 2. Whether the schedule is persistent or not. (bit 1) sl@0: If a schedule is persistent, its lifetime is not limited to the lifetime of sl@0: the tasks associated with it . sl@0: If a schedule is transient, it is created together with a new scheduled task, sl@0: and is destroyed when the task is destroyed. sl@0: sl@0: Bits 2-31 reserved for future use sl@0: */ sl@0: TUint32 iFlags; sl@0: sl@0: /** For future use sl@0: */ sl@0: TAny* iReserved; sl@0: sl@0: // Declare the test accessor as a friend sl@0: friend class TScheduleState2_StateAccessor; sl@0: }; sl@0: sl@0: /** sl@0: Defines the state of a schedule. sl@0: sl@0: An object of this type is passed to, and populated by, a call to RScheduler::GetScheduleL(). sl@0: sl@0: @see RScheduler::GetScheduleL() sl@0: @publishedAll sl@0: @deprecated and replaced by TScheduleState2. sl@0: */ sl@0: class TScheduleState sl@0: { sl@0: public: sl@0: //constructor for use with the deprecated APIs sl@0: TScheduleState(const TScheduleState2& aScheduleState2); sl@0: TScheduleState() sl@0: { sl@0: } sl@0: sl@0: /** The name of the schedule. */ sl@0: TName iName; sl@0: sl@0: /** The time when the schedule is next due. sl@0: sl@0: This only has meaning if the schedule is pending, i.e. it is enabled and has sl@0: tasks associated with it. */ sl@0: TTime iDueTime; sl@0: sl@0: /** Indicates whether the schedule is persistent or not. sl@0: sl@0: If a schedule is persistent, its lifetime is not limited to the lifetime of sl@0: the tasks associated with it . sl@0: sl@0: If a schedule is transient, it is created together with a new scheduled task, sl@0: and is destroyed when the task is destroyed. */ sl@0: TBool iPersists; sl@0: sl@0: /** Indicates whether the schedule is enabled or not. */ sl@0: TBool iEnabled; sl@0: }; sl@0: sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: sl@0: #endif sl@0: sl@0: #endif