Ajout de l'affichage des données dans la fenêtre CAN Viewer
This commit is contained in:
parent
e0c3c3a979
commit
51fb065a42
@ -246,3 +246,99 @@ Otarcik CAN software startup on 2023-01-15 at 12:14:35
|
||||
2023-01-15 12:14:35 OtarcikCan modules starting...
|
||||
2023-01-15 12:14:35 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 12:14:35 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 12:50:07
|
||||
********************************************************************
|
||||
2023-01-15 12:50:07 OtarcikCan modules starting...
|
||||
2023-01-15 12:50:07 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 12:50:07 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:00:09
|
||||
********************************************************************
|
||||
2023-01-15 13:00:09 OtarcikCan modules starting...
|
||||
2023-01-15 13:00:10 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:00:10 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:39:44
|
||||
********************************************************************
|
||||
2023-01-15 13:39:44 OtarcikCan modules starting...
|
||||
2023-01-15 13:39:44 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:39:44 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:40:53
|
||||
********************************************************************
|
||||
2023-01-15 13:40:53 OtarcikCan modules starting...
|
||||
2023-01-15 13:40:53 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:40:53 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:43:32
|
||||
********************************************************************
|
||||
2023-01-15 13:43:32 OtarcikCan modules starting...
|
||||
2023-01-15 13:43:32 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:43:32 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:44:00
|
||||
********************************************************************
|
||||
2023-01-15 13:44:00 OtarcikCan modules starting...
|
||||
2023-01-15 13:44:00 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:44:00 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:46:23
|
||||
********************************************************************
|
||||
2023-01-15 13:46:23 OtarcikCan modules starting...
|
||||
2023-01-15 13:46:24 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:46:24 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:50:05
|
||||
********************************************************************
|
||||
2023-01-15 13:50:05 OtarcikCan modules starting...
|
||||
2023-01-15 13:50:05 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:50:05 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:50:31
|
||||
********************************************************************
|
||||
2023-01-15 13:50:31 OtarcikCan modules starting...
|
||||
2023-01-15 13:50:31 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:50:31 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:52:19
|
||||
********************************************************************
|
||||
2023-01-15 13:52:19 OtarcikCan modules starting...
|
||||
2023-01-15 13:52:19 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:52:19 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:53:11
|
||||
********************************************************************
|
||||
2023-01-15 13:53:11 OtarcikCan modules starting...
|
||||
2023-01-15 13:53:11 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:53:11 PCAN USB init SUCCESS
|
||||
|
||||
|
||||
********************************************************************
|
||||
Otarcik CAN software startup on 2023-01-15 at 13:54:58
|
||||
********************************************************************
|
||||
2023-01-15 13:54:58 OtarcikCan modules starting...
|
||||
2023-01-15 13:54:58 Initializing PCAN USB module. Channel:81, Baudrate:28
|
||||
2023-01-15 13:54:58 PCAN USB init SUCCESS
|
||||
|
||||
@ -2,15 +2,18 @@
|
||||
#include "PCANInterface.h"
|
||||
#include "GeneralMessagesLogDispatcher.h"
|
||||
#include "CANDatabase.h"
|
||||
#include "OtarcikCan.h"
|
||||
|
||||
|
||||
CCANAnalyzer::CCANAnalyzer(QObject *parent) : QObject(parent)
|
||||
{
|
||||
mCANDriverIF = 0;
|
||||
mCANDatabase = 0;
|
||||
mIsCANInitialized = false;
|
||||
mProgramPtr = 0;
|
||||
|
||||
mCANReadTimer = new QTimer;
|
||||
mCANReadTimer->setInterval(1000);
|
||||
mCANReadTimer->setInterval(200);
|
||||
mCANReadTimer->setSingleShot(true);
|
||||
connect(mCANReadTimer,SIGNAL(timeout()),this,SLOT(CANTimerExpired()));
|
||||
}
|
||||
@ -116,4 +119,6 @@ void CCANAnalyzer::CANTimerExpired()
|
||||
NewMessagesList.clear();
|
||||
|
||||
mCANReadTimer->start();
|
||||
|
||||
mProgramPtr->UpdateCANViewerDataRequest(mLastMessagesList);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
|
||||
class CPCANInterface;
|
||||
class CCANDatabase;
|
||||
class COtarcikCan;
|
||||
|
||||
class CCANAnalyzer : public QObject
|
||||
{
|
||||
@ -16,6 +17,7 @@ class CCANAnalyzer : public QObject
|
||||
public:
|
||||
explicit CCANAnalyzer(QObject *parent = 0);
|
||||
~CCANAnalyzer();
|
||||
COtarcikCan *mProgramPtr;
|
||||
|
||||
CPCANInterface *mCANDriverIF;
|
||||
CCANDatabase *mCANDatabase;
|
||||
|
||||
@ -22,7 +22,11 @@ int CCANMessage::SetDataFromDriver(quint32 Channel, TPCANMsg CANMsg, TPCANTimest
|
||||
mCANMsgID = (unsigned long long)CANMsg.ID;
|
||||
mCANMsgLength = (unsigned char)CANMsg.LEN;
|
||||
mCANMsgType = CANMsg.MSGTYPE;
|
||||
mCANMsgData = QByteArray((const char*)&CANMsg.DATA);
|
||||
//mCANMsgData = QByteArray((const char*)&CANMsg.DATA);
|
||||
for(int i = 0; i < mCANMsgLength; i++)
|
||||
{
|
||||
mCANMsgData.append(CANMsg.DATA[i]);
|
||||
}
|
||||
mCANMsgMicrosecs = CANTimeStamp.micros;
|
||||
mCANMsgMillisecs = CANTimeStamp.millis;
|
||||
mCANMsgMillisecsOverflow = CANTimeStamp.millis_overflow;
|
||||
|
||||
@ -1,14 +1,68 @@
|
||||
#include "CANViewerPage.h"
|
||||
#include "ui_CANViewerPage.h"
|
||||
#include "defines.h"
|
||||
|
||||
CCANViewerPage::CCANViewerPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CCANViewerPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->mCANDataTableWidget->setColumnCount(6);
|
||||
ui->mCANDataTableWidget->setHorizontalHeaderLabels(QStringList() << "Time" << "Channel" << "Msg ID" << "Msg Type" << "Msg Length" << "Data");
|
||||
|
||||
}
|
||||
|
||||
CCANViewerPage::~CCANViewerPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
int CCANViewerPage::UpdateCANTable(QList<CCANMessage *> MsgList)
|
||||
{
|
||||
for(int Col = 0; Col < ui->mCANDataTableWidget->columnCount(); Col++)
|
||||
{
|
||||
for(int Row = 0; Row < ui->mCANDataTableWidget->rowCount(); Row++)
|
||||
{
|
||||
delete ui->mCANDataTableWidget->item(Row,Col);
|
||||
}
|
||||
}
|
||||
ui->mCANDataTableWidget->clearContents();
|
||||
ui->mCANDataTableWidget->setRowCount(0);
|
||||
|
||||
ui->mCANDataTableWidget->setRowCount(MsgList.size());
|
||||
for(int Msg = 0; Msg < MsgList.size(); Msg++)
|
||||
{
|
||||
QTableWidgetItem *NewItem;
|
||||
|
||||
NewItem = new QTableWidgetItem("Time");
|
||||
ui->mCANDataTableWidget->setItem(Msg,0,NewItem);
|
||||
|
||||
//Set chanel value
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(MsgList.at(Msg)->mCANChannel));
|
||||
ui->mCANDataTableWidget->setItem(Msg,1,NewItem);
|
||||
|
||||
//Set message ID value
|
||||
NewItem = new QTableWidgetItem(QString("0x%1").arg(MsgList.at(Msg)->mCANMsgID,0,16));
|
||||
ui->mCANDataTableWidget->setItem(Msg,2,NewItem);
|
||||
|
||||
//Set message type value
|
||||
NewItem = new QTableWidgetItem(QString("0x%1").arg(MsgList.at(Msg)->mCANMsgType,0,16));
|
||||
ui->mCANDataTableWidget->setItem(Msg,3,NewItem);
|
||||
|
||||
//Set message length value
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(MsgList.at(Msg)->mCANMsgLength));
|
||||
ui->mCANDataTableWidget->setItem(Msg,4,NewItem);
|
||||
|
||||
//Set data value
|
||||
QString Data;
|
||||
for(int i = 0; i < MsgList.at(Msg)->mCANMsgLength; i++)
|
||||
{
|
||||
unsigned char DataByte = MsgList.at(Msg)->mCANMsgData.at(i);
|
||||
Data.append(QString("%1 ").arg(DataByte,2,16,QLatin1Char('0')));
|
||||
}
|
||||
NewItem = new QTableWidgetItem(Data);
|
||||
ui->mCANDataTableWidget->setItem(Msg,5,NewItem);
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
#define CANVIEWERPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "CANMessage.h"
|
||||
#include <QList>
|
||||
|
||||
namespace Ui {
|
||||
class CCANViewerPage;
|
||||
@ -15,6 +17,9 @@ public:
|
||||
explicit CCANViewerPage(QWidget *parent = 0);
|
||||
~CCANViewerPage();
|
||||
|
||||
|
||||
int UpdateCANTable(QList<CCANMessage*> MsgList);
|
||||
|
||||
private:
|
||||
Ui::CCANViewerPage *ui;
|
||||
};
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<widget class="QTableWidget" name="mCANDataTableWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
@ -23,7 +23,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="mClearCANDataBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
|
||||
@ -21,6 +21,8 @@ COtarcikCan::COtarcikCan(QObject *parent) : QObject(parent)
|
||||
mPCANInterface = new CPCANInterface;
|
||||
mCANDatabase = new CCANDatabase;
|
||||
mCANAnalyzer = new CCANAnalyzer(mPCANInterface);
|
||||
|
||||
mCANAnalyzer->mProgramPtr = this;
|
||||
}
|
||||
|
||||
COtarcikCan::~COtarcikCan()
|
||||
@ -33,9 +35,9 @@ COtarcikCan::~COtarcikCan()
|
||||
|
||||
int COtarcikCan::Start()
|
||||
{
|
||||
w.show();
|
||||
mMainWindow.show();
|
||||
|
||||
CGeneralMessagesLogDispatcher::instance()->BindGuiPageHandle(w.mGeneralStatusPage);
|
||||
CGeneralMessagesLogDispatcher::instance()->BindGuiPageHandle(mMainWindow.mGeneralStatusPage);
|
||||
CGeneralMessagesLogDispatcher::instance()->Init();
|
||||
|
||||
mCANAnalyzer->Init(mPCANInterface,mCANDatabase);
|
||||
@ -46,3 +48,8 @@ int COtarcikCan::Start()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int COtarcikCan::UpdateCANViewerDataRequest(QList<CCANMessage *> MsgList)
|
||||
{
|
||||
return mMainWindow.mCANViewerPage->UpdateCANTable(MsgList);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include "GeneralMessagesLogDispatcher.h"
|
||||
#include "CANDatabase.h"
|
||||
#include "CANAnalyzer.h"
|
||||
#include <QList>
|
||||
|
||||
class COtarcikCan : public QObject
|
||||
{
|
||||
@ -14,10 +15,13 @@ class COtarcikCan : public QObject
|
||||
public:
|
||||
explicit COtarcikCan(QObject *parent = 0);
|
||||
~COtarcikCan();
|
||||
CMainWindow w;
|
||||
CMainWindow mMainWindow;
|
||||
|
||||
int Start();
|
||||
|
||||
|
||||
int UpdateCANViewerDataRequest(QList<CCANMessage*> MsgList);
|
||||
|
||||
private:
|
||||
|
||||
CCANAnalyzer *mCANAnalyzer;
|
||||
|
||||
Binary file not shown.
@ -21,20 +21,20 @@ QT_BEGIN_NAMESPACE
|
||||
class Ui_CCANViewerPage
|
||||
{
|
||||
public:
|
||||
QTableWidget *tableWidget;
|
||||
QPushButton *pushButton;
|
||||
QTableWidget *mCANDataTableWidget;
|
||||
QPushButton *mClearCANDataBtn;
|
||||
|
||||
void setupUi(QWidget *CCANViewerPage)
|
||||
{
|
||||
if (CCANViewerPage->objectName().isEmpty())
|
||||
CCANViewerPage->setObjectName(QString::fromUtf8("CCANViewerPage"));
|
||||
CCANViewerPage->resize(1140, 581);
|
||||
tableWidget = new QTableWidget(CCANViewerPage);
|
||||
tableWidget->setObjectName(QString::fromUtf8("tableWidget"));
|
||||
tableWidget->setGeometry(QRect(30, 60, 1051, 411));
|
||||
pushButton = new QPushButton(CCANViewerPage);
|
||||
pushButton->setObjectName(QString::fromUtf8("pushButton"));
|
||||
pushButton->setGeometry(QRect(70, 500, 80, 22));
|
||||
mCANDataTableWidget = new QTableWidget(CCANViewerPage);
|
||||
mCANDataTableWidget->setObjectName(QString::fromUtf8("mCANDataTableWidget"));
|
||||
mCANDataTableWidget->setGeometry(QRect(30, 60, 1051, 411));
|
||||
mClearCANDataBtn = new QPushButton(CCANViewerPage);
|
||||
mClearCANDataBtn->setObjectName(QString::fromUtf8("mClearCANDataBtn"));
|
||||
mClearCANDataBtn->setGeometry(QRect(70, 500, 80, 22));
|
||||
|
||||
retranslateUi(CCANViewerPage);
|
||||
|
||||
@ -44,7 +44,7 @@ public:
|
||||
void retranslateUi(QWidget *CCANViewerPage)
|
||||
{
|
||||
CCANViewerPage->setWindowTitle(QCoreApplication::translate("CCANViewerPage", "Form", nullptr));
|
||||
pushButton->setText(QCoreApplication::translate("CCANViewerPage", "Reset", nullptr));
|
||||
mClearCANDataBtn->setText(QCoreApplication::translate("CCANViewerPage", "Reset", nullptr));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user