diff --git a/libguh/devicemanager.cpp b/libguh/devicemanager.cpp index 0748d643..5e947e86 100644 --- a/libguh/devicemanager.cpp +++ b/libguh/devicemanager.cpp @@ -917,6 +917,7 @@ DeviceManager::DeviceError DeviceManager::executeAction(const Action &action) return DeviceErrorDeviceNotFound; } +/*! Centralized time tick for the GuhTimer resource. Ticks every second.*/ void DeviceManager::timeTick() { diff --git a/server/guhcore.cpp b/server/guhcore.cpp index 505d8072..f3619147 100644 --- a/server/guhcore.cpp +++ b/server/guhcore.cpp @@ -356,6 +356,7 @@ RuleEngine *GuhCore::ruleEngine() const return m_ruleEngine; } +/*! Returns a pointer to the \l{TimeManager} instance owned by GuhCore.*/ TimeManager *GuhCore::timeManager() const { return m_timeManager; diff --git a/server/jsonrpc/jsontypes.cpp b/server/jsonrpc/jsontypes.cpp index 46681c66..78b3fec4 100644 --- a/server/jsonrpc/jsontypes.cpp +++ b/server/jsonrpc/jsontypes.cpp @@ -843,6 +843,7 @@ QVariantMap JsonTypes::packCalendarItem(const CalendarItem &calendarItem) return calendarItemVariant; } +/*! Returns a variant map of the given \a timeEventItem. */ QVariantMap JsonTypes::packTimeEventItem(const TimeEventItem &timeEventItem) { QVariantMap timeEventItemVariant; @@ -1226,6 +1227,7 @@ CalendarItem JsonTypes::unpackCalendarItem(const QVariantMap &calendarItemMap) return calendarItem; } +/*! Returns a \l{TimeEventItem} created from the given \a timeEventItemMap. */ TimeEventItem JsonTypes::unpackTimeEventItem(const QVariantMap &timeEventItemMap) { TimeEventItem timeEventItem; @@ -1242,6 +1244,7 @@ TimeEventItem JsonTypes::unpackTimeEventItem(const QVariantMap &timeEventItemMap return timeEventItem; } +/*! Returns a \l{TimeDescriptor} created from the given \a timeDescriptorMap. */ TimeDescriptor JsonTypes::unpackTimeDescriptor(const QVariantMap &timeDescriptorMap) { TimeDescriptor timeDescriptor; diff --git a/server/time/timedescriptor.cpp b/server/time/timedescriptor.cpp index e9a76c3b..1c376ca9 100644 --- a/server/time/timedescriptor.cpp +++ b/server/time/timedescriptor.cpp @@ -18,7 +18,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - /*! \class guhserver::TimeDescriptor \brief Describes the time elements of a time based \l{guhserver::Rule}{Rule}. diff --git a/server/time/timeeventitem.cpp b/server/time/timeeventitem.cpp index a9d55963..f9de0b88 100644 --- a/server/time/timeeventitem.cpp +++ b/server/time/timeeventitem.cpp @@ -18,50 +18,72 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*! + \class guhserver::TimeEventItem + \brief Describes a time event of a time based \l{guhserver::Rule}{Rule}. + + \ingroup rules + \inmodule core + + + \sa Rule, TimeDescriptor, CalendarItem +*/ + #include "timeeventitem.h" namespace guhserver { +/*! Constructs an invalid \l{TimeEventItem}. */ TimeEventItem::TimeEventItem() { } +/*! Returns the dateTime of this \l{TimeEventItem}. */ QDateTime TimeEventItem::dateTime() const { return m_dateTimer; } +/*! Sets the dateTime of this \l{TimeEventItem} to the given \a timeStamp. */ void TimeEventItem::setDateTime(const int &timeStamp) { m_dateTimer = QDateTime::fromTime_t(timeStamp); } +/*! Returns the time of this \l{TimeEventItem}. */ QTime TimeEventItem::time() const { return m_time; } +/*! Sets the \a time of this \l{TimeEventItem}. */ void TimeEventItem::setTime(const QTime &time) { m_time = time; } +/*! Returns the \l{RepeatingOption} of this \l{TimeEventItem}. */ RepeatingOption TimeEventItem::repatingOption() const { return m_repeatingOption; } +/*! Sets the \a repeatingOption of this \l{TimeEventItem}. */ void TimeEventItem::setRepeatingOption(const RepeatingOption &repeatingOption) { m_repeatingOption = repeatingOption; } +/*! Returns true if this \l{TimeEventItem} is valid. A \l{TimeEventItem} is valid + if either the \l{time()} or the \l{dateTime()} is set. +*/ bool TimeEventItem::isValid() const { - return !m_dateTimer.isNull() || !m_time.isNull(); + return (!m_dateTimer.isNull() != !m_time.isNull()); } +/*! Returns true, if the given \a dateTime matches this \l{TimeEventItem}. */ bool TimeEventItem::evaluate(const QDateTime &dateTime) const { Q_UNUSED(dateTime) diff --git a/server/time/timemanager.cpp b/server/time/timemanager.cpp index f043c5ad..ce42516c 100644 --- a/server/time/timemanager.cpp +++ b/server/time/timemanager.cpp @@ -18,11 +18,33 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*! + \class guhserver::TimeManager + \brief Describes the centralized time manager of guh. + + \ingroup rules + \inmodule core + +*/ + +/*! \fn void guhserver::TimeManager::tick() + Represents the central time tick. Will be emitted every second. +*/ + +/*! \fn void guhserver::TimeManager::dateChanged(const QDate ¤tDate); + Will be emitted when the \a currentDate has changed. +*/ + +/*! \fn void guhserver::TimeManager::timeChanged(const QTime ¤tTime); + Will be emitted when the \a currentTime has changed. +*/ + #include "timemanager.h" #include "loggingcategories.h" namespace guhserver { +/*! Constructs a new \l{TimeManager} with the given \a timeZone and \a parent. */ TimeManager::TimeManager(const QByteArray &timeZone, QObject *parent) : QObject(parent) { @@ -42,11 +64,13 @@ TimeManager::TimeManager(const QByteArray &timeZone, QObject *parent) : m_guhTimer->start(); } +/*! Returns the time zone of this \l{TimeManager}. */ QByteArray TimeManager::timeZone() const { return m_timeZone.id(); } +/*! Sets the \a timeZone of this \l{TimeManager}. */ void TimeManager::setTimeZone(const QByteArray &timeZone) { if (!QTimeZone(timeZone).isValid()) { @@ -59,16 +83,19 @@ void TimeManager::setTimeZone(const QByteArray &timeZone) } } +/*! Returns the current dateTime of this \l{TimeManager}. */ QDateTime TimeManager::currentDateTime() const { return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone); } +/*! Returns the current time of this \l{TimeManager}. */ QTime TimeManager::currentTime() const { return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone).time(); } +/*! Returns the current date of this \l{TimeManager}. */ QDate TimeManager::currentDate() const { return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone).date();