sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // RScheduler class sl@0: // Client Interface to Scheduler sl@0: // sl@0: // sl@0: sl@0: #if !defined(__CSCH_CLI_H__) sl@0: #define __CSCH_CLI_H__ sl@0: sl@0: #if !defined(__E32BASE_H__) sl@0: #include <e32base.h> sl@0: #endif sl@0: sl@0: #if !defined(__E32STD_H__) sl@0: #include <e32std.h> sl@0: #endif sl@0: sl@0: #if !defined(__SCHINFO_H__) sl@0: #include <schinfo.h> sl@0: #endif sl@0: sl@0: #include <e32cons.h> sl@0: sl@0: sl@0: class TTaskSchedulerCondition; sl@0: class TScheduleSettings2; sl@0: class TScheduleInfo; sl@0: sl@0: sl@0: /** sl@0: Constants sl@0: @publishedAll sl@0: @deprecated sl@0: */ sl@0: const TUint KESchMajorVersionNumber=1; sl@0: const TUint KESchMinorVersionNumber=0; sl@0: const TUint KESchBuildVersionNumber=50; sl@0: sl@0: sl@0: sl@0: /** sl@0: Client side interface to the Task Scheduler. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class RScheduler : public RSessionBase sl@0: { sl@0: public: sl@0: IMPORT_C RScheduler(); sl@0: IMPORT_C TInt Connect(); sl@0: IMPORT_C TVersion Version() const; sl@0: sl@0: // client registration sl@0: IMPORT_C TInt Register(const TFileName& aFileName,const TInt aPriority); sl@0: sl@0: // schedule editing sl@0: IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef, sl@0: const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList); sl@0: sl@0: IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef, sl@0: const CArrayFixFlat<TTaskSchedulerCondition>& aConditions, sl@0: const TTsTime& aDefaultRunTime); sl@0: sl@0: IMPORT_C TInt DeleteSchedule(const TInt aScheduleHandle) const; sl@0: sl@0: IMPORT_C TInt DisableSchedule(const TInt aScheduleHandle) const; sl@0: sl@0: IMPORT_C TInt EnableSchedule(const TInt aScheduleHandle) const; sl@0: sl@0: // This will return KErrArgument if the schedule is not a time based one. sl@0: // (consistent behaviour with GetScheduleL below). sl@0: IMPORT_C TInt EditSchedule(const TInt aScheduleHandle, sl@0: const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList); sl@0: sl@0: // This will return KErrArgument if the schedule is not a condition based one. sl@0: // (consistent behaviour with GetScheduleL below). sl@0: IMPORT_C TInt EditSchedule(TInt aScheduleHandle, sl@0: const CArrayFixFlat<TTaskSchedulerCondition>& aConditions, sl@0: const TTsTime& aDefaultRunTime); sl@0: sl@0: //task funtions sl@0: // Schedule a task based on a persistent schedule. Will return KErrArgument sl@0: // if schedule is a condition based one and task repeat is not 0. sl@0: IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo, sl@0: HBufC& aTaskData, sl@0: const TInt aScheduleHandle); sl@0: sl@0: //creates a transient schedule sl@0: IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo, sl@0: HBufC& aTaskData, sl@0: TSchedulerItemRef& aRef, sl@0: const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList); sl@0: sl@0: // creates a transient schedule based on conditions. Will return KErrArgument sl@0: // if schedule is a condition based one and task repeat is not 0. sl@0: IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo, sl@0: HBufC& aTaskData, sl@0: TSchedulerItemRef& aRef, sl@0: const CArrayFixFlat<TTaskSchedulerCondition>& aConditions, sl@0: const TTsTime& aDefaultRunTime); sl@0: sl@0: IMPORT_C TInt DeleteTask(const TInt aTaskId) const; sl@0: sl@0: //retrieving sl@0: IMPORT_C TInt GetScheduleRefsL(CArrayFixFlat<TSchedulerItemRef>& aScheduleRefArray, sl@0: const TScheduleFilter aFilter); sl@0: sl@0: // Gets time based schedule. Will return KErrArgument if scheduleType sl@0: // is not time based. sl@0: IMPORT_C TInt GetScheduleL(const TInt aScheduleHandle, sl@0: TScheduleState2& aState, sl@0: CArrayFixFlat<TScheduleEntryInfo2>& aEntries, sl@0: CArrayFixFlat<TTaskInfo>& aTasks, sl@0: TTsTime& aDueTime); sl@0: sl@0: // Gets condition based schedule. Will return KErrArgument if scheduleType sl@0: // is not condition based. sl@0: IMPORT_C TInt GetScheduleL(TInt aScheduleHandle, sl@0: TScheduleState2& aState, sl@0: CArrayFixFlat<TTaskSchedulerCondition>& aConditions, sl@0: TTsTime& aDefaultRunTime, sl@0: CArrayFixFlat<TTaskInfo>& aTasks); sl@0: sl@0: IMPORT_C TInt GetTaskRefsL(CArrayFixFlat<TSchedulerItemRef>& aTasks, sl@0: const TScheduleFilter aScheduleFilter, sl@0: const TTaskFilter aTaskFilter); sl@0: sl@0: IMPORT_C TInt GetTaskInfoL(const TInt aTaskId, sl@0: TTaskInfo& aTaskInfo, sl@0: TPtr& aTaskData, sl@0: TSchedulerItemRef& aRef, sl@0: TTsTime& aNextDue); sl@0: sl@0: IMPORT_C TInt GetTaskDataSize(const TInt aTaskId, TInt& aSize); sl@0: sl@0: // Gets the scheduletype for a given schedule handle sl@0: IMPORT_C TInt GetScheduleTypeL(TInt aScheduleHandle, sl@0: TScheduleType& aScheduleType); sl@0: public: sl@0: //deprecated API functions as of v9.2 sl@0: //clients of these APIs are encouraged to migrate to the equivalent APIs above. sl@0: //see ../Documentation/Feature Documentation/SGL.GT0250.204 Task Scheduler Migration Guide to new APIs in Symbian OS v9.x.doc sl@0: sl@0: IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef, sl@0: const CArrayFixFlat<TScheduleEntryInfo>& aEntryList); sl@0: sl@0: IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef& aRef, sl@0: const CArrayFixFlat<TTaskSchedulerCondition>& aConditions, sl@0: const TTime& aDefaultRunTime); sl@0: sl@0: IMPORT_C TInt EditSchedule(const TInt aScheduleHandle, sl@0: const CArrayFixFlat<TScheduleEntryInfo>& aEntryList); sl@0: sl@0: IMPORT_C TInt EditSchedule(TInt aScheduleHandle, sl@0: const CArrayFixFlat<TTaskSchedulerCondition>& aConditions, sl@0: const TTime& aDefaultRunTime); sl@0: sl@0: IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo, sl@0: HBufC& aTaskData, sl@0: TSchedulerItemRef& aRef, sl@0: const CArrayFixFlat<TScheduleEntryInfo>& aEntryList); sl@0: sl@0: IMPORT_C TInt ScheduleTask(TTaskInfo& aTaskInfo, sl@0: HBufC& aTaskData, sl@0: TSchedulerItemRef& aRef, sl@0: const CArrayFixFlat<TTaskSchedulerCondition>& aConditions, sl@0: const TTime& aDefaultRunTime); sl@0: sl@0: IMPORT_C TInt GetScheduleL(const TInt aScheduleHandle, sl@0: TScheduleState& aState, sl@0: CArrayFixFlat<TScheduleEntryInfo>& aEntries, sl@0: CArrayFixFlat<TTaskInfo>& aTasks, sl@0: TTime& aDueTime); sl@0: sl@0: IMPORT_C TInt GetScheduleL(TInt aScheduleHandle, sl@0: TScheduleState& aState, sl@0: CArrayFixFlat<TTaskSchedulerCondition>& aConditions, sl@0: TTime& aDefaultRunTime, sl@0: CArrayFixFlat<TTaskInfo>& aTasks); sl@0: sl@0: IMPORT_C TInt GetTaskInfoL(const TInt aTaskId, sl@0: TTaskInfo& aTaskInfo, sl@0: TPtr& aTaskData, sl@0: TSchedulerItemRef& aRef, sl@0: TTime& aNextDue); sl@0: sl@0: public://debug functions. sl@0: //these functions are included in rel for rel/deb compatibility, sl@0: //but only do stuff in debug builds sl@0: IMPORT_C TInt __DbgMarkHeap(); sl@0: IMPORT_C TInt __DbgCheckHeap(TInt aCount); sl@0: IMPORT_C TInt __DbgMarkEnd(TInt aCount); sl@0: IMPORT_C TInt __DbgFailNext(TInt aCount); sl@0: IMPORT_C TInt __DbgResetHeap(); sl@0: IMPORT_C TInt __FaultServer();//kill the server! sl@0: sl@0: private: sl@0: TInt CreateSchedule(TSchedulerItemRef& aRef, sl@0: const CArrayFixFlat<TScheduleEntryInfo2>& aEntryList, sl@0: const TScheduleSettings2& aSettings); sl@0: TInt CreateSchedule(TSchedulerItemRef& aRef, sl@0: const CArrayFixFlat<TTaskSchedulerCondition>& aConditions, sl@0: const TTsTime& aDefaultRunTime, sl@0: const TScheduleSettings2& aSettings); sl@0: TInt GetScheduleInfo(const TInt aScheduleHandle, sl@0: TScheduleInfo& aInfo, sl@0: TTsTime& aNextDue); sl@0: TInt GetScheduleDataL(const TInt aScheduleHandle, sl@0: const TScheduleInfo& aInfo, sl@0: CArrayFixFlat<TScheduleEntryInfo2>& aEntries); sl@0: TInt GetScheduleDataL(const TInt aScheduleHandle, sl@0: const TScheduleInfo& aInfo, sl@0: CArrayFixFlat<TTaskSchedulerCondition>& aConditions, sl@0: TTsTime& aDefaultRunTime); sl@0: TInt GetTaskDataL(const TInt aScheduleHandle, sl@0: const TScheduleInfo& aInfo, sl@0: CArrayFixFlat<TTaskInfo>& aTasks); sl@0: }; sl@0: sl@0: #endif