1 #pragma once
2 
3 #include <host-cmd-manager.hpp>
4 #include <sdbusplus/bus.hpp>
5 #include <xyz/openbmc_project/Control/Host/server.hpp>
6 namespace phosphor
7 {
8 namespace host
9 {
10 namespace command
11 {
12 
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      *
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     }
35 
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;
43 
44   private:
45     /** @brief sdbusplus DBus bus connection. */
46     sdbusplus::bus::bus& bus;
47 
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);
58 };
59 
60 } // namespace command
61 } // namespace host
62 } // namespace phosphor
63