summaryrefslogtreecommitdiffstats
path: root/control/zone.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'control/zone.hpp')
-rw-r--r--control/zone.hpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/control/zone.hpp b/control/zone.hpp
index 73761d0..2633902 100644
--- a/control/zone.hpp
+++ b/control/zone.hpp
@@ -7,6 +7,7 @@
#include <vector>
#include "fan.hpp"
#include "types.hpp"
+#include "sdbusplus.hpp"
#include "xyz/openbmc_project/Control/ThermalMode/server.hpp"
namespace phosphor
@@ -469,6 +470,57 @@ class Zone : public ThermalObject
int32_t depth);
/**
+ * @brief Get a property value from the zone object or the bus when
+ * the property requested is not on the zone object
+ *
+ * @param[in] path - Path of object
+ * @param[in] intf - Object interface
+ * @param[in] prop - Object property
+ *
+ * @return - Property's value
+ */
+ template <typename T>
+ auto getPropertyByName(const std::string& path,
+ const std::string& intf,
+ const std::string& prop)
+ {
+ T value;
+ auto pathIter = _objects.find(path);
+ if (pathIter != _objects.end())
+ {
+ auto intfIter = pathIter->second.find(intf);
+ if (intfIter != pathIter->second.end())
+ {
+ if (intf == "xyz.openbmc_project.Control.ThermalMode")
+ {
+ auto var = ThermalMode::getPropertyByName(prop);
+ // Use visitor to determine if requested property
+ // type(T) is available on this interface and read it
+ std::visit([&value](auto&& val)
+ {
+ using V = std::decay_t<decltype(val)>;
+ if constexpr(std::is_same_v<T, V>)
+ {
+ value = val;
+ }
+ }, var);
+
+ return value;
+ }
+ }
+ }
+
+ auto service = getService(path, intf);
+ value = util::SDBusPlus::getProperty<T>(_bus,
+ service,
+ path,
+ intf,
+ prop);
+
+ return value;
+ };
+
+ /**
* @brief Overridden thermal object's set 'Current' property function
*
* @param[in] value - Value to set 'Current' to
@@ -490,6 +542,11 @@ class Zone : public ThermalObject
const std::string _path;
/**
+ * Zone supported interfaces
+ */
+ const std::vector<std::string> _ifaces;
+
+ /**
* Full speed for the zone
*/
const uint64_t _fullSpeed;
@@ -588,6 +645,14 @@ class Zone : public ThermalObject
PropertyVariantType>>> _properties;
/**
+ * @brief Map of zone objects
+ */
+ std::map<std::string,
+ std::map<std::string,
+ std::map<std::string,
+ EventData*>>> _objects;
+
+ /**
* @brief Map of active fan control allowed by groups
*/
std::map<const Group, bool> _active;
OpenPOWER on IntegriCloud