blob: 947af43296770c31ed9ccd46655aa5efcf7de00d [file] [log] [blame]
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01001#pragma once
2
Cezary Zwolaka4e67612021-02-18 13:16:16 +01003#include "interfaces/json_storage.hpp"
Szymon Dompke94f71c52021-12-10 07:16:33 +01004#include "interfaces/sensor.hpp"
5#include "interfaces/threshold.hpp"
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01006#include "interfaces/trigger.hpp"
7#include "interfaces/trigger_manager.hpp"
Szymon Dompke94f71c52021-12-10 07:16:33 +01008#include "sensor.hpp"
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +00009#include "types/trigger_types.hpp"
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010010
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010011#include <boost/asio/spawn.hpp>
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010012#include <sdbusplus/message/types.hpp>
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010013
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010014#include <memory>
15#include <utility>
16
17namespace interfaces
18{
19
20class TriggerFactory
21{
22 public:
23 virtual ~TriggerFactory() = default;
24
25 virtual std::unique_ptr<interfaces::Trigger> make(
Szymon Dompkee28aa532021-10-27 12:33:12 +020026 const std::string& id, const std::string& name,
27 const std::vector<std::string>& triggerActions,
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010028 const std::vector<std::string>& reportIds,
Cezary Zwolaka4e67612021-02-18 13:16:16 +010029 interfaces::TriggerManager& triggerManager,
Cezary Zwolak4416fce2021-03-17 03:21:06 +010030 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 Dompke94f71c52021-12-10 07:16:33 +010037
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 Dompkeb7b7e1b2022-05-19 10:15:48 +020043 const std::string& triggerId,
Szymon Dompke94f71c52021-12-10 07:16:33 +010044 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, Jozef76833cb2020-12-21 14:42:41 +010052};
53
54} // namespace interfaces