Mechanism to associate sensor/effecter to FRU entity
The "entity_path" key is defined in PDR JSONs and will have an FRU D-Bus object
path as the value, if this is present, the entity type, instance, and container
id should be associate with the FRU entity.
Tested: test JSON with https://gist.github.com/lxwinspur/7225a9301ccfcbff1f6549203405b4fa
after executing the following command, get the entity information from FruHandler
entity_type = 120
entity_instance_num = 1
entity_container_id = 0
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I019f9a0b9d4dbec20a71dfd797f30ac8f57f67b8
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index a4d3991..fd6821f 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -2,9 +2,9 @@
#include "config.h"
-#include "libpldm/pdr.h"
#include "libpldm/platform.h"
#include "libpldm/states.h"
+#include "pdr.h"
#include "common/utils.hpp"
#include "event_parser.hpp"
@@ -46,6 +46,7 @@
uint8_t tid, size_t eventDataOffset)>;
using EventHandlers = std::vector<EventHandler>;
using EventMap = std::map<EventType, EventHandlers>;
+using AssociatedEntityMap = std::map<DbusPath, pldm_entity>;
// EventEntry = <uint8_t> - EventState <uint8_t> - SensorOffset <uint16_t> -
// SensorID
@@ -436,6 +437,21 @@
*/
void generateTerminusLocatorPDR(Repo& repo);
+ /** @brief Get std::map associated with the entity
+ * key: object path
+ * value: pldm_entity
+ *
+ * @return std::map<ObjectPath, pldm_entity>
+ */
+ inline const AssociatedEntityMap& getAssociateEntityMap() const
+ {
+ if (fruHandler == nullptr)
+ {
+ throw InternalFailure();
+ }
+ return fruHandler->getAssociateEntityMap();
+ }
+
private:
pdr_utils::Repo pdrRepo;
uint16_t nextEffecterId{};