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/trigger_factory.cpp b/src/trigger_factory.cpp
index 709b5d6..d8484c2 100644
--- a/src/trigger_factory.cpp
+++ b/src/trigger_factory.cpp
@@ -3,14 +3,16 @@
 #include "numeric_threshold.hpp"
 #include "sensor.hpp"
 #include "trigger.hpp"
+#include "trigger_actions.hpp"
 #include "utils/dbus_mapper.hpp"
 
 TriggerFactory::TriggerFactory(
     std::shared_ptr<sdbusplus::asio::connection> bus,
     std::shared_ptr<sdbusplus::asio::object_server> objServer,
-    SensorCache& sensorCache) :
+    SensorCache& sensorCache, interfaces::ReportManager& reportManager) :
     bus(std::move(bus)),
-    objServer(std::move(objServer)), sensorCache(sensorCache)
+    objServer(std::move(objServer)), sensorCache(sensorCache),
+    reportManager(reportManager)
 {}
 
 std::unique_ptr<interfaces::Trigger> TriggerFactory::make(
@@ -35,11 +37,26 @@
     for (const auto& [type, dwellTime, direction, value] : params)
     {
         std::vector<std::unique_ptr<interfaces::TriggerAction>> actions;
+        if (logToJournal)
+        {
+            actions.emplace_back(std::make_unique<action::LogToJournal>(
+                numeric::toType(type), value));
+        }
+        if (logToRedfish)
+        {
+            actions.emplace_back(std::make_unique<action::LogToRedfish>(
+                numeric::toType(type), value));
+        }
+        if (updateReport)
+        {
+            actions.emplace_back(std::make_unique<action::UpdateReport>(
+                reportManager, reportNames));
+        }
 
         thresholds.emplace_back(std::make_shared<NumericThreshold>(
             bus->get_io_context(), sensors, sensorNames, std::move(actions),
             std::chrono::milliseconds(dwellTime),
-            static_cast<numeric::Direction>(direction), value));
+            numeric::toDirection(direction), value));
     }
 
     return std::make_unique<Trigger>(