Buteo::SyncSchedule Class Reference

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

## Detailed Description

Class for handling sync schedule settings.

## Constructor & Destructor Documentation

## SyncSchedule() [1/2]

SyncSchedule::SyncSchedule | ( | const SyncSchedule & | aSource | ) |

Copy constructor.

Parameters

  aSource | Copy source.

## SyncSchedule() [2/2]

SyncSchedule::SyncSchedule | ( | const QDomElement & | aRoot | ) |

explicit

Constructs sync schedule from XML.

Parameters

  aRoot | Root element of the XML representation.

## Member Function Documentation

## days()

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.

Returns
  Set of week days.

## inExternalSyncRushPeriod()

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.

Parameters

  aDateTime | DateTime to check.

## interval()

unsigned SyncSchedule::interval | ( |  | ) | const

Gets sync interval in minutes.

Returns
  Interval.

## isSyncScheduled()

bool SyncSchedule::isSyncScheduled | ( | const QDateTime & | aActualDateTime,
|  | const QDateTime & | aPreviousSyncTime = QDateTime() ) const

Returns true if aDateTime is within a scheduled period.

Parameters

  aActualDateTime | the actual sync date time to be tested.
  aPreviousSyncTime | the previous sync time, for calculation where a sync interval is used.

Returns
  true if at aActualDateTime, the synchronization is possible.

## nextRushSwitchTime()

QDateTime SyncSchedule::nextRushSwitchTime | ( | const QDateTime & | aFromTime | ) | const

Gets next time to switch rush/off-rush schedule intervals.

Parameters

  aFromTime | From time to calculate next switch, usually current time.

Returns
  Next time to switch rush/off-rush schedule intervals. Null object if schedule is not defined for rush/off-rush or if the rush and off-rush intervals are the same.

## nextSyncTime()

QDateTime SyncSchedule::nextSyncTime | ( | const QDateTime & | aPrevSync | ) | const

Gets next sync time based on the sync schedule settings.

Parameters

  aPrevSync | Previous sync time.

Returns
  Next sync time. Null object if schedule is not defined.

## operator=()

SyncSchedule & SyncSchedule::operator= | ( | const SyncSchedule & | aRhs | ) |

Assignment operator.

Parameters

  aRhs | Source

## operator==()

bool SyncSchedule::operator== | ( | const SyncSchedule & | aRhs | ) | const

Equal to operator.

Parameters

  aRhs | Source

## rushBegin()

QTime SyncSchedule::rushBegin | ( |  | ) | const

Gets begin time of rush hours.

Returns
  Begin time.

## rushDays()

SyncSchedule::Days SyncSchedule::rushDays | ( |  | ) | const

Gets days enabled for rush hours.

Returns
  Set of days enabled for rush hours.

## rushEnabled()

bool SyncSchedule::rushEnabled | ( |  | ) | const

Checks if rush hour schedule is to be obeyed.

Returns
  True if rush hour schedule is to be used. False, if rush hour scheduling is off (i.e. manual mode).

## rushEnd()

QTime SyncSchedule::rushEnd | ( |  | ) | const

Gets end time of rush hours.

Returns
  End time.

## rushInterval()

unsigned SyncSchedule::rushInterval | ( |  | ) | const

Gets sync interval for rush hours.

Returns
  Interval in minutes.

## scheduleConfiguredTime()

QDateTime SyncSchedule::scheduleConfiguredTime | ( |  | ) |

To get the scheduled config time.

Returns
  QDateTime Sync time.

## scheduleEnabled()

bool SyncSchedule::scheduleEnabled | ( |  | ) | const

Checks if normal schedule is obeyed.

Returns
  Normal schedule is obeyed. Return value false corresponds to "manual" mode.

## setDays()

void SyncSchedule::setDays | ( | Days | aDays | ) |

Sets the enabled week days.

Parameters

  aDays | Set of enabled week days.

## setInterval()

void SyncSchedule::setInterval | ( | unsigned | aInterval | ) |

Sets sync interval in minutes.

Set to zero to disable syncing with intervals.

Parameters

  aInterval | Interval.

## setRushDays()

void SyncSchedule::setRushDays | ( | Days | aDays | ) |

Sets days enabled for rush hours.

Parameters

  aDays | Enabled days for rush hours.

## setRushEnabled()

void SyncSchedule::setRushEnabled | ( | bool | aEnabled | ) |

Sets rush hour schedule is to be obeyed.

Parameters

  aEnabled | If set to false, corresponds to rush hour scheduling off, i.e. "manual" sync.

## setRushInterval()

void SyncSchedule::setRushInterval | ( | unsigned | aInterval | ) |

Sets sync interval for rush hours.

Parameters

  aInterval | Interval.

## setRushTime()

void SyncSchedule::setRushTime | ( | const QTime & | aBegin,
|  | const QTime & | aEnd )

Sets begin and end times of rush hours.

Parameters

  aBegin | Begin time.
  aEnd | End time.

## setScheduleConfiguredTime()

void SyncSchedule::setScheduleConfiguredTime | ( | const QDateTime & | aDateTime | ) |

Sets scheduled config time.

Parameters

  aDateTime | Sync time.

## setScheduleEnabled()

void SyncSchedule::setScheduleEnabled | ( | bool | aEnabled | ) |

Sets if normal schedule is to be obeyed.

Parameters

  aEnabled | Specify if normal scheduling hours enabled. If set to false, corresponds to "manual" mode.

## setSyncExternallyDuringRush()

void SyncSchedule::setSyncExternallyDuringRush | ( | bool | aEnabled | ) |

Sets if rush schedule is controlled by a external process.

Parameters

  aEnabled | If set to true, corresponds to external rush hour scheduling on, i.e. sync controlled by a external process.

## setTime()

void SyncSchedule::setTime | ( | const QTime & | aTime | ) |

Sets the exact time for sync.

Set to null object QTime() to disable syncing at exact time.

Parameters

  aTime | Sync time.

## syncExternallyDuringRush()

bool SyncSchedule::syncExternallyDuringRush | ( |  | ) | const

Checks if rush schedule is controlled by a external process.

Returns
  True if rush hour schedule is to be used by a external process, The external process will control the sync, buteo will just controll the schedule outside rush hours and will be responsible to switch from rush to no-rush(and vice-versa) modes. False, if rush hour scheduling is controlled by this process or if rush hour scheduling is off (i.e. manual mode).

## time()

QTime SyncSchedule::time | ( |  | ) | const

Gets the exact time set in sync schedule.

Returns
  Sync time. Null object if time has not been defined.

## toString()

QString SyncSchedule::toString | ( |  | ) | const

Exports the sync schedule to QString.

Returns
  return the Schedule as xml formatted string

## toXml()

QDomElement SyncSchedule::toXml | ( | QDomDocument & | aDoc | ) | const

Exports the sync schedule to XML.

Parameters

  aDoc | Parent document for the created XML elements.

Returns
  Root element of the created XML.

The documentation for this class was generated from the following files:

- SyncSchedule.h
- SyncSchedule.cpp