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