call for BusCommand::getTypeCStr removed.

This commit is contained in:
Roland Jax
2014-10-19 20:24:08 +02:00
parent 4a61d2d5f8
commit c07f90eab7
2 changed files with 12 additions and 19 deletions
+8 -14
View File
@@ -152,7 +152,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
BusCommand* busCommand = new BusCommand(ebusCommand);
L.log(bas, trace, " type: %s msg: %s", busCommand->getTypeCStr(), ebusCommand.c_str());
L.log(bas, trace, " msg: %s", ebusCommand.c_str());
// send busCommand
m_ebusloop->addBusCommand(busCommand);
busCommand = m_ebusloop->getBusCommand();
@@ -205,7 +205,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
BusCommand* busCommand = new BusCommand(ebusCommand);
L.log(bas, event, " type: %s msg: %s", busCommand->getTypeCStr(), ebusCommand.c_str());
L.log(bas, event, " msg: %s", ebusCommand.c_str());
// send busCommand
m_ebusloop->addBusCommand(busCommand);
busCommand = m_ebusloop->getBusCommand();
@@ -262,22 +262,19 @@ std::string BaseLoop::decodeMessage(const std::string& data)
break;
case hex:
if (cmd.size() != 3) {
result << "usage: 'hex type value' (value: ZZPBSBNNDx)";
if (cmd.size() != 2) {
result << "usage: 'hex value' (value: ZZPBSBNNDx)";
break;
}
if ((strcasecmp(cmd[1].c_str(), "MS") == 0)
|| (strcasecmp(cmd[1].c_str(), "MM") == 0)
|| (strcasecmp(cmd[1].c_str(), "BC") == 0)) {
{
std::string ebusCommand(A.getParam<const char*>("p_address"));
cmd[2].erase(std::remove_if(cmd[2].begin(), cmd[2].end(), isspace), cmd[2].end());
ebusCommand += cmd[2];
cmd[1].erase(std::remove_if(cmd[1].begin(), cmd[1].end(), isspace), cmd[1].end());
ebusCommand += cmd[1];
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
BusCommand* busCommand = new BusCommand(ebusCommand);
L.log(bas, trace, " type: %s msg: %s", busCommand->getTypeCStr(), ebusCommand.c_str());
L.log(bas, trace, " msg: %s", ebusCommand.c_str());
// send busCommand
m_ebusloop->addBusCommand(busCommand);
busCommand = m_ebusloop->getBusCommand();
@@ -290,9 +287,6 @@ std::string BaseLoop::decodeMessage(const std::string& data)
}
delete busCommand;
} else {
result << "specified message type is incorrect";
}
break;
+4 -5
View File
@@ -115,8 +115,7 @@ void* EBusLoop::run()
// add new bus command to send
if (busResult == RESULT_SYN && busCommandActive == false && m_sendBuffer.size() != 0) {
BusCommand* busCommand = m_sendBuffer.remove();
L.log(bus, debug, " type: %s msg: %s",
busCommand->getTypeCStr(), busCommand->getCommand().c_str());
L.log(bus, debug, " msg: %s", busCommand->getCommand().c_str());
m_bus->addCommand(busCommand);
L.log(bus, debug, " addCommand success");
busCommandActive = true;
@@ -150,7 +149,7 @@ void* EBusLoop::run()
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
BusCommand* busCommand = new BusCommand(ebusCommand);
L.log(bus, trace, " type: %s msg: %s", busCommand->getTypeCStr(), ebusCommand.c_str());
L.log(bus, trace, " msg: %s", ebusCommand.c_str());
m_bus->addCommand(busCommand);
L.log(bus, debug, " addCommand success");
@@ -170,7 +169,7 @@ void* EBusLoop::run()
BusCommand* busCommand = m_bus->recvCommand();
L.log(bus, trace, " %s", busCommand->getResult().c_str());
if (busCommand->isErrorResult() && retries < m_retries) {
if (busCommand->isErrorResult() == true && retries < m_retries) {
retries++;
L.log(bus, trace, " retry number: %d", retries);
busCommand->setResult(std::string(), RESULT_OK);
@@ -179,7 +178,7 @@ void* EBusLoop::run()
retries = 0;
if (pollCommandActive == true) {
// only save correct results
if (!busCommand->isErrorResult())
if (busCommand->isErrorResult() == false)
m_commands->storePolData(busCommand->getResult().c_str());
delete busCommand;