blob: 599548ead1de9de45b41e7e3310ef68a8feabdd3 [file] [log] [blame]
Matt Spinler7d24ee82018-01-18 13:56:12 -06001#pragma once
Matt Spinler7d24ee82018-01-18 13:56:12 -06002#include <org/open_power/Sensor/Aggregation/History/Maximum/server.hpp>
3
Brandon Wymand1bc4ce2019-12-13 14:20:34 -06004#include <functional>
5
Lei YUab093322019-10-09 16:43:22 +08006namespace phosphor
Matt Spinler7d24ee82018-01-18 13:56:12 -06007{
8namespace power
9{
10namespace history
11{
12
13template <typename T>
Patrick Williams7354ce62022-07-22 19:26:56 -050014using ServerObject = typename sdbusplus::server::object_t<T>;
Matt Spinler7d24ee82018-01-18 13:56:12 -060015
Matt Spinlerf0f02b92018-10-25 16:12:43 -050016using MaximumInterface =
17 sdbusplus::org::open_power::Sensor::Aggregation::History::server::Maximum;
Matt Spinler7d24ee82018-01-18 13:56:12 -060018
19/**
20 * @class Maximum
21 *
22 * Implements Sensor.Aggregation.History.Maximum
23 *
24 * This includes a property that is an array of timestamp/maximum tuples
25 * and a property to specify the scale.
26 */
27class Maximum : public ServerObject<MaximumInterface>
28{
Matt Spinlerf0f02b92018-10-25 16:12:43 -050029 public:
30 static constexpr auto name = "maximum";
Matt Spinler7d24ee82018-01-18 13:56:12 -060031
Matt Spinlerf0f02b92018-10-25 16:12:43 -050032 Maximum() = delete;
33 Maximum(const Maximum&) = delete;
34 Maximum& operator=(const Maximum&) = delete;
35 Maximum(Maximum&&) = delete;
36 Maximum& operator=(Maximum&&) = delete;
37 ~Maximum() = default;
Matt Spinler7d24ee82018-01-18 13:56:12 -060038
Matt Spinlerf0f02b92018-10-25 16:12:43 -050039 /**
40 * @brief Constructor
41 *
42 * @param[in] bus - D-Bus object
43 * @param[in] objectPath - the D-Bus object path
44 */
Patrick Williams7354ce62022-07-22 19:26:56 -050045 Maximum(sdbusplus::bus_t& bus, const std::string& objectPath) :
Matt Spinlerf0f02b92018-10-25 16:12:43 -050046 ServerObject<MaximumInterface>(bus, objectPath.c_str())
47 {
48 unit(Maximum::Unit::Watts);
49 scale(0);
50 }
Matt Spinler7d24ee82018-01-18 13:56:12 -060051};
52
Matt Spinlerf0f02b92018-10-25 16:12:43 -050053} // namespace history
54} // namespace power
Lei YUab093322019-10-09 16:43:22 +080055} // namespace phosphor