summaryrefslogtreecommitdiffstats
path: root/bmc_state_manager.hpp
diff options
context:
space:
mode:
authorJosh D. King <jdking@us.ibm.com>2016-12-19 16:47:45 -0600
committerJosh D. King <jdking@us.ibm.com>2017-01-26 16:32:31 -0600
commitd613b8166a3c3dc652badf8d8c52e74492941f28 (patch)
tree37e3dad339cb5db73b9fbc32cf2edf651711e851 /bmc_state_manager.hpp
parent5162a7b745623bc2df6ff4ff9a2d2ba22c089341 (diff)
downloadphosphor-state-manager-d613b8166a3c3dc652badf8d8c52e74492941f28.tar.gz
phosphor-state-manager-d613b8166a3c3dc652badf8d8c52e74492941f28.zip
Process system state changes
We are currently subscribed to the systemd to get a signal notifying us when the obmc-standby.target is ready. Things may change in the future but this is what we have decided to do for now. Change-Id: I81ecdcb45123feb611cf88916c0f9caadcd82dfe Signed-off-by: Josh D. King <jdking@us.ibm.com>
Diffstat (limited to 'bmc_state_manager.hpp')
-rw-r--r--bmc_state_manager.hpp43
1 files changed, 38 insertions, 5 deletions
diff --git a/bmc_state_manager.hpp b/bmc_state_manager.hpp
index 1ddef53..bbace38 100644
--- a/bmc_state_manager.hpp
+++ b/bmc_state_manager.hpp
@@ -21,10 +21,6 @@ class BMC : public sdbusplus::server::object::object<
public:
/** @brief Constructs BMC State Manager
*
- * @note This constructor passes 'true' to the base class in order to
- * defer dbus object registration until we can run
- * subscribeToSystemdSignals() and set our properties
- *
* @param[in] bus - The Dbus bus object
* @param[in] busName - The Dbus name to own
* @param[in] objPath - The Dbus object path
@@ -34,7 +30,17 @@ class BMC : public sdbusplus::server::object::object<
sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::State::server::BMC>(
bus, objPath),
- bus(bus)
+ bus(bus),
+ stateSignal(
+ std::make_unique<
+ decltype(stateSignal)::element_type>(
+ bus,
+ "type='signal',"
+ "member='JobRemoved',"
+ "path='/org/freedesktop/systemd1',"
+ "interface='org.freedesktop.systemd1.Manager'",
+ bmcStateChangeSignal,
+ this))
{
subscribeToSystemdSignals();
};
@@ -42,6 +48,8 @@ class BMC : public sdbusplus::server::object::object<
/** @brief Set value of BMCTransition **/
Transition requestedBMCTransition(Transition value) override;
+ /** @brief Set value of CurrentBMCState **/
+ BMCState currentBMCState(BMCState value) override;
private:
/**
@@ -55,9 +63,34 @@ class BMC : public sdbusplus::server::object::object<
*/
void executeTransition(Transition tranReq);
+ /** @brief Callback used to direct you into the class
+ *
+ * @param[in] msg - Data associated with subscribed signal
+ * @param[in] userData - Pointer to this object instance
+ * @param[out] retError - return error data if any
+ *
+ */
+ static int bmcStateChangeSignal(sd_bus_message* msg,
+ void* userData,
+ sd_bus_error* retError);
+
+ /** @brief Callback function on bmc state change
+ *
+ * Check if the state is relevant to the BMC and if so, update
+ * corresponding BMC object's state
+ *
+ * @param[in] msg - Data associated with subscribed signal
+ * @param[out] retError - return error data if any
+ *
+ */
+ int bmcStateChange(sd_bus_message* msg,
+ sd_bus_error* retError);
+
/** @brief Persistent sdbusplus DBus bus connection. **/
sdbusplus::bus::bus& bus;
+ /** @brief Used to subscribe to dbus system state changes **/
+ std::unique_ptr<sdbusplus::server::match::match> stateSignal;
};
} // namespace manager
OpenPOWER on IntegriCloud