Skip to content

Commit

Permalink
Merge pull request #21 from zenitheesc/feature/auto-setup
Browse files Browse the repository at this point in the history
Feature/auto setup
  • Loading branch information
Math-42 authored Mar 15, 2022
2 parents 6aaab24 + cbe664f commit 59bcb00
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ void RoutineServiceProxy::Running::somethingIsMissing()
void RoutineServiceProxy::serviceCycle()
{
changeState(ServiceState::RUNNING);
m_realService.setup();

while (checkState() != ServiceState::STOPPED) {

Expand Down
1 change: 1 addition & 0 deletions src/classes/service-handler/service-handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void ServiceHandler::run()
{
for (auto& [serviceId, proxy] : m_serviceMap) {
proxy->m_proxyConfigs.changeDep("THIS", ServiceProxy::ServiceState::RUNNING);
proxy->configure();
proxy->autoUpdate();
}
}
4 changes: 4 additions & 0 deletions src/classes/service-proxy/service-proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ void ServiceProxy::ProxyConfigs::changeDep(std::string dependencieId, ServiceSta
m_depsMap.at(dependencieId).m_currState = currState;
}

void ServiceProxy::configure()
{
m_realService.setup();
}
2 changes: 2 additions & 0 deletions src/classes/service-proxy/service-proxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ServiceProxy {
virtual void allFine() { }
[[nodiscard]] auto getState() const -> state_t;
};

protected:
class ProxyConfigs {
public:
Expand Down Expand Up @@ -59,6 +60,7 @@ class ServiceProxy {
std::unique_ptr<ServiceState> m_state;

auto checkState() -> ServiceState::state_t;
void configure();

virtual void autoUpdate();
virtual void serviceCycle() { }
Expand Down
1 change: 0 additions & 1 deletion src/classes/static-service-proxy/static-service-proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ void StaticServiceProxy::StandBy::somethingIsMissing()
void StaticServiceProxy::StaticServiceProxy::serviceCycle()
{
changeState(ServiceState::RUNNING);
m_realService.setup();
m_realService.destroy();
changeState(ServiceState::STAND_BY);
}
Expand Down

0 comments on commit 59bcb00

Please sign in to comment.