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);
101 void stopTimeoutChanged();
103 void startTimeoutChanged();
105 void repairTimeoutChanged();
109 void statusChanged();
111 void serviceableChanged();
120 internal::StateInterface * stateInterface();
122 const internal::StateInterface * stateInterface() const;
127 void setStatus(const
QString & status);
130 static
QString & DefaultStatus();
132 void destroyStateMachine();
134 void initializeStateMachine(
Serviceable & serviceable);
138 void addStatuses(
std::unique_ptr<
Serviceable::ServiceStatuses> statuses);
141 int stopTimeout = INITIAL_STOP_TIMEOUT;
142 int startTimeout = INITIAL_START_TIMEOUT;
143 int repairTimeout = INITIAL_REPAIR_TIMEOUT;
150 QState * lastNotifiableState =
nullptr;