blob: 5b2ac68d88e11190f17e9c5a60dc8ac6dd3c2915 [file] [log] [blame]
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -05001#pragma once
2
3#include <sdbusplus/bus.hpp>
4#include <xyz/openbmc_project/Control/Host/server.hpp>
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +05305#include <host-cmd-manager.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<
19 sdbusplus::xyz::openbmc_project::Control::server::Host>
20{
21 public:
22 /** @brief Constructs Host Control Interface
23 *
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +053024 * @param[in] bus - The Dbus bus object
25 * @param[in] objPath - The Dbus object path
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -050026 */
27 Host(sdbusplus::bus::bus& bus,
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +053028 const char* objPath) :
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -050029 sdbusplus::server::object::object<
30 sdbusplus::xyz::openbmc_project::Control::server::Host>(
Andrew Geissler1b9d4e52017-03-21 15:04:05 -050031 bus, objPath),
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +053032 bus(bus)
33 {
34 // Nothing to do
35 }
Andrew Geissler62817fa92017-03-20 14:20:49 -050036
37 /** @brief Send input command to host
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +053038 * Note that the command will be queued in a FIFO if
39 * other commands to the host have yet to be run
Andrew Geissler62817fa92017-03-20 14:20:49 -050040 *
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +053041 * @param[in] command - Input command to execute
Andrew Geissler62817fa92017-03-20 14:20:49 -050042 */
43 void execute(Command command) override;
Andrew Geissler1b9d4e52017-03-21 15:04:05 -050044
45 private:
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +053046 /** @brief sdbusplus DBus bus connection. */
Andrew Geissler1b9d4e52017-03-21 15:04:05 -050047 sdbusplus::bus::bus& bus;
Andrew Geissler12866372017-03-21 22:58:28 -050048
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +053049 /** @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 Geisslerdd2c6fd2017-03-16 15:53:20 -050059};
60
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +053061} // namespace command
Andrew Geisslerdd2c6fd2017-03-16 15:53:20 -050062} // namespace host
63} // namespace phosphor