Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 3 | #include "persistent_json_storage.hpp" |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 4 | #include "report_factory.hpp" |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 5 | #include "report_manager.hpp" |
Krzysztof Grobelny | 6ccfcbf | 2020-11-04 09:31:36 +0100 | [diff] [blame] | 6 | #include "sensor_cache.hpp" |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 7 | #include "trigger_factory.hpp" |
| 8 | #include "trigger_manager.hpp" |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 9 | |
| 10 | #include <sdbusplus/asio/connection.hpp> |
| 11 | #include <sdbusplus/asio/object_server.hpp> |
| 12 | |
| 13 | #include <memory> |
| 14 | |
| 15 | class Telemetry |
| 16 | { |
| 17 | public: |
Krzysztof Grobelny | fbeb5bf | 2022-01-03 09:41:29 +0100 | [diff] [blame] | 18 | explicit Telemetry(std::shared_ptr<sdbusplus::asio::connection> bus) : |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 19 | objServer(std::make_shared<sdbusplus::asio::object_server>(bus)), |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 20 | reportManager( |
| 21 | std::make_unique<ReportFactory>(bus, objServer, sensorCache), |
| 22 | std::make_unique<PersistentJsonStorage>( |
| 23 | interfaces::JsonStorage::DirectoryPath( |
| 24 | "/var/lib/telemetry/Reports")), |
Krzysztof Grobelny | e6d4887 | 2022-02-08 13:41:30 +0100 | [diff] [blame] | 25 | objServer), |
| 26 | triggerManager( |
| 27 | std::make_unique<TriggerFactory>(bus, objServer, sensorCache), |
Szymon Dompke | b4ef22e | 2022-02-07 15:15:12 +0100 | [diff] [blame] | 28 | std::make_unique<PersistentJsonStorage>( |
| 29 | interfaces::JsonStorage::DirectoryPath( |
| 30 | "/var/lib/telemetry/Triggers")), |
Krzysztof Grobelny | e6d4887 | 2022-02-08 13:41:30 +0100 | [diff] [blame] | 31 | objServer) |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 32 | {} |
| 33 | |
| 34 | private: |
| 35 | std::shared_ptr<sdbusplus::asio::object_server> objServer; |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 36 | mutable SensorCache sensorCache; |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 37 | ReportManager reportManager; |
Krzysztof Grobelny | e6d4887 | 2022-02-08 13:41:30 +0100 | [diff] [blame] | 38 | TriggerManager triggerManager; |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 39 | }; |