blob: c1f2473ec02797eb2e1ab94fd504a0d300e2b655 [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,
26 interfaces::TriggerManager& triggerManager) const override;
27
28 private:
29 std::shared_ptr<sdbusplus::asio::connection> bus;
30 std::shared_ptr<sdbusplus::asio::object_server> objServer;
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010031 SensorCache& sensorCache;
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010032 interfaces::ReportManager& reportManager;
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010033
34 std::pair<std::vector<std::shared_ptr<interfaces::Sensor>>,
35 std::vector<std::string>>
36 getSensors(boost::asio::yield_context& yield,
37 const std::vector<
38 std::pair<sdbusplus::message::object_path, std::string>>&
39 sensorPaths) const;
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010040};