adjusted to libebus udpates, start using SymbolString

This commit is contained in:
john30
2014-10-20 21:46:53 +02:00
parent b40d9bd236
commit bb79aa9462
2 changed files with 10 additions and 10 deletions
Regular → Executable
+3 -3
View File
@@ -159,7 +159,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
if (!busCommand->isErrorResult()) { if (!busCommand->isErrorResult()) {
// decode data // decode data
Command* command = new Command(index, (*m_commands)[index], busCommand->getResult()); Command* command = new Command(index, (*m_commands)[index], busCommand->getResultStr()); // TODO use getResult()
// return result // return result
result << command->calcResult(cmd); result << command->calcResult(cmd);
@@ -214,7 +214,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
// decode result // decode result
if (busCommand->getType()==broadcast) if (busCommand->getType()==broadcast)
result << "done"; result << "done";
else if (busCommand->getResult().substr(busCommand->getResult().length()-8) == "00000000") else if (busCommand->getResultStr().substr(busCommand->getResultStr().length()-8) == "00000000") // TODO use getResult()
result << "done"; result << "done";
else else
result << "error"; result << "error";
@@ -286,7 +286,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
L.log(bas, error, " %s", busCommand->getResultCodeCStr()); L.log(bas, error, " %s", busCommand->getResultCodeCStr());
result << busCommand->getResultCodeCStr(); result << busCommand->getResultCodeCStr();
} else { } else {
result << busCommand->getResult(); result << busCommand->getResultStr(); // TODO use getResult()
} }
delete busCommand; delete busCommand;
Regular → Executable
+7 -7
View File
@@ -80,15 +80,15 @@ void* EBusLoop::run()
// new cyc message arrived // new cyc message arrived
if (busResult == RESULT_SYN || busResult == RESULT_BUS_LOCKED) { if (busResult == RESULT_SYN || busResult == RESULT_BUS_LOCKED) {
std::string data = m_bus->getCycData(); SymbolString data = m_bus->getCycData();
if (data.size() == 0 && m_logAutoSyn == true) if (data.size() == 0 && m_logAutoSyn == true)
L.log(bus, trace, "%s", "aa"); L.log(bus, trace, "aa");
if (data.size() != 0) { if (data.size() != 0) {
L.log(bus, trace, "%s", data.c_str()); L.log(bus, trace, "%s", data.getDataStr().c_str());
int index = m_commands->storeCycData(data); int index = m_commands->storeCycData(data.getDataStr());
if (index == -1) { if (index == -1) {
L.log(bus, debug, " command not found"); L.log(bus, debug, " command not found");
@@ -116,7 +116,7 @@ void* EBusLoop::run()
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, " type: %s msg: %s",
busCommand->getTypeCStr(), busCommand->getCommand().c_str()); busCommand->getTypeCStr(), busCommand->getCommandStr().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;
@@ -168,7 +168,7 @@ void* EBusLoop::run()
lookbusretries = 0; lookbusretries = 0;
m_bus->sendCommand(); m_bus->sendCommand();
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->getResultStr().c_str());
if (busCommand->isErrorResult() && retries < m_retries) { if (busCommand->isErrorResult() && retries < m_retries) {
retries++; retries++;
@@ -180,7 +180,7 @@ void* EBusLoop::run()
if (pollCommandActive == true) { if (pollCommandActive == true) {
// only save correct results // only save correct results
if (!busCommand->isErrorResult()) if (!busCommand->isErrorResult())
m_commands->storePolData(busCommand->getResult().c_str()); m_commands->storePolData(busCommand->getResultStr().c_str()); // TODO use getResult()
delete busCommand; delete busCommand;
pollCommandActive = false; pollCommandActive = false;