control: DBusZone object for dbus objects
Create a DBusZone object to handle zones configured to provide the
ThermalMode dbus interface on dbus. Each zone will have an instance of
this object when configured to provide the ThermalMode interface instead
of the zone object doing this directly. This was done to handle SIGHUP
signals that would reload the zone configuration which may or may not
affect what interfaces are put on dbus for each zone object.
Change-Id: I3e78c6d53a9690b9297c71ea3e0852d7d7b01746
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/zone.cpp b/control/json/zone.cpp
index d7d1a90..8053a16 100644
--- a/control/json/zone.cpp
+++ b/control/json/zone.cpp
@@ -215,6 +215,18 @@
}
}
+bool Zone::isPersisted(const std::string& intf, const std::string& prop) const
+{
+ auto it = _propsPersisted.find(intf);
+ if (it == _propsPersisted.end())
+ {
+ return false;
+ }
+
+ return std::any_of(it->second.begin(), it->second.end(),
+ [&prop](const auto& p) { return prop == p; });
+}
+
std::string Zone::current(std::string value)
{
auto current = ThermalObject::current();
@@ -359,18 +371,6 @@
}
}
-bool Zone::isPersisted(const std::string& intf, const std::string& prop)
-{
- auto it = _propsPersisted.find(intf);
- if (it == _propsPersisted.end())
- {
- return false;
- }
-
- return std::any_of(it->second.begin(), it->second.end(),
- [&prop](const auto& p) { return prop == p; });
-}
-
void Zone::saveCurrentMode()
{
fs::path path{CONTROL_PERSIST_ROOT_PATH};