Various fixes to issues caused by recent transition to QCanBusFrame

This commit is contained in:
Collin Kidder
2020-02-18 21:31:18 -05:00
parent 3b41b9579c
commit 367c072b45
8 changed files with 73 additions and 70 deletions
+19 -19
View File
@@ -609,7 +609,7 @@ void FlowViewWindow::changeID(QString newID)
updateGraphLocation();
memcpy(currBytes, frameCache.at(currentPosition).payload(), 8);
memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), 8);
memcpy(refBytes, currBytes, 8);
updateDataView();
@@ -645,7 +645,7 @@ void FlowViewWindow::btnStopClick()
currentPosition = 0;
memcpy(currBytes, frameCache.at(currentPosition).payload().data_ptr(), 8);
memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), 8);
memcpy(refBytes, currBytes, 8);
updateFrameLabel();
@@ -705,23 +705,23 @@ void FlowViewWindow::timerTriggered()
void FlowViewWindow::updateDataView()
{
ui->txtCurr1->setText(Utility::formatNumber((char)currBytes[0]));
ui->txtCurr2->setText(Utility::formatNumber((char)currBytes[1]));
ui->txtCurr3->setText(Utility::formatNumber((char)currBytes[2]));
ui->txtCurr4->setText(Utility::formatNumber((char)currBytes[3]));
ui->txtCurr5->setText(Utility::formatNumber((char)currBytes[4]));
ui->txtCurr6->setText(Utility::formatNumber((char)currBytes[5]));
ui->txtCurr7->setText(Utility::formatNumber((char)currBytes[6]));
ui->txtCurr8->setText(Utility::formatNumber((char)currBytes[7]));
ui->txtCurr1->setText(Utility::formatNumber((unsigned char)currBytes[0]));
ui->txtCurr2->setText(Utility::formatNumber((unsigned char)currBytes[1]));
ui->txtCurr3->setText(Utility::formatNumber((unsigned char)currBytes[2]));
ui->txtCurr4->setText(Utility::formatNumber((unsigned char)currBytes[3]));
ui->txtCurr5->setText(Utility::formatNumber((unsigned char)currBytes[4]));
ui->txtCurr6->setText(Utility::formatNumber((unsigned char)currBytes[5]));
ui->txtCurr7->setText(Utility::formatNumber((unsigned char)currBytes[6]));
ui->txtCurr8->setText(Utility::formatNumber((unsigned char)currBytes[7]));
ui->txtRef1->setText(Utility::formatNumber((char)refBytes[0]));
ui->txtRef2->setText(Utility::formatNumber((char)refBytes[1]));
ui->txtRef3->setText(Utility::formatNumber((char)refBytes[2]));
ui->txtRef4->setText(Utility::formatNumber((char)refBytes[3]));
ui->txtRef5->setText(Utility::formatNumber((char)refBytes[4]));
ui->txtRef6->setText(Utility::formatNumber((char)refBytes[5]));
ui->txtRef7->setText(Utility::formatNumber((char)refBytes[6]));
ui->txtRef8->setText(Utility::formatNumber((char)refBytes[7]));
ui->txtRef1->setText(Utility::formatNumber((unsigned char)refBytes[0]));
ui->txtRef2->setText(Utility::formatNumber((unsigned char)refBytes[1]));
ui->txtRef3->setText(Utility::formatNumber((unsigned char)refBytes[2]));
ui->txtRef4->setText(Utility::formatNumber((unsigned char)refBytes[3]));
ui->txtRef5->setText(Utility::formatNumber((unsigned char)refBytes[4]));
ui->txtRef6->setText(Utility::formatNumber((unsigned char)refBytes[5]));
ui->txtRef7->setText(Utility::formatNumber((unsigned char)refBytes[6]));
ui->txtRef8->setText(Utility::formatNumber((unsigned char)refBytes[7]));
ui->flowView->setReference(refBytes, false);
ui->flowView->updateData(currBytes, true);
@@ -782,7 +782,7 @@ void FlowViewWindow::updatePosition(bool forward)
playbackTimer->stop();
}
memcpy(currBytes, frameCache.at(currentPosition).payload().data(), 8);
memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), 8);
if (ui->cbSync->checkState() == Qt::Checked) emit sendCenterTimeID(frameCache[currentPosition].frameId(), frameCache[currentPosition].timeStamp().microSeconds() / 1000000.0);
}
+3 -22
View File
@@ -2,6 +2,7 @@
#include "ui_isotp_interpreterwindow.h"
#include "mainwindow.h"
#include "helpwindow.h"
#include "filterutility.h"
ISOTP_InterpreterWindow::ISOTP_InterpreterWindow(const QVector<CANFrame> *frames, QWidget *parent) :
QDialog(parent),
@@ -136,7 +137,7 @@ void ISOTP_InterpreterWindow::listFilterItemChanged(QListWidgetItem *item)
{
if (item)
{
int id = item->text().toInt(nullptr, 16);
int id = FilterUtility::getIdAsInt(item);
bool state = item->checkState();
//qDebug() << id << "*" << state;
idFilters[id] = state;
@@ -240,22 +241,6 @@ void ISOTP_InterpreterWindow::newUDSMessage(UDS_MESSAGE msg)
buildText = ui->txtFrameDetails->toPlainText();
/*
buildText.append("UDS Message:\n");
if (msg.isErrorReply)
{
buildText.append("Error reply for service " + udsDecoder->getServiceShortDesc(msg.service));
buildText.append("\nError Desc: " + udsDecoder->getNegativeResponseShort(msg.subFunc));
}
else
{
if (msg.service < 0x3F || (msg.service > 0x7F && msg.service < 0xAF))
buildText.append("Request for service " + udsDecoder->getServiceShortDesc(msg.service) + " Sub Func: " + QString::number(msg.subFunc));
else
buildText.append("Response on service " + udsDecoder->getServiceShortDesc(msg.service - 0x40) + " Sub Func: " + QString::number(msg.subFunc));
}*/
//Much more detailed analysis than the code above. You'll like it.
buildText.append(udsDecoder->getDetailedMessageAnalysis(msg));
ui->txtFrameDetails->setPlainText(buildText);
@@ -275,9 +260,7 @@ void ISOTP_InterpreterWindow::newISOMessage(ISOTP_MESSAGE msg)
{
idFilters.insert(msg.frameId(), true);
QListWidgetItem* listItem = new QListWidgetItem(Utility::formatCANID(msg.frameId(), msg.hasExtendedFrameFormat()), ui->listFilter);
listItem->setFlags(listItem->flags() | Qt::ItemIsUserCheckable); // set checkable flag
listItem->setCheckState(Qt::Checked);
FilterUtility::createCheckableFilterItem(msg.frameId(), true, ui->listFilter);
}
if (!idFilters[msg.frameId()]) return;
messages.append(msg);
@@ -303,5 +286,3 @@ void ISOTP_InterpreterWindow::newISOMessage(ISOTP_MESSAGE msg)
}
ui->tableIsoFrames->setItem(rowNum, 5, new QTableWidgetItem(tempString));
}
+4 -9
View File
@@ -3,6 +3,7 @@
#include "mainwindow.h"
#include "utility.h"
#include "helpwindow.h"
#include "filterutility.h"
RangeStateWindow::RangeStateWindow(const QVector<CANFrame> *frames, QWidget *parent) :
QDialog(parent),
@@ -68,7 +69,7 @@ RangeStateWindow::RangeStateWindow(const QVector<CANFrame> *frames, QWidget *par
[=](QListWidgetItem *item)
{
bool isChecked = false;
int id = Utility::ParseStringToNum(item->text());
int id = FilterUtility::getIdAsInt(item);
if (item->checkState() == Qt::Checked) isChecked = true;
idFilters[id] = isChecked;
});
@@ -161,9 +162,7 @@ void RangeStateWindow::updatedFrames(int numFrames)
if (!idFilters.contains(thisFrame.frameId()))
{
idFilters.insert(thisFrame.frameId(), true);
QListWidgetItem* listItem = new QListWidgetItem(Utility::formatCANID(thisFrame.frameId(), thisFrame.hasExtendedFrameFormat()), ui->listFilter);
listItem->setFlags(listItem->flags() | Qt::ItemIsUserCheckable); // set checkable flag
listItem->setCheckState(Qt::Checked); //default all filters to be set active
FilterUtility::createCheckableFilterItem(thisFrame.frameId(), true, ui->listFilter);
}
}
}
@@ -182,11 +181,7 @@ void RangeStateWindow::refreshFilterList()
if (!idFilters.contains(id))
{
idFilters.insert(id, true);
QListWidgetItem* listItem;
if (id < 0x800) listItem = new QListWidgetItem(Utility::formatCANID(id, false), ui->listFilter);
else listItem = new QListWidgetItem(Utility::formatCANID(id, true), ui->listFilter);
listItem->setFlags(listItem->flags() | Qt::ItemIsUserCheckable); // set checkable flag
listItem->setCheckState(Qt::Checked); //default all filters to be set active
FilterUtility::createCheckableFilterItem(id, true, ui->listFilter);
}
}