blob: 5fdf0b82c6ae44479cb85f3aacb2fdb5331541c7 [file] [log] [blame]
Matt Spinler7d24ee82018-01-18 13:56:12 -06001#pragma once
2#include <functional>
3#include <org/open_power/Sensor/Aggregation/History/Average/server.hpp>
4
Lei YUab093322019-10-09 16:43:22 +08005namespace phosphor
Matt Spinler7d24ee82018-01-18 13:56:12 -06006{
7namespace power
8{
9namespace history
10{
11
12template <typename T>
13using ServerObject = typename sdbusplus::server::object::object<T>;
14
Matt Spinlerf0f02b92018-10-25 16:12:43 -050015using AverageInterface =
16 sdbusplus::org::open_power::Sensor::Aggregation::History::server::Average;
Matt Spinler7d24ee82018-01-18 13:56:12 -060017
18/**
19 * @class Average
20 *
21 * Implements Sensor.Aggregation.History.Average
22 *
23 * This includes a property that is an array of timestamp/average tuples
24 * and a property to specify the scale.
25 */
26class Average : public ServerObject<AverageInterface>
27{
Matt Spinlerf0f02b92018-10-25 16:12:43 -050028 public:
29 static constexpr auto name = "average";
Matt Spinler7d24ee82018-01-18 13:56:12 -060030
Matt Spinlerf0f02b92018-10-25 16:12:43 -050031 Average() = delete;
32 Average(const Average&) = delete;
33 Average& operator=(const Average&) = delete;
34 Average(Average&&) = delete;
35 Average& operator=(Average&&) = delete;
36 ~Average() = default;
Matt Spinler7d24ee82018-01-18 13:56:12 -060037
Matt Spinlerf0f02b92018-10-25 16:12:43 -050038 /**
39 * @brief Constructor
40 *
41 * @param[in] bus - D-Bus object
42 * @param[in] objectPath - the D-Bus object path
43 */
44 Average(sdbusplus::bus::bus& bus, const std::string& objectPath) :
45 ServerObject<AverageInterface>(bus, objectPath.c_str())
46 {
47 unit(Average::Unit::Watts);
48 scale(0);
49 }
Matt Spinler7d24ee82018-01-18 13:56:12 -060050};
51
Matt Spinlerf0f02b92018-10-25 16:12:43 -050052} // namespace history
53} // namespace power
Lei YUab093322019-10-09 16:43:22 +080054} // namespace phosphor