Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Cezary Zwolak | a4e6761 | 2021-02-18 13:16:16 +0100 | [diff] [blame] | 3 | #include "interfaces/json_storage.hpp" |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 4 | #include "interfaces/sensor.hpp" |
| 5 | #include "interfaces/threshold.hpp" |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 6 | #include "interfaces/trigger.hpp" |
| 7 | #include "interfaces/trigger_manager.hpp" |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 8 | #include "sensor.hpp" |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 9 | #include "types/trigger_types.hpp" |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 10 | |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 11 | #include <boost/asio/spawn.hpp> |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 12 | #include <sdbusplus/message/types.hpp> |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 13 | |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 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( |
Szymon Dompke | e28aa53 | 2021-10-27 12:33:12 +0200 | [diff] [blame] | 26 | const std::string& id, const std::string& name, |
| 27 | const std::vector<std::string>& triggerActions, |
Krzysztof Grobelny | b8cc78d | 2021-11-29 15:54:53 +0100 | [diff] [blame] | 28 | const std::vector<std::string>& reportIds, |
Cezary Zwolak | a4e6761 | 2021-02-18 13:16:16 +0100 | [diff] [blame] | 29 | interfaces::TriggerManager& triggerManager, |
Cezary Zwolak | 4416fce | 2021-03-17 03:21:06 +0100 | [diff] [blame] | 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; |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 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, |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame^] | 43 | const std::string& triggerId, |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 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; |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | } // namespace interfaces |