blob: a6fbb68f87f97f3464e33b5595dbd90547ceb2da [file] [log] [blame]
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01001#pragma once
2
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +01003#include "interfaces/report_manager.hpp"
Wludzik, Jozef1477fe62021-01-02 11:56:10 +01004#include "interfaces/sensor.hpp"
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01005#include "interfaces/trigger_factory.hpp"
Wludzik, Jozef1477fe62021-01-02 11:56:10 +01006#include "sensor_cache.hpp"
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01007
8#include <sdbusplus/asio/object_server.hpp>
9
10class TriggerFactory : public interfaces::TriggerFactory
11{
12 public:
13 TriggerFactory(std::shared_ptr<sdbusplus::asio::connection> bus,
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010014 std::shared_ptr<sdbusplus::asio::object_server> objServer,
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010015 SensorCache& sensorCache,
16 interfaces::ReportManager& reportManager);
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010017
18 std::unique_ptr<interfaces::Trigger> make(
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010019 boost::asio::yield_context& yield, const std::string& name,
20 bool isDiscrete, bool logToJournal, bool logToRedfish,
21 bool updateReport,
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010022 const std::vector<
23 std::pair<sdbusplus::message::object_path, std::string>>& sensors,
24 const std::vector<std::string>& reportNames,
25 const TriggerThresholdParams& thresholdParams,
Cezary Zwolaka4e67612021-02-18 13:16:16 +010026 interfaces::TriggerManager& triggerManager,
27 interfaces::JsonStorage& triggerStorage) const override;
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010028
29 private:
30 std::shared_ptr<sdbusplus::asio::connection> bus;
31 std::shared_ptr<sdbusplus::asio::object_server> objServer;
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010032 SensorCache& sensorCache;
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010033 interfaces::ReportManager& reportManager;
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010034
35 std::pair<std::vector<std::shared_ptr<interfaces::Sensor>>,
36 std::vector<std::string>>
37 getSensors(boost::asio::yield_context& yield,
38 const std::vector<
39 std::pair<sdbusplus::message::object_path, std::string>>&
40 sensorPaths) const;
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010041};