Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include "interfaces/trigger.hpp" |
| 4 | #include "interfaces/trigger_manager.hpp" |
| 5 | #include "interfaces/trigger_types.hpp" |
| 6 | |
| 7 | #include <boost/asio/io_context.hpp> |
| 8 | #include <sdbusplus/asio/object_server.hpp> |
| 9 | |
| 10 | #include <memory> |
| 11 | |
| 12 | class Trigger : public interfaces::Trigger |
| 13 | { |
| 14 | public: |
| 15 | Trigger( |
| 16 | boost::asio::io_context& ioc, |
| 17 | const std::shared_ptr<sdbusplus::asio::object_server>& objServer, |
| 18 | const std::string& name, const bool isDiscrete, const bool logToJournal, |
| 19 | const bool logToRedfish, const bool updateReport, |
| 20 | const std::vector< |
| 21 | std::pair<sdbusplus::message::object_path, std::string>>& sensorsIn, |
| 22 | const std::vector<std::string>& reportNames, |
| 23 | const TriggerThresholdParams& thresholds, |
| 24 | interfaces::TriggerManager& triggerManager); |
| 25 | |
| 26 | Trigger(const Trigger&) = delete; |
| 27 | Trigger(Trigger&&) = delete; |
| 28 | Trigger& operator=(const Trigger&) = delete; |
| 29 | Trigger& operator=(Trigger&&) = delete; |
| 30 | |
| 31 | std::string getName() const override |
| 32 | { |
| 33 | return name; |
| 34 | } |
| 35 | |
| 36 | std::string getPath() const override |
| 37 | { |
| 38 | return path; |
| 39 | } |
| 40 | |
| 41 | private: |
| 42 | const std::string name; |
| 43 | const std::string path; |
| 44 | bool persistent; |
| 45 | std::vector<std::pair<sdbusplus::message::object_path, std::string>> |
| 46 | sensors; |
| 47 | std::vector<std::string> reportNames; |
| 48 | TriggerThresholdParams thresholdParams; |
| 49 | |
| 50 | std::unique_ptr<sdbusplus::asio::dbus_interface> deleteIface; |
| 51 | std::unique_ptr<sdbusplus::asio::dbus_interface> triggerIface; |
| 52 | |
| 53 | public: |
| 54 | static constexpr const char* triggerIfaceName = |
| 55 | "xyz.openbmc_project.Telemetry.Trigger"; |
| 56 | static constexpr const char* triggerDir = |
| 57 | "/xyz/openbmc_project/Telemetry/Triggers/"; |
| 58 | static constexpr const char* deleteIfaceName = |
| 59 | "xyz.openbmc_project.Object.Delete"; |
| 60 | }; |