diff --git a/src/cycdata.cpp b/src/cycdata.cpp index ee6e512d..06918466 100644 --- a/src/cycdata.cpp +++ b/src/cycdata.cpp @@ -27,13 +27,7 @@ extern LogInstance& L; CYCData::CYCData(EBusLoop* ebusloop, Commands* commands) : m_ebusloop(ebusloop), m_commands(commands), m_stop(false) { - for (size_t index = 0; index < commands->size(); index++) { - if (strcasecmp((*m_commands)[index][0].c_str(),"cyc") == 0) { - Command* cmd = new Command(index, (*m_commands)[index]); - m_cycDB.insert(pair_t(index, cmd)); - } - } - + addCommands(m_commands); } CYCData::~CYCData() @@ -139,3 +133,15 @@ void CYCData::storeData(int index, std::string data) } } +void CYCData::addCommands(Commands* commands) +{ + for (size_t index = 0; index < commands->size(); index++) { + if (strcasecmp((*m_commands)[index][0].c_str(),"cyc") == 0) { + Command* cmd = new Command(index, (*m_commands)[index]); + m_cycDB.insert(pair_t(index, cmd)); + } + } + + L.log(cyc, trace, "%d cycle commands added", m_cycDB.size()); +} + diff --git a/src/cycdata.h b/src/cycdata.h index b1843c35..949a3d33 100644 --- a/src/cycdata.h +++ b/src/cycdata.h @@ -43,6 +43,8 @@ public: std::string getData(int index); + void addCommands(Commands* commands); + private: EBusLoop* m_ebusloop; Commands* m_commands;