Additional implementation of DBC editor

This commit is contained in:
Collin Kidder
2015-06-09 21:29:03 -04:00
parent 27ab4aade7
commit b140737ab7
4 changed files with 26 additions and 7 deletions
+9 -3
View File
@@ -253,12 +253,18 @@ void DBCHandler::loadDBCFile(QString filename)
inFile->close();
}
void DBCHandler::saveDBCFile(QString filename)
{
}
DBC_NODE *DBCHandler::findNodeByName(QString name)
{
if (dbc_nodes.length() == 0) return NULL;
for (int i = 0; i < dbc_nodes.length(); i++)
{
if (dbc_nodes[i].name == name)
if (dbc_nodes[i].name.compare(name, Qt::CaseInsensitive) == 0)
{
return &dbc_nodes[i];
}
@@ -299,7 +305,7 @@ DBC_MESSAGE *DBCHandler::findMsgByName(QString name)
if (dbc_messages.length() == 0) return NULL;
for (int i = 0; i < dbc_messages.length(); i++)
{
if (dbc_messages[i].name.compare(name, Qt::CaseInsensitive))
if (dbc_messages[i].name.compare(name, Qt::CaseInsensitive) == 0)
{
return &dbc_messages[i];
}
@@ -313,7 +319,7 @@ DBC_SIGNAL *DBCHandler::findSignalByName(DBC_MESSAGE *msg, QString name)
if (msg->msgSignals.length() == 0) return NULL;
for (int i = 0; i < msg->msgSignals.length(); i++)
{
if (msg->msgSignals[i].name == name)
if (msg->msgSignals[i].name.compare(name, Qt::CaseInsensitive) == 0)
{
return &msg->msgSignals[i];
}
+1
View File
@@ -16,6 +16,7 @@ class DBCHandler : public QObject
public:
explicit DBCHandler(QObject *parent = 0);
void loadDBCFile(QString);
void saveDBCFile(QString);
void listDebugging();
QString processSignal(const CANFrame &frame, const DBC_SIGNAL &sig);
DBC_NODE *findNodeByName(QString name);
+11 -1
View File
@@ -114,7 +114,7 @@ void DBCMainEditor::onCellChangedNode(int row,int col)
qDebug() << "New comment: " << thisNode->comment;
}
}
ui->NodesTable->setCurrentCell(row, col);
}
void DBCMainEditor::onCellChangedMessage(int row,int col)
@@ -243,6 +243,8 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
{
ui->MessagesTable->insertRow(ui->MessagesTable->rowCount());
}
ui->MessagesTable->setCurrentCell(row, col);
}
void DBCMainEditor::onCellClickedNode(int row, int col)
@@ -284,6 +286,14 @@ void DBCMainEditor::refreshNodesTable()
int rowIdx;
if (dbcHandler->findNodeByName("Vector_XXX") == NULL)
{
DBC_NODE newNode;
newNode.name = "Vector_XXX";
newNode.comment = "Default node if no other node is specified";
dbcHandler->dbc_nodes.append(newNode);
}
for (int x = 0; x < dbcHandler->dbc_nodes.count(); x++)
{
DBC_NODE node = dbcHandler->dbc_nodes.at(x);
+5 -3
View File
@@ -90,12 +90,14 @@ void DBCSignalEditor::fillSignalForm(DBC_SIGNAL *sig)
endBit = startBit + sig->signalSize - 1;
for (int y = startBit; y <= endBit; y++)
bitpattern[startBit / 8] |= 1 << (startBit % 8);
ui->bitfield->setReference(bitpattern, false);
for (int y = startBit + 1; y <= endBit; y++)
{
int byt = y / 8;
bitpattern[byt] |= 1 << (y % 8);
}
ui->bitfield->setReference(bitpattern, false);
}
ui->bitfield->updateData(bitpattern, true);
ui->cbIntelFormat->setChecked(sig->intelByteOrder);