Skip to content

Commit

Permalink
Merge branch 'COVESA:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bunty95 authored Oct 15, 2024
2 parents 81f6982 + 7a6700e commit efdeae8
Show file tree
Hide file tree
Showing 13 changed files with 360 additions and 176 deletions.
47 changes: 24 additions & 23 deletions qdlt/qdltexporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void QDltExporter::writeCSVLine(int index, QFile *to, QDltMsg msg)
text += escapeCSVValue(QString("%1").arg(msg.getModeString())).append(delimiter);
text += escapeCSVValue(QString("%1").arg(msg.getNumberOfArguments())).append(delimiter);
QString payload = msg.toStringPayload().simplified().remove(QChar::Null);
if(from) from->applyRegExString(payload);
if(from) from->applyRegExString(msg,payload);
text += escapeCSVValue(payload);
text += "\n";

Expand Down Expand Up @@ -99,12 +99,12 @@ bool QDltExporter::start()
{
if(!to->open(QIODevice::WriteOnly | QIODevice::Text))
{
if ( true == QDltOptManager::getInstance()->issilentMode() )
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
else
;//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
if (QDltOptManager::getInstance()->issilentMode())
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
//else
//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
// QString("Cannot open the export file %1").arg(to->fileName()));
return false;
}
Expand All @@ -113,12 +113,12 @@ bool QDltExporter::start()
{
if(!to->open(QIODevice::WriteOnly))
{
if ( true == QDltOptManager::getInstance()->issilentMode() )
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
else
;//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
if (QDltOptManager::getInstance()->issilentMode() )
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
//else
//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
// QString("Cannot open the export file %1").arg(to->fileName()));
return false;
}
Expand All @@ -130,12 +130,12 @@ bool QDltExporter::start()
/* Write the first line of CSV file */
if(!writeCSVHeader(to))
{
if ( true == QDltOptManager::getInstance()->issilentMode() )
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
else
;//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
if(QDltOptManager::getInstance()->issilentMode())
{
qDebug() << QString("ERROR - cannot open the export file %1").arg(to->fileName());
}
//else
//QMessageBox::critical(qobject_cast<QWidget *>(parent()), QString("DLT Viewer"),
// QString("Cannot open the export file %1").arg(to->fileName()));
return false;
}
Expand Down Expand Up @@ -283,7 +283,7 @@ bool QDltExporter::exportMsg(unsigned long int num, QDltMsg &msg, QByteArray &bu
text += " ";
}
QString payload = msg.toStringPayload().simplified().remove(QChar::Null);
if(from) from->applyRegExString(payload);
if(from) from->applyRegExString(msg,payload);
text += payload;
text += "\n";
try
Expand Down Expand Up @@ -331,7 +331,7 @@ bool QDltExporter::exportMsg(unsigned long int num, QDltMsg &msg, QByteArray &bu
else
text += "|" + QString("%1.%2").arg(msg.getTimeString()).arg(msg.getMicroseconds(),6,10,QLatin1Char('0'));
QString payload = msg.toStringPayload().simplified().remove(QChar::Null);
if(from) from->applyRegExString(payload);
if(from) from->applyRegExString(msg,payload);
text += "|" + QString("%1.%2").arg(msg.getTimestamp()/10000).arg(msg.getTimestamp()%10000,4,10,QLatin1Char('0')) +
"|" + msg.getEcuid() +
"|" + msg.getApid() +
Expand Down Expand Up @@ -440,8 +440,9 @@ void QDltExporter::exportMessages(QDltFile *from, QFile *to, QDltPluginManager *
{
//FIXME: The following does not work for non verbose messages, must be fixed to enable RegEx for DLT Export again
//msg.setNumberOfArguments(msg.sizeArguments());
//if(from) from->applyRegExStringMsg(msg);
//msg.getMsg(buf,true);
bool isApplied = false;
if(from) isApplied = from->applyRegExStringMsg(msg);
if(isApplied) msg.getMsg(buf,true);
}

// export message
Expand Down
7 changes: 4 additions & 3 deletions qdlt/qdltfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,12 +755,13 @@ void QDltFile::setIndexFilter(QVector<qint64> _indexFilter)
indexFilter = _indexFilter;
}

bool QDltFile::applyRegExString(QString &text)
bool QDltFile::applyRegExString(QDltMsg &msg,QString &text)
{
return filterList.applyRegExString(text);

return filterList.applyRegExString(msg,text);
}

bool QDltFile::applyRegExStringMsg(QDltMsg &msg)
{
{
return filterList.applyRegExStringMsg(msg);
}
2 changes: 1 addition & 1 deletion qdlt/qdltfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class QDLT_EXPORT QDltFile : public QDlt
//! Apply RegEx Replace to the string, if any active in the filters
/*!
*/
bool applyRegExString(QString &text);
bool applyRegExString(QDltMsg &msg,QString &text);

//! Apply RegEx Replace to the arguments of a message, if any active in the filters
/*!
Expand Down
6 changes: 3 additions & 3 deletions qdlt/qdltfilterlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ QString QDltFilterList::checkMarker(QDltMsg &msg)

#endif

bool QDltFilterList::applyRegExString(QString &text)
bool QDltFilterList::applyRegExString(QDltMsg &msg,QString &text)
{
QDltFilter *filter;
bool result = false;
Expand All @@ -133,7 +133,7 @@ bool QDltFilterList::applyRegExString(QString &text)
{
filter = pfilters[numfilter];

if(filter->enableFilter && filter->enableRegexSearchReplace)
if(filter->enableFilter && filter->enableRegexSearchReplace && filter->match(msg))
{
text.replace(QRegularExpression(filter->regex_search), filter->regex_replace);
result = true;
Expand All @@ -151,7 +151,7 @@ bool QDltFilterList::applyRegExStringMsg(QDltMsg &msg)
{
filter = pfilters[numfilter];

if(filter->enableFilter && filter->enableRegexSearchReplace)
if(filter->enableFilter && filter->enableRegexSearchReplace && filter->match(msg))
{
for(int num=0;num<msg.getNumberOfArguments();num++)
{
Expand Down
2 changes: 1 addition & 1 deletion qdlt/qdltfilterlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class QDLT_EXPORT QDltFilterList
//! Apply RegEx Replace to the string, if any active in the filters.
/*!
*/
bool applyRegExString(QString &text);
bool applyRegExString(QDltMsg &msg,QString &text);

//! Apply RegEx Replace to the argumnets of a message, if any active in the filters.
/*!
Expand Down
Loading

0 comments on commit efdeae8

Please sign in to comment.