xref: /openbmc/telemetry/src/report_manager.hpp (revision 7f06f613)
1 #pragma once
2 
3 #include "report.hpp"
4 
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(
15         const std::shared_ptr<sdbusplus::asio::connection>& bus,
16         const std::shared_ptr<sdbusplus::asio::object_server>& objServer);
17     ~ReportManager() = default;
18 
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);
26 
27   private:
28     std::shared_ptr<sdbusplus::asio::object_server> objServer;
29     std::unique_ptr<sdbusplus::asio::dbus_interface> reportManagerIface;
30     std::vector<std::unique_ptr<Report>> reports;
31 
32   public:
33     static constexpr uint32_t maxReports{20};
34     static constexpr std::chrono::milliseconds minInterval{1000};
35 };
36