discover-system-state: add multi-host support
Add HostObjects class to fetch paths of settings d-bus objects under
/xyz/openbmc_project/control/hostX .
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I1dc55ec389e94e6c85aa7031b304f8c4ed15dc71
diff --git a/settings.hpp b/settings.hpp
index dcdfe8a..b54f202 100644
--- a/settings.hpp
+++ b/settings.hpp
@@ -11,7 +11,7 @@
using Service = std::string;
using Interface = std::string;
-constexpr auto root = "/";
+constexpr auto defaultRoot = "/";
constexpr auto autoRebootIntf = "xyz.openbmc_project.Control.Boot.RebootPolicy";
constexpr auto powerRestoreIntf =
"xyz.openbmc_project.Control.Power.RestorePolicy";
@@ -24,9 +24,10 @@
public:
/** @brief Constructor - fetch settings objects
*
- * @param[in] bus - The Dbus bus object
+ * @param[in] bus - The Dbus bus object
+ * @param[in] root - The root object path
*/
- explicit Objects(sdbusplus::bus::bus& bus);
+ explicit Objects(sdbusplus::bus::bus& bus, const Path& root = defaultRoot);
Objects(const Objects&) = delete;
Objects& operator=(const Objects&) = delete;
Objects(Objects&&) = delete;
@@ -60,4 +61,20 @@
sdbusplus::bus::bus& bus;
};
+/** @class HostObjects
+ * @brief Fetch paths of settings d-bus objects of Host
+ * @note IMPORTANT: This class only supports settings under the
+ * /xyz/openbmc_project/control/hostX object paths
+ */
+struct HostObjects : public Objects
+{
+ public:
+ /** @brief Constructor - fetch settings objects of Host
+ *
+ * @param[in] bus - The Dbus bus object
+ * @param[in] id - The Host id
+ */
+ HostObjects(sdbusplus::bus::bus& bus, size_t id);
+};
+
} // namespace settings