summaryrefslogtreecommitdiffstats
path: root/control/preconditions.hpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-07-28 13:43:04 -0500
committerMatthew Barth <msbarth@us.ibm.com>2017-08-04 13:03:13 -0500
commitccc7770ecd6b758fcef98ce9e7cd585af3f3c77f (patch)
treef0199ba8f9d5e560ea3e95f7c9a99a9b98488cfe /control/preconditions.hpp
parent771659fcd288e40eda8fb80fe04f32b5d18d3599 (diff)
downloadphosphor-fan-presence-ccc7770ecd6b758fcef98ce9e7cd585af3f3c77f.tar.gz
phosphor-fan-presence-ccc7770ecd6b758fcef98ce9e7cd585af3f3c77f.zip
Initial updates to support preconditions
Any defined preconditions for a set speed event must be satisfied prior to configuring the event parameters for fan control. These preconditions will accept a list of group entries that include the value the group's property must be to have the precondition met for that group. Once all preconditions are met, the set speed event will be initialized and become active. Change-Id: Ia5555be55c5937c891af527bea63da1546655b2f Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/preconditions.hpp')
-rw-r--r--control/preconditions.hpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/control/preconditions.hpp b/control/preconditions.hpp
new file mode 100644
index 0000000..61a2f50
--- /dev/null
+++ b/control/preconditions.hpp
@@ -0,0 +1,43 @@
+#pragma once
+
+namespace phosphor
+{
+namespace fan
+{
+namespace control
+{
+namespace precondition
+{
+
+/**
+ * @brief A precondition to compare a group of property values and
+ * subscribe/unsubscribe a set speed event group
+ * @details Compares each entry within the precondition group to a given value
+ * that when each entry's property value matches the given value, the set speed
+ * event is then initialized. At any point a precondition entry's value no
+ * longer matches, the set speed event is removed from being active and fans
+ * are set to full speed.
+ *
+ * @param[in] pg - Precondition property group of property values
+ * @param[in] sse - Set speed event definition
+ *
+ * @return Lambda function
+ * A lambda function to compare precondition property value states
+ * and either subscribe or unsubscribe a set speed event group.
+ */
+auto property_states_match(std::vector<PrecondGroup>&& pg,
+ SetSpeedEvent&& sse)
+{
+ return [pg = std::move(pg),
+ sse = std::move(sse)](auto& zone, auto& group)
+ {
+ // TODO Read/Compare given precondition entries
+ // TODO Only init the event when the precondition(s) are true
+ // TODO Remove the event properties when the precondition(s) are false
+ };
+}
+
+} // namespace precondition
+} // namespace control
+} // namespace fan
+} // namespace phosphor
OpenPOWER on IntegriCloud