blob: 4b92e1873afbbb6c5730d3984b30ca03f374cf30 [file] [log] [blame]
Vishwanatha Subbanna07655062017-07-14 20:31:57 +05301#pragma once
2
3#include <sdbusplus/bus.hpp>
4#include <host-ipmid/ipmid-host-cmd-utils.hpp>
5#include <org/open_power/Control/Host/server.hpp>
6namespace 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{
23 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,
30 const char* objPath) :
31 sdbusplus::server::object::object<Base::Host>(bus, objPath),
32 bus(bus)
33 {
34 // Nothing to do
35 }
36
37 /** @brief Sends input command to host
38 * Note that the command will be queued in a FIFO if
39 * other commands to the host have yet to be run
40 *
41 * @param[in] command - Input command to execute
42 * @param[in] data - Data associated with the command
43 */
44 void execute(Command command,
45 sdbusplus::message::variant<uint8_t> data) override;
46
47 private:
48 /** @brief sdbusplus DBus bus connection. */
49 sdbusplus::bus::bus& bus;
50
51 /** @brief Callback function to be invoked by command manager
52 *
53 * @detail Conveys the status of the last Host bound command.
54 * Depending on the status, a CommandComplete or
55 * CommandFailure signal would be sent
56 *
57 * @param[in] cmd - IPMI command and data sent to Host
58 * @param[in] status - Success or Failure
59 */
60 void commandStatusHandler(IpmiCmdData cmd, bool status);
61};
62
63} // namespace command
64} // namespace host
65} // namespace phosphor