blob: 2427b76d90b2e026dd00ab450fbef8f7fccab5ee [file] [log] [blame]
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02001#pragma once
2
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +02003#include "interfaces/report.hpp"
4#include "interfaces/report_factory.hpp"
5#include "interfaces/report_manager.hpp"
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +02006
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02007#include <sdbusplus/asio/object_server.hpp>
8
9#include <chrono>
10#include <memory>
11#include <vector>
12
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020013class ReportManager : public interfaces::ReportManager
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020014{
15 public:
16 ReportManager(
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020017 std::unique_ptr<interfaces::ReportFactory> reportFactory,
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020018 const std::shared_ptr<sdbusplus::asio::object_server>& objServer);
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020019 ~ReportManager() = default;
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020020
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020021 ReportManager(ReportManager&) = delete;
22 ReportManager(ReportManager&&) = delete;
23 ReportManager& operator=(ReportManager&) = delete;
24 ReportManager& operator=(ReportManager&&) = delete;
25
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020026 void removeReport(const interfaces::Report* report) override;
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020027 static bool verifyScanPeriod(const uint64_t scanPeriod);
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020028
29 private:
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020030 std::unique_ptr<interfaces::ReportFactory> reportFactory;
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020031 std::shared_ptr<sdbusplus::asio::object_server> objServer;
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020032 std::unique_ptr<sdbusplus::asio::dbus_interface> reportManagerIface;
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020033 std::vector<std::unique_ptr<interfaces::Report>> reports;
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020034
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020035 public:
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020036 static constexpr uint32_t maxReports{20};
37 static constexpr std::chrono::milliseconds minInterval{1000};
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020038 static constexpr const char* reportManagerIfaceName =
39 "xyz.openbmc_project.Telemetry.ReportManager";
40 static constexpr const char* reportManagerPath =
41 "/xyz/openbmc_project/Telemetry/Reports";
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020042};