Slight change to civ detection code

merge-requests/4/head
Phil Taylor 2021-05-14 08:45:40 +01:00
rodzic e8ea5a9427
commit 6fba8c8328
1 zmienionych plików z 1 dodań i 6 usunięć

Wyświetl plik

@ -190,16 +190,11 @@ void pttyHandler::receiveDataIn(int fd) {
#endif
int lastFE = inPortData.lastIndexOf((char)0xfe);
if (civId == 0 && inPortData.length() > lastFE + 2 && (quint8)inPortData[lastFE + 2] > (quint8)0xdf && (quint8)inPortData[lastFE + 2] < (quint8)0xef) {
if (inPortData.length() > lastFE + 2 && (quint8)inPortData[lastFE + 2] > (quint8)0xdf && (quint8)inPortData[lastFE + 2] < (quint8)0xef) {
// This is (should be) the remotes CIV id.
civId = (quint8)inPortData[lastFE + 2];
qDebug(logSerial()) << "pty detected remote CI-V:" << hex << civId;
}
else if (civId != 0 && inPortData.length() > lastFE + 2 && (quint8)inPortData[lastFE + 2] != civId)
{
civId = (quint8)inPortData[lastFE + 2];
qDebug(logSerial()) << "pty remote CI-V changed:" << hex << (quint8)civId;
}
// filter 1A 05 01 12/27 = C-IV transceive command before forwarding on.
if (inPortData.contains(QByteArrayLiteral("\x1a\x05\x01\x12")) || inPortData.contains(QByteArrayLiteral("\x1a\x05\x01\x27")))