Add state set id support for remote sensor events
In the current state, PLDM does not support having a state set ID
field in the event JSONs, this commit would add that support in
PLDM there by allowing hosts to have multiple sensors with the
same entity instance number, type and container id, but with different
state sets.
TESTED: with pldmtool raw commands sending sensor events to the BMC.
Signed-off-by: Sagar Srinivas <sagar.srinivas@ibm.com>
Change-Id: If9bb9bde27d6b35f5904ac199801dbdffde0f57e
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index c309c2a..72f2478 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -857,10 +857,12 @@
pldm::pdr::EntityInfo entityInfo{};
pldm::pdr::CompositeSensorStates
compositeSensorStates{};
+ std::vector<pldm::pdr::StateSetId> stateSetIds{};
try
{
- std::tie(entityInfo, compositeSensorStates) =
+ std::tie(entityInfo, compositeSensorStates,
+ stateSetIds) =
lookupSensorInfo(sensorEntry);
}
catch (const std::out_of_range&)
@@ -868,7 +870,8 @@
try
{
sensorEntry.terminusID = PLDM_TID_RESERVED;
- std::tie(entityInfo, compositeSensorStates) =
+ std::tie(entityInfo, compositeSensorStates,
+ stateSetIds) =
lookupSensorInfo(sensorEntry);
}
catch (const std::out_of_range&)
@@ -893,9 +896,11 @@
}
const auto& [containerId, entityType,
entityInstance] = entityInfo;
+ auto stateSetId = stateSetIds[sensorOffset];
pldm::responder::events::StateSensorEntry
stateSensorEntry{containerId, entityType,
- entityInstance, sensorOffset};
+ entityInstance, sensorOffset,
+ stateSetId};
handleStateSensorEvent(stateSensorEntry, eventState);
}
};