summaryrefslogtreecommitdiffstats
path: root/host-interface.hpp
diff options
context:
space:
mode:
authorAndrew Geissler <andrewg@us.ibm.com>2017-03-21 22:58:28 -0500
committerAndrew Geissler <andrewg@us.ibm.com>2017-05-09 12:50:39 -0500
commit1286637013b65a615e37d8677d75a1bba4c53e4b (patch)
treeaae064436865ce2f3d4bb44c42e52e8449294694 /host-interface.hpp
parent1b9d4e5c676f5f2fd35583dc5e3459783a650578 (diff)
downloadphosphor-host-ipmid-1286637013b65a615e37d8677d75a1bba4c53e4b.tar.gz
phosphor-host-ipmid-1286637013b65a615e37d8677d75a1bba4c53e4b.zip
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>
Diffstat (limited to 'host-interface.hpp')
-rw-r--r--host-interface.hpp28
1 files changed, 28 insertions, 0 deletions
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 @@ class Host : public sdbusplus::server::object::object<
*/
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
OpenPOWER on IntegriCloud