summaryrefslogtreecommitdiffstats
path: root/bmc_state_manager.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'bmc_state_manager.hpp')
-rw-r--r--bmc_state_manager.hpp112
1 files changed, 53 insertions, 59 deletions
diff --git a/bmc_state_manager.hpp b/bmc_state_manager.hpp
index f6f7540..b060ccd 100644
--- a/bmc_state_manager.hpp
+++ b/bmc_state_manager.hpp
@@ -12,10 +12,9 @@ namespace manager
{
using BMCInherit = sdbusplus::server::object::object<
- sdbusplus::xyz::openbmc_project::State::server::BMC>;
+ sdbusplus::xyz::openbmc_project::State::server::BMC>;
namespace sdbusRule = sdbusplus::bus::match::rules;
-
/** @class BMC
* @brief OpenBMC BMC state management implementation.
* @details A concrete implementation for xyz.openbmc_project.State.BMC
@@ -23,71 +22,66 @@ namespace sdbusRule = sdbusplus::bus::match::rules;
*/
class BMC : public BMCInherit
{
- public:
- /** @brief Constructs BMC State Manager
- *
- * @param[in] bus - The Dbus bus object
- * @param[in] busName - The Dbus name to own
- * @param[in] objPath - The Dbus object path
- */
- BMC(sdbusplus::bus::bus& bus,
- const char* objPath) :
- BMCInherit(bus, objPath, true),
- bus(bus),
- stateSignal(
- std::make_unique<decltype(stateSignal)::element_type>(
- bus,
- sdbusRule::type::signal() +
- sdbusRule::member("JobRemoved") +
- sdbusRule::path("/org/freedesktop/systemd1") +
- sdbusRule::interface(
- "org.freedesktop.systemd1.Manager"),
- std::bind(std::mem_fn(&BMC::bmcStateChange),
- this, std::placeholders::_1)))
- {
- subscribeToSystemdSignals();
- discoverInitialState();
- this->emit_object_added();
- };
+ public:
+ /** @brief Constructs BMC State Manager
+ *
+ * @param[in] bus - The Dbus bus object
+ * @param[in] busName - The Dbus name to own
+ * @param[in] objPath - The Dbus object path
+ */
+ BMC(sdbusplus::bus::bus& bus, const char* objPath) :
+ BMCInherit(bus, objPath, true), bus(bus),
+ stateSignal(std::make_unique<decltype(stateSignal)::element_type>(
+ bus,
+ sdbusRule::type::signal() + sdbusRule::member("JobRemoved") +
+ sdbusRule::path("/org/freedesktop/systemd1") +
+ sdbusRule::interface("org.freedesktop.systemd1.Manager"),
+ std::bind(std::mem_fn(&BMC::bmcStateChange), this,
+ std::placeholders::_1)))
+ {
+ subscribeToSystemdSignals();
+ discoverInitialState();
+ this->emit_object_added();
+ };
- /** @brief Set value of BMCTransition **/
- Transition requestedBMCTransition(Transition value) override;
+ /** @brief Set value of BMCTransition **/
+ Transition requestedBMCTransition(Transition value) override;
- /** @brief Set value of CurrentBMCState **/
- BMCState currentBMCState(BMCState value) override;
+ /** @brief Set value of CurrentBMCState **/
+ BMCState currentBMCState(BMCState value) override;
- private:
- /**
- * @brief discover the state of the bmc
- **/
- void discoverInitialState();
+ private:
+ /**
+ * @brief discover the state of the bmc
+ **/
+ void discoverInitialState();
- /**
- * @brief subscribe to the systemd signals
- **/
- void subscribeToSystemdSignals();
+ /**
+ * @brief subscribe to the systemd signals
+ **/
+ void subscribeToSystemdSignals();
- /** @brief Execute the transition request
- *
- * @param[in] tranReq - Transition requested
- */
- void executeTransition(Transition tranReq);
+ /** @brief Execute the transition request
+ *
+ * @param[in] tranReq - Transition requested
+ */
+ void executeTransition(Transition tranReq);
- /** @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
- *
- */
- int bmcStateChange(sdbusplus::message::message& msg);
+ /** @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
+ *
+ */
+ int bmcStateChange(sdbusplus::message::message& msg);
- /** @brief Persistent sdbusplus DBus bus connection. **/
- sdbusplus::bus::bus& bus;
+ /** @brief Persistent sdbusplus DBus bus connection. **/
+ sdbusplus::bus::bus& bus;
- /** @brief Used to subscribe to dbus system state changes **/
- std::unique_ptr<sdbusplus::bus::match_t> stateSignal;
+ /** @brief Used to subscribe to dbus system state changes **/
+ std::unique_ptr<sdbusplus::bus::match_t> stateSignal;
};
} // namespace manager
OpenPOWER on IntegriCloud