Add a new function to DBC handler to make it easier to find messages
by name
This commit is contained in:
@@ -1472,6 +1472,21 @@ DBC_MESSAGE* DBCHandler::findMessage(const CANFrame &frame)
|
|||||||
return nullptr;
|
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()
|
int DBCHandler::getFileCount()
|
||||||
{
|
{
|
||||||
return loadedFiles.count();
|
return loadedFiles.count();
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ public:
|
|||||||
void removeAllFiles();
|
void removeAllFiles();
|
||||||
void swapFiles(int pos1, int pos2);
|
void swapFiles(int pos1, int pos2);
|
||||||
DBC_MESSAGE* findMessage(const CANFrame &frame);
|
DBC_MESSAGE* findMessage(const CANFrame &frame);
|
||||||
|
DBC_MESSAGE* findMessage(const QString msgName);
|
||||||
int getFileCount();
|
int getFileCount();
|
||||||
DBCFile* getFileByIdx(int idx);
|
DBCFile* getFileByIdx(int idx);
|
||||||
DBCFile* getFileByName(QString name);
|
DBCFile* getFileByName(QString name);
|
||||||
|
|||||||
Reference in New Issue
Block a user