Process system state changes
Use the system state signal to know when to change the state
of the host
The signal we look at may change with future skeleton
refactors but this is the best signal for now
Change-Id: Ibba7cc5628994425520c21cdf122d2710f8164aa
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/host_state_manager.hpp b/host_state_manager.hpp
index 8f0733b..515409e 100644
--- a/host_state_manager.hpp
+++ b/host_state_manager.hpp
@@ -35,7 +35,11 @@
sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::State::server::Host>(
bus, objPath, true),
- bus(bus)
+ bus(bus),
+ stateSignal(bus,
+ "type='signal',member='GotoSystemState'",
+ handleSysStateChange,
+ this)
{
// Will throw exception on fail
determineInitialState();
@@ -67,8 +71,25 @@
*/
void executeTransition(Transition tranReq);
+ /** @brief Callback function on system state changes
+ *
+ * Check if the state is relevant to the Host and if so, update
+ * corresponding host object's state
+ *
+ * @param[in] msg - Data associated with subscribed signal
+ * @param[in] userData - Pointer to this object instance
+ * @param[in] retError - Return error data
+ *
+ */
+ static int handleSysStateChange(sd_bus_message* msg,
+ void* userData,
+ sd_bus_error* retError);
+
/** @brief Persistent sdbusplus DBus bus connection. */
sdbusplus::bus::bus& bus;
+
+ /** @brief Used to subscribe to dbus system state changes */
+ sdbusplus::server::match::match stateSignal;
};
} // namespace manager