Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 3 | #include "interfaces/report_manager.hpp" |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 4 | #include "interfaces/sensor.hpp" |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 5 | #include "interfaces/trigger_factory.hpp" |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 6 | #include "sensor_cache.hpp" |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 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, |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 14 | std::shared_ptr<sdbusplus::asio::object_server> objServer, |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 15 | SensorCache& sensorCache, |
| 16 | interfaces::ReportManager& reportManager); |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 17 | |
Cezary Zwolak | 4416fce | 2021-03-17 03:21:06 +0100 | [diff] [blame] | 18 | std::unique_ptr<interfaces::Trigger> |
Szymon Dompke | e28aa53 | 2021-10-27 12:33:12 +0200 | [diff] [blame] | 19 | make(const std::string& id, const std::string& name, |
Szymon Dompke | 2001301 | 2021-07-23 09:54:20 +0200 | [diff] [blame] | 20 | const std::vector<std::string>& triggerActions, |
Krzysztof Grobelny | b8cc78d | 2021-11-29 15:54:53 +0100 | [diff] [blame] | 21 | const std::vector<std::string>& reportIds, |
Cezary Zwolak | 4416fce | 2021-03-17 03:21:06 +0100 | [diff] [blame] | 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; |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 31 | |
| 32 | private: |
| 33 | std::shared_ptr<sdbusplus::asio::connection> bus; |
| 34 | std::shared_ptr<sdbusplus::asio::object_server> objServer; |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 35 | SensorCache& sensorCache; |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 36 | interfaces::ReportManager& reportManager; |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 37 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 38 | std::pair<Sensors, std::vector<std::string>> getSensors( |
| 39 | const std::vector<LabeledSensorInfo>& labeledSensorsInfo) const; |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 40 | }; |