Add timer type for set speed event timers
This is the first step towards allowing timer driven and/or wrapped
actions where the timer interval and type will be defined by the user.
Change-Id: If008fda5a2b73117e869f93223e0bfe61290f858
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py
index 96fb2fd..fcd3f02 100755
--- a/control/gen-fan-zone-defs.py
+++ b/control/gen-fan-zone-defs.py
@@ -69,7 +69,8 @@
%endfor
},
Timer{
- ${event['timer']['interval']}
+ ${event['timer']['interval']},
+ ${event['timer']['type']}
},
std::vector<Signal>{
%for s in event['signals']:
@@ -204,7 +205,8 @@
%endif
},
Timer{
- ${event['pc']['pctime']['interval']}
+ ${event['pc']['pctime']['interval']},
+ ${event['pc']['pctime']['type']}
},
std::vector<Signal>{
%for s in event['pc']['pcsigs']:
@@ -401,6 +403,7 @@
else:
timer['interval'] = (interval +
"(" + str(0) + ")")
+ timer['type'] = "util::Timer::TimerType::repeating"
event['timer'] = timer
return event
@@ -551,6 +554,7 @@
else:
timer['interval'] = (interval +
"(" + str(0) + ")")
+ timer['type'] = "util::Timer::TimerType::repeating"
precond['pctime'] = timer
return precond
diff --git a/control/types.hpp b/control/types.hpp
index 915b8b4..0d7610c 100644
--- a/control/types.hpp
+++ b/control/types.hpp
@@ -58,7 +58,9 @@
using Service = std::tuple<std::string, bool>;
constexpr auto intervalPos = 0;
-using Timer = std::tuple<std::chrono::seconds>;
+constexpr auto typePos = 1;
+using Timer = std::tuple<std::chrono::seconds,
+ util::Timer::TimerType>;
constexpr auto sigMatchPos = 0;
constexpr auto sigHandlerPos = 1;
diff --git a/control/zone.cpp b/control/zone.cpp
index b9a7583..b698c12 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -271,7 +271,7 @@
if (!timer->running())
{
timer->start(std::get<intervalPos>(eventTimer),
- util::Timer::TimerType::repeating);
+ std::get<typePos>(eventTimer));
}
_timerEvents.emplace_back(std::move(timer));
}