X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fvom%2Fvom%2Fhw.cpp;h=54f0aa2c02f28ddae2375f465a915b7f31e6d0e6;hb=7c03ed4;hp=0952b60f9d93402e70ac6fb0d068a1ee4b46fd42;hpb=164e5f8c63652028ecb9c3570e1ea8618b163071;p=vpp.git diff --git a/extras/vom/vom/hw.cpp b/extras/vom/vom/hw.cpp index 0952b60f9d9..54f0aa2c02f 100644 --- a/extras/vom/vom/hw.cpp +++ b/extras/vom/vom/hw.cpp @@ -16,6 +16,7 @@ #include "vom/hw.hpp" #include "vom/hw_cmds.hpp" #include "vom/logger.hpp" +#include "vom/stat_reader.hpp" namespace VOM { HW::cmd_q::cmd_q() @@ -170,6 +171,11 @@ HW::cmd_q::write() * The single Command Queue */ HW::cmd_q* HW::m_cmdQ; + +/* + * single stat reader + */ +stat_reader* HW::m_statReader; HW::item HW::m_poll_state; /** @@ -179,6 +185,17 @@ void HW::init(HW::cmd_q* f) { m_cmdQ = f; + m_statReader = new stat_reader(); +} + +/** + * Initialse the connection to VPP + */ +void +HW::init(HW::cmd_q* f, stat_reader* s) +{ + m_cmdQ = f; + m_statReader = s; } /** @@ -188,6 +205,7 @@ void HW::init() { m_cmdQ = new cmd_q(); + m_statReader = new stat_reader(); } void @@ -211,12 +229,13 @@ HW::enqueue(std::queue& cmds) bool HW::connect() { - return m_cmdQ->connect(); + return (m_cmdQ->connect() && m_statReader->connect()); } void HW::disconnect() { + m_statReader->disconnect(); m_cmdQ->disconnect(); } @@ -249,6 +268,12 @@ HW::poll() return (m_poll_state); } +void +HW::read_stats() +{ + m_statReader->read(); +} + template <> std::string HW::item::to_string() const