#pragma once #include "interfaces/json_storage.hpp" #include "interfaces/metric.hpp" #include "interfaces/report.hpp" #include "interfaces/report_manager.hpp" #include "types/report_types.hpp" #include #include #include #include #include class Report : public interfaces::Report { public: Report(boost::asio::io_context& ioc, const std::shared_ptr& objServer, const std::string& reportName, const std::string& reportingType, const bool emitsReadingsSignal, const bool logToMetricReportsCollection, const Milliseconds period, interfaces::ReportManager& reportManager, interfaces::JsonStorage& reportStorage, std::vector> metrics, const bool enabled); ~Report() = default; Report(const Report&) = delete; Report(Report&&) = delete; Report& operator=(const Report&) = delete; Report& operator=(Report&&) = delete; std::string getName() const override { return name; } std::string getPath() const override { return path; } void updateReadings() override; bool storeConfiguration() const; private: std::unique_ptr makeReportInterface(); static void timerProc(boost::system::error_code, Report& self); void scheduleTimer(Milliseconds interval); const std::string name; const std::string path; std::string reportingType; Milliseconds interval; bool emitsReadingsUpdate; bool logToMetricReportsCollection; ReadingParametersPastVersion readingParametersPastVersion; ReadingParameters readingParameters; bool persistency = false; Readings cachedReadings = {}; Readings readings = {}; std::shared_ptr objServer; std::unique_ptr reportIface; std::unique_ptr deleteIface; std::vector> metrics; boost::asio::steady_timer timer; interfaces::JsonStorage::FilePath fileName; interfaces::JsonStorage& reportStorage; bool enabled; public: static constexpr const char* reportIfaceName = "xyz.openbmc_project.Telemetry.Report"; static constexpr const char* reportDir = "/xyz/openbmc_project/Telemetry/Reports/"; static constexpr const char* deleteIfaceName = "xyz.openbmc_project.Object.Delete"; static constexpr size_t reportVersion = 4; };