From 922e27dd10a7a30c0a755b2b9d828d1f2fb95458 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Sat, 20 Aug 2016 20:54:39 -0400 Subject: [PATCH] Fixes to DBC loading - Fixes signals that end in M and messages that use extended IDs --- dbc_classes.h | 4 ++-- dbchandler.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dbc_classes.h b/dbc_classes.h index 9318791..bde4ead 100644 --- a/dbc_classes.h +++ b/dbc_classes.h @@ -91,10 +91,10 @@ class DBC_MESSAGE public: DBC_MESSAGE(); - int ID; + uint32_t ID; QString name; QString comment; - int len; + unsigned int len; DBC_NODE *sender; QList attributes; DBCSignalHandler *sigHandler; diff --git a/dbchandler.cpp b/dbchandler.cpp index 057ecb1..2142ee3 100644 --- a/dbchandler.cpp +++ b/dbchandler.cpp @@ -289,7 +289,7 @@ void DBCFile::loadFile(QString fileName) if (match.hasMatch()) { 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.len = match.captured(3).toInt(); msg.sender = findNodeByName(match.captured(4)); @@ -310,7 +310,7 @@ void DBCFile::loadFile(QString fileName) sig.isMultiplexor = false; 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); if (match.hasMatch()) @@ -321,7 +321,7 @@ void DBCFile::loadFile(QString fileName) } 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); if (match.hasMatch()) {