Reorganize the setEventReceiver code

This commit is to re-organise the code to make the
setEventReceiver optional when GetTID gets called.

Currently, it is being called on every GetTID command.
This is and OEM behaviour, which was implemented at -
https://gerrit.openbmc.org/c/openbmc/pldm/+/41779/36

Also, setEventReceiver is a command defined in the platform
Spec, so rightfully placing it under the platform handler.

Signed-off-by: Sagar Srinivas <sagar.srinivas@ibm.com>
Change-Id: Ib60e9d46a8eaf4806c5ec2e9575f4e219bc80eab
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index eb01e5f..a5dcc44 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -48,19 +48,22 @@
 class Handler : public CmdHandler
 {
   public:
-    Handler(const pldm::utils::DBusHandler* dBusIntf,
-            const std::string& pdrJsonsDir, pldm_pdr* repo,
-            HostPDRHandler* hostPDRHandler,
+    Handler(const pldm::utils::DBusHandler* dBusIntf, uint8_t eid,
+            pldm::InstanceIdDb* instanceIdDb, const std::string& pdrJsonsDir,
+            pldm_pdr* repo, HostPDRHandler* hostPDRHandler,
             pldm::state_sensor::DbusToPLDMEvent* dbusToPLDMEventHandler,
             fru::Handler* fruHandler,
             pldm::responder::oem_platform::Handler* oemPlatformHandler,
+            pldm::requester::Handler<pldm::requester::Request>* handler,
             sdeventplus::Event& event, bool buildPDRLazily = false,
             const std::optional<EventMap>& addOnHandlersMap = std::nullopt) :
-        pdrRepo(repo),
+        eid(eid),
+        instanceIdDb(instanceIdDb), pdrRepo(repo),
         hostPDRHandler(hostPDRHandler),
         dbusToPLDMEventHandler(dbusToPLDMEventHandler), fruHandler(fruHandler),
         dBusIntf(dBusIntf), oemPlatformHandler(oemPlatformHandler),
-        event(event), pdrJsonsDir(pdrJsonsDir), pdrCreated(false)
+        handler(handler), event(event), pdrJsonsDir(pdrJsonsDir),
+        pdrCreated(false)
     {
         if (!buildPDRLazily)
         {
@@ -464,7 +467,12 @@
      */
     void _processPostGetPDRActions(sdeventplus::source::EventBase& source);
 
+    /** @brief Method for setEventreceiver */
+    void setEventReceiver();
+
   private:
+    uint8_t eid;
+    InstanceIdDb* instanceIdDb;
     pdr_utils::Repo pdrRepo;
     uint16_t nextEffecterId{};
     uint16_t nextSensorId{};
@@ -475,6 +483,7 @@
     fru::Handler* fruHandler;
     const pldm::utils::DBusHandler* dBusIntf;
     pldm::responder::oem_platform::Handler* oemPlatformHandler;
+    pldm::requester::Handler<pldm::requester::Request>* handler;
     sdeventplus::Event& event;
     std::string pdrJsonsDir;
     bool pdrCreated;