control: Rename Timer -> TimerConf
It is confusing to read some of the type definitions that deal with
timers when Timer could mean a timer instantiation or a set of timer
configuration parameters. This change disambiguates the two types.
Tested:
Built and run through unit tests.
Change-Id: I9dd6b47886747d56a86b6a50eb9a74a331d0a1fe
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/control/actions.cpp b/control/actions.cpp
index 71f7f72..923b1cc 100644
--- a/control/actions.cpp
+++ b/control/actions.cpp
@@ -11,7 +11,8 @@
using namespace phosphor::fan;
-Action call_actions_based_on_timer(Timer&& tConf, std::vector<Action>&& actions)
+Action call_actions_based_on_timer(TimerConf&& tConf,
+ std::vector<Action>&& actions)
{
return [tConf = std::move(tConf),
actions = std::move(actions)](control::Zone& zone,
diff --git a/control/actions.hpp b/control/actions.hpp
index b079bf4..cce481c 100644
--- a/control/actions.hpp
+++ b/control/actions.hpp
@@ -26,7 +26,7 @@
* An Action function that creates a timer
*/
Action call_actions_based_on_timer(
- Timer&& tConf,
+ TimerConf&& tConf,
std::vector<Action>&& actions);
/**
diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py
index 0ddfb63..3db9a40 100755
--- a/control/gen-fan-zone-defs.py
+++ b/control/gen-fan-zone-defs.py
@@ -125,7 +125,7 @@
else:
if p == 'timer':
param = (
- "Timer{static_cast<std::chrono::seconds>(" +
+ "TimerConf{static_cast<std::chrono::seconds>(" +
str(eActions[p]['delay']) + "), " +
"TimerType::" +
str(eActions[p]['type']) + "}")
diff --git a/control/templates/defs.mako b/control/templates/defs.mako
index 0980f81..2fd3856 100644
--- a/control/templates/defs.mako
+++ b/control/templates/defs.mako
@@ -58,7 +58,7 @@
),
%endfor
},
-Timer{
+TimerConf{
${event['timer']['interval']},
${event['timer']['type']}
},
diff --git a/control/templates/fan_zone_defs.mako.cpp b/control/templates/fan_zone_defs.mako.cpp
index e735e0d..fdf5bb2 100644
--- a/control/templates/fan_zone_defs.mako.cpp
+++ b/control/templates/fan_zone_defs.mako.cpp
@@ -120,7 +120,7 @@
),
%endif
},
- Timer{
+ TimerConf{
${event['pc']['pctime']['interval']},
${event['pc']['pctime']['type']}
},
diff --git a/control/types.hpp b/control/types.hpp
index f565333..967b0b4 100644
--- a/control/types.hpp
+++ b/control/types.hpp
@@ -65,8 +65,8 @@
constexpr auto intervalPos = 0;
constexpr auto typePos = 1;
using TimerType = phosphor::fan::util::Timer::TimerType;
-using Timer = std::tuple<std::chrono::seconds,
- TimerType>;
+using TimerConf = std::tuple<std::chrono::seconds,
+ TimerType>;
constexpr auto sigMatchPos = 0;
constexpr auto sigHandlerPos = 1;
@@ -74,11 +74,11 @@
constexpr auto groupPos = 0;
constexpr auto actionsPos = 1;
-constexpr auto timerPos = 2;
+constexpr auto timerConfPos = 2;
constexpr auto signalsPos = 3;
using SetSpeedEvent = std::tuple<Group,
std::vector<Action>,
- Timer,
+ TimerConf,
std::vector<Signal>>;
constexpr auto eventGroupPos = 0;
diff --git a/control/zone.cpp b/control/zone.cpp
index 11246db..5f0c15d 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -332,8 +332,8 @@
_signalEvents.emplace_back(std::move(eventData), std::move(match));
}
// Attach a timer to run the action of an event
- auto eventTimer = std::get<timerPos>(event);
- if (std::get<intervalPos>(eventTimer) != seconds(0))
+ auto timerConf = std::get<timerConfPos>(event);
+ if (std::get<intervalPos>(timerConf) != seconds(0))
{
// Associate event data with timer
std::unique_ptr<EventData> eventData =
@@ -354,8 +354,8 @@
});
if (!timer->running())
{
- timer->start(std::get<intervalPos>(eventTimer),
- std::get<typePos>(eventTimer));
+ timer->start(std::get<intervalPos>(timerConf),
+ std::get<typePos>(timerConf));
}
addTimer(std::move(eventData), std::move(timer));
}