Refactor the platform event message handler code
This commit makes slight code change to use some functions both
in BMC requester and responder flow.
Tested : Using pldmtool platformEventMessage is sent and D-Bus
property is verified.
Change-Id: Id433f136ad4c7be0d94817deed1d6b60df36b3e4
Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index ecbc121..d2d1d6e 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -399,7 +399,8 @@
const auto& [containerId, entityType, entityInstance] = entityInfo;
events::StateSensorEntry stateSensorEntry{containerId, entityType,
entityInstance, sensorOffset};
- return stateSensorHandler.eventAction(stateSensorEntry, eventState);
+ return hostPDRHandler->handleStateSensorEvent(stateSensorEntry,
+ eventState);
}
else
{
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index 3eda7cb..ef2434d 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -52,13 +52,13 @@
{
public:
Handler(const pldm::utils::DBusHandler* dBusIntf,
- const std::string& pdrJsonsDir, const std::string& eventsJsonsDir,
- pldm_pdr* repo, HostPDRHandler* hostPDRHandler,
+ const std::string& pdrJsonsDir, pldm_pdr* repo,
+ HostPDRHandler* hostPDRHandler,
DbusToPLDMEvent* dbusToPLDMEventHandler, fru::Handler* fruHandler,
bool buildPDRLazily = false,
const std::optional<EventMap>& addOnHandlersMap = std::nullopt) :
pdrRepo(repo),
- hostPDRHandler(hostPDRHandler), stateSensorHandler(eventsJsonsDir),
+ hostPDRHandler(hostPDRHandler),
dbusToPLDMEventHandler(dbusToPLDMEventHandler), fruHandler(fruHandler),
dBusIntf(dBusIntf), pdrJsonsDir(pdrJsonsDir), pdrCreated(false)
{
@@ -438,7 +438,6 @@
DbusObjMaps effecterDbusObjMaps{};
DbusObjMaps sensorDbusObjMaps{};
HostPDRHandler* hostPDRHandler;
- events::StateSensorHandler stateSensorHandler;
DbusToPLDMEvent* dbusToPLDMEventHandler;
fru::Handler* fruHandler;
const pldm::utils::DBusHandler* dBusIntf;