blob: 14f9f39f7ad4506776c56cbeb90e07bf187876b7 [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"
Szymon Dompke94f71c52021-12-10 07:16:33 +01006#include "types/sensor_types.hpp"
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +02007
8#include <boost/asio/io_context.hpp>
9#include <sdbusplus/asio/object_server.hpp>
10
11class ReportFactory : public interfaces::ReportFactory
12{
13 public:
14 ReportFactory(
Wludzik, Jozefe2362792020-10-27 17:23:55 +010015 std::shared_ptr<sdbusplus::asio::connection> bus,
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010016 const std::shared_ptr<sdbusplus::asio::object_server>& objServer,
17 SensorCache& sensorCache);
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020018
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000019 std::vector<LabeledMetricParameters> convertMetricParams(
20 boost::asio::yield_context& yield,
21 const ReadingParameters& metricParams) const override;
22
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +000023 std::unique_ptr<interfaces::Report>
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010024 make(const std::string& reportId, const std::string& name,
25 const ReportingType reportingType,
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010026 const std::vector<ReportAction>& reportActions,
Szymon Dompke3eb56862021-09-20 15:32:04 +020027 Milliseconds period, uint64_t appendLimitIn,
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010028 const ReportUpdates reportUpdatesIn,
Szymon Dompke3eb56862021-09-20 15:32:04 +020029 interfaces::ReportManager& reportManager,
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +000030 interfaces::JsonStorage& reportStorage,
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +020031 std::vector<LabeledMetricParameters> labeledMetricParams,
32 bool enabled) const override;
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020033
34 private:
Szymon Dompke94f71c52021-12-10 07:16:33 +010035 Sensors getSensors(const std::vector<LabeledSensorInfo>& sensorPaths) const;
Krzysztof Grobelny6ccfcbf2020-11-04 09:31:36 +010036
Wludzik, Jozefe2362792020-10-27 17:23:55 +010037 std::shared_ptr<sdbusplus::asio::connection> bus;
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020038 std::shared_ptr<sdbusplus::asio::object_server> objServer;
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010039 SensorCache& sensorCache;
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020040};