Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "interfaces/report_factory.hpp" |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 4 | #include "interfaces/sensor.hpp" |
Krzysztof Grobelny | 6ccfcbf | 2020-11-04 09:31:36 +0100 | [diff] [blame] | 5 | #include "sensor_cache.hpp" |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 6 | #include "types/sensor_types.hpp" |
Szymon Dompke | fdb06a1 | 2022-02-11 11:04:44 +0100 | [diff] [blame] | 7 | #include "utils/dbus_mapper.hpp" |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 8 | |
| 9 | #include <boost/asio/io_context.hpp> |
| 10 | #include <sdbusplus/asio/object_server.hpp> |
| 11 | |
| 12 | class ReportFactory : public interfaces::ReportFactory |
| 13 | { |
| 14 | public: |
| 15 | ReportFactory( |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 16 | std::shared_ptr<sdbusplus::asio::connection> bus, |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 17 | const std::shared_ptr<sdbusplus::asio::object_server>& objServer, |
| 18 | SensorCache& sensorCache); |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 19 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 20 | std::vector<LabeledMetricParameters> convertMetricParams( |
| 21 | boost::asio::yield_context& yield, |
| 22 | const ReadingParameters& metricParams) const override; |
| 23 | |
Szymon Dompke | fdb06a1 | 2022-02-11 11:04:44 +0100 | [diff] [blame] | 24 | std::vector<LabeledMetricParameters> convertMetricParams( |
| 25 | const ReadingParameters& metricParams) const override; |
| 26 | |
Szymon Dompke | 32305f1 | 2022-07-05 15:37:21 +0200 | [diff] [blame] | 27 | void updateMetrics( |
| 28 | std::vector<std::shared_ptr<interfaces::Metric>>& metrics, bool enabled, |
| 29 | const std::vector<LabeledMetricParameters>& labeledMetricParams) |
| 30 | const override; |
Szymon Dompke | fdb06a1 | 2022-02-11 11:04:44 +0100 | [diff] [blame] | 31 | |
Krzysztof Grobelny | e6d4887 | 2022-02-08 13:41:30 +0100 | [diff] [blame] | 32 | std::unique_ptr<interfaces::Report> |
| 33 | make(const std::string& reportId, const std::string& name, |
| 34 | const ReportingType reportingType, |
| 35 | const std::vector<ReportAction>& reportActions, |
| 36 | Milliseconds period, uint64_t appendLimitIn, |
| 37 | const ReportUpdates reportUpdatesIn, |
| 38 | interfaces::ReportManager& reportManager, |
| 39 | interfaces::JsonStorage& reportStorage, |
| 40 | std::vector<LabeledMetricParameters> labeledMetricParams, |
Krzysztof Grobelny | 493e62e | 2022-02-14 10:55:50 +0100 | [diff] [blame] | 41 | bool enabled, Readings) const override; |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 42 | |
| 43 | private: |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 44 | Sensors getSensors(const std::vector<LabeledSensorInfo>& sensorPaths) const; |
Szymon Dompke | fdb06a1 | 2022-02-11 11:04:44 +0100 | [diff] [blame] | 45 | std::vector<LabeledMetricParameters> getMetricParamsFromSensorTree( |
| 46 | const ReadingParameters& metricParams, |
| 47 | const std::vector<utils::SensorTree>& tree) const; |
Krzysztof Grobelny | 6ccfcbf | 2020-11-04 09:31:36 +0100 | [diff] [blame] | 48 | |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 49 | std::shared_ptr<sdbusplus::asio::connection> bus; |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 50 | std::shared_ptr<sdbusplus::asio::object_server> objServer; |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 51 | SensorCache& sensorCache; |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 52 | }; |