Added fully qualified dbc, node, and msg searching
...to graphing window and signal viewer so complex systems with message name duplication (eg "Status") works well. DBCHandler class has a new function to find a msg by fully qualified node name...Utility class defines the qualified name seperator, right now it is :: and is used thusly filenameNoExtension::nodeName for display in the node dropdown (because nodes can be common between dbc files). To get the message from the system you use the findMessage function in dbchandler and pass the msgName and the fully qualified node name. This is about as unique as we can get, second only to message ID. Added node comboBox to graph signal editor for easier data filtering (took the same implementation that was in signal viewer, and tuned up both of them)
This commit is contained in:
@@ -392,6 +392,11 @@ QString DBCFile::getFilename()
|
||||
return fileName;
|
||||
}
|
||||
|
||||
QString DBCFile::getFilenameNoExt()
|
||||
{
|
||||
return fileName.split(".dbc")[0];
|
||||
}
|
||||
|
||||
QString DBCFile::getPath()
|
||||
{
|
||||
return filePath;
|
||||
@@ -873,6 +878,7 @@ bool DBCFile::loadFile(QString fileName)
|
||||
DBC_ATTRIBUTE attr;
|
||||
int numSigFaults = 0, numMsgFaults = 0;
|
||||
int linesSinceYield = 0;
|
||||
QString fileBaseName = QFileInfo(fileName).baseName();
|
||||
|
||||
bool inMultilineBU = false;
|
||||
|
||||
@@ -911,6 +917,7 @@ bool DBCFile::loadFile(QString fileName)
|
||||
if (rawLine.startsWith("\t") || rawLine.startsWith(" "))
|
||||
{
|
||||
DBC_NODE node;
|
||||
node.sourceFileName = fileBaseName;
|
||||
node.name = line;
|
||||
dbc_nodes.append(node);
|
||||
}
|
||||
@@ -950,6 +957,7 @@ bool DBCFile::loadFile(QString fileName)
|
||||
if (nodeStrings[i].length() > 1)
|
||||
{
|
||||
DBC_NODE node;
|
||||
node.sourceFileName = fileBaseName;
|
||||
node.name = nodeStrings[i];
|
||||
dbc_nodes.append(node);
|
||||
}
|
||||
@@ -2202,6 +2210,8 @@ DBC_MESSAGE* DBCHandler::findMessageForFilter(uint32_t id, MatchingCriteria_t *
|
||||
|
||||
/*
|
||||
* As above, a real shortcut function that searches all files in order to try to find a message with the given name
|
||||
* This has pitfalls because the same message name can easily exist in multiple dbc files AND nodes in a single file
|
||||
* By DBC standards only the MSG ID is required to be unique
|
||||
*/
|
||||
DBC_MESSAGE* DBCHandler::findMessage(const QString msgName)
|
||||
{
|
||||
@@ -2215,6 +2225,43 @@ DBC_MESSAGE* DBCHandler::findMessage(const QString msgName)
|
||||
return nullptr; //no match, tough luck, return null
|
||||
}
|
||||
|
||||
DBC_MESSAGE* DBCHandler::findMessage(const QString msgName, const QString nodeName, const QString fileNameNoExt)
|
||||
{
|
||||
DBC_MESSAGE *msg = nullptr;
|
||||
for(int i = 0; i < loadedFiles.count(); i++)
|
||||
{
|
||||
DBCFile * file = getFileByIdx(i);
|
||||
if(file->getFilenameNoExt() == fileNameNoExt)
|
||||
{
|
||||
int msgCount = file->messageHandler->getCount();
|
||||
for(int f = 0; f < msgCount; f++)
|
||||
{
|
||||
msg = file->messageHandler->findMsgByIdx(f);
|
||||
if (msg && msg->name == msgName && msg->sender->name == nodeName)
|
||||
return msg; //if it's not null and the node name matches return it
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr; //no match, tough luck, return null
|
||||
}
|
||||
|
||||
DBC_MESSAGE* DBCHandler::findMessage(const QString msgName, const QString fullyQualifiedNodeName)
|
||||
{
|
||||
QStringList nodeNameParts = fullyQualifiedNodeName.split(Utility::fullyQualifiedNameSeperator);
|
||||
if(nodeNameParts.count() != 2)
|
||||
{
|
||||
qDebug() << "Error parsing fully qualified node name for message search";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString fileNameNoExt = nodeNameParts[0];
|
||||
QString nodeName = nodeNameParts[1];
|
||||
|
||||
DBC_MESSAGE *msg = nullptr;
|
||||
msg = findMessage(msgName, nodeName, fileNameNoExt);
|
||||
return msg;
|
||||
}
|
||||
|
||||
int DBCHandler::getFileCount()
|
||||
{
|
||||
return loadedFiles.count();
|
||||
|
||||
Reference in New Issue
Block a user