1 #pragma once 2 3 #include <sdbusplus/bus.hpp> 4 #include "xyz/openbmc_project/State/BMC/server.hpp" 5 6 namespace phosphor 7 { 8 namespace state 9 { 10 namespace manager 11 { 12 13 /** @class BMC 14 * @brief OpenBMC BMC state management implementation. 15 * @details A concrete implementation for xyz.openbmc_project.State.BMC 16 * DBus API. 17 */ 18 class BMC : public sdbusplus::server::object::object< 19 sdbusplus::xyz::openbmc_project::State::server::BMC> 20 { 21 public: 22 /** @brief Constructs BMC State Manager 23 * 24 * @note This constructor passes 'true' to the base class in order to 25 * defer dbus object registration until we can run 26 * subscribeToSystemdSignals() and set our properties 27 * 28 * @param[in] bus - The Dbus bus object 29 * @param[in] busName - The Dbus name to own 30 * @param[in] objPath - The Dbus object path 31 */ 32 BMC(sdbusplus::bus::bus& bus, 33 const char* objPath) : 34 sdbusplus::server::object::object< 35 sdbusplus::xyz::openbmc_project::State::server::BMC>( 36 bus, objPath), 37 bus(bus) 38 { 39 subscribeToSystemdSignals(); 40 }; 41 42 /** @brief Set value of BMCTransition **/ 43 Transition requestedBMCTransition(Transition value) override; 44 45 46 private: 47 /** 48 * @brief subscribe to the systemd signals 49 **/ 50 void subscribeToSystemdSignals(); 51 52 /** @brief Execute the transition request 53 * 54 * @param[in] tranReq - Transition requested 55 */ 56 void executeTransition(Transition tranReq); 57 58 /** @brief Persistent sdbusplus DBus bus connection. **/ 59 sdbusplus::bus::bus& bus; 60 61 }; 62 63 } // namespace manager 64 } // namespace state 65 } // namespace phosphor 66