diff --git a/dbc/dbchandler.cpp b/dbc/dbchandler.cpp index b1353c2..6bf7c85 100644 --- a/dbc/dbchandler.cpp +++ b/dbc/dbchandler.cpp @@ -1472,6 +1472,21 @@ DBC_MESSAGE* DBCHandler::findMessage(const CANFrame &frame) return nullptr; } +/* + * As above, a real shortcut function that searches all files in order to try to find a message with the given name +*/ +DBC_MESSAGE* DBCHandler::findMessage(const QString msgName) +{ + DBC_MESSAGE *msg = nullptr; + for(int i = 0; i < loadedFiles.count(); i++) + { + DBCFile * file = getFileByIdx(i); + msg = file->messageHandler->findMsgByName(msgName); + if (msg) return msg; //if it's not null then we have a match so return it + } + return nullptr; //no match, tough luck, return null +} + int DBCHandler::getFileCount() { return loadedFiles.count(); diff --git a/dbc/dbchandler.h b/dbc/dbchandler.h index eb4a32b..ebe48e1 100644 --- a/dbc/dbchandler.h +++ b/dbc/dbchandler.h @@ -96,6 +96,7 @@ public: void removeAllFiles(); void swapFiles(int pos1, int pos2); DBC_MESSAGE* findMessage(const CANFrame &frame); + DBC_MESSAGE* findMessage(const QString msgName); int getFileCount(); DBCFile* getFileByIdx(int idx); DBCFile* getFileByName(QString name);