Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: MsvScheduleSend.h
Link against: schsend.lib

This item is not part of the S60 3rd Edition SDK for Symbian OS, Feature Pack 2.

Class CMsvScheduleSend

class CMsvScheduleSend : public CBase;

Description

Provides a Server MTM's interface to the Task Scheduler for messaging scheduling.

Server MTM's must provide a derived class that implements GetMessageL() to provide a factory for MTM-specific scheduling CMsvScheduledEntry-based objects.

Derivation

Members

Defined in CMsvScheduleSend:
AgentActions(), CMsvScheduleSend(), CheckScheduleL(), ConnectAndRegisterL(), ConstructL(), CreateScheduleL(), CreateScheduleL(), DeleteScheduleL(), FindScheduleL(), FindScheduleL(), GetMessageL(), LoadScheduleSettingsL(), OffPeakTimes(), ReScheduleL(), RoundUpToMinute(), ScheduleEntryL(), ScheduleL(), ScheduleSettings(), SendErrorActions(), SendingCompleteL(), SendingCompleteL(), UpdateEntryAfterSchedule(), iAgentActions, iErrorActions, iOffPeakTimes, iPackage, iRegistered, iSchEntries, iSchEntryInfo, iSchTaskInfo, iScheduler, iServerEntry, iSettings, ~CMsvScheduleSend()

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


~CMsvScheduleSend()

IMPORT_C ~CMsvScheduleSend();

Description

Destructor.


CMsvScheduleSend()

protected: IMPORT_C CMsvScheduleSend(CMsvServerEntry &aServerEntry);

Description

Constructor.

Parameters

CMsvServerEntry &aServerEntry

The CMsvServerEntry of the server MTM of which this CMsvScheduleSend object is a member.


ConstructL()

protected: virtual IMPORT_C void ConstructL();

Description

Second phase constructor.

This constructor creates instances of the following classes: CMsvScheduleSettings, CMsvOffPeakTimes, CMsvSendErrorActions, CMsvSysAgentActions and CMsvScheduledEntries.

[Top]


Member functions


ScheduleL()

IMPORT_C void ScheduleL(const CMsvEntrySelection &aSelection, const TMsvSchedulePackage &aPackage);

Description

Schedules messages on the task scheduler.

Messages that are successfully scheduled have their sending state set to KMsvSendStateScheduled.

Parameters

const CMsvEntrySelection &aSelection

Array of message IDs that need to be scheduled. This array cannot be empty. All the messages identified in the selection must belong to the same MTM; be scheduled for the same time; have the same setting for their OffPeak() flag; have the scheduled time stored in the iDate member of their corresponding TMsvEntry.

const TMsvSchedulePackage &aPackage

Scheduling options

Leave codes

Any

error code but KErrLocked and KErrNotFound The method overloading CMsvScheduledEntry::GetMessageL() left with an error, i.e. the scheduling info of one of the messages from the selection could not be retrieved from the message server.

Any

error code Unable to reset the previous scheduling info for a message.

Panic codes

ScheduleSend-DLL

0 The array of message IDs is empty. Debug build only.

ScheduleSend-DLL

1 At least one of the selected messages is scheduled for a different time as the others. Debug build only.

ScheduleSend-DLL

2 At least one of the selected messages does not belong to the same MTM. Debug build only.

ScheduleSend-DLL

3 At least one of the selected messages does not have the same off-peak settings as the others. Debug build only.


ReScheduleL()

IMPORT_C void ReScheduleL(const CMsvEntrySelection &aSelection, const TMsvSchedulePackage &aPackage, const TMsvSendErrorAction *aErrorAction=0);

Description

Determines when the messages should be re-scheduled on the task scheduler, then schedules the messages at the new time(s).

Messages that are successfully re-scheduled are updated. The pending conditions flag indicates whether the message has been schedule for a set of conditions being met (or a timeout occuring) or scheduled for a specified time/date.

NOTE - conditions scheduling is only supoprted from 8.1 onwards.

In the case of time-scheduling, the date field is the scheduled time/date. In the case of conditions-scheduling, the date field reflects the timeout value.

There are several cases when messages are not re-scheduled. If all recipients have been sent to - in this case the message's sending state set to KMsvSendStateSent. If, more commonly, the message's maximum number of re-tries has been exceeded or the error action was ESendActionFail then the message is not changed.

Parameters

const CMsvEntrySelection &aSelection

Array of message IDs that need to be re-scheduled. This array cannot be empty. All the messages identified must belong to the same MTM. It is not a precondition that each message has already been scheduled on the task scheduler.

const TMsvSchedulePackage &aPackage

Scheduling options.

const TMsvSendErrorAction *aErrorAction

The specific action to take with the messages. If this argument is omitted, then ReScheduleL() uses the iError member of each TMsvEntry to find the related TMsvSendErrorAction in iErrorActions.

Panic codes

ScheduleSend-DLL

0 The array of message IDs is empty. Debug build only.


CheckScheduleL()

IMPORT_C void CheckScheduleL(const CMsvEntrySelection &aSelection);

Description

Verifies that the schedule information stored in specified messages is the same as that on the task scheduler.

Parameters

const CMsvEntrySelection &aSelection

Array of message IDs that need to be checked against the task scheduler.

Panic codes

ScheduleSend-DLL

0 The array of message IDs is empty. Debug build only.


DeleteScheduleL()

IMPORT_C void DeleteScheduleL(const CMsvEntrySelection &aSelection);

Description

Delete the schedules for the specified messages from the task scheduler.

The messages themselves are not deleted.

Parameters

const CMsvEntrySelection &aSelection

Array of message IDs that need to be deleted from the task scheduler.

Leave codes

Any

error code Unable to connect and register with the scheduler.

Any

error code but KErrLocked and KErrNotFound The method overloading CMsvScheduledEntry::GetMessageL() left with an error, i.e. the scheduling info of one of the messages from the selection could not be retrieved from the message server.

Any

error code Unable to reset the previous scheduling info for a message.


SendingCompleteL()

IMPORT_C void SendingCompleteL(TMsvEntry &aEntry, const TBool aChangeEntry=EFalse);

Description

Tells the scheduler that sending is complete.

This function must be called when a message that had previously been scheduled is either sent or has failed. This function:

1. Deletes the TMsvEntryScheduleData associated with the message

2. Sets the Scheduled flag to EFalse

3. If required, calls ChangeEntry() on the message server entry

Note: SendingCompleteL() does not change the sending state of each message, nor delete each message from the task scheduler.

Parameters

TMsvEntry &aEntry

The message which was either successfully sent or which failed (all the attempts) to send. It is not a precondition that the message has already been scheduled on the task scheduler.

const TBool aChangeEntry

If aChangeEntry is ETrue then SendingCompleteL() will call CMsvServerEntry::ChangeEntry() to update the message on the message server.

Panic codes

ScheduleSend-DLL

24 The server entry is not set to the correct entry. Debug build only.


SendingCompleteL()

IMPORT_C void SendingCompleteL(const CMsvEntrySelection &aSelection);

Description

Tells the scheduler that sending is complete.

This method sets the messages's scheduled flag to false, resets the schedule data associated with each message and the number of retries for each recipient and stores the data and recipients in a stream associated with the TMsvEntry.

Parameters

const CMsvEntrySelection &aSelection

Messages that were either successfully sent or which failed all the attempts to send.


OffPeakTimes()

inline CMsvOffPeakTimes &OffPeakTimes() const;

Description

Gets off-peak times settings.

Return value

CMsvOffPeakTimes &

Off-peak times settings


ScheduleSettings()

inline CMsvScheduleSettings &ScheduleSettings() const;

Description

Gets scheduler settings.

Return value

CMsvScheduleSettings &

Scheduler settings


SendErrorActions()

inline CMsvSendErrorActions &SendErrorActions() const;

Description

Gets action-on-sending-error settings.

Return value

CMsvSendErrorActions &

Action-on-sending-error settings


AgentActions()

inline CMsvSysAgentActions &AgentActions() const;

Description

Gets System Agent conditions that must be satisfied before a sending attempt.

Return value

CMsvSysAgentActions &

System Agent conditions


CreateScheduleL()

static IMPORT_C void CreateScheduleL(RScheduler &aScheduler, const CMsvScheduleSettings &aSettings, const TTime &aStartTime, const TTimeIntervalMinutes &aValidityPeriod, TSchedulerItemRef &aRef);

Description

Creates a new schedule on the task scheduler with which each message can be associated.

The schedule is triggered by a start time being reached.

Parameters

RScheduler &aScheduler

Handle to scheduler to update.

const CMsvScheduleSettings &aSettings

Scheduler settings.

const TTime &aStartTime

Schedule start time.

const TTimeIntervalMinutes &aValidityPeriod

Schedule validity period.

TSchedulerItemRef &aRef

On return, the new schedule.


CreateScheduleL()

static IMPORT_C void CreateScheduleL(RScheduler &aScheduler, const CArrayFixFlat< TTaskSchedulerCondition > &aConditions, const TTime &aTimeout, TSchedulerItemRef &aRef);

Description

Creates a new schedule on the task scheduler with which each message can be associated.

The schedule is triggered by either a set of conditions being met or a timeout being reached.

Parameters

RScheduler &aScheduler

Handle to scheduler to update.

const CArrayFixFlat< TTaskSchedulerCondition > &aConditions

The set of System Agent conditions that are required to be met to trigger the schedule.

const TTime &aTimeout

The timeout value for the schedule.

TSchedulerItemRef &aRef

On return, the new schedule.


FindScheduleL()

static IMPORT_C void FindScheduleL(RScheduler &aScheduler, const TTime &aStartTime, TSchedulerItemRef &aRef);

Description

Searches the scheduler for an existing schedule item with a schedule time that matches with time supplied.

Parameters

RScheduler &aScheduler

Handle to the scheduler.

const TTime &aStartTime

Schedule start time.

TSchedulerItemRef &aRef

On return, the schedule item.

Leave codes

KErrNotFound

No schedule found matching the schedule time.

See also:


FindScheduleL()

static IMPORT_C void FindScheduleL(RScheduler &aScheduler, const CArrayFixFlat< TTaskSchedulerCondition > &aConditions, const TTime &aTimeout, TSchedulerItemRef &aRef);

Description

Searches the scheduler for an existing conditions schedule item with a set of pending conditions and timeout value that matches with those supplied.

Parameters

RScheduler &aScheduler

Handle to the scheduler.

const CArrayFixFlat< TTaskSchedulerCondition > &aConditions

The set of System Agent conditions that are required to be met to trigger the schedule.

const TTime &aTimeout

The timeout value for the schedule.

TSchedulerItemRef &aRef

On return, the schedule item.

Leave codes

KErrNotFound

No schedule found matching the schedule conditions and timeout.


RoundUpToMinute()

static IMPORT_C void RoundUpToMinute(TTime &aTime);

Description

Utility function that rounds a specified time up to the nearest minute.

Parameters

TTime &aTime

On return, the passed value rounded up to the nearest minute.


ScheduleEntryL()

static IMPORT_C void ScheduleEntryL(RScheduler &aScheduler, const TSchedulerItemRef &aRef, const TMsvSchedulePackage &aPackage, TTaskInfo &aInfo);

Description

Adds an entry to an existing schedule.

Parameters

RScheduler &aScheduler

Scheduler to access.

const TSchedulerItemRef &aRef

Id of the schedule.

const TMsvSchedulePackage &aPackage

Scheduler settings.

TTaskInfo &aInfo

Information about the entry to be added to the schedule.

Leave codes

KErrNotFound

No existing schedule with the specified Id.

See also:


UpdateEntryAfterSchedule()

static IMPORT_C void UpdateEntryAfterSchedule(const TSchedulerItemRef &aRef, const TTaskInfo &aInfo, const TTime &aTime, TInt aFinalState, TMsvEntry &aEntry, TMsvEntryScheduleData &aData);

Description

Utility function that updates message index entry fields to reflect the message's scheduling.

Parameters

const TSchedulerItemRef &aRef

Scheduler item.

const TTaskInfo &aInfo

Scheduler task information.

const TTime &aTime

Schedule start time.

TInt aFinalState

Sending state flag.

TMsvEntry &aEntry

On return, updated index entry.

TMsvEntryScheduleData &aData

On return, populated messaging scheduling data.


ConnectAndRegisterL()

static IMPORT_C void ConnectAndRegisterL(RScheduler &aScheduler, const CMsvScheduleSettings &aSettings);

Description

Connects to and registers with the task scheduler.

Parameters

RScheduler &aScheduler

Handle to the scheduler to connect to.

const CMsvScheduleSettings &aSettings

Schedule settings.

Leave codes

Any

error code RScheduler::Connect() returned an error.

Any

error code RFs::Connect() returned an error.

KErrPathNotFound

The .EXE file to be called by the Task Scheduler when messages are due to be sent cannot be found. The filename is part of the schedule settings.

Any

error code RScheduler::Register() returned an error.


LoadScheduleSettingsL()

IMPORT_C void LoadScheduleSettingsL(CRepository &aRepository);

Description

Loads schedule settings from CenRep

Parameters

CRepository &aRepository

CenRep repository to load settings from


GetMessageL()

protected: virtual CMsvScheduledEntry *GetMessageL(const TMsvId aId) const=0;

Description

Gets the schedule data and recipients of a message.

Recipient information is MTM-specific, so the server MTM must provide a derived class that implements CMsvScheduledEntry, and return objects of that type from this function.

Parameters

const TMsvId aId

The message ID.

Return value

CMsvScheduledEntry *

The message's schedule data.

[Top]


Member data


iSettings

protected: CMsvScheduleSettings * iSettings;

Description

The Server MTM specific scheduled message sending settings.


iOffPeakTimes

protected: CMsvOffPeakTimes * iOffPeakTimes;

Description

The Server MTM specific off peak time periods.


iErrorActions

protected: CMsvSendErrorActions * iErrorActions;

Description

The Server MTM specific actions to take when particular errors occur during message sending.


iAgentActions

protected: CMsvSysAgentActions * iAgentActions;

Description

The System Agent conditions that must be satisfied before a sending attempt.


iRegistered

protected: TBool iRegistered;

Description

Indicates if this has been registered with the Task Scheduler.

Initially set to EFalse.


iScheduler

protected: RScheduler iScheduler;

Description

Provides an interface to the Task Scheduler.


iServerEntry

protected: CMsvServerEntry & iServerEntry;

Description

The CMsvServerEntry of the server MTM.


iPackage

protected: TMsvSchedulePackage iPackage;

Description

Scheduling options.


iSchEntries

protected: CMsvScheduledEntries * iSchEntries;

Description

Array of message schedule data.


iSchEntryInfo

protected: CArrayFixFlat< TScheduleEntryInfo2 > * iSchEntryInfo;

Description

Array of schedule entry data.


iSchTaskInfo

protected: CArrayFixFlat< TTaskInfo > * iSchTaskInfo;

Description

Array of schedule task data.