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> 19 make(const std::string& id, const std::string& name, 20 const std::vector<std::string>& triggerActions, 21 const std::vector<std::string>& reportIds, 22 interfaces::TriggerManager& triggerManager, 23 interfaces::JsonStorage& triggerStorage, 24 const LabeledTriggerThresholdParams& labeledThresholdParams, 25 const std::vector<LabeledSensorInfo>& labeledSensorsinfo) 26 const override; 27 28 std::vector<LabeledSensorInfo> 29 getLabeledSensorsInfo(boost::asio::yield_context& yield, 30 const SensorsInfo& sensorsInfo) const override; 31 32 private: 33 std::shared_ptr<sdbusplus::asio::connection> bus; 34 std::shared_ptr<sdbusplus::asio::object_server> objServer; 35 SensorCache& sensorCache; 36 interfaces::ReportManager& reportManager; 37 38 std::pair<Sensors, std::vector<std::string>> getSensors( 39 const std::vector<LabeledSensorInfo>& labeledSensorsInfo) const; 40 }; 41