treat empty result as valid
This commit is contained in:
@@ -73,7 +73,7 @@ bool PollRequest::notify(result_t result, SymbolString& slave)
|
|||||||
if (result == RESULT_OK) {
|
if (result == RESULT_OK) {
|
||||||
result = m_message->decode(pt_slaveData, slave, output); // decode data
|
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));
|
logError(lf_bus, "poll %s %s failed: %s", m_message->getClass().c_str(), m_message->getName().c_str(), getResultCode(result));
|
||||||
else
|
else
|
||||||
logNotice(lf_bus, "poll %s %s: %s", m_message->getClass().c_str(), m_message->getName().c_str(), output.str().c_str());
|
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;
|
scanResult << hex << setw(2) << setfill('0') << static_cast<unsigned>(dstAddress) << UI_FIELD_SEPARATOR;
|
||||||
result = m_message->decode(pt_slaveData, slave, scanResult, append); // decode data
|
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));
|
logError(lf_bus, "scan %2.2x failed: %s", dstAddress, getResultCode(result));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ result_t BusHandler::sendAndWait(SymbolString& master, SymbolString& slave)
|
|||||||
result_t result = RESULT_ERR_NO_SIGNAL;
|
result_t result = RESULT_ERR_NO_SIGNAL;
|
||||||
ActiveBusRequest request(master, slave);
|
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);
|
m_nextRequests.add(&request);
|
||||||
bool success = m_finishedRequests.waitRemove(&request);
|
bool success = m_finishedRequests.waitRemove(&request);
|
||||||
result = success ? request.m_result : RESULT_ERR_TIMEOUT;
|
result = success ? request.m_result : RESULT_ERR_TIMEOUT;
|
||||||
@@ -718,7 +718,7 @@ void BusHandler::receiveCompleted()
|
|||||||
string name = message->getName();
|
string name = message->getName();
|
||||||
ostringstream output;
|
ostringstream output;
|
||||||
result_t result = message->decode(m_command, m_response, 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));
|
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 {
|
else {
|
||||||
string data = output.str();
|
string data = output.str();
|
||||||
@@ -761,7 +761,7 @@ result_t BusHandler::startScan(bool full)
|
|||||||
|
|
||||||
m_scanResults.clear();
|
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))
|
if (!isValidAddress(slave, false) || isMaster(slave))
|
||||||
continue;
|
continue;
|
||||||
if (!full && !m_seenAddresses[slave]) {
|
if (!full && !m_seenAddresses[slave]) {
|
||||||
@@ -784,7 +784,7 @@ result_t BusHandler::startScan(bool full)
|
|||||||
void BusHandler::formatScanResult(ostringstream& output)
|
void BusHandler::formatScanResult(ostringstream& output)
|
||||||
{
|
{
|
||||||
bool first = true;
|
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);
|
map<unsigned char, string>::iterator it = m_scanResults.find(slave);
|
||||||
if (it != m_scanResults.end()) {
|
if (it != m_scanResults.end()) {
|
||||||
if (first)
|
if (first)
|
||||||
|
|||||||
Reference in New Issue
Block a user