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