/usr/include/buteosyncfw5/SyncSchedule.h is in libbuteosyncfw5-dev 0.7.21+16.04.20151216.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | /*
* This file is part of buteo-syncfw package
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
* Copyright (C) 2014-2015 Jolla Ltd
*
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SYNCSCHEDULE_H
#define SYNCSCHEDULE_H
#include <QTime>
#include <QSet>
class QDomDocument;
class QDomElement;
namespace Buteo {
class SyncSchedulePrivate;
class SyncScheduleTest;
typedef QSet<int> DaySet;
const QString SYNC_SCHEDULE_ENABLED_KEY_BOOL("scheduler/schedule_enabled");
const QString SYNC_SCHEDULE_PEAK_ENABLED_KEY_BOOL("scheduler/schedule_peak_enabled");
const QString SYNC_SCHEDULE_OFFPEAK_ENABLED_KEY_BOOL("scheduler/schedule_offpeak_enabled");
const QString SYNC_SCHEDULE_PEAK_DAYS_KEY_INT ("scheduler/schedule_peak_days");
const QString SYNC_SCHEDULE_PEAK_START_TIME_KEY_INT ("scheduler/schedule_peak_start_time");
const QString SYNC_SCHEDULE_PEAK_END_TIME_KEY_INT ("scheduler/schedule_peak_end_time");
const QString SYNC_SCHEDULE_PEAK_SCHEDULE_KEY_INT ("scheduler/schedule_peak");
const QString SYNC_SCHEDULE_OFFPEAK_SCHEDULE_KEY_INT ("scheduler/schedule_off_peak");
/*! \brief Class for handling sync schedule settings.
*
*/
class SyncSchedule
{
public:
/*! \brief Constructs an empty schedule.
*
*/
SyncSchedule();
/*! \brief Copy constructor.
*
* \param aSource Copy source.
*/
SyncSchedule(const SyncSchedule &aSource);
/*! \brief Constructs sync schedule from XML.
*
* \param aRoot Root element of the XML representation.
*/
explicit SyncSchedule(const QDomElement &aRoot);
/*! \brief Destructor.
*/
~SyncSchedule();
/*! \brief Assignment operator.
*
* \param aRhs Source
*/
SyncSchedule& operator=(const SyncSchedule &aRhs);
/*! \brief Equal to operator.
*
* \param aRhs Source
*/
bool operator==(const SyncSchedule &aRhs);
/*! \brief Exports the sync schedule to XML.
*
* \param aDoc Parent document for the created XML elements.
* \return Root element of the created XML.
*/
QDomElement toXml(QDomDocument &aDoc) const;
/*! \brief Exports the sync schedule to QString.
*
* \return return the Schedule as xml formatted string
*/
QString toString() const;
/*! \brief Gets the enabled week days of the sync schedule.
*
* The returned set contains the numbers of enabled week days.
* Day numbers are defined in Qt::DayOfWeek.
* \return Set of week day numbers.
*/
DaySet days() const;
/*! \brief Sets the enabled week days.
*
* \param aDays Set of enabled week days.
*/
void setDays(const DaySet &aDays);
/*! \brief Gets the exact time set in sync schedule.
*
* \return Sync time. Null object if time has not been defined.
*/
QTime time() const;
/*! \brief Sets the exact time for sync.
*
* Set to null object QTime() to disable syncing at exact time.
* \param aTime Sync time.
*/
void setTime(const QTime &aTime);
/*! \brief Sets scheduled config time.
*
* \param QDateTime Sync time.
*/
void setScheduleConfiguredTime(const QDateTime &aDateTime);
/*! \brief To get the scheduled config time.
*
* \return QDateTime Sync time.
*/
QDateTime scheduleConfiguredTime();
/*! \brief Gets sync interval in minutes.
*
* \return Interval.
*/
unsigned interval() const;
/*! \brief Sets sync interval in minutes.
*
* Set to zero to disable syncing with intervals.
* \param aInterval Interval.
*/
void setInterval(unsigned aInterval);
/*! \brief Checks if normal schedule is obeyed.
*
* \return Normal schedule is obeyed. Return value false corresponds to "manual" mode.
*/
bool scheduleEnabled() const;
/*! \brief Sets if normal schedule is to be obeyed.
*
* \param aEnabled Specify if normal scheduling hours enabled. If set to false, corresponds to "manual" mode.
*/
void setScheduleEnabled(bool aEnabled);
// ============== RUSH HOUR SETTINGS ============================
/*! \brief Checks if rush hour schedule is to be obeyed.
*
* \return True if rush hour schedule is to be used. False, if rush hour scheduling is off (i.e. manual mode).
*/
bool rushEnabled() const;
/*! \brief Sets rush hour schedule is to be obeyed.
*
* \param aEnabled If set to false, corresponds to rush hour scheduling off, i.e. "manual" sync.
*/
void setRushEnabled(bool aEnabled);
/*! \brief Checks if rush schedule is controlled by a external process.
*
* \return 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).
*/
bool syncExternallyDuringRush() const;
/*! \brief Sets if rush schedule is controlled by a external process.
*
* \param aEnabled If set to true, corresponds to external rush hour scheduling on, i.e. sync controlled by a external process.
*/
void setSyncExternallyDuringRush(bool aEnabled);
/*! \brief Gets days enabled for rush hours.
*
* \return Set of days enabled for rush hours.
*/
DaySet rushDays() const;
/*! \brief Sets days enabled for rush hours.
*
* \param aDays Enabled days for rush hours.
*/
void setRushDays(const DaySet &aDays);
/*! \brief Gets begin time of rush hours.
*
* \return Begin time.
*/
QTime rushBegin() const;
/*! \brief Gets end time of rush hours.
*
* \return End time.
*/
QTime rushEnd() const;
/*! \brief Sets begin and end times of rush hours.
*
* \param aBegin Begin time.
* \param aEnd End time.
*/
void setRushTime(const QTime &aBegin, const QTime &aEnd);
/*! \brief Gets sync interval for rush hours.
*
* \return Interval in minutes.
*/
unsigned rushInterval() const;
/*! \brief Sets sync interval for rush hours.
*
* \param aInterval Interval.
*/
void setRushInterval(unsigned aInterval);
/*! \brief Checks if a given time is inside rush hour and if the sync is controlled by a external process.
*
* \param aDateTime DateTime to check.
*/
bool inExternalSyncRushPeriod(const QDateTime &aDateTime) const;
/*! \brief Gets next sync time based on the sync schedule settings.
*
* \param aPrevSync Previous sync time.
* \param aPrevious sync time.
* \return Next sync time. Null object if schedule is not defined.
*/
QDateTime nextSyncTime(const QDateTime &aPrevSync) const;
/*! \brief Gets next time to switch rush/off-rush schedule intervals.
*
* \param aFromTime From time to calculate next switch, usually current time.
* \return 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.
*/
QDateTime nextRushSwitchTime(const QDateTime& aFromTime) const;
private:
SyncSchedulePrivate* d_ptr;
#ifdef SYNCFW_UNIT_TESTS
friend class SyncScheduleTest;
#endif
};
}
#endif // SYNCSCHEDULE_H
|