CMsvScheduleSend Class Reference

#include <mw/msvschedulesend.h>

Link against: schsend.lib

class CMsvScheduleSend : public CBase

Inherits from

Protected Attributes
CMsvSysAgentActions *iAgentActions
CMsvSendErrorActions *iErrorActions
CMsvOffPeakTimes *iOffPeakTimes
TMsvSchedulePackage iPackage
TBool iRegistered
CMsvScheduledEntries *iSchEntries
CArrayFixFlat< TScheduleEntryInfo2 > *iSchEntryInfo
CArrayFixFlat< TTaskInfo > *iSchTaskInfo
RScheduler iScheduler
CMsvServerEntry &iServerEntry
CMsvScheduleSettings *iSettings
Public Member Functions
~CMsvScheduleSend()
CMsvSysAgentActions &AgentActions()
IMPORT_C voidCheckScheduleL(const CMsvEntrySelection &)
IMPORT_C voidConnectAndRegisterL(RScheduler &, const CMsvScheduleSettings &)
IMPORT_C voidCreateScheduleL(RScheduler &, const CMsvScheduleSettings &, const TTime &, const TTimeIntervalMinutes &, TSchedulerItemRef &)
IMPORT_C voidCreateScheduleL(RScheduler &, const CArrayFixFlat< TTaskSchedulerCondition > &, const TTime &, TSchedulerItemRef &)
IMPORT_C voidDeleteScheduleL(const CMsvEntrySelection &)
IMPORT_C voidFindScheduleL(RScheduler &, const TTime &, TSchedulerItemRef &)
IMPORT_C voidFindScheduleL(RScheduler &, const CArrayFixFlat< TTaskSchedulerCondition > &, const TTime &, TSchedulerItemRef &)
IMPORT_C voidLoadScheduleSettingsL(CRepository &)
CMsvOffPeakTimes &OffPeakTimes()
IMPORT_C voidReScheduleL(const CMsvEntrySelection &, const TMsvSchedulePackage &, const TMsvSendErrorAction *)
IMPORT_C voidRoundUpToMinute(TTime &)
IMPORT_C voidScheduleEntryL(RScheduler &, const TSchedulerItemRef &, const TMsvSchedulePackage &, TTaskInfo &)
IMPORT_C voidScheduleL(const CMsvEntrySelection &, const TMsvSchedulePackage &)
CMsvScheduleSettings &ScheduleSettings()
CMsvSendErrorActions &SendErrorActions()
IMPORT_C voidSendingCompleteL(TMsvEntry &, const TBool)
IMPORT_C voidSendingCompleteL(const CMsvEntrySelection &)
IMPORT_C voidUpdateEntryAfterSchedule(const TSchedulerItemRef &, const TTaskInfo &, const TTime &, TInt, TMsvEntry &, TMsvEntryScheduleData &)
Protected Member Functions
CMsvScheduleSend(CMsvServerEntry &)
virtual IMPORT_C voidConstructL()
pure virtual CMsvScheduledEntry *GetMessageL(const TMsvId)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()

Detailed 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.

Member Attribute Documentation

iAgentActions

CMsvSysAgentActions *iAgentActions[protected]

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

iErrorActions

CMsvSendErrorActions *iErrorActions[protected]

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

iOffPeakTimes

CMsvOffPeakTimes *iOffPeakTimes[protected]

The Server MTM specific off peak time periods.

iPackage

TMsvSchedulePackage iPackage[protected]

Scheduling options.

iRegistered

TBool iRegistered[protected]

Indicates if this has been registered with the Task Scheduler.

Initially set to EFalse.

iSchEntries

CMsvScheduledEntries *iSchEntries[protected]

Array of message schedule data.

iSchEntryInfo

CArrayFixFlat< TScheduleEntryInfo2 > *iSchEntryInfo[protected]

Array of schedule entry data.

iSchTaskInfo

CArrayFixFlat< TTaskInfo > *iSchTaskInfo[protected]

Array of schedule task data.

iScheduler

RScheduler iScheduler[protected]

Provides an interface to the Task Scheduler.

iServerEntry

CMsvServerEntry &iServerEntry[protected]

The CMsvServerEntry of the server MTM.

iSettings

CMsvScheduleSettings *iSettings[protected]

The Server MTM specific scheduled message sending settings.

Constructor & Destructor Documentation

CMsvScheduleSend ( CMsvServerEntry & )

IMPORT_CCMsvScheduleSend(CMsvServerEntry &aServerEntry)[protected]

Constructor.

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

~CMsvScheduleSend ( )

IMPORT_C~CMsvScheduleSend()

Destructor.

Member Function Documentation

AgentActions ( )

CMsvSysAgentActions &AgentActions()const [inline]

CheckScheduleL ( const CMsvEntrySelection & )

IMPORT_C voidCheckScheduleL(const CMsvEntrySelection &aSelection)

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

Parameters
aSelectionArray of message IDs that need to be checked against the task scheduler.
Panic Codes
ScheduleSend-DLL0 The array of message IDs is empty. Debug build only.

ConnectAndRegisterL ( RScheduler &, const CMsvScheduleSettings & )

IMPORT_C voidConnectAndRegisterL(RScheduler &aScheduler,
const CMsvScheduleSettings &aSettings
)[static]

Connects to and registers with the task scheduler.

Parameters
aSchedulerHandle to the scheduler to connect to.
aSettingsSchedule settings.
Leave Codes
Anyerror code
Anyerror code
KErrPathNotFoundThe .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.
Anyerror code

ConstructL ( )

IMPORT_C voidConstructL()[protected, virtual]

Second phase constructor.

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

CreateScheduleL ( RScheduler &, const CMsvScheduleSettings &, const TTime &, const TTimeIntervalMinutes &, TSchedulerItemRef & )

IMPORT_C voidCreateScheduleL(RScheduler &aScheduler,
const CMsvScheduleSettings &aSettings,
const TTime &aStartTime,
const TTimeIntervalMinutes &aValidityPeriod,
TSchedulerItemRef &aRef
)[static]

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.

See also: RScheduler::CreatePersistentSchedule

Parameters
aSchedulerHandle to scheduler to update.
aSettingsScheduler settings.
aStartTimeSchedule start time.
aValidityPeriodSchedule validity period.
aRefOn return, the new schedule.

CreateScheduleL ( RScheduler &, const CArrayFixFlat< TTaskSchedulerCondition > &, const TTime &, TSchedulerItemRef & )

IMPORT_C voidCreateScheduleL(RScheduler &aScheduler,
const CArrayFixFlat< TTaskSchedulerCondition > &aConditions,
const TTime &aTimeout,
TSchedulerItemRef &aRef
)[static]

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.

See also: RScheduler::CreatePersistentSchedule TSysAgentCondition

Parameters
aSchedulerHandle to scheduler to update.
aConditionsThe set of System Agent conditions that are required to be met to trigger the schedule.
aTimeoutThe timeout value for the schedule.
aRefOn return, the new schedule.

DeleteScheduleL ( const CMsvEntrySelection & )

IMPORT_C voidDeleteScheduleL(const CMsvEntrySelection &aSelection)

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

The messages themselves are not deleted.

Parameters
aSelectionArray of message IDs that need to be deleted from the task scheduler.
Leave Codes
Anyerror code Unable to connect and register with the scheduler.
Anyerror 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.
Anyerror code Unable to reset the previous scheduling info for a message.

FindScheduleL ( RScheduler &, const TTime &, TSchedulerItemRef & )

IMPORT_C voidFindScheduleL(RScheduler &aScheduler,
const TTime &aStartTime,
TSchedulerItemRef &aRef
)[static]

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

See also: RScheduler::GetScheduleL()

Parameters
aSchedulerHandle to the scheduler.
aStartTimeSchedule start time.
aRefOn return, the schedule item.
Leave Codes
KErrNotFoundNo schedule found matching the schedule time.

FindScheduleL ( RScheduler &, const CArrayFixFlat< TTaskSchedulerCondition > &, const TTime &, TSchedulerItemRef & )

IMPORT_C voidFindScheduleL(RScheduler &aScheduler,
const CArrayFixFlat< TTaskSchedulerCondition > &aConditions,
const TTime &aTimeout,
TSchedulerItemRef &aRef
)[static]

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

See also: RScheduler::GetScheduleL

Parameters
aSchedulerHandle to the scheduler.
aConditionsThe set of System Agent conditions that are required to be met to trigger the schedule.
aTimeoutThe timeout value for the schedule.
aRefOn return, the schedule item.
Leave Codes
KErrNotFoundNo schedule found matching the schedule conditions and timeout.

GetMessageL ( const TMsvId )

CMsvScheduledEntry *GetMessageL(const TMsvIdaId)const [protected, pure virtual]

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
aIdThe message ID.
Return Value
The message's schedule data.

LoadScheduleSettingsL ( CRepository & )

IMPORT_C voidLoadScheduleSettingsL(CRepository &aRepository)

Loads schedule settings from CenRep

Parameters
aRepositoryCenRep repository to load settings from

OffPeakTimes ( )

CMsvOffPeakTimes &OffPeakTimes()const [inline]

ReScheduleL ( const CMsvEntrySelection &, const TMsvSchedulePackage &, const TMsvSendErrorAction * )

IMPORT_C voidReScheduleL(const CMsvEntrySelection &aSelection,
const TMsvSchedulePackage &aPackage,
const TMsvSendErrorAction *aErrorAction = NULL
)

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
aSelectionArray 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.
aPackageScheduling options.
aErrorActionThe 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-DLL0 The array of message IDs is empty. Debug build only.

RoundUpToMinute ( TTime & )

IMPORT_C voidRoundUpToMinute(TTime &aTime)[static]

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

Parameters
aTimeOn return, the passed value rounded up to the nearest minute.

ScheduleEntryL ( RScheduler &, const TSchedulerItemRef &, const TMsvSchedulePackage &, TTaskInfo & )

IMPORT_C voidScheduleEntryL(RScheduler &aScheduler,
const TSchedulerItemRef &aRef,
const TMsvSchedulePackage &aPackage,
TTaskInfo &aInfo
)[static]

Adds an entry to an existing schedule.

See also: RScheduler::ScheduleTask()

Parameters
aSchedulerScheduler to access.
aRefId of the schedule.
aPackageScheduler settings.
aInfoInformation about the entry to be added to the schedule.
Leave Codes
KErrNotFoundNo existing schedule with the specified Id.

ScheduleL ( const CMsvEntrySelection &, const TMsvSchedulePackage & )

IMPORT_C voidScheduleL(const CMsvEntrySelection &aSelection,
const TMsvSchedulePackage &aPackage
)

Schedules messages on the task scheduler.

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

Parameters
aSelectionArray 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.
aPackageScheduling options
Leave Codes
Anyerror 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.
Anyerror code Unable to reset the previous scheduling info for a message.
Panic Codes
ScheduleSend-DLL0 The array of message IDs is empty. Debug build only.
ScheduleSend-DLL1 At least one of the selected messages is scheduled for a different time as the others. Debug build only.
ScheduleSend-DLL2 At least one of the selected messages does not belong to the same MTM. Debug build only.
ScheduleSend-DLL3 At least one of the selected messages does not have the same off-peak settings as the others. Debug build only.

ScheduleSettings ( )

CMsvScheduleSettings &ScheduleSettings()const [inline]

SendErrorActions ( )

CMsvSendErrorActions &SendErrorActions()const [inline]

SendingCompleteL ( TMsvEntry &, const TBool )

IMPORT_C voidSendingCompleteL(TMsvEntry &aEntry,
const TBoolaChangeEntry = EFalse
)

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
aEntryThe 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.
aChangeEntryIf aChangeEntry is ETrue then SendingCompleteL() will call CMsvServerEntry::ChangeEntry() to update the message on the message server.
Panic Codes
ScheduleSend-DLL24 The server entry is not set to the correct entry. Debug build only.

SendingCompleteL ( const CMsvEntrySelection & )

IMPORT_C voidSendingCompleteL(const CMsvEntrySelection &aSelection)

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
aSelectionMessages that were either successfully sent or which failed all the attempts to send.

UpdateEntryAfterSchedule ( const TSchedulerItemRef &, const TTaskInfo &, const TTime &, TInt, TMsvEntry &, TMsvEntryScheduleData & )

IMPORT_C voidUpdateEntryAfterSchedule(const TSchedulerItemRef &aRef,
const TTaskInfo &aInfo,
const TTime &aTime,
TIntaFinalState,
TMsvEntry &aEntry,
TMsvEntryScheduleData &aData
)[static]

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

Parameters
aRefScheduler item.
aInfoScheduler task information.
aTimeSchedule start time.
aFinalStateSending state flag.
aEntryOn return, updated index entry.
aDataOn return, populated messaging scheduling data.