control: Use group objects in actions
Switch to use the group objects created from JSON in the actions which
allows the zone and fan YAML objects to be removed from the JSON based
binary. In switching to the JSON based group objects, the
`default_floor` action required additional methods to be added to the
appropriate objects. These additional methods were copied over from the
associated YAML based object classes.
To reduce the amount of changes in this commit, the `requestIncrease`
method was not copied over and will be in a following commit. An
additional commit will also remove the use of YAML based objects from
the JSON based zone object.
Change-Id: I5fea29f099d0176b2ffe486e79f0c585e744d807
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/zone.hpp b/control/json/zone.hpp
index 2ed3166..b91af2f 100644
--- a/control/json/zone.hpp
+++ b/control/json/zone.hpp
@@ -160,6 +160,33 @@
*/
void addFan(std::unique_ptr<Fan> fan);
+ /**
+ * @brief Set the floor to the given target and increase target to the floor
+ * when the target is below the floor value when floor changes are allowed.
+ *
+ * @param[in] target - Target to set the floor to
+ */
+ void setFloor(uint64_t target);
+
+ /**
+ * @brief Sets the floor change allowed state
+ *
+ * @param[in] ident - An identifier that affects floor changes
+ * @param[in] isAllow - Allow state according to the identifier
+ */
+ inline void setFloorChangeAllow(const std::string& ident, bool isAllow)
+ {
+ _floorChange[ident] = isAllow;
+ }
+
+ /**
+ * @brief Calculate the requested target from the given delta and increases
+ * the fans, not going above the ceiling.
+ *
+ * @param[in] targetDelta - The delta to increase the target by
+ */
+ void requestIncrease(uint64_t targetDelta);
+
private:
/* The zone's full speed value for fans */
uint64_t _fullSpeed;
@@ -173,6 +200,15 @@
/* Zone's speed decrease interval(in seconds) */
uint64_t _decInterval;
+ /* The floor target to not go below */
+ uint64_t _floor;
+
+ /* Target for this zone */
+ uint64_t _target;
+
+ /* Map of whether floor changes are allowed by a string identifier */
+ std::map<std::string, bool> _floorChange;
+
/**
* Zone interface handler functions for its
* configured interfaces (OPTIONAL)