blob: c54e6aec0f868abbd5988fc3ca8627ebbe2c1943 [file] [log] [blame]
Vishwanatha Subbanna07655062017-07-14 20:31:57 +05301#pragma once
2
Vishwanatha Subbanna07655062017-07-14 20:31:57 +05303#include <host-ipmid/ipmid-host-cmd-utils.hpp>
4#include <org/open_power/Control/Host/server.hpp>
Patrick Venture02261c02018-10-31 15:16:23 -07005#include <sdbusplus/bus.hpp>
Vishwanatha Subbanna07655062017-07-14 20:31:57 +05306namespace open_power
7{
8namespace host
9{
10namespace command
11{
12
13namespace Base = sdbusplus::org::open_power::Control::server;
14using IpmiCmdData = phosphor::host::command::IpmiCmdData;
15
16/** @class Host
17 * @brief OpenBMC control host interface implementation.
18 * @details A concrete implementation for org.open_power.Control.Host
19 * DBus API.
20 */
21class Host : public sdbusplus::server::object::object<Base::Host>
22{
Patrick Venture02261c02018-10-31 15:16:23 -070023 public:
24 /** @brief Constructs Host Control Interface
25 *
26 * @param[in] bus - The Dbus bus object
27 * @param[in] objPath - The Dbus object path
28 */
29 Host(sdbusplus::bus::bus& bus, const char* objPath) :
30 sdbusplus::server::object::object<Base::Host>(bus, objPath), bus(bus)
31 {
32 // Nothing to do
33 }
Vishwanatha Subbanna07655062017-07-14 20:31:57 +053034
Patrick Venture02261c02018-10-31 15:16:23 -070035 /** @brief Sends input command to host
36 * Note that the command will be queued in a FIFO if
37 * other commands to the host have yet to be run
38 *
39 * @param[in] command - Input command to execute
40 * @param[in] data - Data associated with the command
41 */
42 void execute(Command command,
43 sdbusplus::message::variant<uint8_t> data) override;
Vishwanatha Subbanna07655062017-07-14 20:31:57 +053044
Patrick Venture02261c02018-10-31 15:16:23 -070045 private:
46 /** @brief sdbusplus DBus bus connection. */
47 sdbusplus::bus::bus& bus;
Vishwanatha Subbanna07655062017-07-14 20:31:57 +053048
Patrick Venture02261c02018-10-31 15:16:23 -070049 /** @brief Callback function to be invoked by command manager
50 *
51 * @detail Conveys the status of the last Host bound command.
52 * Depending on the status, a CommandComplete or
53 * CommandFailure signal would be sent
54 *
55 * @param[in] cmd - IPMI command and data sent to Host
56 * @param[in] status - Success or Failure
57 */
58 void commandStatusHandler(IpmiCmdData cmd, bool status);
Vishwanatha Subbanna07655062017-07-14 20:31:57 +053059};
60
61} // namespace command
62} // namespace host
Patrick Venture02261c02018-10-31 15:16:23 -070063} // namespace open_power