Buteo Synchronization Framework
|
Class for handling sync schedule settings. More...
#include <SyncSchedule.h>
Public Types | |
enum | Day { NoDays = 0x00 , Monday = 0x01 , Tuesday = 0x02 , Wednesday = 0x04 , Thursday = 0x08 , Friday = 0x10 , Saturday = 0x20 , Sunday = 0x40 } |
Public Member Functions | |
SyncSchedule () | |
Constructs an empty schedule. | |
SyncSchedule (const SyncSchedule &aSource) | |
Copy constructor. | |
SyncSchedule (const QDomElement &aRoot) | |
Constructs sync schedule from XML. | |
~SyncSchedule () | |
Destructor. | |
SyncSchedule & | operator= (const SyncSchedule &aRhs) |
Assignment operator. | |
bool | operator== (const SyncSchedule &aRhs) const |
Equal to operator. | |
QDomElement | toXml (QDomDocument &aDoc) const |
Exports the sync schedule to XML. | |
QString | toString () const |
Exports the sync schedule to QString. | |
Days | days () const |
Gets the enabled week days of the sync schedule. | |
void | setDays (Days aDays) |
Sets the enabled week days. | |
QTime | time () const |
Gets the exact time set in sync schedule. | |
void | setTime (const QTime &aTime) |
Sets the exact time for sync. | |
void | setScheduleConfiguredTime (const QDateTime &aDateTime) |
Sets scheduled config time. | |
QDateTime | scheduleConfiguredTime () |
To get the scheduled config time. | |
unsigned | interval () const |
Gets sync interval in minutes. | |
void | setInterval (unsigned aInterval) |
Sets sync interval in minutes. | |
bool | scheduleEnabled () const |
Checks if normal schedule is obeyed. | |
void | setScheduleEnabled (bool aEnabled) |
Sets if normal schedule is to be obeyed. | |
bool | rushEnabled () const |
Checks if rush hour schedule is to be obeyed. | |
void | setRushEnabled (bool aEnabled) |
Sets rush hour schedule is to be obeyed. | |
bool | syncExternallyDuringRush () const |
Checks if rush schedule is controlled by a external process. | |
void | setSyncExternallyDuringRush (bool aEnabled) |
Sets if rush schedule is controlled by a external process. | |
Days | rushDays () const |
Gets days enabled for rush hours. | |
void | setRushDays (Days aDays) |
Sets days enabled for rush hours. | |
QTime | rushBegin () const |
Gets begin time of rush hours. | |
QTime | rushEnd () const |
Gets end time of rush hours. | |
void | setRushTime (const QTime &aBegin, const QTime &aEnd) |
Sets begin and end times of rush hours. | |
unsigned | rushInterval () const |
Gets sync interval for rush hours. | |
void | setRushInterval (unsigned aInterval) |
Sets sync interval for rush hours. | |
bool | inExternalSyncRushPeriod (const QDateTime &aDateTime) const |
Checks if a given time is inside rush hour and if the sync is controlled by a external process. | |
QDateTime | nextSyncTime (const QDateTime &aPrevSync) const |
Gets next sync time based on the sync schedule settings. | |
QDateTime | nextRushSwitchTime (const QDateTime &aFromTime) const |
Gets next time to switch rush/off-rush schedule intervals. | |
bool | isSyncScheduled (const QDateTime &aActualDateTime, const QDateTime &aPreviousSyncTime=QDateTime()) const |
Returns true if aDateTime is within a scheduled period. | |
Properties | |
QTime | time |
Days | days |
unsigned | interval |
bool | enabled |
QTime | rushBegin |
QTime | rushEnd |
Days | rushDays |
unsigned | rushInterval |
bool | rushEnabled |
Class for handling sync schedule settings.
SyncSchedule::SyncSchedule | ( | const SyncSchedule & | aSource | ) |
Copy constructor.
aSource | Copy source. |
|
explicit |
Constructs sync schedule from XML.
aRoot | Root element of the XML representation. |
SyncSchedule::Days SyncSchedule::days | ( | ) | const |
Gets the enabled week days of the sync schedule.
Enabled week days are provided as a bitwise OR of SyncSchedule::Day.
bool SyncSchedule::inExternalSyncRushPeriod | ( | const QDateTime & | aDateTime | ) | const |
Checks if a given time is inside rush hour and if the sync is controlled by a external process.
aDateTime | DateTime to check. |
unsigned SyncSchedule::interval | ( | ) | const |
Gets sync interval in minutes.
bool SyncSchedule::isSyncScheduled | ( | const QDateTime & | aActualDateTime, |
const QDateTime & | aPreviousSyncTime = QDateTime() ) const |
Returns true if aDateTime is within a scheduled period.
aActualDateTime | the actual sync date time to be tested. |
aPreviousSyncTime | the previous sync time, for calculation where a sync interval is used. |
QDateTime SyncSchedule::nextRushSwitchTime | ( | const QDateTime & | aFromTime | ) | const |
Gets next time to switch rush/off-rush schedule intervals.
aFromTime | From time to calculate next switch, usually current time. |
QDateTime SyncSchedule::nextSyncTime | ( | const QDateTime & | aPrevSync | ) | const |
Gets next sync time based on the sync schedule settings.
aPrevSync | Previous sync time. |
SyncSchedule & SyncSchedule::operator= | ( | const SyncSchedule & | aRhs | ) |
Assignment operator.
aRhs | Source |
bool SyncSchedule::operator== | ( | const SyncSchedule & | aRhs | ) | const |
Equal to operator.
aRhs | Source |
QTime SyncSchedule::rushBegin | ( | ) | const |
Gets begin time of rush hours.
SyncSchedule::Days SyncSchedule::rushDays | ( | ) | const |
Gets days enabled for rush hours.
bool SyncSchedule::rushEnabled | ( | ) | const |
Checks if rush hour schedule is to be obeyed.
QTime SyncSchedule::rushEnd | ( | ) | const |
Gets end time of rush hours.
unsigned SyncSchedule::rushInterval | ( | ) | const |
Gets sync interval for rush hours.
QDateTime SyncSchedule::scheduleConfiguredTime | ( | ) |
To get the scheduled config time.
bool SyncSchedule::scheduleEnabled | ( | ) | const |
Checks if normal schedule is obeyed.
void SyncSchedule::setDays | ( | Days | aDays | ) |
Sets the enabled week days.
aDays | Set of enabled week days. |
void SyncSchedule::setInterval | ( | unsigned | aInterval | ) |
Sets sync interval in minutes.
Set to zero to disable syncing with intervals.
aInterval | Interval. |
void SyncSchedule::setRushDays | ( | Days | aDays | ) |
Sets days enabled for rush hours.
aDays | Enabled days for rush hours. |
void SyncSchedule::setRushEnabled | ( | bool | aEnabled | ) |
Sets rush hour schedule is to be obeyed.
aEnabled | If set to false, corresponds to rush hour scheduling off, i.e. "manual" sync. |
void SyncSchedule::setRushInterval | ( | unsigned | aInterval | ) |
Sets sync interval for rush hours.
aInterval | Interval. |
void SyncSchedule::setRushTime | ( | const QTime & | aBegin, |
const QTime & | aEnd ) |
Sets begin and end times of rush hours.
aBegin | Begin time. |
aEnd | End time. |
void SyncSchedule::setScheduleConfiguredTime | ( | const QDateTime & | aDateTime | ) |
Sets scheduled config time.
QDateTime | Sync time. |
void SyncSchedule::setScheduleEnabled | ( | bool | aEnabled | ) |
Sets if normal schedule is to be obeyed.
aEnabled | Specify if normal scheduling hours enabled. If set to false, corresponds to "manual" mode. |
void SyncSchedule::setSyncExternallyDuringRush | ( | bool | aEnabled | ) |
Sets if rush schedule is controlled by a external process.
aEnabled | If set to true, corresponds to external rush hour scheduling on, i.e. sync controlled by a external process. |
void SyncSchedule::setTime | ( | const QTime & | aTime | ) |
Sets the exact time for sync.
Set to null object QTime() to disable syncing at exact time.
aTime | Sync time. |
bool SyncSchedule::syncExternallyDuringRush | ( | ) | const |
Checks if rush schedule is controlled by a external process.
QTime SyncSchedule::time | ( | ) | const |
Gets the exact time set in sync schedule.
QString SyncSchedule::toString | ( | ) | const |
Exports the sync schedule to QString.
QDomElement SyncSchedule::toXml | ( | QDomDocument & | aDoc | ) | const |
Exports the sync schedule to XML.
aDoc | Parent document for the created XML elements. |