Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 3 | #include <host-cmd-manager.hpp> |
Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 4 | #include <sdbusplus/bus.hpp> |
| 5 | #include <xyz/openbmc_project/Control/Host/server.hpp> |
Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 6 | namespace phosphor |
| 7 | { |
| 8 | namespace host |
| 9 | { |
Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 10 | namespace command |
| 11 | { |
Andrew Geissler | 1286637 | 2017-03-21 22:58:28 -0500 | [diff] [blame] | 12 | |
Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 13 | /** @class Host |
| 14 | * @brief OpenBMC control host interface implementation. |
| 15 | * @details A concrete implementation for xyz.openbmc_project.Control.Host |
| 16 | * DBus API. |
| 17 | */ |
| 18 | class Host : public sdbusplus::server::object::object< |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 19 | sdbusplus::xyz::openbmc_project::Control::server::Host> |
Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 20 | { |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 21 | 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 Geissler | 62817fa9 | 2017-03-20 14:20:49 -0500 | [diff] [blame] | 35 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 36 | /** @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 Geissler | 1b9d4e5 | 2017-03-21 15:04:05 -0500 | [diff] [blame] | 43 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 44 | private: |
| 45 | /** @brief sdbusplus DBus bus connection. */ |
| 46 | sdbusplus::bus::bus& bus; |
Andrew Geissler | 1286637 | 2017-03-21 22:58:28 -0500 | [diff] [blame] | 47 | |
Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 48 | /** @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 Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 58 | }; |
| 59 | |
Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 60 | } // namespace command |
Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 61 | } // namespace host |
| 62 | } // namespace phosphor |