summaryrefslogtreecommitdiffstats
path: root/occ_pass_through.cpp
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2017-03-18 02:57:43 -0500
committerDeepak Kodihalli <dkodihal@in.ibm.com>2017-03-30 05:55:09 -0500
commit02ba9ecca446f606a26e897cd9381e26d3abeb53 (patch)
tree7b2ef9e4ddb1ad0c090fb150a3ae8be6a4d5b4d8 /occ_pass_through.cpp
parent6b492fbf372aca6100c6c24cb1f574de7eb81ec2 (diff)
downloadopenpower-occ-control-02ba9ecca446f606a26e897cd9381e26d3abeb53.tar.gz
openpower-occ-control-02ba9ecca446f606a26e897cd9381e26d3abeb53.zip
Implement org.open_power.OCC.PassThrough.Send
The Send method accepts a command as an array of hex strings, and returns the response as an another array of hex strings. For now, Send just logs the command array to the journal. Change-Id: Iff288d36075833b8c615cdb18b78395839e1e2da Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'occ_pass_through.cpp')
-rw-r--r--occ_pass_through.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/occ_pass_through.cpp b/occ_pass_through.cpp
index aef0e04..872e281 100644
--- a/occ_pass_through.cpp
+++ b/occ_pass_through.cpp
@@ -1,5 +1,6 @@
#include <memory>
-#include <iostream>
+#include <algorithm>
+#include <phosphor-logging/log.hpp>
#include "occ_pass_through.hpp"
#include "occ_finder.hpp"
@@ -45,6 +46,25 @@ PassThrough::PassThrough(
std::vector<int32_t> PassThrough::send(std::vector<int32_t> command)
{
+ std::string msg = "Pass through to OCC ";
+ msg += path;
+
+ std::string cmd;
+ std::for_each(command.cbegin(), command.cend(),
+ [&cmd](const auto& c)
+ {
+ cmd += std::to_string(c);
+ cmd += ',';
+ });
+ if (!cmd.empty())
+ {
+ // Remove trailing ','
+ cmd.pop_back();
+ }
+
+ using namespace phosphor::logging;
+ log<level::INFO>(msg.c_str(), entry("COMMAND=%s", cmd.c_str()));
+
return {};
}
OpenPOWER on IntegriCloud