control: Associate identifier with target holds
Create a zone method that associates a unique identifier to a target
hold so that if more than one hold exists, the highest target is always
used between all actions that could have set a target hold on the zone.
Change-Id: I7699769a2e271c8a63a0a0a05aef6b0888ce180a
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/zone.hpp b/control/json/zone.hpp
index b47e051..d6ee3e2 100644
--- a/control/json/zone.hpp
+++ b/control/json/zone.hpp
@@ -216,6 +216,18 @@
void setTarget(uint64_t target);
/**
+ * Sets and holds all fans in the zone to the target given or releases a
+ * target hold resulting in the fans being held at the highest remaining
+ * hold target if other hold targets had been requested. When no hold
+ * targets exist, the zone returns to being active.
+ *
+ * @param[in] ident - Unique identifier for a target hold
+ * @param[in] target - Target to hold fans at
+ * @param[in] hold - Whether to hold(true) or release(false) a target hold
+ */
+ void setTargetHold(const std::string& ident, uint64_t target, bool hold);
+
+ /**
* @brief Sets the automatic fan control allowed active state
*
* @param[in] ident - An identifier that affects the active state
@@ -434,6 +446,9 @@
/* Map of active fan control allowed by a string identifier */
std::map<std::string, bool> _active;
+ /* Map of target holds by a string identifier */
+ std::unordered_map<std::string, uint64_t> _holds;
+
/* Interface to property mapping of their associated set property handler
* function */
static const std::map<