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