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 | |
| 18 | std::unique_ptr<interfaces::Trigger> make( |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 19 | boost::asio::yield_context& yield, const std::string& name, |
| 20 | bool isDiscrete, bool logToJournal, bool logToRedfish, |
| 21 | bool updateReport, |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 22 | const std::vector< |
| 23 | std::pair<sdbusplus::message::object_path, std::string>>& sensors, |
| 24 | const std::vector<std::string>& reportNames, |
| 25 | const TriggerThresholdParams& thresholdParams, |
| 26 | interfaces::TriggerManager& triggerManager) const override; |
| 27 | |
| 28 | private: |
| 29 | std::shared_ptr<sdbusplus::asio::connection> bus; |
| 30 | std::shared_ptr<sdbusplus::asio::object_server> objServer; |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 31 | SensorCache& sensorCache; |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 32 | interfaces::ReportManager& reportManager; |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 33 | |
| 34 | std::pair<std::vector<std::shared_ptr<interfaces::Sensor>>, |
| 35 | std::vector<std::string>> |
| 36 | getSensors(boost::asio::yield_context& yield, |
| 37 | const std::vector< |
| 38 | std::pair<sdbusplus::message::object_path, std::string>>& |
| 39 | sensorPaths) const; |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 40 | }; |