blob: 1160a6f2f5fd947dd2e0f71deed3251ca7b6226e [file] [log] [blame]
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +02001#pragma once
2
3#include "interfaces/report_factory.hpp"
Wludzik, Jozefe2362792020-10-27 17:23:55 +01004#include "interfaces/sensor.hpp"
Krzysztof Grobelny6ccfcbf2020-11-04 09:31:36 +01005#include "sensor_cache.hpp"
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +02006
7#include <boost/asio/io_context.hpp>
8#include <sdbusplus/asio/object_server.hpp>
9
10class ReportFactory : public interfaces::ReportFactory
11{
12 public:
13 ReportFactory(
Wludzik, Jozefe2362792020-10-27 17:23:55 +010014 std::shared_ptr<sdbusplus::asio::connection> bus,
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010015 const std::shared_ptr<sdbusplus::asio::object_server>& objServer,
16 SensorCache& sensorCache);
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020017
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000018 std::vector<LabeledMetricParameters> convertMetricParams(
19 boost::asio::yield_context& yield,
20 const ReadingParameters& metricParams) const override;
21
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +000022 std::unique_ptr<interfaces::Report>
23 make(const std::string& name, const std::string& reportingType,
24 bool emitsReadingsSignal, bool logToMetricReportsCollection,
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000025 Milliseconds period, interfaces::ReportManager& reportManager,
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +000026 interfaces::JsonStorage& reportStorage,
27 std::vector<LabeledMetricParameters> labeledMetricParams)
28 const override;
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020029
30 private:
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000031 Sensors getSensors(
32 const std::vector<LabeledSensorParameters>& sensorPaths) const;
Krzysztof Grobelny6ccfcbf2020-11-04 09:31:36 +010033
Wludzik, Jozefe2362792020-10-27 17:23:55 +010034 std::shared_ptr<sdbusplus::asio::connection> bus;
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020035 std::shared_ptr<sdbusplus::asio::object_server> objServer;
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010036 SensorCache& sensorCache;
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020037};