blob: 464c68bcc9ac895c68b44add2ad5c945a6b128fd [file] [log] [blame]
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01001#pragma once
2
3#include "interfaces/trigger_types.hpp"
4
Wludzik, Jozef1477fe62021-01-02 11:56:10 +01005#include <chrono>
Wludzik, Jozef76833cb2020-12-21 14:42:41 +01006#include <utility>
7
8class 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, Jozef1477fe62021-01-02 11:56:10 +010053 const TriggerThresholdParams& thresholdParams() const
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010054 {
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, Jozef1477fe62021-01-02 11:56:10 +010065 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, Jozef76833cb2020-12-21 14:42:41 +010078};