Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <CSCH_CLI.H>
Link against: schsvr.lib

Class RScheduler

class RScheduler : public RSessionBase;

Description

Client side interface to the Task Scheduler.

Derivation

Members

Defined in RScheduler:

Inherited from RHandleBase:

Inherited from RSessionBase:

Related Topics


Construction and destruction


RScheduler()

IMPORT_C RScheduler();

Description

Default constructor.

[Top]


Member functions


Connect()

IMPORT_C TInt Connect();

Description

Connects a client to the Task Scheduler server, creating a session with that server.

Return value

TInt

KErrNone, if successful; otherwise one of the other system wide error codes.


Version()const

IMPORT_C TVersion Version() const;

Description

Gets the client side version number.

Return value

TVersion

The version number.


Register(const TFileName &,const TInt)

IMPORT_C TInt Register(const TFileName &aFileName, const TInt aPriority);

Description

Registers a client with the Task Scheduler.

A client must register with the Task Scheduler before scheduling any tasks, but does not need to register just to create and edit schedules.

Parameters

const TBuf &aFileName

The name and full path of a program that encapsulates the client-specific knowledge for implementing tasks. On the emulator, the program should be a DLL; on an ARM processor, it should be an executable.

const TInt aPriority

A priority value.

Return value

TInt

KErrNone, if successful; otherwise one of the other system wide error codes.


CreatePersistentSchedule(TSchedulerItemRef &,const CArrayFixFlat< TScheduleEntryInfo2 > &)

Capability: WriteDeviceData

IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef &aRef, const CArrayFixFlat< TScheduleEntryInfo2 > &aEntryList);

Description

Creates a persistent time based schedule.

This schedule has no tasks associated with it but merely contains information about start and finish times.

Parameters

TSchedulerItemRef &aRef

Definition of the new schedule. On return this contains a valid handle to the newly created schedule.

const CArrayFixFlat< TScheduleEntryInfo2 > &aEntryList

The set of schedule entries that make up the new schedule.

Return value

TInt

KErrNone, if successful, KErrArgument if the condition array is empty, or an entry has an interval less than 1, KErrServerBusy, if a backup or restore operation is taking place, KErrPermissionDenied if the client does not have WriteDeviceData capability. Otherwise one of the other system wide error codes.

See also:


DeleteSchedule(const TInt)const

Capability: Security policy note: Only clients with the same SID as the schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt DeleteSchedule(const TInt aScheduleHandle) const;

Description

Deletes the specified schedule.

Note that a schedule cannot be deleted if there are tasks associated with it; the tasks must be explicitly deleted first.

Parameters

const TInt aScheduleHandle

The Id that identifies the schedule.

Return value

TInt

KErrNone if successful, KErrNotFound if there is no schedule with the specified Id, KErrArgument if there are outstanding tasks associated with the schedule, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability, KErrServerBusy, if a backup or restore operation is taking place or any of the other system wide error codes.


DisableSchedule(const TInt)const

Capability: Security policy note: Only clients with the same SID as the schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt DisableSchedule(const TInt aScheduleHandle) const;

Description

Disables the specified schedule.

Parameters

const TInt aScheduleHandle

The Id that identifies the schedule.

Return value

TInt

KErrNone if successful, KErrNotFound if there is no schedule with the specified Id, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability, KErrServerBusy, if a backup or restore operation is taking place or any of the other system wide error codes.


EnableSchedule(const TInt)const

Capability: Security policy note: Only clients with the same SID as the schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt EnableSchedule(const TInt aScheduleHandle) const;

Description

Enables the specified schedule.

Parameters

const TInt aScheduleHandle

The Id that identifies the schedule.

Return value

TInt

KErrNone if successful. KErrNotFound if there is no schedule with the specified Id, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability, KErrServerBusy, if a backup or restore operation is taking place or any of the other system wide error codes.


EditSchedule(const TInt,const CArrayFixFlat< TScheduleEntryInfo2 > &)

Capability: Security policy note: Only clients with the same SID as the schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt EditSchedule(const TInt aScheduleHandle, const CArrayFixFlat< TScheduleEntryInfo2 > &aEntryList);

Description

Changes a time based schedule.

Note that changing a schedule is implemented by supplying a replacement set of schedule entries.

Parameters

const TInt aScheduleHandle

The Id that identifies the schedule.

const CArrayFixFlat< TScheduleEntryInfo2 > &aEntryList

The set of schedule entries that will make up the new schedule.

Return value

TInt

KErrNone if successful, KErrNotFound if there is no schedule with the specified Id, KErrArgument if the schedule is not a time based one, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability, KErrServerBusy, if a backup or restore operation is taking place or any of the other system wide error codes.

See also:


ScheduleTask(TTaskInfo &,HBufC &,const TInt)

Capability: Security policy note: Only clients with the same SID as the schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt ScheduleTask(TTaskInfo &aTaskInfo, HBufC &aTaskData, const TInt aScheduleHandle);

Description

Adds a task to an existing persistent schedule.

Behaviour of execution after a Backup and Restore operation should be considered when adding tasks to a persistent schedule. Persistent schedules might be backed up when a one-off task might be pending, and become due and executed some time after the backup operation. When the backup is restored, the tasks might be executed again if they are still valid (restore done during the validation period for time-based schedules, or conditions satisfied after restore for condition-based schedules). Clients should refrain from creating tasks that might have undesired effects under these conditions (e.g. by incurring a cost to the user by sending an SMS twice).

Parameters

TTaskInfo &aTaskInfo

Information about the task to be added to the schedule. On return the task Id is written into this class.

HBufC16 &aTaskData

Data that is passed to the task on execution.

const TInt aScheduleHandle

The Id that identifies the schedule to be used.

Return value

TInt

KErrNone if successful, KErrNotFound if there is no schedule with the specified Id, KErrArgument if a task with a repeat vale other than 0 is being tried to be assigned to a condition based schedule, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability, KErrServerBusy, if a backup or restore operation is taking place or any of the other system wide error codes.

Panic codes

CTaskScheduler

0 The client has not registered. The client must register before adding tasks to the schedule.


ScheduleTask(TTaskInfo &,HBufC &,TSchedulerItemRef &,const CArrayFixFlat< TScheduleEntryInfo2 > &)

IMPORT_C TInt ScheduleTask(TTaskInfo &aTaskInfo, HBufC &aTaskData, TSchedulerItemRef &aRef, const CArrayFixFlat< TScheduleEntryInfo2 > &aEntryList);

Description

Creates a new, transient, time based schedule and adds a task to it.

Note that a transient schedule is destroyed when the task is destroyed or power is lost.

Parameters

TTaskInfo &aTaskInfo

Information about the task to be added to the transient schedule. On return the task Id is written into this class.

HBufC16 &aTaskData

Data that is passed to the task on execution.

TSchedulerItemRef &aRef

Definition of the new transient schedule.

const CArrayFixFlat< TScheduleEntryInfo2 > &aEntryList

The set of schedule entries that make up the new transient schedule.

Return value

TInt

KErrNone, if successful, or any of the other system wide error codes.

Panic codes

CTaskScheduler

0 The client has not registered. The client must register before adding tasks to the schedule.

See also:


DeleteTask(const TInt)const

Capability: Security policy note: Only clients with the same SID as the relevant schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt DeleteTask(const TInt aTaskId) const;

Description

Deletes the specified task.

Parameters

const TInt aTaskId

The Id that identifies the task.

Return value

TInt

KErrNone if successful, KErrNotFound if there is no task with the specified Id, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability, KErrServerBusy, if a backup or restore operation is taking place or any of the other system wide error codes.


GetScheduleRefsL(CArrayFixFlat< TSchedulerItemRef > &,const TScheduleFilter)

Capability: Security policy note: A call to this API will only retrieve schedules created with the caller's SID. If the caller has WriteDeviceData capability all schedules will be retrieved.

IMPORT_C TInt GetScheduleRefsL(CArrayFixFlat< TSchedulerItemRef > &aScheduleRefArray, const TScheduleFilter aFilter);

Description

Gets a list of all schedules, or a subset of schedules.

Parameters

CArrayFixFlat< TSchedulerItemRef > &aScheduleRefArray

On return, a populated array of schedule definitions. Note that populating the array could cause this function to leave because of an out of memory condition.

const TScheduleFilter aFilter

The schedule filter.

Return value

TInt

KErrNone if successful otherwise one of the other system wide error codes.

See also:


GetScheduleL(const TInt,TScheduleState2 &,CArrayFixFlat< TScheduleEntryInfo2 > &,CArrayFixFlat< TTaskInfo > &,TTsTime &)

Capability: Security policy note: Only clients with the same SID as the schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt GetScheduleL(const TInt aScheduleHandle, TScheduleState2 &aState, CArrayFixFlat< TScheduleEntryInfo2 > &aEntries, CArrayFixFlat< TTaskInfo > &aTasks, TTsTime &aDueTime);

Description

Gets information relating to a specified time based schedule.

Parameters

const TInt aScheduleHandle

The Id that identifies the schedule.

TScheduleState2 &aState

On return, the state of the specified schedule.

CArrayFixFlat< TScheduleEntryInfo2 > &aEntries

On return, a populated array of schedule entries that make up the schedule. Note that populating the array could cause this function to leave because of an out of memory condition.

CArrayFixFlat< TTaskInfo > &aTasks

On return, a populated array of tasks associated with the schedule. Note that populating the array could cause this function to leave because of an out of memory condition.

TTsTime &aDueTime

On return, the time that the schedule is next due. This value may be local time or UTC based,dependent on the type of time used for schedule entries. Comparisons used within the scheduler to find the next due time are UTC based.

Return value

TInt

KErrNone if successful, KErrNotFound if there is no schedule with the specified Id, KErrArgument if the schedule is not a time based one, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability, or any of the other system wide error codes.

See also:


GetTaskRefsL(CArrayFixFlat< TSchedulerItemRef > &,const TScheduleFilter,const TTaskFilter)

Capability: Security policy note: A call to this API will only retrieve tasks created with the caller's SID. If the caller has WriteDeviceData capability all tasks will be retrieved.

IMPORT_C TInt GetTaskRefsL(CArrayFixFlat< TSchedulerItemRef > &aTasks, const TScheduleFilter aScheduleFilter, const TTaskFilter aTaskFilter);

Description

Gets a list of all tasks, or a subset of tasks.

Note that if more than one client has supplied the same information when registering, then it is possible for a list of tasks to be returned, which the calling client has not scheduled.

Parameters

CArrayFixFlat< TSchedulerItemRef > &aTasks

On return, a populated array of schedule definitions. The schedule definitions are those whose associated tasks satisfy the selection criteria. Note that populating the array could cause this function to leave because of an out of memory condition.

const TScheduleFilter aScheduleFilter

The schedule filter.

const TTaskFilter aTaskFilter

The task filter.

Return value

TInt

KErrNone if successful otherwise one of the other system wide error codes.

See also:


GetTaskInfoL(const TInt,TTaskInfo &,TPtr &,TSchedulerItemRef &,TTsTime &)

Capability: Security policy note: Only clients with the same SID as the relevant schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt GetTaskInfoL(const TInt aTaskId, TTaskInfo &aTaskInfo, TPtr &aTaskData, TSchedulerItemRef &aRef, TTsTime &aNextDue);

Description

Gets information relating to a specified task.

Parameters

const TInt aTaskId

The Id that identifies the task.

TTaskInfo &aTaskInfo

On return, information about the task.

TPtr16 &aTaskData

On return, a pointer descriptor representing the data that is passed to the program to be executed. The caller must set up this pointer descriptor before calling the function. The required length of the descriptor can be found by calling RScheduler::GetTaskDataSize(const TInt,TInt &).

TSchedulerItemRef &aRef

On return, the associated schedule definition.

TTsTime &aNextDue

On return, the time that the task is next due. This value may be local time or UTC based. Comparisons used to find the next due time are based on UTC.

Return value

TInt

KErrNone, if successful. KErrNotFound, if there is no task with the specified Id, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability.


GetTaskDataSize(const TInt,TInt &)

Capability: Security policy note: Only clients with the same SID as the relevant schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt GetTaskDataSize(const TInt aTaskId, TInt &aSize);

Description

Gets the size of the data to be passed to the task's program.

This function should be called before calling RScheduler::GetTaskInfoL(const TInt,TTaskInfo &,TPtr &,TSchedulerItemRef &,TTsTime &) so that a descriptor of the correct size can be set up.

Parameters

const TInt aTaskId

The Id that identifies the task.

TInt &aSize

The size of the task's data.

Return value

TInt

KErrNone if successful, KErrNotFound if there is no task with the specified Id, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability, otherwise any of the other system wide error codes.


CreatePersistentSchedule(TSchedulerItemRef &,const CArrayFixFlat< TScheduleEntryInfo > &)

Interface status: deprecated See note in CSch_Cli.h
Capability: WriteDeviceData

IMPORT_C TInt CreatePersistentSchedule(TSchedulerItemRef &aRef, const CArrayFixFlat< TScheduleEntryInfo > &aEntryList);

Description

Creates a persistent time based schedule.

This schedule has no tasks associated with it but merely contains information about start and finish times.

Parameters

TSchedulerItemRef &aRef

Definition of the new schedule. On return this contains a valid handle to the newly created schedule.

const CArrayFixFlat< TScheduleEntryInfo > &aEntryList

The set of schedule entries that make up the new schedule. Start times of all entries are assumed to be local time based.

Return value

TInt

KErrNone, if successful, KErrArgument if the condition array is empty, or an entry has an interval less than 1, KErrServerBusy, if a backup or restore operation is taking place, KErrPermissionDenied if the client does not have WriteDeviceData capability. Otherwise one of the other system wide error codes.

See also:


EditSchedule(const TInt,const CArrayFixFlat< TScheduleEntryInfo > &)

Interface status: deprecated See note in CSch_Cli.h
Capability: Security policy note: Only clients with the same SID as the schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt EditSchedule(const TInt aScheduleHandle, const CArrayFixFlat< TScheduleEntryInfo > &aEntryList);

Description

Changes a time based schedule.

Note that changing a schedule is implemented by supplying a replacement set of schedule entries.

Parameters

const TInt aScheduleHandle

The Id that identifies the schedule.

const CArrayFixFlat< TScheduleEntryInfo > &aEntryList

The set of schedule entries that will make up the new schedule. Start times of all entries are assumed to be local time based.

Return value

TInt

KErrNone if successful, KErrNotFound if there is no schedule with the specified Id, KErrArgument if the schedule is not a time based one, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability, KErrServerBusy, if a backup or restore operation is taking place or any of the other system wide error codes.

See also:


ScheduleTask(TTaskInfo &,HBufC &,TSchedulerItemRef &,const CArrayFixFlat< TScheduleEntryInfo > &)

Interface status: deprecated See note in CSch_Cli.h

IMPORT_C TInt ScheduleTask(TTaskInfo &aTaskInfo, HBufC &aTaskData, TSchedulerItemRef &aRef, const CArrayFixFlat< TScheduleEntryInfo > &aEntryList);

Description

Creates a new, transient, time based schedule and adds a task to it.

Note that a transient schedule is destroyed when the task is destroyed or power is lost.

Parameters

TTaskInfo &aTaskInfo

Information about the task to be added to the transient schedule. On return the task Id is written into this class.

HBufC16 &aTaskData

Data that is passed to the task on execution.

TSchedulerItemRef &aRef

Definition of the new transient schedule.

const CArrayFixFlat< TScheduleEntryInfo > &aEntryList

The set of schedule entries that make up the new transient schedule. All entry start times are assumed to be local time based.

Return value

TInt

KErrNone, if successful, otherwise one of the other system wide error codes.

Panic codes

CTaskScheduler

0 The client has not registered. The client must register before adding tasks to the schedule.

See also:


GetScheduleL(const TInt,TScheduleState &,CArrayFixFlat< TScheduleEntryInfo > &,CArrayFixFlat< TTaskInfo > &,TTime &)

Interface status: deprecated See note in CSch_Cli.h
Capability: Security policy note: Only clients with the same SID as the schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt GetScheduleL(const TInt aScheduleHandle, TScheduleState &aState, CArrayFixFlat< TScheduleEntryInfo > &aEntries, CArrayFixFlat< TTaskInfo > &aTasks, TTime &aDueTime);

Description

Gets information relating to a specified time based schedule.

Parameters

const TInt aScheduleHandle

The Id that identifies the schedule.

TScheduleState &aState

On return, the state of the specified schedule. On return, aState will have a local time based iDueTime member, regardless of whether the schedule is UTC or local time based. If the schedule is UTC based, the due time will be converted to a local time based value before returning.

CArrayFixFlat< TScheduleEntryInfo > &aEntries

On return, a populated array of schedule entries that make up the schedule. All entry start times returned will be local time based, though they may be UTC or local time based within the scheduler. The scheduler will convert any UTC based times to local time before returning. Note that populating the array could cause this function to leave because of an out of memory condition.

CArrayFixFlat< TTaskInfo > &aTasks

On return, a populated array of tasks associated with the schedule. Note that populating the array could cause this function to leave because of an out of memory condition.

TTime &aDueTime

On return, the time that the schedule is next due. This value will be local time based, regardless of whether the schedule is UTC or local time based. If the schedule is UTC based, the due time will be converted to a local time based value before returning.

Return value

TInt

KErrNone if successful, KErrNotFound if there is no schedule with the specified Id, KErrArgument if the schedule is not a time based one, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability, or any of the other system wide error codes.

See also:


GetTaskInfoL(const TInt,TTaskInfo &,TPtr &,TSchedulerItemRef &,TTime &)

Interface status: deprecated See note in CSch_Cli.h
Capability: Security policy note: Only clients with the same SID as the relevant schedule creator, or WriteDeviceData capability can sucessfully call this API.

IMPORT_C TInt GetTaskInfoL(const TInt aTaskId, TTaskInfo &aTaskInfo, TPtr &aTaskData, TSchedulerItemRef &aRef, TTime &aNextDue);

Description

Gets information relating to a specified task.

Parameters

const TInt aTaskId

The Id that identifies the task.

TTaskInfo &aTaskInfo

On return, information about the task.

TPtr16 &aTaskData

On return, a pointer descriptor representing the data that is passed to the program to be executed. The caller must set up this pointer descriptor before calling the function. The required length of the descriptor can be found by calling RScheduler::GetTaskDataSize(const TInt,TInt &).

TSchedulerItemRef &aRef

On return, the associated schedule definition.

TTime &aNextDue

On return, the time that the task is next due. This value will be local time based, regardless of whether the schedule is UTC or local time based. If the schedule is UTC based, the due time will be converted to a local time based value before returning.

Return value

TInt

KErrNone, if successful. KErrNotFound, if there is no task with the specified Id, KErrPermissionDenied if the client does not have the same SID as the schedules creator or has WriteDeviceData capability.


__DbgMarkHeap()

IMPORT_C TInt __DbgMarkHeap();

Description

Return value

TInt


__DbgCheckHeap(TInt)

IMPORT_C TInt __DbgCheckHeap(TInt aCount);

Description

Parameters

TInt aCount

Return value

TInt


__DbgMarkEnd(TInt)

IMPORT_C TInt __DbgMarkEnd(TInt aCount);

Description

Parameters

TInt aCount

Return value

TInt


__DbgFailNext(TInt)

IMPORT_C TInt __DbgFailNext(TInt aCount);

Description

Parameters

TInt aCount

Return value

TInt


__DbgResetHeap()

IMPORT_C TInt __DbgResetHeap();

Description

Return value

TInt


__FaultServer()

IMPORT_C TInt __FaultServer();

Description

Return value

TInt