From 1286637013b65a615e37d8677d75a1bba4c53e4b Mon Sep 17 00:00:00 2001 From: Andrew Geissler Date: Tue, 21 Mar 2017 22:58:28 -0500 Subject: Implement basic queue for sending multiple commands Sends dbus signal upon completion of command Change-Id: Ic507f35af0b38305eecd5558c55738f2d283aac5 Signed-off-by: Andrew Geissler --- host-interface.hpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'host-interface.hpp') 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 #include +#include #include +#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("Control Host work queue is empty!"); + elog(); + } + 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 workQueue{}; }; } // namespace host -- cgit v1.2.1