xref: /openbmc/telemetry/src/telemetry.hpp (revision e6d4887453f0b23b46c012da7cb26f2beb38ef0e)
164b75a5bSKrzysztof Grobelny #pragma once
264b75a5bSKrzysztof Grobelny 
3e2362796SWludzik, Jozef #include "persistent_json_storage.hpp"
42f9f9b87SWludzik, Jozef #include "report_factory.hpp"
564b75a5bSKrzysztof Grobelny #include "report_manager.hpp"
66ccfcbf5SKrzysztof Grobelny #include "sensor_cache.hpp"
776833cb5SWludzik, Jozef #include "trigger_factory.hpp"
876833cb5SWludzik, Jozef #include "trigger_manager.hpp"
964b75a5bSKrzysztof Grobelny 
1064b75a5bSKrzysztof Grobelny #include <sdbusplus/asio/connection.hpp>
1164b75a5bSKrzysztof Grobelny #include <sdbusplus/asio/object_server.hpp>
1264b75a5bSKrzysztof Grobelny 
1364b75a5bSKrzysztof Grobelny #include <memory>
1464b75a5bSKrzysztof Grobelny 
1564b75a5bSKrzysztof Grobelny class Telemetry
1664b75a5bSKrzysztof Grobelny {
1764b75a5bSKrzysztof Grobelny   public:
Telemetry(std::shared_ptr<sdbusplus::asio::connection> bus)18fbeb5bf4SKrzysztof Grobelny     explicit Telemetry(std::shared_ptr<sdbusplus::asio::connection> bus) :
1964b75a5bSKrzysztof Grobelny         objServer(std::make_shared<sdbusplus::asio::object_server>(bus)),
201477fe6aSWludzik, Jozef         reportManager(
211477fe6aSWludzik, Jozef             std::make_unique<ReportFactory>(bus, objServer, sensorCache),
22e2362796SWludzik, Jozef             std::make_unique<PersistentJsonStorage>(
23e2362796SWludzik, Jozef                 interfaces::JsonStorage::DirectoryPath(
24e2362796SWludzik, Jozef                     "/var/lib/telemetry/Reports")),
25*e6d48874SKrzysztof Grobelny             objServer),
26*e6d48874SKrzysztof Grobelny         triggerManager(
27*e6d48874SKrzysztof Grobelny             std::make_unique<TriggerFactory>(bus, objServer, sensorCache),
28a4e67616SCezary Zwolak             std::make_unique<PersistentJsonStorage>(
29a4e67616SCezary Zwolak                 interfaces::JsonStorage::DirectoryPath(
30a4e67616SCezary Zwolak                     "/var/lib/telemetry/Triggers")),
31*e6d48874SKrzysztof Grobelny             objServer)
3264b75a5bSKrzysztof Grobelny     {}
3364b75a5bSKrzysztof Grobelny 
3464b75a5bSKrzysztof Grobelny   private:
3564b75a5bSKrzysztof Grobelny     std::shared_ptr<sdbusplus::asio::object_server> objServer;
361477fe6aSWludzik, Jozef     mutable SensorCache sensorCache;
3764b75a5bSKrzysztof Grobelny     ReportManager reportManager;
38*e6d48874SKrzysztof Grobelny     TriggerManager triggerManager;
3964b75a5bSKrzysztof Grobelny };
40