1 #pragma once 2 3 #include "interfaces/trigger_types.hpp" 4 5 #include <sdbusplus/message.hpp> 6 7 #include <chrono> 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 55 const TriggerThresholdParams& thresholdParams() const 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>> 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 {numeric::typeToString(numeric::Type::lowerCritical), 75 std::chrono::milliseconds(10).count(), 76 numeric::directionToString(numeric::Direction::decreasing), 0.0}, 77 {numeric::typeToString(numeric::Type::upperCritical), 78 std::chrono::milliseconds(10).count(), 79 numeric::directionToString(numeric::Direction::increasing), 90.0}}; 80 }; 81