1 #ifndef H_EXTENSIONS_CUTEHMI_SERVICES_2_INCLUDE_CUTEHMI_SERVICES_SERVICE_HPP
2 #define H_EXTENSIONS_CUTEHMI_SERVICES_2_INCLUDE_CUTEHMI_SERVICES_SERVICE_HPP
4 #include "internal/common.hpp"
5 #include "internal/StateInterface.hpp"
6 #include "Serviceable.hpp"
11 #include <QStateMachine>
30 static constexpr
int INITIAL_STOP_TIMEOUT = 30000;
31 static constexpr
int INITIAL_START_TIMEOUT = 30000;
32 static constexpr
int INITIAL_REPAIR_TIMEOUT = 30000;
33 static constexpr
const char * INITIAL_NAME =
"Unnamed Service";
35 Q_PROPERTY(
int stopTimeout READ stopTimeout WRITE setStopTimeout NOTIFY stopTimeoutChanged)
36 Q_PROPERTY(
int startTimeout READ startTimeout WRITE setStartTimeout NOTIFY startTimeoutChanged)
37 Q_PROPERTY(
int repairTimeout READ repairTimeout WRITE setRepairTimeout NOTIFY repairTimeoutChanged)
38 Q_PROPERTY(
QString name READ name WRITE setName NOTIFY nameChanged)
39 Q_PROPERTY(
QString status READ status NOTIFY statusChanged)
40 Q_PROPERTY(
QVariant serviceable READ serviceable WRITE setServiceable NOTIFY serviceableChanged)
42 Q_CLASSINFO("DefaultProperty", "serviceable")
48 int stopTimeout() const;
55 void setStopTimeout(
int stopTimeout);
57 int startTimeout() const;
64 void setStartTimeout(
int startTimeout);
66 int repairTimeout() const;
73 void setRepairTimeout(
int repairTimeout);
77 void setName(const
QString & name);
87 void setServiceable(
QVariant serviceable);
121 void stopTimeoutChanged();
123 void startTimeoutChanged();
125 void repairTimeoutChanged();
129 void statusChanged();
131 void serviceableChanged();
140 internal::StateInterface * stateInterface();
142 const internal::StateInterface * stateInterface() const;
147 void setStatus(const
QString & status);
150 static
QString & DefaultStatus();
152 void destroyStateMachine();
154 void initializeStateMachine(
Serviceable & serviceable);
158 void addStatuses(
std::unique_ptr<
Serviceable::ServiceStatuses> statuses);
161 int stopTimeout = INITIAL_STOP_TIMEOUT;
162 int startTimeout = INITIAL_START_TIMEOUT;
163 int repairTimeout = INITIAL_REPAIR_TIMEOUT;
170 QState * lastNotifiableState =
nullptr;