Added discrete threshold trigger support
Implemented discrete threshold logic
Discrete trigger with empty threshold array is handled as 'onChange'
Added unit tests coverage for discrete trigger
Supported scenarios:
-discrete threshold with value and dwell time
-discrete threshold with value, without dwell time
-discrete trigger without threshold ('onChange')
Tests:
-Unit tests passed
Change-Id: Id60a48f4113bd955d97e154888c00d1b6e5490af
Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
diff --git a/src/trigger_actions.hpp b/src/trigger_actions.hpp
index 2c8db69..408bcb5 100644
--- a/src/trigger_actions.hpp
+++ b/src/trigger_actions.hpp
@@ -7,17 +7,19 @@
namespace action
{
+namespace numeric
+{
class LogToJournal : public interfaces::TriggerAction
{
public:
- LogToJournal(numeric::Type type, double val) : type(type), threshold(val)
+ LogToJournal(::numeric::Type type, double val) : type(type), threshold(val)
{}
void commit(const std::string& id, uint64_t timestamp,
double value) override;
private:
- numeric::Type type;
+ ::numeric::Type type;
double threshold;
const char* getType() const;
@@ -26,18 +28,76 @@
class LogToRedfish : public interfaces::TriggerAction
{
public:
- LogToRedfish(numeric::Type type, double val) : type(type), threshold(val)
+ LogToRedfish(::numeric::Type type, double val) : type(type), threshold(val)
{}
void commit(const std::string& id, uint64_t timestamp,
double value) override;
private:
- numeric::Type type;
+ ::numeric::Type type;
double threshold;
const char* getMessageId() const;
};
+} // namespace numeric
+
+namespace discrete
+{
+class LogToJournal : public interfaces::TriggerAction
+{
+ public:
+ LogToJournal(::discrete::Severity severity) : severity(severity)
+ {}
+
+ void commit(const std::string& id, uint64_t timestamp,
+ double value) override;
+
+ private:
+ ::discrete::Severity severity;
+
+ const char* getSeverity() const;
+};
+
+class LogToRedfish : public interfaces::TriggerAction
+{
+ public:
+ LogToRedfish(::discrete::Severity severity) : severity(severity)
+ {}
+
+ void commit(const std::string& id, uint64_t timestamp,
+ double value) override;
+
+ private:
+ ::discrete::Severity severity;
+
+ const char* getMessageId() const;
+};
+
+namespace onChange
+{
+class LogToJournal : public interfaces::TriggerAction
+{
+ public:
+ LogToJournal()
+ {}
+
+ void commit(const std::string& id, uint64_t timestamp,
+ double value) override;
+};
+
+class LogToRedfish : public interfaces::TriggerAction
+{
+ public:
+ LogToRedfish()
+ {}
+
+ void commit(const std::string& id, uint64_t timestamp,
+ double value) override;
+};
+} // namespace onChange
+
+} // namespace discrete
class UpdateReport : public interfaces::TriggerAction
{