blob: 6d34d3b3e31cad174bdd6f2ef248e72da8200268 [file] [log] [blame]
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01001#pragma once
2
3#include "interfaces/trigger_types.hpp"
4
Krzysztof Grobelnye8fc5752021-02-05 14:30:45 +00005#include <sdbusplus/message.hpp>
6
Wludzik, Jozef1477fe62021-01-02 11:56:10 +01007#include <chrono>
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01008#include <utility>
9
10class 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, Jozef1477fe62021-01-02 11:56:10 +010055 const TriggerThresholdParams& thresholdParams() const
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010056 {
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, Jozef1477fe62021-01-02 11:56:10 +010067 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>{
Wludzik, Jozef9f145912021-02-11 08:54:10 +010074 {numeric::typeToString(numeric::Type::lowerCritical),
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010075 std::chrono::milliseconds(10).count(),
Wludzik, Jozef9f145912021-02-11 08:54:10 +010076 numeric::directionToString(numeric::Direction::decreasing), 0.0},
77 {numeric::typeToString(numeric::Type::upperCritical),
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010078 std::chrono::milliseconds(10).count(),
Wludzik, Jozef9f145912021-02-11 08:54:10 +010079 numeric::directionToString(numeric::Direction::increasing), 90.0}};
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010080};