1#ifndef H_EXTENSIONS_CUTEHMI_SERVICES_3_SRC_CUTEHMI_SERVICES_INTERNAL_SERVICESTATEINTERFACE_HPP
2#define H_EXTENSIONS_CUTEHMI_SERVICES_3_SRC_CUTEHMI_SERVICES_INTERNAL_SERVICESTATEINTERFACE_HPP
4#include "internal/common.hpp"
5#include "StateInterface.hpp"
6#include "ServiceStartedStateInterface.hpp"
7#include "ServiceStateMachine.hpp"
11#include <QStateMachine>
28 Q_PROPERTY(
QString status READ status WRITE setStatus NOTIFY statusChanged)
38 void setStatus(
const QString & status);
40 bool isShutdown()
const;
44 void configureServiceable(
Serviceable * serviceable);
64 void reconfigureStopped(
const Serviceable & serviceable);
66 void reconfigureStarting(
Serviceable & serviceable);
70 void reconfigureStopping(
Serviceable & serviceable);
74 void reconfigureRepairing(
Serviceable & serviceable);
76 void reconfigureEvacuating(
Serviceable & serviceable);
78 void reconfigureInterrupted(
const Serviceable & serviceable);
80 void replaceTransitionToStarted(
const Serviceable & serviceable);
82 void replaceTransitionToStopped(
const Serviceable & serviceable);
84 void replaceTransitionToBroken(
const Serviceable & serviceable);
86 void replaceTransitionToYielding(
const Serviceable & serviceable);
88 void replaceTransitionToIdling(
const Serviceable & serviceable);
105 QState * startingPersistent()
const;
107 QState * startedPersistent()
const;
111 QState * stoppingPersistent()
const;
113 QState * stoppedPersistent()
const;
115 QState * brokenPersistent()
const;
117 QState * repairingPersistent()
const;
119 QState * evacuatingPersistent()
const;
121 QState * interruptedPersistent()
const;
123 QState * startingEphemeric()
const;
125 QState * startedEphemeric()
const;
127 QState * stoppingEphemeric()
const;
129 QState * stoppedEphemeric()
const;
131 QState * brokenEphemeric()
const;
133 QState * repairingEphemeric()
const;
135 QState * evacuatingEphemeric()
const;
137 QState * interruptedEphemeric()
const;
167 void initializePersistentStates();
169 void resetEphemericStates();
171 void resetStartingEphemeric();
173 void resetStartedEphemeric();
175 void resetStoppingEphemeric();
177 void resetStoppedEphemeric();
179 void resetBrokenEphemeric();
181 void resetRepairingEphemeric();
183 void resetEvacuatingEphemeric();
185 void resetInterruptedEphemeric();
187 void setUpStopped(
bool reconfigure,
const Serviceable & serviceable);
189 void setUpStarting(
bool reconfigure,
Serviceable & serviceable);
191 void setUpStarted(
bool reconfigure,
Serviceable & serviceable);
193 void setUpStopping(
bool reconfigure,
Serviceable & serviceable);
195 void setUpBroken(
bool reconfigure,
Serviceable & serviceable);
197 void setUpRepairing(
bool reconfigure,
Serviceable & serviceable);
199 void setUpEvacuating(
bool reconfigure,
Serviceable & serviceable);
201 void setUpInterrupted(
bool reconfigure,
const Serviceable & serviceable);
207 void addStoppedTransition(
int index);
214 void addStartingTransition(
int index,
const Serviceable & serviceable);
221 void addStartedTransition(
int index,
const Serviceable & serviceable);
228 void addStoppingTransition(
int index,
const Serviceable & serviceable);
234 void addBrokenTransition(
int index);
241 void addRepairingTransition(
int index,
const Serviceable & serviceable);
248 void addEvacuatingTransition(
int index,
const Serviceable & serviceable);
254 void addInterrputedTransition(
int index);
263 QState * lastNotifiableState =
nullptr;
310 Members(ServiceStateInterface * p_parent):
311 stateMachine(new ServiceStateMachine(p_parent)),
312 starting{new
QState(stateMachine), nullptr, {}},
313 started{
new QState(stateMachine),
nullptr, {},
nullptr},
314 stopping{
new QState(stateMachine),
nullptr, {}},
315 stopped{
new QState(stateMachine),
nullptr, {}},
316 broken{
new QState(stateMachine),
nullptr, {}},
317 repairing{
new QState(stateMachine),
nullptr, {}},
318 evacuating{
new QState(stateMachine),
nullptr, {}},
319 interrupted{
new QState(stateMachine),
nullptr, {}},
322 started.interface =
new ServiceStartedStateInterface(p_parent, started.persistent);
Serviceable interface.
Definition: Serviceable.hpp:33
Substates of started state of the state interface.
Definition: StartedStateInterface.hpp:24
State interface.
Definition: StateInterface.hpp:30
AbstractService * service() const
Definition: StateInterface.cpp:27
Definition: ServiceStartedStateInterface.hpp:16
Definition: ServiceStateInterface.hpp:24
void statusChanged(const QString &status)
Service state machine.
Definition: ServiceStateMachine.hpp:24