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> |
| 19 | make(const std::string& name, bool isDiscrete, bool logToJournal, |
| 20 | bool logToRedfish, bool updateReport, |
| 21 | const std::vector<std::string>& reportNames, |
| 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 | }; |