Update contrib.
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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.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__)
37 class TTaskSchedulerCondition;
38 class TScheduleSettings2;
47 const TUint KESchMajorVersionNumber=1;
48 const TUint KESchMinorVersionNumber=0;
49 const TUint KESchBuildVersionNumber=50;
54 Client side interface to the Task Scheduler.
58 class RScheduler : public RSessionBase
61 IMPORT_C RScheduler();
62 IMPORT_C TInt Connect();
63 IMPORT_C TVersion Version() const;
65 // client registration
66 IMPORT_C TInt Register(const TFileName& aFileName,const TInt aPriority);
69 IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef,
70 const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList);
72 IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef,
73 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
74 const TTsTime& aDefaultRunTime);
76 IMPORT_C TInt DeleteSchedule(const TInt aScheduleHandle) const;
78 IMPORT_C TInt DisableSchedule(const TInt aScheduleHandle) const;
80 IMPORT_C TInt EnableSchedule(const TInt aScheduleHandle) const;
82 // This will return KErrArgument if the schedule is not a time based one.
83 // (consistent behaviour with GetScheduleL below).
84 IMPORT_C TInt EditSchedule(const TInt aScheduleHandle,
85 const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList);
87 // This will return KErrArgument if the schedule is not a condition based one.
88 // (consistent behaviour with GetScheduleL below).
89 IMPORT_C TInt EditSchedule(TInt aScheduleHandle,
90 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
91 const TTsTime& aDefaultRunTime);
94 // Schedule a task based on a persistent schedule. Will return KErrArgument
95 // if schedule is a condition based one and task repeat is not 0.
96 IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo,
98 const TInt aScheduleHandle);
100 //creates a transient schedule
101 IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo,
103 TSchedulerItemRef& aRef,
104 const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList);
106 // creates a transient schedule based on conditions. Will return KErrArgument
107 // if schedule is a condition based one and task repeat is not 0.
108 IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo,
110 TSchedulerItemRef& aRef,
111 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
112 const TTsTime& aDefaultRunTime);
114 IMPORT_C TInt DeleteTask(const TInt aTaskId) const;
117 IMPORT_C TInt GetScheduleRefsL(CArrayFixFlat<TSchedulerItemRef>& aScheduleRefArray,
118 const TScheduleFilter aFilter);
120 // Gets time based schedule. Will return KErrArgument if scheduleType
121 // is not time based.
122 IMPORT_C TInt GetScheduleL(const TInt aScheduleHandle,
123 TScheduleState2& aState,
124 CArrayFixFlat<TScheduleEntryInfo2>& aEntries,
125 CArrayFixFlat<TTaskInfo>& aTasks,
128 // Gets condition based schedule. Will return KErrArgument if scheduleType
129 // is not condition based.
130 IMPORT_C TInt GetScheduleL(TInt aScheduleHandle,
131 TScheduleState2& aState,
132 CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
133 TTsTime& aDefaultRunTime,
134 CArrayFixFlat<TTaskInfo>& aTasks);
136 IMPORT_C TInt GetTaskRefsL(CArrayFixFlat<TSchedulerItemRef>& aTasks,
137 const TScheduleFilter aScheduleFilter,
138 const TTaskFilter aTaskFilter);
140 IMPORT_C TInt GetTaskInfoL(const TInt aTaskId,
141 TTaskInfo& aTaskInfo,
143 TSchedulerItemRef& aRef,
146 IMPORT_C TInt GetTaskDataSize(const TInt aTaskId, TInt& aSize);
148 // Gets the scheduletype for a given schedule handle
149 IMPORT_C TInt GetScheduleTypeL(TInt aScheduleHandle,
150 TScheduleType& aScheduleType);
152 //deprecated API functions as of v9.2
153 //clients of these APIs are encouraged to migrate to the equivalent APIs above.
154 //see ../Documentation/Feature Documentation/SGL.GT0250.204 Task Scheduler Migration Guide to new APIs in Symbian OS v9.x.doc
156 IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef,
157 const CArrayFixFlat<TScheduleEntryInfo>& aEntryList);
159 IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef,
160 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
161 const TTime& aDefaultRunTime);
163 IMPORT_C TInt EditSchedule(const TInt aScheduleHandle,
164 const CArrayFixFlat<TScheduleEntryInfo>& aEntryList);
166 IMPORT_C TInt EditSchedule(TInt aScheduleHandle,
167 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
168 const TTime& aDefaultRunTime);
170 IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo,
172 TSchedulerItemRef& aRef,
173 const CArrayFixFlat<TScheduleEntryInfo>& aEntryList);
175 IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo,
177 TSchedulerItemRef& aRef,
178 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
179 const TTime& aDefaultRunTime);
181 IMPORT_C TInt GetScheduleL(const TInt aScheduleHandle,
182 TScheduleState& aState,
183 CArrayFixFlat<TScheduleEntryInfo>& aEntries,
184 CArrayFixFlat<TTaskInfo>& aTasks,
187 IMPORT_C TInt GetScheduleL(TInt aScheduleHandle,
188 TScheduleState& aState,
189 CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
190 TTime& aDefaultRunTime,
191 CArrayFixFlat<TTaskInfo>& aTasks);
193 IMPORT_C TInt GetTaskInfoL(const TInt aTaskId,
194 TTaskInfo& aTaskInfo,
196 TSchedulerItemRef& aRef,
199 public://debug functions.
200 //these functions are included in rel for rel/deb compatibility,
201 //but only do stuff in debug builds
202 IMPORT_C TInt __DbgMarkHeap();
203 IMPORT_C TInt __DbgCheckHeap(TInt aCount);
204 IMPORT_C TInt __DbgMarkEnd(TInt aCount);
205 IMPORT_C TInt __DbgFailNext(TInt aCount);
206 IMPORT_C TInt __DbgResetHeap();
207 IMPORT_C TInt __FaultServer();//kill the server!
210 TInt CreateSchedule(TSchedulerItemRef& aRef,
211 const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList,
212 const TScheduleSettings2& aSettings);
213 TInt CreateSchedule(TSchedulerItemRef& aRef,
214 const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
215 const TTsTime& aDefaultRunTime,
216 const TScheduleSettings2& aSettings);
217 TInt GetScheduleInfo(const TInt aScheduleHandle,
218 TScheduleInfo& aInfo,
220 TInt GetScheduleDataL(const TInt aScheduleHandle,
221 const TScheduleInfo& aInfo,
222 CArrayFixFlat<TScheduleEntryInfo2>& aEntries);
223 TInt GetScheduleDataL(const TInt aScheduleHandle,
224 const TScheduleInfo& aInfo,
225 CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
226 TTsTime& aDefaultRunTime);
227 TInt GetTaskDataL(const TInt aScheduleHandle,
228 const TScheduleInfo& aInfo,
229 CArrayFixFlat<TTaskInfo>& aTasks);