blob: 177a03cebe247f164d5979eaaf00fda57bc8b24f [file] [log] [blame]
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02001#pragma once
2
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +02003#include "report.hpp"
4
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02005#include <sdbusplus/asio/object_server.hpp>
6
7#include <chrono>
8#include <memory>
9#include <vector>
10
11class ReportManager
12{
13 public:
14 ReportManager(
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020015 const std::shared_ptr<sdbusplus::asio::connection>& bus,
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020016 const std::shared_ptr<sdbusplus::asio::object_server>& objServer);
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020017 ~ReportManager() = default;
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020018
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020019 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 Grobelny64b75a52020-09-18 10:17:16 +020026
27 private:
28 std::shared_ptr<sdbusplus::asio::object_server> objServer;
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020029 std::unique_ptr<sdbusplus::asio::dbus_interface> reportManagerIface;
30 std::vector<std::unique_ptr<Report>> reports;
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020031
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020032 public:
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020033 static constexpr uint32_t maxReports{20};
34 static constexpr std::chrono::milliseconds minInterval{1000};
35};