Add Average and Maximum classes
These classes will implement the
xyz.openbmc_project.Sensor.Aggregation.History.Average/Maximum
interfaces. Each of these interfaces contains an array of
value/timestamp entries, where the value is either the average
or maximum power as reported by the power supply. The most recent
value will always be in element 0 of the array.
Change-Id: I41b0b84abe146c57f23629bd50acbf9e7fb746ab
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/power-supply/maximum.hpp b/power-supply/maximum.hpp
new file mode 100644
index 0000000..e1fbffc
--- /dev/null
+++ b/power-supply/maximum.hpp
@@ -0,0 +1,57 @@
+#pragma once
+#include <functional>
+#include <org/open_power/Sensor/Aggregation/History/Maximum/server.hpp>
+
+namespace witherspoon
+{
+namespace power
+{
+namespace history
+{
+
+template <typename T>
+using ServerObject = typename sdbusplus::server::object::object<T>;
+
+using MaximumInterface = sdbusplus::org::open_power::
+ Sensor::Aggregation::History::server::Maximum;
+
+/**
+ * @class Maximum
+ *
+ * Implements Sensor.Aggregation.History.Maximum
+ *
+ * This includes a property that is an array of timestamp/maximum tuples
+ * and a property to specify the scale.
+ */
+class Maximum : public ServerObject<MaximumInterface>
+{
+ public:
+
+ static constexpr auto name = "maximum";
+
+ Maximum() = delete;
+ Maximum(const Maximum&) = delete;
+ Maximum& operator=(const Maximum&) = delete;
+ Maximum(Maximum&&) = delete;
+ Maximum& operator=(Maximum&&) = delete;
+ ~Maximum() = default;
+
+ /**
+ * @brief Constructor
+ *
+ * @param[in] bus - D-Bus object
+ * @param[in] objectPath - the D-Bus object path
+ */
+ Maximum(sdbusplus::bus::bus& bus,
+ const std::string& objectPath) :
+ ServerObject<MaximumInterface>(bus, objectPath.c_str())
+ {
+ unit(Maximum::Unit::Watts);
+ scale(0);
+ }
+};
+
+
+}
+}
+}