Matt Spinler | 7d24ee8 | 2018-01-18 13:56:12 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | #include <functional> |
| 3 | #include <org/open_power/Sensor/Aggregation/History/Average/server.hpp> |
| 4 | |
| 5 | namespace witherspoon |
| 6 | { |
| 7 | namespace power |
| 8 | { |
| 9 | namespace history |
| 10 | { |
| 11 | |
| 12 | template <typename T> |
| 13 | using ServerObject = typename sdbusplus::server::object::object<T>; |
| 14 | |
| 15 | using AverageInterface = sdbusplus::org::open_power:: |
| 16 | Sensor::Aggregation::History::server::Average; |
| 17 | |
| 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 | */ |
| 26 | class Average : public ServerObject<AverageInterface> |
| 27 | { |
| 28 | public: |
| 29 | |
| 30 | static constexpr auto name = "average"; |
| 31 | |
| 32 | Average() = delete; |
| 33 | Average(const Average&) = delete; |
| 34 | Average& operator=(const Average&) = delete; |
| 35 | Average(Average&&) = delete; |
| 36 | Average& operator=(Average&&) = delete; |
| 37 | ~Average() = default; |
| 38 | |
| 39 | /** |
| 40 | * @brief Constructor |
| 41 | * |
| 42 | * @param[in] bus - D-Bus object |
| 43 | * @param[in] objectPath - the D-Bus object path |
| 44 | */ |
| 45 | Average(sdbusplus::bus::bus& bus, |
| 46 | const std::string& objectPath) : |
| 47 | ServerObject<AverageInterface>(bus, objectPath.c_str()) |
| 48 | { |
| 49 | unit(Average::Unit::Watts); |
| 50 | scale(0); |
| 51 | } |
| 52 | }; |
| 53 | |
| 54 | |
| 55 | } |
| 56 | } |
| 57 | } |