blob: 7c13e55d843fc2afff4238a968e0e26a1aa38426 [file] [log] [blame]
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01001#pragma once
2
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +01003#include "interfaces/report_manager.hpp"
Wludzik, Jozef1477fe62021-01-02 11:56:10 +01004#include "interfaces/sensor.hpp"
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01005#include "interfaces/trigger_factory.hpp"
Wludzik, Jozef1477fe62021-01-02 11:56:10 +01006#include "sensor_cache.hpp"
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01007
8#include <sdbusplus/asio/object_server.hpp>
9
10class TriggerFactory : public interfaces::TriggerFactory
11{
12 public:
13 TriggerFactory(std::shared_ptr<sdbusplus::asio::connection> bus,
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010014 std::shared_ptr<sdbusplus::asio::object_server> objServer,
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010015 SensorCache& sensorCache,
16 interfaces::ReportManager& reportManager);
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010017
Cezary Zwolak4416fce2021-03-17 03:21:06 +010018 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, Jozef76833cb2020-12-21 14:42:41 +010031
32 private:
33 std::shared_ptr<sdbusplus::asio::connection> bus;
34 std::shared_ptr<sdbusplus::asio::object_server> objServer;
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010035 SensorCache& sensorCache;
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010036 interfaces::ReportManager& reportManager;
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010037
38 std::pair<std::vector<std::shared_ptr<interfaces::Sensor>>,
39 std::vector<std::string>>
Cezary Zwolak4416fce2021-03-17 03:21:06 +010040 getSensors(
41 const std::vector<LabeledSensorInfo>& labeledSensorsInfo) const;
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010042};