1 #pragma once 2 3 #include "interfaces/json_storage.hpp" 4 #include "interfaces/sensor.hpp" 5 #include "interfaces/threshold.hpp" 6 #include "interfaces/trigger.hpp" 7 #include "interfaces/trigger_manager.hpp" 8 #include "sensor.hpp" 9 #include "types/trigger_types.hpp" 10 11 #include <boost/asio/spawn.hpp> 12 #include <sdbusplus/message/types.hpp> 13 14 #include <memory> 15 #include <utility> 16 17 namespace interfaces 18 { 19 20 class TriggerFactory 21 { 22 public: 23 virtual ~TriggerFactory() = default; 24 25 virtual std::unique_ptr<interfaces::Trigger> make( 26 const std::string& id, const std::string& name, 27 const std::vector<std::string>& triggerActions, 28 const std::vector<std::string>& reportIds, 29 interfaces::TriggerManager& triggerManager, 30 interfaces::JsonStorage& triggerStorage, 31 const LabeledTriggerThresholdParams& labeledThresholdParams, 32 const std::vector<LabeledSensorInfo>& labeledSensorsInfo) const = 0; 33 34 virtual std::vector<LabeledSensorInfo> 35 getLabeledSensorsInfo(boost::asio::yield_context& yield, 36 const SensorsInfo& sensorsInfo) const = 0; 37 38 virtual std::vector<LabeledSensorInfo> 39 getLabeledSensorsInfo(const SensorsInfo& sensorsInfo) const = 0; 40 41 virtual void updateThresholds( 42 std::vector<std::shared_ptr<interfaces::Threshold>>& currentThresholds, 43 const std::vector<::TriggerAction>& triggerActions, 44 const std::shared_ptr<std::vector<std::string>>& reportIds, 45 const Sensors& sensors, 46 const LabeledTriggerThresholdParams& newParams) const = 0; 47 48 virtual void updateSensors( 49 Sensors& currentSensors, 50 const std::vector<LabeledSensorInfo>& labeledSensorsInfo) const = 0; 51 }; 52 53 } // namespace interfaces 54