Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame^] | 3 | #include "interfaces/report.hpp" |
| 4 | #include "interfaces/report_factory.hpp" |
| 5 | #include "interfaces/report_manager.hpp" |
Wludzik, Jozef | cb88cfd | 2020-09-28 16:38:57 +0200 | [diff] [blame] | 6 | |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 7 | #include <sdbusplus/asio/object_server.hpp> |
| 8 | |
| 9 | #include <chrono> |
| 10 | #include <memory> |
| 11 | #include <vector> |
| 12 | |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame^] | 13 | class ReportManager : public interfaces::ReportManager |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 14 | { |
| 15 | public: |
| 16 | ReportManager( |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame^] | 17 | std::unique_ptr<interfaces::ReportFactory> reportFactory, |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 18 | const std::shared_ptr<sdbusplus::asio::object_server>& objServer); |
Wludzik, Jozef | cb88cfd | 2020-09-28 16:38:57 +0200 | [diff] [blame] | 19 | ~ReportManager() = default; |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 20 | |
Wludzik, Jozef | cb88cfd | 2020-09-28 16:38:57 +0200 | [diff] [blame] | 21 | ReportManager(ReportManager&) = delete; |
| 22 | ReportManager(ReportManager&&) = delete; |
| 23 | ReportManager& operator=(ReportManager&) = delete; |
| 24 | ReportManager& operator=(ReportManager&&) = delete; |
| 25 | |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame^] | 26 | void removeReport(const interfaces::Report* report) override; |
Wludzik, Jozef | cb88cfd | 2020-09-28 16:38:57 +0200 | [diff] [blame] | 27 | static bool verifyScanPeriod(const uint64_t scanPeriod); |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 28 | |
| 29 | private: |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame^] | 30 | std::unique_ptr<interfaces::ReportFactory> reportFactory; |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 31 | std::shared_ptr<sdbusplus::asio::object_server> objServer; |
Wludzik, Jozef | cb88cfd | 2020-09-28 16:38:57 +0200 | [diff] [blame] | 32 | std::unique_ptr<sdbusplus::asio::dbus_interface> reportManagerIface; |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame^] | 33 | std::vector<std::unique_ptr<interfaces::Report>> reports; |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 34 | |
Wludzik, Jozef | cb88cfd | 2020-09-28 16:38:57 +0200 | [diff] [blame] | 35 | public: |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 36 | static constexpr uint32_t maxReports{20}; |
| 37 | static constexpr std::chrono::milliseconds minInterval{1000}; |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame^] | 38 | static constexpr const char* reportManagerIfaceName = |
| 39 | "xyz.openbmc_project.Telemetry.ReportManager"; |
| 40 | static constexpr const char* reportManagerPath = |
| 41 | "/xyz/openbmc_project/Telemetry/Reports"; |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 42 | }; |