class CMsvScheduleSend : public CBase |
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.
Protected Member Functions | |
---|---|
CMsvScheduleSend(CMsvServerEntry &) | |
IMPORT_C void | ConstructL() |
CMsvScheduledEntry * | GetMessageL(const TMsvId) |
Private Member Enumerations | |
---|---|
enum | anonymous { EDefaultTaskPriority = 1, EDefaultTaskRepeat = 0 } |
IMPORT_C | CMsvScheduleSend | ( | CMsvServerEntry & | aServerEntry | ) | [protected] |
Constructor.
CMsvServerEntry & aServerEntry | The CMsvServerEntry of the server MTM of which this CMsvScheduleSend object is a member. |
CMsvSysAgentActions & | AgentActions | ( | ) | const [inline] |
Gets System Agent conditions that must be satisfied before a sending attempt.
IMPORT_C void | CheckScheduleL | ( | const CMsvEntrySelection & | aSelection | ) |
Verifies that the schedule information stored in specified messages is the same as that on the task scheduler.
const CMsvEntrySelection & aSelection | Array of message IDs that need to be checked against the task scheduler. |
IMPORT_C void | ConnectAndRegisterL | ( | RScheduler & | aScheduler, |
const CMsvScheduleSettings & | aSettings | |||
) | [static] |
Connects to and registers with the task scheduler.
RScheduler & aScheduler | Handle to the scheduler to connect to. |
const CMsvScheduleSettings & aSettings | Schedule settings. |
IMPORT_C void | ConstructL | ( | ) | [protected, virtual] |
Second phase constructor.
This constructor creates instances of the following classes: CMsvScheduleSettings, CMsvOffPeakTimes, CMsvSendErrorActions, CMsvSysAgentActions and CMsvScheduledEntries.
IMPORT_C void | CreateScheduleL | ( | 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.
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. |
IMPORT_C void | CreateScheduleL | ( | 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.
RScheduler::CreatePersistentSchedule TSysAgentCondition
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. |
void | CreateScheduleL | ( | const TTime & | aStartTime, |
const TTimeIntervalMinutes & | aValidityPeriod, | |||
const CArrayFixFlat< TTaskSchedulerCondition > & | aSchConditions, | |||
TBool | aPendingConditions, | |||
TSchedulerItemRef & | aRef | |||
) | [private] |
const TTime & aStartTime | |
const TTimeIntervalMinutes & aValidityPeriod | |
const CArrayFixFlat< TTaskSchedulerCondition > & aSchConditions | |
TBool aPendingConditions | |
TSchedulerItemRef & aRef |
void | DeleteScheduleForEntryL | ( | CMsvScheduledEntry & | aMessage | ) | [private] |
CMsvScheduledEntry & aMessage |
IMPORT_C void | DeleteScheduleL | ( | const CMsvEntrySelection & | aSelection | ) |
Delete the schedules for the specified messages from the task scheduler.
The messages themselves are not deleted.
const CMsvEntrySelection & aSelection | Array of message IDs that need to be deleted from the task scheduler. |
void | DoReScheduleL | ( | CMsvScheduledEntries & | aSchEntries | ) | [private] |
CMsvScheduledEntries & aSchEntries |
void | DoScheduleL | ( | CMsvScheduledEntries & | aSchEntries, |
const TInt | aFinalState, | |||
const TTime & | aTime, | |||
TBool | aPendingConditions | |||
) | [private] |
Does the actual scheduling of the supplied messages.
This function is called by ScheduleL() and DoReScheduleL(). The supplied messages are assumed to have the values for the following data - MTM UID, off-peak flag, schedule date and pending conditions flag. In debug mode, if these info is matching in all the messages then a panic will occur.
CMsvScheduledEntries & aSchEntries | An array with the messages to be scheduled. |
const TInt aFinalState | The sending state to set to the messages to if the message is successfully scheduled. |
const TTime & aTime | For conditions-scheduled messages this is the timeout, for time-scheduled messages this is the scheduled time. |
TBool aPendingConditions | A flag indicating whether the schedule should be pending conditions. |
void | FLog | ( | TRefByValue< const TDesC > | aFormat, |
... | ||||
) | [private] |
TRefByValue< const TDesC > aFormat | |
... |
void | FLog | ( | TRefByValue< const TDesC8 > | aFormat, |
... | ||||
) | [private] |
TRefByValue< const TDesC8 > aFormat | |
... |
IMPORT_C void | FindScheduleL | ( | 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.
RScheduler & aScheduler | Handle to the scheduler. |
const TTime & aStartTime | Schedule start time. |
TSchedulerItemRef & aRef | On return, the schedule item. |
IMPORT_C void | FindScheduleL | ( | 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.
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. |
void | FindScheduleL | ( | const TTime & | aTime, |
const CArrayFixFlat< TTaskSchedulerCondition > & | aSchConditions, | |||
TBool | aPendingConditions, | |||
TSchedulerItemRef & | aRef | |||
) | [private] |
const TTime & aTime | |
const CArrayFixFlat< TTaskSchedulerCondition > & aSchConditions | |
TBool aPendingConditions | |
TSchedulerItemRef & aRef |
CMsvScheduledEntry * | GetMessageL | ( | const TMsvId | aId | ) | 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.
const TMsvId aId | The message ID. |
void | GetMessagesL | ( | const CMsvEntrySelection & | aSelection | ) | [private] |
const CMsvEntrySelection & aSelection |
TBool | GetNextRetry | ( | CMsvScheduledEntry & | aMessage, |
const TMsvSendErrorAction & | aErrorAction, | |||
TTimeIntervalSeconds & | aInterval | |||
) | const [private] |
Determines whether the message should be sent and if so the time interval (in seconds) that must elapse before aMessage should be sent.
The time interval is determined by the error action supplied. In the case of an error action of ESendActionRetryConditionMet, the time interval indicates how long the message can be pending conditions to be met before the message is failed.
The actual time period is defined in the iSettings object. This will be either iPendingConditionsTimeout, iShortInterval, iLongInterval or an element of iVariableIntervals.
If the message should be sent then a value of ETrue is returned. A value of EFalse is returned if the message should not be sent. In this case the output argument aInterval is not valid.
CMsvScheduledEntry & aMessage | The message to be re-scheduled. |
const TMsvSendErrorAction & aErrorAction | The error action that determines the re-schedule behaviour. |
TTimeIntervalSeconds & aInterval | An output argument that holds the time interval to when the message should be re-sent or when the message should be failed. |
void | GetOffPeakL | ( | TTime | aFromTime, |
TTime & | aStartTime, | |||
TTimeIntervalMinutes & | aValidityPeriod | |||
) | const [private] |
TTime aFromTime | |
TTime & aStartTime | |
TTimeIntervalMinutes & aValidityPeriod |
IMPORT_C void | LoadScheduleSettingsL | ( | CRepository & | aRepository | ) |
Loads schedule settings from CenRep
CRepository & aRepository | CenRep repository to load settings from |
void | PopulateScheduleConditionsL | ( | CArrayFixFlat< TTaskSchedulerCondition > & | aSchConditions | ) | [private] |
CArrayFixFlat< TTaskSchedulerCondition > & aSchConditions |
IMPORT_C void | ReScheduleL | ( | 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.
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 = NULL | 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. |
void | ResetScheduleInfoForEntryL | ( | CMsvScheduledEntry & | aMessage, |
const TBool | aChangeEntry | |||
) | [private] |
CMsvScheduledEntry & aMessage | |
const TBool aChangeEntry |
IMPORT_C void | RoundUpToMinute | ( | TTime & | aTime | ) | [static] |
Utility function that rounds a specified time up to the nearest minute.
TTime & aTime | On return, the passed value rounded up to the nearest minute. |
IMPORT_C void | ScheduleEntryL | ( | RScheduler & | aScheduler, |
const TSchedulerItemRef & | aRef, | |||
const TMsvSchedulePackage & | aPackage, | |||
TTaskInfo & | aInfo | |||
) | [static] |
Adds an entry to an existing schedule.
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. |
void | ScheduleEntryL | ( | CMsvScheduledEntry & | aMessage, |
const TInt | aFinalState, | |||
const TTime & | aStartTime, | |||
const TSchedulerItemRef & | aRef, | |||
TBool | aPendingConditions | |||
) | [private] |
Schedules aMessage on the schedule referred to by aRef.
Updates the message entry and the schedule data using the utility function UpdateEntryAfterSchedule().
CMsvScheduledEntry & aMessage | The message to be scheduled. |
const TInt aFinalState | The sending state to set to the messages to if the message is successfully scheduled. |
const TTime & aStartTime | |
const TSchedulerItemRef & aRef | The ID of the schedule to add this task to. |
TBool aPendingConditions | A flag indicating whether this message is schedule for conditions. |
IMPORT_C void | ScheduleL | ( | const CMsvEntrySelection & | aSelection, |
const TMsvSchedulePackage & | aPackage | |||
) |
Schedules messages on the task scheduler.
Messages that are successfully scheduled have their sending state set to KMsvSendStateScheduled.
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 |
CMsvSendErrorActions & | SendErrorActions | ( | ) | const [inline] |
Gets action-on-sending-error settings.
IMPORT_C void | SendingCompleteL | ( | TMsvEntry & | aEntry, |
const TBool | aChangeEntry = 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.
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 = EFalse | If aChangeEntry is ETrue then SendingCompleteL() will call CMsvServerEntry::ChangeEntry() to update the message on the message server. |
IMPORT_C void | SendingCompleteL | ( | 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.
const CMsvEntrySelection & aSelection | Messages that were either successfully sent or which failed all the attempts to send. |
void | SendingCompleteL | ( | CMsvScheduledEntry & | aScheduledEntry, |
const TBool | aChangeEntry | |||
) | [private] |
CMsvScheduledEntry & aScheduledEntry | |
const TBool aChangeEntry |
TBool | SetMessageStartTime | ( | CMsvScheduledEntry & | aMessage, |
const TTime & | aFromTime, | |||
const TMsvSendErrorAction * | aErrorAction = NULL | |||
) | [private] |
Determines the schedule time for a message.
The schedule time is determined by the error action. If no error action is supplied, then the error action is obtained from the iErrorActions. This is a list of error codes associated with an error action. The error code with which the message failed to be sent is used to determine the error action from this list.
This function also increments the number of re-tries that the message has undergone.
A value of ETrue is returned if the message can be sent or a value of EFalse if the message cannot be sent.
If the message can be sent, then its schedule date and pending conditions flag are updated.
CMsvScheduledEntry & aMessage | The message to be re-scheduled. |
const TTime & aFromTime | The current time. Used to calculate the absolute schedule time once the interval has been established. |
const TMsvSendErrorAction * aErrorAction = NULL | The error action applied to the message. This can be NULL in which case the error action is obtained from iErrorActions. |
void | SortByDateAndPendingConditionsL | ( | CMsvScheduledEntries & | aScheduledEntries | ) | [private] |
Sorts the supplied array of messages.
The messages are sorted by their schedule date (held in the iEntry.iDate member of CMsvScheduledEntry). Messages with the same schedule time are then further sorted by if they to be scheduled for pending conditions.
CMsvScheduledEntries & aScheduledEntries | The input/output parameter that holds the messages to be sorted. This will contain the sorted list once the function completes. |
TBool | TaskAndMessageMatchL | ( | const CMsvScheduledEntry & | aMessage | ) | [private] |
const CMsvScheduledEntry & aMessage |
IMPORT_C void | UpdateEntryAfterSchedule | ( | const TSchedulerItemRef & | aRef, |
const TTaskInfo & | aInfo, | |||
const TTime & | aTime, | |||
TInt | aFinalState, | |||
TMsvEntry & | aEntry, | |||
TMsvEntryScheduleData & | aData | |||
) | [static] |
Utility function that updates message index entry fields to reflect the message's scheduling.
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. |
CMsvSysAgentActions * | iAgentActions | [protected] |
The System Agent conditions that must be satisfied before a sending attempt.
CMsvSendErrorActions * | iErrorActions | [protected] |
The Server MTM specific actions to take when particular errors occur during message sending.
CMsvOffPeakTimes * | iOffPeakTimes | [protected] |
The Server MTM specific off peak time periods.
TBool | iRegistered | [protected] |
Indicates if this has been registered with the Task Scheduler.
Initially set to EFalse.
CMsvScheduledEntries * | iSchEntries | [protected] |
Array of message schedule data.
CArrayFixFlat< TScheduleEntryInfo2 > * | iSchEntryInfo | [protected] |
Array of schedule entry data.
CArrayFixFlat< TTaskInfo > * | iSchTaskInfo | [protected] |
Array of schedule task data.
CMsvServerEntry & | iServerEntry | [protected] |
The CMsvServerEntry of the server MTM.
CMsvScheduleSettings * | iSettings | [protected] |
The Server MTM specific scheduled message sending settings.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.