Fixes to DBC loading - Fixes signals that end in M and messages that use extended IDs

This commit is contained in:
Collin Kidder
2016-08-20 20:54:39 -04:00
parent f0e0a8d705
commit 922e27dd10
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -91,10 +91,10 @@ class DBC_MESSAGE
public: public:
DBC_MESSAGE(); DBC_MESSAGE();
int ID; uint32_t ID;
QString name; QString name;
QString comment; QString comment;
int len; unsigned int len;
DBC_NODE *sender; DBC_NODE *sender;
QList<DBC_ATTRIBUTE> attributes; QList<DBC_ATTRIBUTE> attributes;
DBCSignalHandler *sigHandler; DBCSignalHandler *sigHandler;
+3 -3
View File
@@ -289,7 +289,7 @@ void DBCFile::loadFile(QString fileName)
if (match.hasMatch()) if (match.hasMatch())
{ {
DBC_MESSAGE msg; DBC_MESSAGE msg;
msg.ID = match.captured(1).toInt(); //the ID is always stored in decimal format msg.ID = match.captured(1).toULong() & 0x7FFFFFFFul; //the ID is always stored in decimal format
msg.name = match.captured(2); msg.name = match.captured(2);
msg.len = match.captured(3).toInt(); msg.len = match.captured(3).toInt();
msg.sender = findNodeByName(match.captured(4)); msg.sender = findNodeByName(match.captured(4));
@@ -310,7 +310,7 @@ void DBCFile::loadFile(QString fileName)
sig.isMultiplexor = false; sig.isMultiplexor = false;
qDebug() << "Found a SG line"; qDebug() << "Found a SG line";
regex.setPattern("^SG\\_ *(\\w+) *M *: *(\\d+)\\|(\\d+)@(\\d+)([\\+|\\-]) \\(([0-9.+\\-eE]+),([0-9.+\\-eE]+)\\) \\[([0-9.+\\-eE]+)\\|([0-9.+\\-eE]+)\\] \\\"(.*)\\\" (.*)"); regex.setPattern("^SG\\_ *(\\w+)^ *M *: *(\\d+)\\|(\\d+)@(\\d+)([\\+|\\-]) \\(([0-9.+\\-eE]+),([0-9.+\\-eE]+)\\) \\[([0-9.+\\-eE]+)\\|([0-9.+\\-eE]+)\\] \\\"(.*)\\\" (.*)");
match = regex.match(line); match = regex.match(line);
if (match.hasMatch()) if (match.hasMatch())
@@ -321,7 +321,7 @@ void DBCFile::loadFile(QString fileName)
} }
else else
{ {
regex.setPattern("^SG\\_ *(\\w+) *m(\\d+) *: *(\\d+)\\|(\\d+)@(\\d+)([\\+|\\-]) \\(([0-9.+\\-eE]+),([0-9.+\\-eE]+)\\) \\[([0-9.+\\-eE]+)\\|([0-9.+\\-eE]+)\\] \\\"(.*)\\\" (.*)"); regex.setPattern("^SG\\_ *(\\w+)^ *m(\\d+) *: *(\\d+)\\|(\\d+)@(\\d+)([\\+|\\-]) \\(([0-9.+\\-eE]+),([0-9.+\\-eE]+)\\) \\[([0-9.+\\-eE]+)\\|([0-9.+\\-eE]+)\\] \\\"(.*)\\\" (.*)");
match = regex.match(line); match = regex.match(line);
if (match.hasMatch()) if (match.hasMatch())
{ {