Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "interfaces/report_manager.hpp" |
| 4 | #include "interfaces/trigger_action.hpp" |
| 5 | #include "interfaces/trigger_types.hpp" |
| 6 | |
| 7 | namespace action |
| 8 | { |
| 9 | |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 10 | namespace numeric |
| 11 | { |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 12 | class LogToJournal : public interfaces::TriggerAction |
| 13 | { |
| 14 | public: |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 15 | LogToJournal(::numeric::Type type, double val) : type(type), threshold(val) |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 16 | {} |
| 17 | |
| 18 | void commit(const std::string& id, uint64_t timestamp, |
| 19 | double value) override; |
| 20 | |
| 21 | private: |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 22 | ::numeric::Type type; |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 23 | double threshold; |
| 24 | |
| 25 | const char* getType() const; |
| 26 | }; |
| 27 | |
| 28 | class LogToRedfish : public interfaces::TriggerAction |
| 29 | { |
| 30 | public: |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 31 | LogToRedfish(::numeric::Type type, double val) : type(type), threshold(val) |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 32 | {} |
| 33 | |
| 34 | void commit(const std::string& id, uint64_t timestamp, |
| 35 | double value) override; |
| 36 | |
| 37 | private: |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 38 | ::numeric::Type type; |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 39 | double threshold; |
| 40 | |
| 41 | const char* getMessageId() const; |
| 42 | }; |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 43 | } // namespace numeric |
| 44 | |
| 45 | namespace discrete |
| 46 | { |
| 47 | class 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 | |
| 62 | class 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 | |
| 77 | namespace onChange |
| 78 | { |
| 79 | class 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 | |
| 89 | class 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, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 101 | |
| 102 | class 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 |