rename method
This commit is contained in:
+11
-11
@@ -219,7 +219,7 @@ result_t FileDevice::afterOpen() {
|
|||||||
return RESULT_ERR_SEND;
|
return RESULT_ERR_SEND;
|
||||||
}
|
}
|
||||||
if (m_listener != nullptr) {
|
if (m_listener != nullptr) {
|
||||||
m_listener->notifyStatus(false, "resetting");
|
m_listener->notifyDeviceStatus(false, "resetting");
|
||||||
}
|
}
|
||||||
m_resetRequested = true;
|
m_resetRequested = true;
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,7 @@ result_t FileDevice::requestEnhancedInfo(symbol_t infoId) {
|
|||||||
if (m_infoReqTime > 0 && time(NULL) > m_infoReqTime+5) {
|
if (m_infoReqTime > 0 && time(NULL) > m_infoReqTime+5) {
|
||||||
// request timed out
|
// request timed out
|
||||||
if (m_listener != nullptr) {
|
if (m_listener != nullptr) {
|
||||||
m_listener->notifyStatus(false, "info request timed out");
|
m_listener->notifyDeviceStatus(false, "info request timed out");
|
||||||
}
|
}
|
||||||
m_infoId = 0xff;
|
m_infoId = 0xff;
|
||||||
m_infoReqTime = 0;
|
m_infoReqTime = 0;
|
||||||
@@ -546,7 +546,7 @@ bool FileDevice::available() {
|
|||||||
DEBUG_RAW_TRAFFIC("avail enhanced following bad @%d+%d %2.2x %2.2x", m_bufPos, pos,
|
DEBUG_RAW_TRAFFIC("avail enhanced following bad @%d+%d %2.2x %2.2x", m_bufPos, pos,
|
||||||
m_buffer[(pos+m_bufPos)%m_bufSize], ch);
|
m_buffer[(pos+m_bufPos)%m_bufSize], ch);
|
||||||
if (m_listener != nullptr) {
|
if (m_listener != nullptr) {
|
||||||
m_listener->notifyStatus(true, "unexpected available enhanced following byte 1");
|
m_listener->notifyDeviceStatus(true, "unexpected available enhanced following byte 1");
|
||||||
}
|
}
|
||||||
// drop first byte of invalid sequence
|
// drop first byte of invalid sequence
|
||||||
m_bufPos = (m_bufPos + 1) % m_bufSize;
|
m_bufPos = (m_bufPos + 1) % m_bufSize;
|
||||||
@@ -565,7 +565,7 @@ bool FileDevice::available() {
|
|||||||
}
|
}
|
||||||
DEBUG_RAW_TRAFFIC("avail enhanced bad @%d+%d %2.2x", m_bufPos, pos, ch);
|
DEBUG_RAW_TRAFFIC("avail enhanced bad @%d+%d %2.2x", m_bufPos, pos, ch);
|
||||||
if (m_listener != nullptr) {
|
if (m_listener != nullptr) {
|
||||||
m_listener->notifyStatus(true, "unexpected available enhanced byte 2");
|
m_listener->notifyDeviceStatus(true, "unexpected available enhanced byte 2");
|
||||||
}
|
}
|
||||||
// skip byte from erroneous protocol
|
// skip byte from erroneous protocol
|
||||||
m_bufPos = (m_bufPos+1)%m_bufSize;
|
m_bufPos = (m_bufPos+1)%m_bufSize;
|
||||||
@@ -582,7 +582,7 @@ bool FileDevice::read(symbol_t* value, bool isAvailable, ArbitrationState* arbit
|
|||||||
// more than half of input buffer consumed is taken as signal that ebusd is too slow
|
// more than half of input buffer consumed is taken as signal that ebusd is too slow
|
||||||
m_bufLen = 0;
|
m_bufLen = 0;
|
||||||
if (m_listener != nullptr) {
|
if (m_listener != nullptr) {
|
||||||
m_listener->notifyStatus(true, "buffer overflow");
|
m_listener->notifyDeviceStatus(true, "buffer overflow");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
size_t tail;
|
size_t tail;
|
||||||
@@ -652,7 +652,7 @@ bool FileDevice::handleEnhancedBufferedData(symbol_t* value, ArbitrationState* a
|
|||||||
m_bufLen--;
|
m_bufLen--;
|
||||||
if (kind == ENH_BYTE2) {
|
if (kind == ENH_BYTE2) {
|
||||||
if (m_listener != nullptr) {
|
if (m_listener != nullptr) {
|
||||||
m_listener->notifyStatus(true, "unexpected enhanced byte 2");
|
m_listener->notifyDeviceStatus(true, "unexpected enhanced byte 2");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -662,7 +662,7 @@ bool FileDevice::handleEnhancedBufferedData(symbol_t* value, ArbitrationState* a
|
|||||||
m_bufLen--;
|
m_bufLen--;
|
||||||
if ((ch2 & ENH_BYTE_MASK) != ENH_BYTE2) {
|
if ((ch2 & ENH_BYTE_MASK) != ENH_BYTE2) {
|
||||||
if (m_listener != nullptr) {
|
if (m_listener != nullptr) {
|
||||||
m_listener->notifyStatus(true, "missing enhanced byte 2");
|
m_listener->notifyDeviceStatus(true, "missing enhanced byte 2");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -720,7 +720,7 @@ bool FileDevice::handleEnhancedBufferedData(symbol_t* value, ArbitrationState* a
|
|||||||
cancelRunningArbitration(arbitrationState);
|
cancelRunningArbitration(arbitrationState);
|
||||||
}
|
}
|
||||||
if (m_listener != nullptr) {
|
if (m_listener != nullptr) {
|
||||||
m_listener->notifyStatus(false, (m_extraFatures&0x01) ? "reset, supports info" : "reset");
|
m_listener->notifyDeviceStatus(false, (m_extraFatures&0x01) ? "reset, supports info" : "reset");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENH_RES_INFO:
|
case ENH_RES_INFO:
|
||||||
@@ -820,7 +820,7 @@ bool FileDevice::handleEnhancedBufferedData(symbol_t* value, ArbitrationState* a
|
|||||||
<< static_cast<unsigned>(m_infoPos);
|
<< static_cast<unsigned>(m_infoPos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_listener->notifyStatus(false, ("extra info: "+stream.str()).c_str());
|
m_listener->notifyDeviceStatus(false, ("extra info: "+stream.str()).c_str());
|
||||||
m_infoLen = 0;
|
m_infoLen = 0;
|
||||||
m_infoId = 0xff;
|
m_infoId = 0xff;
|
||||||
}
|
}
|
||||||
@@ -846,7 +846,7 @@ bool FileDevice::handleEnhancedBufferedData(symbol_t* value, ArbitrationState* a
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
string str = stream.str();
|
string str = stream.str();
|
||||||
m_listener->notifyStatus(true, str.c_str());
|
m_listener->notifyDeviceStatus(true, str.c_str());
|
||||||
}
|
}
|
||||||
cancelRunningArbitration(arbitrationState);
|
cancelRunningArbitration(arbitrationState);
|
||||||
break;
|
break;
|
||||||
@@ -856,7 +856,7 @@ bool FileDevice::handleEnhancedBufferedData(symbol_t* value, ArbitrationState* a
|
|||||||
stream << "unexpected enhanced command 0x" << setw(2) << setfill('0') << hex
|
stream << "unexpected enhanced command 0x" << setw(2) << setfill('0') << hex
|
||||||
<< static_cast<unsigned>(cmd);
|
<< static_cast<unsigned>(cmd);
|
||||||
string str = stream.str();
|
string str = stream.str();
|
||||||
m_listener->notifyStatus(true, str.c_str());
|
m_listener->notifyDeviceStatus(true, str.c_str());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class DeviceListener {
|
|||||||
* @param error true for an error message, false for an info message.
|
* @param error true for an error message, false for an info message.
|
||||||
* @param message the message string.
|
* @param message the message string.
|
||||||
*/
|
*/
|
||||||
virtual void notifyStatus(bool error, const char* message) = 0; // abstract
|
virtual void notifyDeviceStatus(bool error, const char* message) = 0; // abstract
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ void ProtocolHandler::notifyDeviceData(symbol_t symbol, bool received) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolHandler::notifyStatus(bool error, const char* message) {
|
void ProtocolHandler::notifyDeviceStatus(bool error, const char* message) {
|
||||||
if (error) {
|
if (error) {
|
||||||
logError(lf_bus, "device status: %s", message);
|
logError(lf_bus, "device status: %s", message);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ class ProtocolHandler : public WaitThread, DeviceListener {
|
|||||||
m_logRawFile(nullptr), m_logRawEnabled(false), m_logRawBytes(false),
|
m_logRawFile(nullptr), m_logRawEnabled(false), m_logRawBytes(false),
|
||||||
m_logRawLastSymbol(SYN), m_dumpFile(nullptr) {
|
m_logRawLastSymbol(SYN), m_dumpFile(nullptr) {
|
||||||
memset(m_seenAddresses, 0, sizeof(m_seenAddresses));
|
memset(m_seenAddresses, 0, sizeof(m_seenAddresses));
|
||||||
m_device->setListener(this);
|
device->setListener(this);
|
||||||
m_logRawLastReceived = true;
|
m_logRawLastReceived = true;
|
||||||
m_logRawLastSymbol = SYN;
|
m_logRawLastSymbol = SYN;
|
||||||
}
|
}
|
||||||
@@ -371,7 +371,7 @@ class ProtocolHandler : public WaitThread, DeviceListener {
|
|||||||
void notifyDeviceData(symbol_t symbol, bool received) override;
|
void notifyDeviceData(symbol_t symbol, bool received) override;
|
||||||
|
|
||||||
// @copydoc
|
// @copydoc
|
||||||
void notifyStatus(bool error, const char* message) override;
|
void notifyDeviceStatus(bool error, const char* message) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear stored values (e.g. scan results).
|
* Clear stored values (e.g. scan results).
|
||||||
|
|||||||
Reference in New Issue
Block a user