Implement Trigger Actions

Now action is triggered when threshold is crossed. There are 3
actions: write message to journal, write message to journal as
Redfish Event and update an existing Report.
To update an existing Report updateReading method is changed to
public. Added UpdateReport to ReportManager, now object is able
to update readings of any report using report name.

Tested:
 - Unit tests passed
 - Verified that logs are propagated to journal when threshold
   is crossed

Change-Id: Iebca7c8b9ab9b50b4c401877ccf8c2f01f1e6f36
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
diff --git a/src/interfaces/report.hpp b/src/interfaces/report.hpp
index 98421be..a299dac 100644
--- a/src/interfaces/report.hpp
+++ b/src/interfaces/report.hpp
@@ -12,5 +12,6 @@
 
     virtual std::string getName() const = 0;
     virtual std::string getPath() const = 0;
+    virtual void updateReadings() = 0;
 };
 } // namespace interfaces
diff --git a/src/interfaces/report_manager.hpp b/src/interfaces/report_manager.hpp
index 80e0c82..910e439 100644
--- a/src/interfaces/report_manager.hpp
+++ b/src/interfaces/report_manager.hpp
@@ -11,6 +11,7 @@
     virtual ~ReportManager() = default;
 
     virtual void removeReport(const interfaces::Report* report) = 0;
+    virtual void updateReport(const std::string& name) = 0;
 };
 
 } // namespace interfaces
diff --git a/src/interfaces/trigger_factory.hpp b/src/interfaces/trigger_factory.hpp
index 2de5ae8..7d448d0 100644
--- a/src/interfaces/trigger_factory.hpp
+++ b/src/interfaces/trigger_factory.hpp
@@ -5,6 +5,7 @@
 #include "interfaces/trigger_types.hpp"
 
 #include <boost/asio/spawn.hpp>
+#include <sdbusplus/message/types.hpp>
 
 #include <memory>
 #include <utility>
diff --git a/src/interfaces/trigger_types.hpp b/src/interfaces/trigger_types.hpp
index ef61aa6..eb0f7c4 100644
--- a/src/interfaces/trigger_types.hpp
+++ b/src/interfaces/trigger_types.hpp
@@ -1,10 +1,11 @@
 #pragma once
 
-#include <sdbusplus/message/types.hpp>
+#include "utils/conversion.hpp"
 
 #include <string>
 #include <tuple>
 #include <utility>
+#include <variant>
 #include <vector>
 
 namespace discrete
@@ -17,6 +18,11 @@
     critical
 };
 
+inline Severity toSeverity(int x)
+{
+    return utils::toEnum<Severity, Severity::ok, Severity::critical>(x);
+}
+
 using ThresholdParam = std::tuple<std::string, std::underlying_type_t<Severity>,
                                   std::variant<double>, uint64_t>;
 } // namespace discrete
@@ -39,6 +45,17 @@
     increasing
 };
 
+inline Type toType(int x)
+{
+    return utils::toEnum<Type, Type::lowerCritical, Type::upperCritical>(x);
+}
+
+inline Direction toDirection(int x)
+{
+    return utils::toEnum<Direction, Direction::either, Direction::increasing>(
+        x);
+}
+
 using ThresholdParam = std::tuple<std::underlying_type_t<Type>, uint64_t,
                                   std::underlying_type_t<Direction>, double>;
 } // namespace numeric