genericservices/taskscheduler/INC/CSCH_CLI.H
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // RScheduler class
       
    15 // Client Interface to Scheduler
       
    16 // 
       
    17 //
       
    18 
       
    19 #if !defined(__CSCH_CLI_H__)
       
    20 #define __CSCH_CLI_H__
       
    21 
       
    22 #if !defined(__E32BASE_H__)
       
    23 #include <e32base.h>
       
    24 #endif
       
    25 
       
    26 #if !defined(__E32STD_H__)
       
    27 #include <e32std.h>
       
    28 #endif
       
    29 
       
    30 #if !defined(__SCHINFO_H__)
       
    31 #include <schinfo.h>
       
    32 #endif
       
    33 
       
    34 #include <e32cons.h>
       
    35 
       
    36 
       
    37 class TTaskSchedulerCondition;
       
    38 class TScheduleSettings2;
       
    39 class TScheduleInfo;
       
    40 
       
    41 
       
    42 /** 
       
    43 Constants
       
    44 @publishedAll
       
    45 @deprecated
       
    46 */
       
    47 const TUint KESchMajorVersionNumber=1;
       
    48 const TUint KESchMinorVersionNumber=0;
       
    49 const TUint KESchBuildVersionNumber=50;
       
    50 
       
    51 
       
    52 
       
    53 /**
       
    54 Client side interface to the Task Scheduler.
       
    55 @publishedAll	
       
    56 @released
       
    57 */
       
    58 class RScheduler : public RSessionBase
       
    59 	{
       
    60 public:
       
    61 	IMPORT_C RScheduler();
       
    62 	IMPORT_C TInt Connect();
       
    63 	IMPORT_C TVersion Version() const;
       
    64 	
       
    65 	// client registration
       
    66 	IMPORT_C TInt Register(const TFileName& aFileName,const TInt aPriority);
       
    67 	
       
    68 	// schedule editing
       
    69 	IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef, 
       
    70 							const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList);
       
    71 
       
    72 	IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef, 
       
    73 							const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
       
    74 							const TTsTime& aDefaultRunTime);
       
    75 
       
    76 	IMPORT_C TInt DeleteSchedule(const TInt aScheduleHandle) const;
       
    77 
       
    78 	IMPORT_C TInt DisableSchedule(const TInt aScheduleHandle) const;
       
    79 
       
    80 	IMPORT_C TInt EnableSchedule(const TInt aScheduleHandle) const;
       
    81 
       
    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);
       
    86 
       
    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);	
       
    92 
       
    93 	//task funtions
       
    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, 
       
    97 							HBufC& aTaskData, 
       
    98 							const TInt aScheduleHandle);
       
    99 
       
   100 	//creates a transient schedule
       
   101 	IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo, 
       
   102 							HBufC& aTaskData, 
       
   103 							TSchedulerItemRef& aRef,
       
   104 							const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList);
       
   105 
       
   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, 
       
   109 							HBufC& aTaskData, 
       
   110 							TSchedulerItemRef& aRef, 
       
   111 							const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
       
   112 							const TTsTime& aDefaultRunTime);
       
   113 
       
   114 	IMPORT_C TInt DeleteTask(const TInt aTaskId) const;
       
   115 	
       
   116 	//retrieving
       
   117 	IMPORT_C TInt GetScheduleRefsL(CArrayFixFlat<TSchedulerItemRef>& aScheduleRefArray,
       
   118 							const TScheduleFilter aFilter);
       
   119 
       
   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, 
       
   126 							TTsTime& aDueTime);
       
   127 
       
   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);
       
   135 
       
   136 	IMPORT_C TInt GetTaskRefsL(CArrayFixFlat<TSchedulerItemRef>& aTasks,
       
   137 							const TScheduleFilter aScheduleFilter, 
       
   138 							const TTaskFilter aTaskFilter);
       
   139 
       
   140 	IMPORT_C TInt GetTaskInfoL(const TInt aTaskId, 
       
   141 							TTaskInfo& aTaskInfo, 
       
   142 							TPtr& aTaskData, 
       
   143 							TSchedulerItemRef& aRef, 
       
   144 							TTsTime& aNextDue);
       
   145 
       
   146 	IMPORT_C TInt GetTaskDataSize(const TInt aTaskId, TInt& aSize);
       
   147 	
       
   148 	// Gets the scheduletype for a given schedule handle
       
   149 	IMPORT_C TInt GetScheduleTypeL(TInt aScheduleHandle,
       
   150 											TScheduleType& aScheduleType);
       
   151 public:
       
   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
       
   155 	
       
   156 	IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef, 
       
   157 							const CArrayFixFlat<TScheduleEntryInfo>& aEntryList);
       
   158 
       
   159 	IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef, 
       
   160 							const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
       
   161 							const TTime& aDefaultRunTime);
       
   162 
       
   163 	IMPORT_C TInt EditSchedule(const TInt aScheduleHandle, 
       
   164 							const CArrayFixFlat<TScheduleEntryInfo>& aEntryList);
       
   165 
       
   166 	IMPORT_C TInt EditSchedule(TInt aScheduleHandle, 
       
   167 							const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
       
   168 							const TTime& aDefaultRunTime);	
       
   169 
       
   170 	IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo, 
       
   171 							HBufC& aTaskData, 
       
   172 							TSchedulerItemRef& aRef,
       
   173 							const CArrayFixFlat<TScheduleEntryInfo>& aEntryList);
       
   174 
       
   175 	IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo, 
       
   176 							HBufC& aTaskData, 
       
   177 							TSchedulerItemRef& aRef, 
       
   178 							const CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
       
   179 							const TTime& aDefaultRunTime);
       
   180 	
       
   181 	IMPORT_C TInt GetScheduleL(const TInt aScheduleHandle, 
       
   182 							TScheduleState& aState, 
       
   183 							CArrayFixFlat<TScheduleEntryInfo>& aEntries, 
       
   184 							CArrayFixFlat<TTaskInfo>& aTasks, 
       
   185 							TTime& aDueTime);
       
   186 
       
   187 	IMPORT_C TInt GetScheduleL(TInt aScheduleHandle, 
       
   188 							TScheduleState& aState, 
       
   189 							CArrayFixFlat<TTaskSchedulerCondition>& aConditions,
       
   190 							TTime& aDefaultRunTime, 
       
   191 							CArrayFixFlat<TTaskInfo>& aTasks);
       
   192 
       
   193 	IMPORT_C TInt GetTaskInfoL(const TInt aTaskId, 
       
   194 							TTaskInfo& aTaskInfo, 
       
   195 							TPtr& aTaskData, 
       
   196 							TSchedulerItemRef& aRef, 
       
   197 							TTime& aNextDue);
       
   198 	
       
   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!
       
   208 
       
   209 private:
       
   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, 
       
   219 						TTsTime& aNextDue);
       
   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);					
       
   230 	};
       
   231 
       
   232 #endif