Add preliminaries for signal viewer, update version number, switch dbc handler to singleton pattern, changes to DBC attributes

This commit is contained in:
Collin Kidder
2017-01-15 16:30:08 -05:00
parent d94c823216
commit 74f6d7f947
21 changed files with 236 additions and 55 deletions
+28 -10
View File
@@ -1,15 +1,17 @@
#ifndef DBC_CLASSES_H
#define DBC_CLASSES_H
#include <QColor>
#include <QString>
#include <QStringList>
#include <QVariant>
#include "can_structs.h"
/*classes to encapsulate data from a DBC file. Really, the stuff of interest
are the nodes, messages, signals, attributes, and comments.
These things sort of form a hierarchy. Nodes send and receive messages.
Messages are comprised of signals. Signals and messages have attributes.
Messages are comprised of signals. Nodes, signals, and messages potentially have attribute values.
All of them can have comments.
*/
@@ -30,17 +32,31 @@ enum DBC_ATTRIBUTE_VAL_TYPE
ENUM
};
enum DBC_ATTRIBUTE_TYPE
{
GENERAL,
NODE,
MESSAGE,
SIG
};
class DBC_ATTRIBUTE
{
public:
QString name;
DBC_ATTRIBUTE_VAL_TYPE type;
double startVal;
double endVal;
QStringList enumVals; //also used for STRING type but then you're assured to have only one
DBC_ATTRIBUTE_VAL_TYPE valType;
DBC_ATTRIBUTE_TYPE attrType;
double upper, lower;
QVariant defaultValue;
};
class DBC_VAL
class DBC_ATTRIBUTE_VALUE
{
QString attrName;
QVariant value;
};
class DBC_VAL_ENUM_ENTRY
{
public:
int value;
@@ -52,7 +68,7 @@ class DBC_NODE
public:
QString name;
QString comment;
QList<DBC_ATTRIBUTE> attributes;
QList<DBC_ATTRIBUTE_VALUE> attributes;
};
class DBC_MESSAGE; //forward reference so that DBC_SIGNAL can compile before we get to real definition of DBC_MESSAGE
@@ -76,8 +92,8 @@ public: //TODO: this is sloppy. It shouldn't all be public!
DBC_MESSAGE *parentMessage;
QString unitName;
QString comment;
QList<DBC_ATTRIBUTE> attributes;
QList<DBC_VAL> valList;
QList<DBC_ATTRIBUTE_VALUE> attributes;
QList<DBC_VAL_ENUM_ENTRY> valList;
bool processAsText(const CANFrame &frame, QString &outString);
bool processAsInt(const CANFrame &frame, int32_t &outValue);
@@ -96,7 +112,9 @@ public:
QString comment;
unsigned int len;
DBC_NODE *sender;
QList<DBC_ATTRIBUTE> attributes;
QColor bgColor;
QColor fgColor;
QList<DBC_ATTRIBUTE_VALUE> attributes;
DBCSignalHandler *sigHandler;
DBC_SIGNAL* multiplexorSignal;
};