blob: 5c95a663948167fd3a657212bdeca88409ef2cb2 [file] [log] [blame]
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -05001#pragma once
2
Patrick Venture0b02be92018-08-31 11:55:55 -07003#include <host-cmd-manager.hpp>
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -05004#include <sdbusplus/bus.hpp>
5#include <xyz/openbmc_project/Control/Host/server.hpp>
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -05006namespace phosphor
7{
8namespace host
9{
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +053010namespace command
11{
Andrew Geissler12866372017-03-21 22:58:28 -050012
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -050013/** @class Host
14 * @brief OpenBMC control host interface implementation.
15 * @details A concrete implementation for xyz.openbmc_project.Control.Host
16 * DBus API.
17 */
18class Host : public sdbusplus::server::object::object<
Patrick Venture0b02be92018-08-31 11:55:55 -070019 sdbusplus::xyz::openbmc_project::Control::server::Host>
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -050020{
Patrick Venture0b02be92018-08-31 11:55:55 -070021 public:
22 /** @brief Constructs Host Control Interface
23 *
24 * @param[in] bus - The Dbus bus object
25 * @param[in] objPath - The Dbus object path
26 */
27 Host(sdbusplus::bus::bus& bus, const char* objPath) :
28 sdbusplus::server::object::object<
29 sdbusplus::xyz::openbmc_project::Control::server::Host>(bus,
30 objPath),
31 bus(bus)
32 {
33 // Nothing to do
34 }
Andrew Geissler62817fa92017-03-20 14:20:49 -050035
Patrick Venture0b02be92018-08-31 11:55:55 -070036 /** @brief Send input command to host
37 * Note that the command will be queued in a FIFO if
38 * other commands to the host have yet to be run
39 *
40 * @param[in] command - Input command to execute
41 */
42 void execute(Command command) override;
Andrew Geissler1b9d4e52017-03-21 15:04:05 -050043
Patrick Venture0b02be92018-08-31 11:55:55 -070044 private:
45 /** @brief sdbusplus DBus bus connection. */
46 sdbusplus::bus::bus& bus;
Andrew Geissler12866372017-03-21 22:58:28 -050047
Patrick Venture0b02be92018-08-31 11:55:55 -070048 /** @brief Callback function to be invoked by command manager
49 *
50 * @detail Conveys the status of the last Host bound command.
51 * Depending on the status, a CommandComplete or
52 * CommandFailure signal would be sent
53 *
54 * @param[in] cmd - IPMI command and data sent to Host
55 * @param[in] status - Success or Failure
56 */
57 void commandStatusHandler(IpmiCmdData cmd, bool status);
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -050058};
59
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +053060} // namespace command
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -050061} // namespace host
62} // namespace phosphor