diff --git a/canframemodel.cpp b/canframemodel.cpp index 735236b..c7f5ce1 100644 --- a/canframemodel.cpp +++ b/canframemodel.cpp @@ -779,7 +779,7 @@ int CANFrameModel::sendBulkRefresh() if (lastUpdateNumFrames == 0 && !overwriteDups) return 0; if (filteredFrames.count() == 0) return 0; - qDebug() << "Bulk refresh of " << lastUpdateNumFrames; + //qDebug() << "Bulk refresh of " << lastUpdateNumFrames; beginResetModel(); endResetModel(); diff --git a/connections/canconfactory.cpp b/connections/canconfactory.cpp index 1fc461c..0adb9b8 100644 --- a/connections/canconfactory.cpp +++ b/connections/canconfactory.cpp @@ -13,6 +13,9 @@ CANConnection* CanConFactory::create(type pType, QString pPortName, QString pDri case SERIALBUS: return new SerialBusConnection(pPortName, pDriverName); case GVRET_SERIAL: + if(pPortName.contains(".")) + return new GVRetSerial(pPortName, true); + else return new GVRetSerial(pPortName, false); case REMOTE: return new GVRetSerial(pPortName, true); //it's a special case of GVRET connected over TCP/IP so it uses the same class diff --git a/connections/socketcand.cpp b/connections/socketcand.cpp index 9bbddbb..20f2ae8 100644 --- a/connections/socketcand.cpp +++ b/connections/socketcand.cpp @@ -263,6 +263,12 @@ void SocketCANd::decodeFrames(QString data, int busNum) QString frameStr = frameStrConst; QStringList frameParsed = (frameStr.remove(QRegExp("^<")).remove(QRegExp(">$"))).simplified().split(' '); + if(frameParsed.length() < 2) + { + qDebug() << "Received datagramm is an incomplete frame: " << data; + return; + } + buildFrame.setFrameId(frameParsed[1].toUInt(nullptr, 16)); buildFrame.bus = busNum; @@ -271,6 +277,13 @@ void SocketCANd::decodeFrames(QString data, int busNum) buildFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, frameParsed[2].toDouble() * 1000000l)); //buildFrame.len = frameParsed[3].length() * 0.5; + + if(frameParsed.length() < 4) + { + qDebug() << "Received frame doesn't contain any data: " << data; + return; + } + int framelength = frameParsed[3].length() * 0.5; buildData.resize(framelength); @@ -383,6 +396,18 @@ void SocketCANd::procRXData(QString data, int busNum) { rx_state[busNum] = RAWMODE; } + else if(data.indexOf("< ok >", 0, Qt::CaseSensitivity::CaseInsensitive) == 0) + { + qDebug() << "Ok found at start of compound message, switching to RAW and decoding immediately"; + rx_state[busNum] = RAWMODE; + decodeFrames(data, busNum); + } + else if(data.indexOf("< ok >", 0, Qt::CaseSensitivity::CaseInsensitive) > 0) + { + qDebug() << "Ok found at in middle of compound message, switching to RAW and decoding immediately"; + rx_state[busNum] = RAWMODE; + decodeFrames(data, busNum); + } break; case RAWMODE: decodeFrames(data, busNum); diff --git a/framesenderwindow.cpp b/framesenderwindow.cpp index 8e796ef..7029fa0 100644 --- a/framesenderwindow.cpp +++ b/framesenderwindow.cpp @@ -898,7 +898,7 @@ void FrameSenderWindow::processCellChange(int line, int col) case 6: //Data bytes for (int i = 0; i < 8; i++) sendingData[line].payload().data()[i] = 0; - tokens = ui->tableSender->item(line, 6)->text().split(" "); + tokens = ui->tableSender->item(line, 6)->text().split(" ", QString::SkipEmptyParts); arr.clear(); arr.reserve(tokens.count()); for (int j = 0; j < tokens.count(); j++)