call for BusCommand::getTypeCStr removed.
This commit is contained in:
+8
-14
@@ -152,7 +152,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
|
|||||||
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
|
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
|
||||||
|
|
||||||
BusCommand* busCommand = new BusCommand(ebusCommand);
|
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
|
// send busCommand
|
||||||
m_ebusloop->addBusCommand(busCommand);
|
m_ebusloop->addBusCommand(busCommand);
|
||||||
busCommand = m_ebusloop->getBusCommand();
|
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);
|
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
|
||||||
|
|
||||||
BusCommand* busCommand = new BusCommand(ebusCommand);
|
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
|
// send busCommand
|
||||||
m_ebusloop->addBusCommand(busCommand);
|
m_ebusloop->addBusCommand(busCommand);
|
||||||
busCommand = m_ebusloop->getBusCommand();
|
busCommand = m_ebusloop->getBusCommand();
|
||||||
@@ -262,22 +262,19 @@ std::string BaseLoop::decodeMessage(const std::string& data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case hex:
|
case hex:
|
||||||
if (cmd.size() != 3) {
|
if (cmd.size() != 2) {
|
||||||
result << "usage: 'hex type value' (value: ZZPBSBNNDx)";
|
result << "usage: 'hex value' (value: ZZPBSBNNDx)";
|
||||||
break;
|
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"));
|
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());
|
cmd[1].erase(std::remove_if(cmd[1].begin(), cmd[1].end(), isspace), cmd[1].end());
|
||||||
ebusCommand += cmd[2];
|
ebusCommand += cmd[1];
|
||||||
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
|
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
|
||||||
|
|
||||||
BusCommand* busCommand = new BusCommand(ebusCommand);
|
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
|
// send busCommand
|
||||||
m_ebusloop->addBusCommand(busCommand);
|
m_ebusloop->addBusCommand(busCommand);
|
||||||
busCommand = m_ebusloop->getBusCommand();
|
busCommand = m_ebusloop->getBusCommand();
|
||||||
@@ -290,9 +287,6 @@ std::string BaseLoop::decodeMessage(const std::string& data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete busCommand;
|
delete busCommand;
|
||||||
|
|
||||||
} else {
|
|
||||||
result << "specified message type is incorrect";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
+4
-5
@@ -115,8 +115,7 @@ void* EBusLoop::run()
|
|||||||
// add new bus command to send
|
// add new bus command to send
|
||||||
if (busResult == RESULT_SYN && busCommandActive == false && m_sendBuffer.size() != 0) {
|
if (busResult == RESULT_SYN && busCommandActive == false && m_sendBuffer.size() != 0) {
|
||||||
BusCommand* busCommand = m_sendBuffer.remove();
|
BusCommand* busCommand = m_sendBuffer.remove();
|
||||||
L.log(bus, debug, " type: %s msg: %s",
|
L.log(bus, debug, " msg: %s", busCommand->getCommand().c_str());
|
||||||
busCommand->getTypeCStr(), busCommand->getCommand().c_str());
|
|
||||||
m_bus->addCommand(busCommand);
|
m_bus->addCommand(busCommand);
|
||||||
L.log(bus, debug, " addCommand success");
|
L.log(bus, debug, " addCommand success");
|
||||||
busCommandActive = true;
|
busCommandActive = true;
|
||||||
@@ -150,7 +149,7 @@ void* EBusLoop::run()
|
|||||||
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
|
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
|
||||||
|
|
||||||
BusCommand* busCommand = new BusCommand(ebusCommand);
|
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);
|
m_bus->addCommand(busCommand);
|
||||||
L.log(bus, debug, " addCommand success");
|
L.log(bus, debug, " addCommand success");
|
||||||
@@ -170,7 +169,7 @@ void* EBusLoop::run()
|
|||||||
BusCommand* busCommand = m_bus->recvCommand();
|
BusCommand* busCommand = m_bus->recvCommand();
|
||||||
L.log(bus, trace, " %s", busCommand->getResult().c_str());
|
L.log(bus, trace, " %s", busCommand->getResult().c_str());
|
||||||
|
|
||||||
if (busCommand->isErrorResult() && retries < m_retries) {
|
if (busCommand->isErrorResult() == true && retries < m_retries) {
|
||||||
retries++;
|
retries++;
|
||||||
L.log(bus, trace, " retry number: %d", retries);
|
L.log(bus, trace, " retry number: %d", retries);
|
||||||
busCommand->setResult(std::string(), RESULT_OK);
|
busCommand->setResult(std::string(), RESULT_OK);
|
||||||
@@ -179,7 +178,7 @@ void* EBusLoop::run()
|
|||||||
retries = 0;
|
retries = 0;
|
||||||
if (pollCommandActive == true) {
|
if (pollCommandActive == true) {
|
||||||
// only save correct results
|
// only save correct results
|
||||||
if (!busCommand->isErrorResult())
|
if (busCommand->isErrorResult() == false)
|
||||||
m_commands->storePolData(busCommand->getResult().c_str());
|
m_commands->storePolData(busCommand->getResult().c_str());
|
||||||
|
|
||||||
delete busCommand;
|
delete busCommand;
|
||||||
|
|||||||
Reference in New Issue
Block a user