blob: 408bcb5e14200e2df2252416be278b9af16a78ed [file] [log] [blame]
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +01001#pragma once
2
3#include "interfaces/report_manager.hpp"
4#include "interfaces/trigger_action.hpp"
5#include "interfaces/trigger_types.hpp"
6
7namespace action
8{
9
Szymon Dompkef763c9e2021-03-12 09:19:22 +010010namespace numeric
11{
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010012class LogToJournal : public interfaces::TriggerAction
13{
14 public:
Szymon Dompkef763c9e2021-03-12 09:19:22 +010015 LogToJournal(::numeric::Type type, double val) : type(type), threshold(val)
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010016 {}
17
18 void commit(const std::string& id, uint64_t timestamp,
19 double value) override;
20
21 private:
Szymon Dompkef763c9e2021-03-12 09:19:22 +010022 ::numeric::Type type;
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010023 double threshold;
24
25 const char* getType() const;
26};
27
28class LogToRedfish : public interfaces::TriggerAction
29{
30 public:
Szymon Dompkef763c9e2021-03-12 09:19:22 +010031 LogToRedfish(::numeric::Type type, double val) : type(type), threshold(val)
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010032 {}
33
34 void commit(const std::string& id, uint64_t timestamp,
35 double value) override;
36
37 private:
Szymon Dompkef763c9e2021-03-12 09:19:22 +010038 ::numeric::Type type;
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010039 double threshold;
40
41 const char* getMessageId() const;
42};
Szymon Dompkef763c9e2021-03-12 09:19:22 +010043} // namespace numeric
44
45namespace discrete
46{
47class LogToJournal : public interfaces::TriggerAction
48{
49 public:
50 LogToJournal(::discrete::Severity severity) : severity(severity)
51 {}
52
53 void commit(const std::string& id, uint64_t timestamp,
54 double value) override;
55
56 private:
57 ::discrete::Severity severity;
58
59 const char* getSeverity() const;
60};
61
62class LogToRedfish : public interfaces::TriggerAction
63{
64 public:
65 LogToRedfish(::discrete::Severity severity) : severity(severity)
66 {}
67
68 void commit(const std::string& id, uint64_t timestamp,
69 double value) override;
70
71 private:
72 ::discrete::Severity severity;
73
74 const char* getMessageId() const;
75};
76
77namespace onChange
78{
79class LogToJournal : public interfaces::TriggerAction
80{
81 public:
82 LogToJournal()
83 {}
84
85 void commit(const std::string& id, uint64_t timestamp,
86 double value) override;
87};
88
89class LogToRedfish : public interfaces::TriggerAction
90{
91 public:
92 LogToRedfish()
93 {}
94
95 void commit(const std::string& id, uint64_t timestamp,
96 double value) override;
97};
98} // namespace onChange
99
100} // namespace discrete
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +0100101
102class UpdateReport : public interfaces::TriggerAction
103{
104 public:
105 UpdateReport(interfaces::ReportManager& reportManager,
106 std::vector<std::string> names) :
107 reportManager(reportManager),
108 reportNames(std::move(names))
109 {}
110
111 void commit(const std::string& id, uint64_t timestamp,
112 double value) override;
113
114 private:
115 interfaces::ReportManager& reportManager;
116 std::vector<std::string> reportNames;
117};
118} // namespace action