blob: 1ddef537e47334c86407bb445df38f69a6f623a9 [file] [log] [blame]
Josh D. Kingbdd9cb72016-12-19 11:13:43 -06001#pragma once
2
3#include <sdbusplus/bus.hpp>
4#include "xyz/openbmc_project/State/BMC/server.hpp"
5
6namespace phosphor
7{
8namespace state
9{
10namespace 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 */
18class 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. King5162a7b2016-12-19 16:15:00 -060024 * @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. Kingbdd9cb72016-12-19 11:13:43 -060028 * @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. King6db38222016-12-19 14:52:40 -060036 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. King6db38222016-12-19 14:52:40 -060045
46 private:
47 /**
48 * @brief subscribe to the systemd signals
49 **/
50 void subscribeToSystemdSignals();
51
Josh D. King5162a7b2016-12-19 16:15:00 -060052 /** @brief Execute the transition request
53 *
54 * @param[in] tranReq - Transition requested
55 */
56 void executeTransition(Transition tranReq);
57
Josh D. King6db38222016-12-19 14:52:40 -060058 /** @brief Persistent sdbusplus DBus bus connection. **/
59 sdbusplus::bus::bus& bus;
60
Josh D. Kingbdd9cb72016-12-19 11:13:43 -060061};
62
63} // namespace manager
64} // namespace state
65} // namespace phosphor