send PLDM event msg when state sensor changes

Add the D-Bus to event handler interface to listen all of the state
sensor PDRs and pldm should be able to send up a PLDM event msg when a
D-Bus property changes. the PlatformEventMessage command format is
defined in Table 15 in DSP0248 v1.2.0.

Tested: test with JSON
https://gist.github.com/lxwinspur/6a40abea7330c25e4d49826e890c4be9
The sendEventMsg method is successfully called and the corresponding
message is successfully sent when the D-Bus property value of the sensor
status changes.
print requestMsg Data: 80 02 0a 01 00 00 01 00 01 00 00 00(when calling
sendEventMsg method)

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I9b6d5c1403bfcaa00dbbf478f7d797cc4a40f20d
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index 6d6fd95..a4d3991 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -2,12 +2,14 @@
 
 #include "config.h"
 
+#include "libpldm/pdr.h"
 #include "libpldm/platform.h"
 #include "libpldm/states.h"
 
 #include "common/utils.hpp"
 #include "event_parser.hpp"
 #include "fru.hpp"
+#include "host-bmc/dbus_to_event_handler.hpp"
 #include "host-bmc/host_pdr_handler.hpp"
 #include "libpldmresponder/pdr.hpp"
 #include "libpldmresponder/pdr_utils.hpp"
@@ -26,6 +28,7 @@
 
 using namespace pldm::utils;
 using namespace pldm::responder::pdr_utils;
+using namespace pldm::state_sensor;
 
 using generatePDR =
     std::function<void(const pldm::utils::DBusHandler& dBusIntf,
@@ -59,12 +62,13 @@
     Handler(const pldm::utils::DBusHandler* dBusIntf,
             const std::string& pdrJsonsDir, const std::string& eventsJsonsDir,
             pldm_pdr* repo, HostPDRHandler* hostPDRHandler,
-            fru::Handler* fruHandler, bool buildPDRLazily = false,
+            DbusToPLDMEvent* dbusToPLDMEventHandler, fru::Handler* fruHandler,
+            bool buildPDRLazily = false,
             const std::optional<EventMap>& addOnHandlersMap = std::nullopt) :
         pdrRepo(repo),
         hostPDRHandler(hostPDRHandler), stateSensorHandler(eventsJsonsDir),
-        fruHandler(fruHandler), dBusIntf(dBusIntf), pdrJsonsDir(pdrJsonsDir),
-        pdrCreated(false)
+        dbusToPLDMEventHandler(dbusToPLDMEventHandler), fruHandler(fruHandler),
+        dBusIntf(dBusIntf), pdrJsonsDir(pdrJsonsDir), pdrCreated(false)
     {
         if (!buildPDRLazily)
         {
@@ -440,6 +444,7 @@
     DbusObjMaps sensorDbusObjMaps{};
     HostPDRHandler* hostPDRHandler;
     events::StateSensorHandler stateSensorHandler;
+    DbusToPLDMEvent* dbusToPLDMEventHandler;
     fru::Handler* fruHandler;
     const pldm::utils::DBusHandler* dBusIntf;
     std::string pdrJsonsDir;