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.
15 // Client Interface to Scheduler
19 #if !defined(__CSCH_CLI_H__)
20 #define __CSCH_CLI_H__
22 #if !defined(__E32BASE_H__)
26 #if !defined(__E32STD_H__)
30 #if !defined(__SCHINFO_H__)
36 class TTaskSchedulerCondition;
37 class TScheduleSettings2;
39 starts scheduler under EPOC32
43 IMPORT_C TInt StartSch32();
50 const TUint KESchMajorVersionNumber=1;
51 const TUint KESchMinorVersionNumber=0;
52 const TUint KESchBuildVersionNumber=50;
58 const TInt KMaxScheduleName=50;
64 _LIT(KScheduleServerName, "!TaskScheduler");
67 Client side interface to the Task Scheduler.
71 class RScheduler : public RSessionBase
74 IMPORT_C RScheduler();
75 IMPORT_C TInt Connect();
76 IMPORT_C TVersion Version() const;
78 // client registration
79 IMPORT_C TInt Register(const TFileName& aFileName,const TInt aPriority);
82 IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef,
83 const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList);
85 IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef,
86 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
87 const TTsTime& aDefaultRunTime);
89 IMPORT_C TInt DeleteSchedule(const TInt aScheduleHandle) const;
91 IMPORT_C TInt DisableSchedule(const TInt aScheduleHandle) const;
93 IMPORT_C TInt EnableSchedule(const TInt aScheduleHandle) const;
95 // This will return KErrArgument if the schedule is not a time based one.
96 // (consistent behaviour with GetScheduleL below).
97 IMPORT_C TInt EditSchedule(const TInt aScheduleHandle,
98 const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList);
100 // This will return KErrArgument if the schedule is not a condition based one.
101 // (consistent behaviour with GetScheduleL below).
102 IMPORT_C TInt EditSchedule(TInt aScheduleHandle,
103 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
104 const TTsTime& aDefaultRunTime);
107 // Schedule a task based on a persistent schedule. Will return KErrArgument
108 // if schedule is a condition based one and task repeat is not 0.
109 IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo,
111 const TInt aScheduleHandle);
113 //creates a transient schedule
114 IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo,
116 TSchedulerItemRef& aRef,
117 const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList);
119 // creates a transient schedule based on conditions. Will return KErrArgument
120 // if schedule is a condition based one and task repeat is not 0.
121 IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo,
123 TSchedulerItemRef& aRef,
124 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
125 const TTsTime& aDefaultRunTime);
127 IMPORT_C TInt DeleteTask(const TInt aTaskId) const;
130 IMPORT_C TInt GetScheduleRefsL(CArrayFixFlat<TSchedulerItemRef>& aScheduleRefArray,
131 const TScheduleFilter aFilter);
133 // Gets time based schedule. Will return KErrArgument if scheduleType
134 // is not time based.
135 IMPORT_C TInt GetScheduleL(const TInt aScheduleHandle,
136 TScheduleState2& aState,
137 CArrayFixFlat<TScheduleEntryInfo2>& aEntries,
138 CArrayFixFlat<TTaskInfo>& aTasks,
141 // Gets condition based schedule. Will return KErrArgument if scheduleType
142 // is not condition based.
143 IMPORT_C TInt GetScheduleL(TInt aScheduleHandle,
144 TScheduleState2& aState,
145 CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
146 TTsTime& aDefaultRunTime,
147 CArrayFixFlat<TTaskInfo>& aTasks);
149 IMPORT_C TInt GetTaskRefsL(CArrayFixFlat<TSchedulerItemRef>& aTasks,
150 const TScheduleFilter aScheduleFilter,
151 const TTaskFilter aTaskFilter);
153 IMPORT_C TInt GetTaskInfoL(const TInt aTaskId,
154 TTaskInfo& aTaskInfo,
156 TSchedulerItemRef& aRef,
159 IMPORT_C TInt GetTaskDataSize(const TInt aTaskId, TInt& aSize);
161 // Gets the scheduletype for a given schedule handle
162 IMPORT_C TInt GetScheduleTypeL(TInt aScheduleHandle,
163 TScheduleType& aScheduleType);
165 //deprecated API functions as of v9.2
166 //clients of these APIs are encouraged to migrate to the equivalent APIs above.
167 //see ../Documentation/Feature Documentation/SGL.GT0250.204 Task Scheduler Migration Guide to new APIs in Symbian OS v9.x.doc
169 IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef,
170 const CArrayFixFlat<TScheduleEntryInfo>& aEntryList);
172 IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef,
173 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
174 const TTime& aDefaultRunTime);
176 IMPORT_C TInt EditSchedule(const TInt aScheduleHandle,
177 const CArrayFixFlat<TScheduleEntryInfo>& aEntryList);
179 IMPORT_C TInt EditSchedule(TInt aScheduleHandle,
180 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
181 const TTime& aDefaultRunTime);
183 IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo,
185 TSchedulerItemRef& aRef,
186 const CArrayFixFlat<TScheduleEntryInfo>& aEntryList);
188 IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo,
190 TSchedulerItemRef& aRef,
191 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
192 const TTime& aDefaultRunTime);
194 IMPORT_C TInt GetScheduleL(const TInt aScheduleHandle,
195 TScheduleState& aState,
196 CArrayFixFlat<TScheduleEntryInfo>& aEntries,
197 CArrayFixFlat<TTaskInfo>& aTasks,
200 IMPORT_C TInt GetScheduleL(TInt aScheduleHandle,
201 TScheduleState& aState,
202 CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
203 TTime& aDefaultRunTime,
204 CArrayFixFlat<TTaskInfo>& aTasks);
206 IMPORT_C TInt GetTaskInfoL(const TInt aTaskId,
207 TTaskInfo& aTaskInfo,
209 TSchedulerItemRef& aRef,
212 public://debug functions.
213 //these functions are included in rel for rel/deb compatibility,
214 //but only do stuff in debug builds
215 IMPORT_C TInt __DbgMarkHeap();
216 IMPORT_C TInt __DbgCheckHeap(TInt aCount);
217 IMPORT_C TInt __DbgMarkEnd(TInt aCount);
218 IMPORT_C TInt __DbgFailNext(TInt aCount);
219 IMPORT_C TInt __DbgResetHeap();
220 IMPORT_C TInt __FaultServer();//kill the server!
223 TInt CreateSchedule(TSchedulerItemRef& aRef,
224 const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList,
225 const TScheduleSettings2& aSettings);
226 TInt CreateSchedule(TSchedulerItemRef& aRef,
227 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
228 const TTsTime& aDefaultRunTime,
229 const TScheduleSettings2& aSettings);
230 TInt GetScheduleInfo(const TInt aScheduleHandle,
231 TScheduleInfo& aInfo,
233 TInt GetScheduleDataL(const TInt aScheduleHandle,
234 const TScheduleInfo& aInfo,
235 CArrayFixFlat<TScheduleEntryInfo2>& aEntries);
236 TInt GetScheduleDataL(const TInt aScheduleHandle,
237 const TScheduleInfo& aInfo,
238 CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
239 TTsTime& aDefaultRunTime);
240 TInt GetTaskDataL(const TInt aScheduleHandle,
241 const TScheduleInfo& aInfo,
242 CArrayFixFlat<TTaskInfo>& aTasks);