1 #pragma once 2 3 #include <host-cmd-manager.hpp> 4 #include <sdbusplus/bus.hpp> 5 #include <xyz/openbmc_project/Condition/HostFirmware/server.hpp> 6 #include <xyz/openbmc_project/Control/Host/server.hpp> 7 namespace phosphor 8 { 9 namespace host 10 { 11 namespace command 12 { 13 14 /** @class Host 15 * @brief OpenBMC control and condition host interface implementation. 16 * @details A concrete implementation for xyz.openbmc_project.Control.Host 17 * and xyz.openbmc_project.Condition.HostFirmware DBus API's. 18 */ 19 class Host 20 : public sdbusplus::server::object::object< 21 sdbusplus::xyz::openbmc_project::Control::server::Host, 22 sdbusplus::xyz::openbmc_project::Condition::server::HostFirmware> 23 { 24 public: 25 /** @brief Constructs Host Control and Condition Interfaces 26 * 27 * @param[in] bus - The Dbus bus object 28 * @param[in] objPath - The Dbus object path 29 */ 30 Host(sdbusplus::bus::bus& bus, const char* objPath) : 31 sdbusplus::server::object::object< 32 sdbusplus::xyz::openbmc_project::Control::server::Host, 33 sdbusplus::xyz::openbmc_project::Condition::server::HostFirmware>( 34 bus, objPath), 35 bus(bus) 36 { 37 // Nothing to do 38 } 39 40 /** @brief Send input command to host 41 * Note that the command will be queued in a FIFO if 42 * other commands to the host have yet to be run 43 * 44 * @param[in] command - Input command to execute 45 */ 46 void execute(Command command) override; 47 48 /** @brief Override reads to CurrentFirmwareCondition */ 49 FirmwareCondition currentFirmwareCondition() const override; 50 51 private: 52 /** @brief sdbusplus DBus bus connection. */ 53 sdbusplus::bus::bus& bus; 54 55 /** @brief Callback function to be invoked by command manager 56 * 57 * @detail Conveys the status of the last Host bound command. 58 * Depending on the status, a CommandComplete or 59 * CommandFailure signal would be sent 60 * 61 * @param[in] cmd - IPMI command and data sent to Host 62 * @param[in] status - Success or Failure 63 */ 64 void commandStatusHandler(IpmiCmdData cmd, bool status); 65 }; 66 67 } // namespace command 68 } // namespace host 69 } // namespace phosphor 70