discover_system_state: apply power restore policy as early as BMC ready
Add a waitBmcReady() to monitor BMC state every second, this function
returns true if BMC enters ready state early or returns flase if
timeout reached.
This allows phosphor-diecover-system-state service can perform power
restore policy as early as BMC enters ready state.
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I3f1ef2957c9c8218d094b0e7643dc2eec03535b4
diff --git a/utils.hpp b/utils.hpp
index fa65c31..49f62bf 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -95,6 +95,13 @@
*/
bool isBmcReady(sdbusplus::bus_t& bus);
+/** @brief Wait BMC to enter ready state or timeout reached.
+ *
+ * @param[in] bus - The Dbus bus object
+ * @param[in] timeout - Timeout in second
+ */
+bool waitBmcReady(sdbusplus::bus_t& bus, std::chrono::seconds timeout);
+
} // namespace utils
} // namespace manager
} // namespace state