Implement basic queue for sending multiple commands

Sends dbus signal upon completion of command

Change-Id: Ic507f35af0b38305eecd5558c55738f2d283aac5
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/host-interface.hpp b/host-interface.hpp
index a3b7efa..36b41d9 100644
--- a/host-interface.hpp
+++ b/host-interface.hpp
@@ -1,13 +1,18 @@
 #pragma once
 
+#include <queue>
 #include <sdbusplus/bus.hpp>
+#include <phosphor-logging/elog.hpp>
 #include <xyz/openbmc_project/Control/Host/server.hpp>
+#include "elog-errors.hpp"
 
 namespace phosphor
 {
 namespace host
 {
 
+using namespace phosphor::logging;
+
 /** @class Host
  *  @brief OpenBMC control host interface implementation.
  *  @details A concrete implementation for xyz.openbmc_project.Control.Host
@@ -39,10 +44,33 @@
          */
         void execute(Command command) override;
 
+        /** @brief Return the next entry in the queue
+         *
+         *  Also signal that the command is complete since the interface
+         *  contract is that we emit this signal once the message has been
+         *  passed to the host (which is required when calling this interface)
+         *
+         */
+        Command getNextCommand()
+        {
+            if(this->workQueue.empty())
+            {
+                log<level::ERR>("Control Host work queue is empty!");
+                elog<xyz::openbmc_project::Control::Internal::Host::QueueEmpty>();
+            }
+            Command command = this->workQueue.front();
+            this->workQueue.pop();
+            this->commandComplete(command, Result::Success);
+            return command;
+        }
+
     private:
 
         /** @brief Persistent sdbusplus DBus bus connection. */
         sdbusplus::bus::bus& bus;
+
+        /** @brief Queue to store the requested commands */
+        std::queue<Command> workQueue{};
 };
 
 } // namespace host