Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 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 | * |
Josh D. King | 5162a7b | 2016-12-19 16:15:00 -0600 | [diff] [blame^] | 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 | * |
Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 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>( |
Josh D. King | 6db3822 | 2016-12-19 14:52:40 -0600 | [diff] [blame] | 36 | bus, objPath), |
| 37 | bus(bus) |
| 38 | { |
| 39 | subscribeToSystemdSignals(); |
| 40 | }; |
| 41 | |
| 42 | /** @brief Set value of BMCTransition **/ |
| 43 | Transition requestedBMCTransition(Transition value) override; |
| 44 | |
Josh D. King | 6db3822 | 2016-12-19 14:52:40 -0600 | [diff] [blame] | 45 | |
| 46 | private: |
| 47 | /** |
| 48 | * @brief subscribe to the systemd signals |
| 49 | **/ |
| 50 | void subscribeToSystemdSignals(); |
| 51 | |
Josh D. King | 5162a7b | 2016-12-19 16:15:00 -0600 | [diff] [blame^] | 52 | /** @brief Execute the transition request |
| 53 | * |
| 54 | * @param[in] tranReq - Transition requested |
| 55 | */ |
| 56 | void executeTransition(Transition tranReq); |
| 57 | |
Josh D. King | 6db3822 | 2016-12-19 14:52:40 -0600 | [diff] [blame] | 58 | /** @brief Persistent sdbusplus DBus bus connection. **/ |
| 59 | sdbusplus::bus::bus& bus; |
| 60 | |
Josh D. King | bdd9cb7 | 2016-12-19 11:13:43 -0600 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | } // namespace manager |
| 64 | } // namespace state |
| 65 | } // namespace phosphor |