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