control: Add fan objects to their zones
Load the fan configurations and add each fan to its configured zone.
Change-Id: Ib798db9f272484c60b6eadd58e6545bd704b9573
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/zone.hpp b/control/json/zone.hpp
index 4f7742c..2ed3166 100644
--- a/control/json/zone.hpp
+++ b/control/json/zone.hpp
@@ -16,6 +16,7 @@
#pragma once
#include "config_base.hpp"
+#include "fan.hpp"
#include "types.hpp"
#include <nlohmann/json.hpp>
@@ -148,6 +149,17 @@
return _zoneHandlers;
}
+ /**
+ * @brief Add a fan object to the zone
+ *
+ * @param[in] fan - Unique pointer to a fan object that will be moved into
+ * the zone
+ *
+ * Adds a fan object to the list of fans that make up the zone by moving the
+ * fan object into the list.
+ */
+ void addFan(std::unique_ptr<Fan> fan);
+
private:
/* The zone's full speed value for fans */
uint64_t _fullSpeed;
@@ -171,6 +183,9 @@
static const std::map<std::string, std::map<std::string, propHandler>>
_intfPropHandlers;
+ /* List of fans included in this zone */
+ std::vector<std::unique_ptr<Fan>> _fans;
+
/**
* @brief Parse and set the zone's full speed value
*