Trigger: make dbus properties writable

This change allows to modify 'Sensors', 'ReportNames' and 'Thresholds'
dbus properties of Trigger interface. They are required by Redfish to
implement PATCH functionality for Trigger schema.

Some backend changes were required to enable this functionality, and as
such few improvements were made for existing code:
- NumericThreshold and DiscreteThreshold now have common implementation
  where it was possible.
- Internal sensor info structure for Trigger is now the same as the one
  used for Report. This resulted in breaking compatibility with previous
  Trigger persistency data.
- Added getInfo / getParams methods for Sensor and Threshold interfaces.
  They are used by Trigger dbus getters and persistency mechanism now,
  instead of storing this data in Trigger object.

Testing done:
- Unit tests were expanded and are passing
- dbus setters for Sensors and Thresholds are working and modifications
  are reflected by calling appropriate getters.

Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: I7a14c15a30d78ce872342b5f938aba43c77be9c0
diff --git a/src/trigger.hpp b/src/trigger.hpp
index 54f67c5..a9348bd 100644
--- a/src/trigger.hpp
+++ b/src/trigger.hpp
@@ -3,6 +3,7 @@
 #include "interfaces/json_storage.hpp"
 #include "interfaces/threshold.hpp"
 #include "interfaces/trigger.hpp"
+#include "interfaces/trigger_factory.hpp"
 #include "interfaces/trigger_manager.hpp"
 #include "types/trigger_types.hpp"
 
@@ -17,13 +18,13 @@
     Trigger(boost::asio::io_context& ioc,
             const std::shared_ptr<sdbusplus::asio::object_server>& objServer,
             const std::string& id, const std::string& name,
-            const std::vector<std::string>& triggerActions,
-            const std::vector<std::string>& reportIds,
-            const std::vector<LabeledSensorInfo>& LabeledSensorsInfoIn,
-            const LabeledTriggerThresholdParams& labeledThresholdParamsIn,
+            const std::vector<TriggerAction>& triggerActions,
+            const std::shared_ptr<std::vector<std::string>> reportIds,
             std::vector<std::shared_ptr<interfaces::Threshold>>&& thresholds,
             interfaces::TriggerManager& triggerManager,
-            interfaces::JsonStorage& triggerStorage);
+            interfaces::JsonStorage& triggerStorage,
+            const interfaces::TriggerFactory& triggerFactory,
+            Sensors sensorsIn);
 
     Trigger(const Trigger&) = delete;
     Trigger(Trigger&&) = delete;
@@ -45,18 +46,17 @@
   private:
     std::string id;
     std::string name;
-    std::vector<std::string> triggerActions;
+    std::vector<TriggerAction> triggerActions;
     std::string path;
     bool persistent = false;
-    std::vector<std::string> reportIds;
-    std::vector<LabeledSensorInfo> labeledSensorsInfo;
-    LabeledTriggerThresholdParams labeledThresholdParams;
+    std::shared_ptr<std::vector<std::string>> reportIds;
     std::unique_ptr<sdbusplus::asio::dbus_interface> deleteIface;
     std::unique_ptr<sdbusplus::asio::dbus_interface> triggerIface;
     std::vector<std::shared_ptr<interfaces::Threshold>> thresholds;
 
     interfaces::JsonStorage::FilePath fileName;
     interfaces::JsonStorage& triggerStorage;
+    Sensors sensors;
 
   public:
     static constexpr const char* triggerIfaceName =
@@ -65,5 +65,5 @@
         "/xyz/openbmc_project/Telemetry/Triggers/";
     static constexpr const char* deleteIfaceName =
         "xyz.openbmc_project.Object.Delete";
-    static constexpr size_t triggerVersion = 0;
+    static constexpr size_t triggerVersion = 1;
 };