1 #pragma once 2 3 #include "interfaces/report_manager.hpp" 4 #include "interfaces/sensor.hpp" 5 #include "interfaces/trigger_factory.hpp" 6 #include "sensor_cache.hpp" 7 8 #include <sdbusplus/asio/object_server.hpp> 9 10 class TriggerFactory : public interfaces::TriggerFactory 11 { 12 public: 13 TriggerFactory(std::shared_ptr<sdbusplus::asio::connection> bus, 14 std::shared_ptr<sdbusplus::asio::object_server> objServer, 15 SensorCache& sensorCache, 16 interfaces::ReportManager& reportManager); 17 18 std::unique_ptr<interfaces::Trigger> make( 19 boost::asio::yield_context& yield, const std::string& name, 20 bool isDiscrete, bool logToJournal, bool logToRedfish, 21 bool updateReport, 22 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, 27 interfaces::JsonStorage& triggerStorage) const override; 28 29 private: 30 std::shared_ptr<sdbusplus::asio::connection> bus; 31 std::shared_ptr<sdbusplus::asio::object_server> objServer; 32 SensorCache& sensorCache; 33 interfaces::ReportManager& reportManager; 34 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; 41 }; 42