blob: e671b6c9a31ee0389ad4f8f9d1a0c054bd9eea72 [file] [log] [blame]
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02001#pragma once
2
Wludzik, Jozefe2362792020-10-27 17:23:55 +01003#include "persistent_json_storage.hpp"
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +02004#include "report_factory.hpp"
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02005#include "report_manager.hpp"
Krzysztof Grobelny6ccfcbf2020-11-04 09:31:36 +01006#include "sensor_cache.hpp"
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01007#include "trigger_factory.hpp"
8#include "trigger_manager.hpp"
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02009
10#include <sdbusplus/asio/connection.hpp>
11#include <sdbusplus/asio/object_server.hpp>
12
13#include <memory>
14
15class Telemetry
16{
17 public:
Krzysztof Grobelnyfbeb5bf2022-01-03 09:41:29 +010018 explicit Telemetry(std::shared_ptr<sdbusplus::asio::connection> bus) :
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020019 objServer(std::make_shared<sdbusplus::asio::object_server>(bus)),
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010020 reportManager(
21 std::make_unique<ReportFactory>(bus, objServer, sensorCache),
22 std::make_unique<PersistentJsonStorage>(
23 interfaces::JsonStorage::DirectoryPath(
24 "/var/lib/telemetry/Reports")),
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010025 objServer),
26 triggerManager(
27 std::make_unique<TriggerFactory>(bus, objServer, sensorCache),
Szymon Dompkeb4ef22e2022-02-07 15:15:12 +010028 std::make_unique<PersistentJsonStorage>(
29 interfaces::JsonStorage::DirectoryPath(
30 "/var/lib/telemetry/Triggers")),
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010031 objServer)
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020032 {}
33
34 private:
35 std::shared_ptr<sdbusplus::asio::object_server> objServer;
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010036 mutable SensorCache sensorCache;
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020037 ReportManager reportManager;
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010038 TriggerManager triggerManager;
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020039};