Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame^] | 1 | #include "report_manager.hpp" |
| 2 | |
| 3 | #include <system_error> |
| 4 | |
| 5 | constexpr const char* reportManagerIfaceName = |
| 6 | "xyz.openbmc_project.Telemetry.ReportManager"; |
| 7 | constexpr const char* reportManagerPath = |
| 8 | "/xyz/openbmc_project/Telemetry/Reports"; |
| 9 | |
| 10 | ReportManager::ReportManager( |
| 11 | const std::shared_ptr<sdbusplus::asio::object_server>& objServer) : |
| 12 | objServer(objServer) |
| 13 | { |
| 14 | reportManagerIntf = |
| 15 | objServer->add_interface(reportManagerPath, reportManagerIfaceName); |
| 16 | |
| 17 | reportManagerIntf->register_property_r( |
| 18 | "MaxReports", uint32_t{}, sdbusplus::vtable::property_::const_, |
| 19 | [](const auto&) { return maxReports; }); |
| 20 | reportManagerIntf->register_property_r( |
| 21 | "MinInterval", uint64_t{}, sdbusplus::vtable::property_::const_, |
| 22 | [](const auto&) -> uint64_t { return minInterval.count(); }); |
| 23 | |
| 24 | reportManagerIntf->initialize(); |
| 25 | } |
| 26 | |
| 27 | ReportManager::~ReportManager() |
| 28 | { |
| 29 | objServer->remove_interface(reportManagerIntf); |
| 30 | } |