| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 1 | #pragma once | 
|  | 2 |  | 
|  | 3 | #include <sdbusplus/bus.hpp> | 
|  | 4 | #include <xyz/openbmc_project/Control/Host/server.hpp> | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 5 | #include <host-cmd-manager.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< | 
|  | 19 | sdbusplus::xyz::openbmc_project::Control::server::Host> | 
|  | 20 | { | 
|  | 21 | public: | 
|  | 22 | /** @brief Constructs Host Control Interface | 
|  | 23 | * | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 24 | *  @param[in] bus     - The Dbus bus object | 
|  | 25 | *  @param[in] objPath - The Dbus object path | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 26 | */ | 
|  | 27 | Host(sdbusplus::bus::bus& bus, | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 28 | const char* objPath) : | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 29 | sdbusplus::server::object::object< | 
|  | 30 | sdbusplus::xyz::openbmc_project::Control::server::Host>( | 
| Andrew Geissler | 1b9d4e5 | 2017-03-21 15:04:05 -0500 | [diff] [blame] | 31 | bus, objPath), | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 32 | bus(bus) | 
|  | 33 | { | 
|  | 34 | // Nothing to do | 
|  | 35 | } | 
| Andrew Geissler | 62817fa9 | 2017-03-20 14:20:49 -0500 | [diff] [blame] | 36 |  | 
|  | 37 | /** @brief Send input command to host | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 38 | *         Note that the command will be queued in a FIFO if | 
|  | 39 | *         other commands to the host have yet to be run | 
| Andrew Geissler | 62817fa9 | 2017-03-20 14:20:49 -0500 | [diff] [blame] | 40 | * | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 41 | *  @param[in] command - Input command to execute | 
| Andrew Geissler | 62817fa9 | 2017-03-20 14:20:49 -0500 | [diff] [blame] | 42 | */ | 
|  | 43 | void execute(Command command) override; | 
| Andrew Geissler | 1b9d4e5 | 2017-03-21 15:04:05 -0500 | [diff] [blame] | 44 |  | 
|  | 45 | private: | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 46 | /** @brief sdbusplus DBus bus connection. */ | 
| Andrew Geissler | 1b9d4e5 | 2017-03-21 15:04:05 -0500 | [diff] [blame] | 47 | sdbusplus::bus::bus& bus; | 
| Andrew Geissler | 1286637 | 2017-03-21 22:58:28 -0500 | [diff] [blame] | 48 |  | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 49 | /** @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); | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 59 | }; | 
|  | 60 |  | 
| Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 61 | } // namespace command | 
| Andrew Geissler | dd2c6fd | 2017-03-16 15:53:20 -0500 | [diff] [blame] | 62 | } // namespace host | 
|  | 63 | } // namespace phosphor |