treat empty result as valid

This commit is contained in:
john30
2015-03-12 23:40:34 +01:00
parent 16febf3555
commit f1be064dda
+6 -6
View File
@@ -73,7 +73,7 @@ bool PollRequest::notify(result_t result, SymbolString& slave)
if (result == RESULT_OK) {
result = m_message->decode(pt_slaveData, slave, output); // decode data
}
if (result != RESULT_OK)
if (result < RESULT_OK)
logError(lf_bus, "poll %s %s failed: %s", m_message->getClass().c_str(), m_message->getName().c_str(), getResultCode(result));
else
logNotice(lf_bus, "poll %s %s: %s", m_message->getClass().c_str(), m_message->getName().c_str(), output.str().c_str());
@@ -102,7 +102,7 @@ bool ScanRequest::notify(result_t result, SymbolString& slave)
scanResult << hex << setw(2) << setfill('0') << static_cast<unsigned>(dstAddress) << UI_FIELD_SEPARATOR;
result = m_message->decode(pt_slaveData, slave, scanResult, append); // decode data
}
if (result != RESULT_OK) {
if (result < RESULT_OK) {
logError(lf_bus, "scan %2.2x failed: %s", dstAddress, getResultCode(result));
return false;
}
@@ -148,7 +148,7 @@ result_t BusHandler::sendAndWait(SymbolString& master, SymbolString& slave)
result_t result = RESULT_ERR_NO_SIGNAL;
ActiveBusRequest request(master, slave);
for (int sendRetries=m_failedSendRetries+1; sendRetries>=0; sendRetries--) {
for (int sendRetries = m_failedSendRetries + 1; sendRetries >= 0; sendRetries--) {
m_nextRequests.add(&request);
bool success = m_finishedRequests.waitRemove(&request);
result = success ? request.m_result : RESULT_ERR_TIMEOUT;
@@ -718,7 +718,7 @@ void BusHandler::receiveCompleted()
string name = message->getName();
ostringstream output;
result_t result = message->decode(m_command, m_response, output);
if (result != RESULT_OK)
if (result < RESULT_OK)
logError(lf_update, "unable to parse %s %s from %s / %s: %s", clazz.c_str(), name.c_str(), m_command.getDataStr().c_str(), m_response.getDataStr().c_str(), getResultCode(result));
else {
string data = output.str();
@@ -761,7 +761,7 @@ result_t BusHandler::startScan(bool full)
m_scanResults.clear();
for (unsigned char slave=1; slave != 0; slave++) { // 0 is known to be a master
for (unsigned char slave = 1; slave != 0; slave++) { // 0 is known to be a master
if (!isValidAddress(slave, false) || isMaster(slave))
continue;
if (!full && !m_seenAddresses[slave]) {
@@ -784,7 +784,7 @@ result_t BusHandler::startScan(bool full)
void BusHandler::formatScanResult(ostringstream& output)
{
bool first = true;
for (unsigned char slave=1; slave != 0; slave++) { // 0 is known to be a master
for (unsigned char slave = 1; slave != 0; slave++) { // 0 is known to be a master
map<unsigned char, string>::iterator it = m_scanResults.find(slave);
if (it != m_scanResults.end()) {
if (first)