added cyc command

This commit is contained in:
john30
2014-12-06 23:43:04 +01:00
parent 5bbdcac5d4
commit 8ef8418702
+12 -16
View File
@@ -312,25 +312,21 @@ string BaseLoop::decodeMessage(const string& data)
break; break;
/*case ct_cyc: case ct_cyc:
if (cmd.size() < 3 || cmd.size() > 4) { if (cmd.size() < 2 || cmd.size() > 3) {
result << "usage: 'cyc class cmd (sub)'"; result << "usage: 'cyc [class] cmd'";
break; break;
} }
index = m_commands->findCommand(data); if (cmd.size() == 2)
message = m_messages->find("", cmd[1], false, true);
else
message = m_messages->find(cmd[1], cmd[2], false, true);
if (index >= 0) { if (message != NULL) {
// get cycdata token = m_busHandler->getReceivedData(message);
cycdata = m_commands->getCycData(index); if (token.empty() == false) {
if (cycdata != "") { result << token;
// decode data
Command* command = new Command(index, (*m_commands)[index], cycdata);
// return result
result << command->calcResult(cmd);
delete command;
} else { } else {
result << "no data stored"; result << "no data stored";
} }
@@ -338,7 +334,7 @@ string BaseLoop::decodeMessage(const string& data)
result << "ebus command not found"; result << "ebus command not found";
} }
break;*/ break;
case ct_hex: case ct_hex:
if (cmd.size() != 2) { if (cmd.size() != 2) {