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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Various T-classes for client input to scheduler, scheduler output to client
15 // These classes comprise part of the interface (the rest is defined in RScheduler)
19 #if !defined (__SCHINFO_H__)
22 #if !defined (__SCHTIME_H__)
26 #if !defined(__E32BASE_H__)
33 Contains detailed information for a single task.
35 A schedule can have any number of tasks. An object of this type is passed
36 to RScheduler::ScheduleTask(). Objects of this type are also returned by functions
37 within RScheduler that retrieve information about tasks.
39 @see RScheduler::ScheduleTask()
40 @see RScheduler::GetScheduleL()
41 @see RScheduler::GetTaskInfoL()
49 IMPORT_C TTaskInfo (TInt aTaskId, TName& aName, TInt aPriority, TInt aRepeat);
50 IMPORT_C TTaskInfo();//
52 IMPORT_C TTaskInfo& operator=(const TTaskInfo& aTaskInfo);
53 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
54 IMPORT_C void InternalizeL(RReadStream& aStream);
56 //TTaskInfo (TTaskInfo& aTaskInfo);
59 /** Specifies how often the task is to be repeated.
61 This is defined by the client.
63 A value of 1 means once, a value of 2 means twice etc.
65 Note that zero is interpreted to mean once, and a negative value is interpreted
66 to mean that the task will be repeated until it is explicitly deleted. */
69 /** The unique Id for the task.
71 This is generated by the Task Scheduler. Clients should use the generated
72 Id to refer to the task in future transactions. */
75 /** The name of the task.
77 This is defined by the client.
82 /** The priority of the task.
84 This is defined by the client.
86 Determines the order in which a client's tasks are executed. Where a client
87 has two tasks with different priorities, the task with the higher priority
88 will be executed first. */
93 Defines a filter to be used when listing tasks scheduled in a call to RScheduler::GetTaskRefsL().
95 @see RScheduler::GetTaskRefsL()
101 /** Indicates that all tasks are to be selected. */
103 /** Indicates those tasks associated with the executing program with which the
104 calling client is associated, are to be selected. */
110 Defines a filter to be used when listing schedules in a call to RScheduler::GetScheduleRefsL(),
111 and when listing tasks in a call to RScheduler::GetTaskRefsL().
113 @see RScheduler::GetScheduleRefsL()
114 @see RScheduler::GetTaskRefsL()
120 /** Indicates that all schedules are to be selected. */
122 /** Indicates that only pending schedules are to be selected.
124 Note that pending schedules are those that are enabled and have tasks associated
130 Defines the type of interval used by a schedule entry.
132 @see TScheduleEntryInfo
138 /** The interval is based on hours. */
140 /** The interval is based on days. */
142 /** The interval is based on months. */
144 /** The interval is based on years. */
149 Defines the types of schedules supported by the task scheduler API
154 /** Indicates a time based schedule. */
156 /** Indicates a conditon based schedule. */
162 Defines a condition which a Publish and Subscribe Uid must satisfy.
164 A condition encapsulates three pieces of information:
166 the UID identifying the P&S variable against which a test is to be made.
168 the value against which that P&S variable is to be tested.
170 the type of test to be made.
172 @see RScheduler::CreatePersistentSchedule
173 @see RScheduler::EditSchedule
174 @see RScheduler::ScheduleTask
175 @see RScheduler::GetScheduleL
180 class TTaskSchedulerCondition
184 An enumeration defining the type of test to be made against
185 a Publish and Subscribe property.
189 /** Tests that a value is equal to a state variable value. */
191 /** Tests that a value is unequal to a state variable value. */
193 /** Tests that a value is greater than a state variable value. */
195 /** Tests that a value is less than a state variable value. */
198 inline TTaskSchedulerCondition();
199 inline TTaskSchedulerCondition(TUid aCategory,
202 TConditionType aType);
208 /** Integer state of corresponding P&S variable to be tested against*/
210 /** type of test to be performed */
211 TConditionType iType;
216 Constructs the object with default values.
218 The UID identifying the P&S category against which a test is to be made
219 is set to KNullUid. The sub key is set to zero.
221 The value against which that P&S variable is to be tested is set to zero.
223 The type of test to be made is set to EEquals.
225 inline TTaskSchedulerCondition::TTaskSchedulerCondition()
226 : iCategory(KNullUid),
234 Constructs the object with the specified values.
236 Note that the RProperty variable identified by the aCategory/aKey pair
237 must be of integer type for this to be a valid task scheduler condition.
239 @param aCategory The publish and subscribe category to be tested.
240 @param aKey The publish and suscribe sub-key to be tested.
241 @param aState The value against which the P&S variable identified by the
242 specified UID is to be tested.
243 @param aType The type of test to be made.
247 inline TTaskSchedulerCondition::TTaskSchedulerCondition(TUid aCategory,
250 TConditionType aType)
251 : iCategory(aCategory),
259 Defines, and uniquely identifies a schedule.
261 @see RScheduler::CreatePersistentSchedule()
262 @see RScheduler::ScheduleTask()
263 @see RScheduler::GetScheduleRefsL()
264 @see RScheduler::GetTaskRefsL()
265 @see RScheduler::GetTaskInfoL()
269 class TSchedulerItemRef
272 /** The unique Id for the schedule.
274 This is generated by the Task Scheduler when the schedule is created. Clients
275 should use this Id to refer to the schedule in future transactions. */
278 /** The name of the schedule.
280 This is defined by the client. */
285 Contains detailed information for a single schedule entry.
287 A schedule can have any number of schedule entries. A client passes one or
288 more of these objects, contained within an array, to the RScheduler functions
289 that create or amend a schedule.
291 @see RScheduler::CreatePersistentSchedule()
292 @see RScheduler::EditSchedule()
293 @see RScheduler::ScheduleTask()
294 @see RScheduler::GetScheduleL()
296 @deprecated and replaced by TScheduleEntryInfo2
298 class TScheduleEntryInfo
301 void ExternalizeL(RWriteStream& aStream) const;
302 void InternalizeL(RReadStream& aStream);
304 /** Defines the type of time-frame relative to which execution of tasks is timed;
305 for example, EHourly implies relative to the current hour, EDaily implies
306 relative to the current day.
308 @see TIntervalType */
309 TIntervalType iIntervalType;
311 /** The first time that the entry will cause execution of tasks. */
314 /** The interval between execution of tasks.
316 The way that this value is interpreted depends on the value of iIntervalType.
317 For example, if the interval is 2 and iIntervalType has a value of EMonthly,
318 then the interval is 2 months.
320 The interval must have a minimum value of 1.
323 @see iIntervalType */
326 /** The period for which the entry is valid.
328 After the validity period has expired, tasks associated with the entry will
329 not be eligible for execution.
331 @see TTimeIntervalMinutes */
332 TTimeIntervalMinutes iValidityPeriod;
338 Contains detailed information for a single schedule entry.
340 A schedule can have any number of schedule entries. A client passes one or
341 more of these objects, contained within an array, to the RScheduler functions
342 that create or amend a schedule.
344 @see RScheduler::CreatePersistentSchedule()
345 @see RScheduler::EditSchedule()
346 @see RScheduler::ScheduleTask()
347 @see RScheduler::GetScheduleL()
351 class TScheduleEntryInfo2
355 IMPORT_C TScheduleEntryInfo2();
356 IMPORT_C TScheduleEntryInfo2(const TScheduleEntryInfo2& aEntryInfo);
357 IMPORT_C TScheduleEntryInfo2(const TTsTime& aStartTime, TIntervalType aIntervalType, TInt aInterval, TTimeIntervalMinutes aValidityPeriod);
359 //utility Get and Set methods
360 IMPORT_C TIntervalType IntervalType() const;
361 IMPORT_C void SetIntervalType(TIntervalType aIntervalType);
363 IMPORT_C const TTsTime& StartTime() const;
364 IMPORT_C void SetStartTime(const TTsTime& aStartTime);
366 IMPORT_C TInt Interval() const;
367 IMPORT_C void SetInterval(TInt aInterval);
369 IMPORT_C TTimeIntervalMinutes ValidityPeriod() const;
370 IMPORT_C void SetValidityPeriod(TTimeIntervalMinutes aValidityPeriod);
372 //assignment operator
373 IMPORT_C TScheduleEntryInfo2& operator=(const TScheduleEntryInfo2& aEntryInfo);
377 // APIs for use within the Task Scheduler server
378 TScheduleEntryInfo2(const TScheduleEntryInfo& aEntryInfo);
379 void ProcessOffsetEvent();
381 void ExternalizeL(RWriteStream& aStream) const;
382 void InternalizeL(RReadStream& aStream);
385 /** The interval between execution of tasks.
386 The way that this value is interpreted depends on the value of iIntervalType.
387 For example, if the interval is 2 and iIntervalType has a value of EMonthly,
388 then the interval is 2 months.
389 The interval must have a minimum value of 1.
393 /** Defines the type of interval between the execution of tasks.
394 May be EHourly, EDaily, EMonthly or EYearly.
396 TIntervalType iIntervalType;
398 /** The first time that the entry will cause execution of tasks. */
401 /** The period for which the entry is valid.
402 After the validity period has expired, tasks associated with the entry will
403 not be eligible for execution.
405 TTimeIntervalMinutes iValidityPeriod;
411 // Declare the test accessor as a friend
412 friend class TScheduleEntryInfo2_StateAccessor;
417 Defines the state of a schedule.
419 An object of this type is passed to, and populated by, a call to RScheduler::GetScheduleL().
421 @see RScheduler::GetScheduleL()
425 class TScheduleState2
430 IMPORT_C TScheduleState2();
431 IMPORT_C TScheduleState2(const TScheduleState2& aScheduleState);
432 IMPORT_C TScheduleState2(const TName& aName, const TTsTime& aDueTime, TBool aPersists, TBool aEnabled);
435 IMPORT_C const TName& Name() const;
436 IMPORT_C void SetName(const TName& aName);
438 IMPORT_C const TTsTime& DueTime() const;
439 IMPORT_C void SetDueTime(const TTsTime& aDueTime);
441 IMPORT_C TBool Persists() const;
442 IMPORT_C void SetPersists(TBool aPersists);
444 IMPORT_C TBool Enabled() const;
445 IMPORT_C void SetEnabled(TBool aEnabled);
447 IMPORT_C TScheduleState2& operator=(const TScheduleState2& aScheduleState);
450 /** The name of the schedule. */
453 /** The time when the schedule is next due.
454 This only has meaning if the schedule is pending, i.e. it is enabled and has
455 tasks associated with it. */
458 /** Flags used to indicate:
459 1. Whether the schedule is enabled or not. (bit 0)
460 2. Whether the schedule is persistent or not. (bit 1)
461 If a schedule is persistent, its lifetime is not limited to the lifetime of
462 the tasks associated with it .
463 If a schedule is transient, it is created together with a new scheduled task,
464 and is destroyed when the task is destroyed.
466 Bits 2-31 reserved for future use
474 // Declare the test accessor as a friend
475 friend class TScheduleState2_StateAccessor;
479 Defines the state of a schedule.
481 An object of this type is passed to, and populated by, a call to RScheduler::GetScheduleL().
483 @see RScheduler::GetScheduleL()
485 @deprecated and replaced by TScheduleState2.
490 //constructor for use with the deprecated APIs
491 TScheduleState(const TScheduleState2& aScheduleState2);
496 /** The name of the schedule. */
499 /** The time when the schedule is next due.
501 This only has meaning if the schedule is pending, i.e. it is enabled and has
502 tasks associated with it. */
505 /** Indicates whether the schedule is persistent or not.
507 If a schedule is persistent, its lifetime is not limited to the lifetime of
508 the tasks associated with it .
510 If a schedule is transient, it is created together with a new scheduled task,
511 and is destroyed when the task is destroyed. */
514 /** Indicates whether the schedule is enabled or not. */
521 class TScheduleInfo // Move to cschcode.h when appropriate
524 TScheduleState2 iState;
531 @deprecated replaced with TScheduleSettings2
533 class TScheduleSettings // Move to cschcode.h when appropriate