diff --git a/qdlt/qdltsettingsmanager.cpp b/qdlt/qdltsettingsmanager.cpp index b1a710b0..fd888f1a 100644 --- a/qdlt/qdltsettingsmanager.cpp +++ b/qdlt/qdltsettingsmanager.cpp @@ -142,6 +142,7 @@ void QDltSettingsManager::writeSettingsLocal(QXmlStreamWriter &xml) xml.writeTextElement("updateContextLoadingFile",QString("%1").arg(updateContextLoadingFile)); xml.writeTextElement("updateContextsUnregister",QString("%1").arg(updateContextsUnregister)); xml.writeTextElement("loggingOnlyMode",QString("%1").arg(loggingOnlyMode)); + xml.writeTextElement("loggingOnlyFilteredMessages",QString("%1").arg(loggingOnlyFilteredMessages)); xml.writeTextElement("splitlogfile",QString("%1").arg(splitlogfile)); xml.writeTextElement("fmaxFileSizeMB",QString("%1").arg(fmaxFileSizeMB)); xml.writeTextElement("appendDateTime",QString("%1").arg(appendDateTime)); @@ -186,6 +187,7 @@ void QDltSettingsManager::writeSettings() settings->setValue("startup/autoMarkWarn",autoMarkWarn); settings->setValue("startup/autoMarkMarker",autoMarkMarker); settings->setValue("startup/loggingOnlyMode",loggingOnlyMode); + settings->setValue("startup/loggingOnlyFilteredMessages",loggingOnlyFilteredMessages); settings->setValue("startup/splitfileyesno",splitlogfile); settings->setValue("startup/maxFileSizeMB",fmaxFileSizeMB); settings->setValue("startup/appendDateTime",appendDateTime); @@ -358,6 +360,10 @@ void QDltSettingsManager::readSettingsLocal(QXmlStreamReader &xml) { loggingOnlyMode = xml.readElementText().toInt(); } + if(xml.name() == QString("loggingOnlyFilteredMessages")) + { + loggingOnlyFilteredMessages = xml.readElementText().toInt(); + } if(xml.name() == QString("markercolor")) { markercolor.setNamedColor(xml.readElementText()); @@ -430,6 +436,7 @@ void QDltSettingsManager::readSettings() autoMarkWarn = settings->value("startup/autoMarkWarn",0).toInt(); autoMarkMarker = settings->value("startup/autoMarkMarker",1).toInt(); loggingOnlyMode = settings->value("startup/loggingOnlyMode",0).toInt(); + loggingOnlyFilteredMessages = settings->value("startup/loggingOnlyFilteredMessages",0).toInt(); splitlogfile = settings->value("startup/splitfileyesno",0).toInt(); fmaxFileSizeMB = settings->value("startup/maxFileSizeMB",100).toFloat(); appendDateTime = settings->value("startup/appendDateTime",0).toInt(); diff --git a/qdlt/qdltsettingsmanager.h b/qdlt/qdltsettingsmanager.h index eaf67971..51bb03c3 100644 --- a/qdlt/qdltsettingsmanager.h +++ b/qdlt/qdltsettingsmanager.h @@ -97,6 +97,7 @@ class QDLT_EXPORT QDltSettingsManager int updateContextLoadingFile; // project and local setting int updateContextsUnregister; // project and local setting int loggingOnlyMode; // project and local setting + int loggingOnlyFilteredMessages; // project and local setting int splitlogfile; // local and project setting float fmaxFileSizeMB; // local and project setting int appendDateTime; // local and project setting diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index efdb5ebb..53e2d0ec 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4273,7 +4273,26 @@ void MainWindow::read(EcuItem* ecuitem) { // DLT message found, write it with storage header QByteArray empty; - writeDLTMessageToFile(empty,dataPtr,sizeMsg,ecuitem); + if(settings->loggingOnlyFilteredMessages) + { + // write only messages which match filter + bool silentMode = !QDltOptManager::getInstance()->issilentMode(); + QDltMsg qmsg; + qmsg.setMsg(QByteArray(dataPtr,sizeMsg),false); + if ( true == pluginsEnabled ) // we check the general plugin enabled/disabled switch + { + pluginManager.decodeMsg(qmsg,silentMode); + } + if(qfile.checkFilter(qmsg)) + { + writeDLTMessageToFile(empty,dataPtr,sizeMsg,ecuitem); + } + } + else + { + // write all messages + writeDLTMessageToFile(empty,dataPtr,sizeMsg,ecuitem); + } totalBytesRcvd+=sizeMsg; if(sizeMsg<=dataSize) { @@ -4330,18 +4349,36 @@ void MainWindow::read(EcuItem* ecuitem) (ecuitem->interfacetype == EcuItem::INTERFACETYPE_SERIAL_DLT && ecuitem->serialcon.parseDlt(qmsg)) || (ecuitem->interfacetype == EcuItem::INTERFACETYPE_SERIAL_ASCII && ecuitem->serialcon.parseAscii(qmsg)) ) { + /* analyse received message, check if DLT control message response */ + if ( (qmsg.getType()==QDltMsg::DltTypeControl) && (qmsg.getSubtype()==QDltMsg::DltControlResponse)) + { + controlMessage_ReceiveControlMessage(ecuitem,qmsg); + } + /* write message to file */ QByteArray bufferHeader; QByteArray bufferPayload; bufferHeader = qmsg.getHeader(); bufferPayload = qmsg.getPayload(); - writeDLTMessageToFile(bufferHeader,bufferPayload.data(),bufferPayload.size(),ecuitem); - - /* analyse received message, check if DLT control message response */ - if ( (qmsg.getType()==QDltMsg::DltTypeControl) && (qmsg.getSubtype()==QDltMsg::DltControlResponse)) + if(settings->loggingOnlyFilteredMessages) { - controlMessage_ReceiveControlMessage(ecuitem,qmsg); + // write only messages which match filter + bool silentMode = !QDltOptManager::getInstance()->issilentMode(); + if ( true == pluginsEnabled ) // we check the general plugin enabled/disabled switch + { + pluginManager.decodeMsg(qmsg,silentMode); + } + if(qfile.checkFilter(qmsg)) + { + writeDLTMessageToFile(bufferHeader,bufferPayload.data(),bufferPayload.size(),ecuitem); + } + } + else + { + // write all messages + writeDLTMessageToFile(bufferHeader,bufferPayload.data(),bufferPayload.size(),ecuitem); } + } //end while if(ecuitem->interfacetype == EcuItem::INTERFACETYPE_TCP) diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 3cc3cce0..4edd0613 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -243,6 +243,7 @@ void SettingsDialog::writeDlg() ui->checkBoxAutoMarkWarn->setCheckState(settings->autoMarkWarn?Qt::Checked:Qt::Unchecked); ui->checkBoxAutoMarkMarker->setCheckState(settings->autoMarkMarker?Qt::Checked:Qt::Unchecked); ui->checkBoxLoggingOnlyMode->setCheckState(settings->loggingOnlyMode?Qt::Checked:Qt::Unchecked); + ui->checkBoxLoggingOnlyFilteredMessages->setCheckState(settings->loggingOnlyFilteredMessages?Qt::Checked:Qt::Unchecked); ui->groupBoxMaxFileSizeMB->setChecked(settings->splitlogfile?Qt::Checked:Qt::Unchecked); ui->lineEditMaxFileSizeMB->setText(QString("%1").arg(settings->fmaxFileSizeMB)); ui->checkBoxAppendDateTime->setCheckState(settings->appendDateTime?Qt::Checked:Qt::Unchecked); @@ -412,6 +413,7 @@ void SettingsDialog::readDlg() settings->autoMarkWarn = (ui->checkBoxAutoMarkWarn->checkState() == Qt::Checked); settings->autoMarkMarker = (ui->checkBoxAutoMarkMarker->checkState() == Qt::Checked); settings->loggingOnlyMode = (ui->checkBoxLoggingOnlyMode->checkState() == Qt::Checked); + settings->loggingOnlyFilteredMessages = (ui->checkBoxLoggingOnlyFilteredMessages->checkState() == Qt::Checked); settings->splitlogfile = ui->groupBoxMaxFileSizeMB->isChecked(); if(settings->splitlogfile != 0) { diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index 7fd45f48..f6adb3c7 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -842,51 +842,31 @@ Other - - - - <html><head/><body><p>Automatically mark all messages of subtype ( loglevel ) &quot;fatal&quot; and &quot;error&quot; with red color</p></body></html> - - - Auto mark fatal/error messages - - - - + Append Date/Time to filename when closing DLT Viewer - - - - Update Contexts when loading log file - - - - - - - <html><head/><body><p>If this chechbox is enabled the last ECU connected is tried to be connected automatically.</p></body></html> - + + - Auto connect to ECUs at start + Update Context Unregister - - + + - Auto scroll + Logging only mode (Disables View and Plugins) - - + + - Logging only mode (Disables View and Plugins) + Auto mark Marker messages @@ -897,7 +877,7 @@ - + Manual marker color @@ -972,14 +952,24 @@ - - + + + + <html><head/><body><p>If this chechbox is enabled the last ECU connected is tried to be connected automatically.</p></body></html> + - Auto mark Marker messages + Auto connect to ECUs at start - + + + + Update Contexts when loading log file + + + + @@ -1018,7 +1008,7 @@ - true + false @@ -1037,10 +1027,27 @@ - - + + - Update Context Unregister + Auto scroll + + + + + + + <html><head/><body><p>Automatically mark all messages of subtype ( loglevel ) &quot;fatal&quot; and &quot;error&quot; with red color</p></body></html> + + + Auto mark fatal/error messages + + + + + + + Logging only filtered DLT Messages