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::string& triggerId,
44         const std::vector<::TriggerAction>& triggerActions,
45         const std::shared_ptr<std::vector<std::string>>& reportIds,
46         const Sensors& sensors,
47         const LabeledTriggerThresholdParams& newParams) const = 0;
48 
49     virtual void updateSensors(
50         Sensors& currentSensors,
51         const std::vector<LabeledSensorInfo>& labeledSensorsInfo) const = 0;
52 };
53 
54 } // namespace interfaces
55