Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "interfaces/trigger_types.hpp" |
| 4 | |
Krzysztof Grobelny | e8fc575 | 2021-02-05 14:30:45 +0000 | [diff] [blame] | 5 | #include <sdbusplus/message.hpp> |
| 6 | |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 7 | #include <chrono> |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 8 | #include <utility> |
| 9 | |
| 10 | class TriggerParams |
| 11 | { |
| 12 | public: |
| 13 | TriggerParams& name(std::string val) |
| 14 | { |
| 15 | nameProperty = std::move(val); |
| 16 | return *this; |
| 17 | } |
| 18 | |
| 19 | const std::string& name() const |
| 20 | { |
| 21 | return nameProperty; |
| 22 | } |
| 23 | |
| 24 | bool isDiscrete() const |
| 25 | { |
| 26 | return discreteProperty; |
| 27 | } |
| 28 | |
| 29 | bool logToJournal() const |
| 30 | { |
| 31 | return logToJournalProperty; |
| 32 | } |
| 33 | |
| 34 | bool logToRedfish() const |
| 35 | { |
| 36 | return logToRedfishProperty; |
| 37 | } |
| 38 | |
| 39 | bool updateReport() const |
| 40 | { |
| 41 | return updateReportProperty; |
| 42 | } |
| 43 | |
| 44 | const std::vector<std::pair<sdbusplus::message::object_path, std::string>>& |
| 45 | sensors() const |
| 46 | { |
| 47 | return sensorsProperty; |
| 48 | } |
| 49 | |
| 50 | const std::vector<std::string>& reportNames() const |
| 51 | { |
| 52 | return reportNamesProperty; |
| 53 | } |
| 54 | |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 55 | const TriggerThresholdParams& thresholdParams() const |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 56 | { |
| 57 | return thresholdsProperty; |
| 58 | } |
| 59 | |
| 60 | private: |
| 61 | std::string nameProperty = "Trigger1"; |
| 62 | bool discreteProperty = false; |
| 63 | bool logToJournalProperty = false; |
| 64 | bool logToRedfishProperty = false; |
| 65 | bool updateReportProperty = false; |
| 66 | std::vector<std::pair<sdbusplus::message::object_path, std::string>> |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 67 | sensorsProperty = { |
| 68 | {sdbusplus::message::object_path( |
| 69 | "/xyz/openbmc_project/sensors/temperature/BMC_Temp"), |
| 70 | ""}}; |
| 71 | std::vector<std::string> reportNamesProperty = {"Report1"}; |
| 72 | TriggerThresholdParams thresholdsProperty = |
| 73 | std::vector<numeric::ThresholdParam>{ |
| 74 | {static_cast<int>(numeric::Type::lowerCritical), |
| 75 | std::chrono::milliseconds(10).count(), |
| 76 | static_cast<int>(numeric::Direction::decreasing), 0.0}, |
| 77 | {static_cast<int>(numeric::Type::upperCritical), |
| 78 | std::chrono::milliseconds(10).count(), |
| 79 | static_cast<int>(numeric::Direction::increasing), 90.0}}; |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 80 | }; |