Commands::getEbusCommand reworked.
This commit is contained in:
@@ -149,7 +149,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
|
||||
}
|
||||
|
||||
std::string ebusCommand(A.getParam<const char*>("p_address"));
|
||||
ebusCommand += m_commands->getEbusCommand(index, false);
|
||||
ebusCommand += m_commands->getEbusCommand(index);
|
||||
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
|
||||
|
||||
BusCommand* busCommand = new BusCommand(ebusCommand, false);
|
||||
@@ -190,7 +190,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
|
||||
if (index >= 0) {
|
||||
|
||||
std::string ebusCommand(A.getParam<const char*>("p_address"));
|
||||
ebusCommand += m_commands->getEbusCommand(index, false);
|
||||
ebusCommand += m_commands->getEbusCommand(index);
|
||||
|
||||
// encode data
|
||||
Command* command = new Command(index, (*m_commands)[index], cmd[3]);
|
||||
|
||||
@@ -267,7 +267,7 @@ void EBusLoop::addPollCommand()
|
||||
L.log(bus, event, " polling [%4d] %s", index, tmp.c_str());
|
||||
|
||||
std::string ebusCommand(A.getParam<const char*>("p_address"));
|
||||
ebusCommand += m_commands->getEbusCommand(index, false);
|
||||
ebusCommand += m_commands->getEbusCommand(index);
|
||||
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
|
||||
|
||||
BusCommand* busCommand = new BusCommand(ebusCommand, true);
|
||||
|
||||
@@ -127,13 +127,13 @@ int Commands::findCommand(const std::string& data) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string Commands::getEbusCommand(const int index, const bool cycle) const
|
||||
std::string Commands::getEbusCommand(const int index) const
|
||||
{
|
||||
cmd_t command = m_cmdDB.at(index);
|
||||
std::string cmd;
|
||||
std::stringstream sstr;
|
||||
|
||||
if (cycle == true)
|
||||
if (strcasecmp(command[0].c_str(), "C") == 0)
|
||||
cmd += command[4]; // QQ
|
||||
|
||||
cmd += command[5]; // ZZ
|
||||
@@ -163,7 +163,7 @@ int Commands::storeCycData(const std::string& data) const
|
||||
// walk through commands
|
||||
for (; iter != m_cycDB.end(); iter++) {
|
||||
|
||||
std::string command = getEbusCommand(iter->first, true);
|
||||
std::string command = getEbusCommand(iter->first);
|
||||
|
||||
// skip wrong search string length
|
||||
if (command.length() > search.length())
|
||||
@@ -216,7 +216,7 @@ void Commands::storePolData(const std::string& data) const
|
||||
// walk through commands
|
||||
for (; iter != m_polDB.end(); iter++) {
|
||||
|
||||
std::string command = getEbusCommand(iter->first, false);
|
||||
std::string command = getEbusCommand(iter->first);
|
||||
|
||||
// skip wrong search string length
|
||||
if (command.length() > search.length())
|
||||
|
||||
@@ -55,8 +55,7 @@ public:
|
||||
int findCommand(const std::string& data) const;
|
||||
|
||||
std::string getCmdType(const int index) const { return std::string(m_cmdDB.at(index)[0]); }
|
||||
std::string getEbusType(const int index) const { return std::string(m_cmdDB.at(index)[4]); }
|
||||
std::string getEbusCommand(const int index, const bool cycle) const;
|
||||
std::string getEbusCommand(const int index) const;
|
||||
|
||||
int storeCycData(const std::string& data) const;
|
||||
std::string getCycData(int index) const;
|
||||
|
||||
Reference in New Issue
Block a user