Use zone object's path attribute
A zone's object path is set when the zone is created and available to be
used instead of determining the zone's object path each time.
Change-Id: Iddfebd1545bb49054d95f8c19a71b2fbf9c2f592
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/zone.cpp b/control/zone.cpp
index 7a5f926..326ca68 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -329,14 +329,11 @@
// When match is empty, handle if zone object member
if (std::get<sigMatchPos>(sig).empty())
{
- fs::path path{CONTROL_OBJPATH};
- path /= std::to_string(_zoneNum);
-
// Set event data for each host group member
for (auto it = std::get<groupPos>(event).begin();
it != std::get<groupPos>(event).end(); ++it)
{
- if (it->first == path.string())
+ if (it->first == _path)
{
// Group member interface in list owned by zone
if (std::find(_ifaces.begin(), _ifaces.end(),
@@ -643,9 +640,7 @@
current = ThermalObject::current(value);
saveCurrentMode();
// Trigger event(s) for custom mode property change
- fs::path path{CONTROL_OBJPATH};
- path /= std::to_string(_zoneNum);
- auto eData = _objects[path.string()]
+ auto eData = _objects[_path]
["xyz.openbmc_project.Control.ThermalMode"]
["Current"];
if (eData != nullptr)