blob: 15f5898a3a792e96adcae66ce80d8c573f9177fb [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>
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010023 make(const std::string& name, const ReportingType reportingType,
24 const std::vector<ReportAction>& reportActions,
Szymon Dompke3eb56862021-09-20 15:32:04 +020025 Milliseconds period, uint64_t appendLimitIn,
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010026 const ReportUpdates reportUpdatesIn,
Szymon Dompke3eb56862021-09-20 15:32:04 +020027 interfaces::ReportManager& reportManager,
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +000028 interfaces::JsonStorage& reportStorage,
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +020029 std::vector<LabeledMetricParameters> labeledMetricParams,
30 bool enabled) const override;
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020031
32 private:
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000033 Sensors getSensors(
34 const std::vector<LabeledSensorParameters>& sensorPaths) const;
Krzysztof Grobelny6ccfcbf2020-11-04 09:31:36 +010035
Wludzik, Jozefe2362792020-10-27 17:23:55 +010036 std::shared_ptr<sdbusplus::asio::connection> bus;
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020037 std::shared_ptr<sdbusplus::asio::object_server> objServer;
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010038 SensorCache& sensorCache;
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020039};