Dev
This commit is contained in:
parent
ed0678081f
commit
145d07754d
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
*.o
|
||||
*.pro.user
|
||||
*~*
|
||||
/Otarcik_CAN/debug/moc_*.cpp
|
||||
|
||||
|
||||
BIN
Doc interne/Big Endian.xlsx
Normal file
BIN
Doc interne/Big Endian.xlsx
Normal file
Binary file not shown.
BIN
Otarcik_CAN/Config/Station.cfg
Normal file
BIN
Otarcik_CAN/Config/Station.cfg
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -42,7 +42,8 @@ SOURCES += Sources/main.cpp \
|
||||
Sources/Gui/CANViewerPage.cpp \
|
||||
Sources/CANDatabase/CANDatabase.cpp \
|
||||
Sources/CANDevice.cpp \
|
||||
Sources/CANSignal.cpp
|
||||
Sources/CANSignal.cpp \
|
||||
Sources/SystemConfig.cpp
|
||||
|
||||
HEADERS += Sources/MainWindow.h \
|
||||
Sources/PCANInterface.h \
|
||||
@ -58,7 +59,8 @@ HEADERS += Sources/MainWindow.h \
|
||||
Sources/Gui/CANViewerPage.h \
|
||||
Sources/CANDatabase/CANDatabase.h \
|
||||
Sources/CANDevice.h \
|
||||
Sources/CANSignal.h
|
||||
Sources/CANSignal.h \
|
||||
Sources/SystemConfig.h
|
||||
|
||||
FORMS += Sources/Gui/MainWindow.ui \
|
||||
Sources/Gui/GeneralStatusPage.ui \
|
||||
|
||||
@ -11,9 +11,10 @@ CCANAnalyzer::CCANAnalyzer(QObject *parent) : QObject(parent)
|
||||
mIsCANInitialized = false;
|
||||
mDevicePtr = 0;
|
||||
mDeviceMessagesList = 0;
|
||||
mCANPollPeriod = 0;
|
||||
|
||||
mCANReadTimer = new QTimer;
|
||||
mCANReadTimer->setInterval(200);
|
||||
mCANReadTimer->setInterval(1000);
|
||||
mCANReadTimer->setSingleShot(true);
|
||||
connect(mCANReadTimer,SIGNAL(timeout()),this,SLOT(CANTimerExpired()));
|
||||
}
|
||||
@ -25,16 +26,21 @@ CCANAnalyzer::~CCANAnalyzer()
|
||||
delete mCANReadTimer;
|
||||
}
|
||||
|
||||
int CCANAnalyzer::Init(TPCANHandle CANDeviceChannel, TPCANBaudrate CANDeviceBaudrate, QList<CCANMessage *> *MsgList)
|
||||
int CCANAnalyzer::Init(TPCANHandle CANDeviceChannel, TPCANBaudrate CANDeviceBaudrate, QList<CCANMessage *> *MsgList, unsigned int PollPeriod)
|
||||
{
|
||||
|
||||
if(MsgList == 0)
|
||||
{
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
if(PollPeriod < 200)
|
||||
{
|
||||
PollPeriod = 200;
|
||||
qDebug("CANAnalyzer:: Trying to init with poll period lower tan 200ms");
|
||||
}
|
||||
|
||||
|
||||
mCANDeviceChannel = CANDeviceChannel;
|
||||
mCANPollPeriod = PollPeriod;
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage("Démarrage d'un module CAN...");
|
||||
|
||||
mDeviceMessagesList = MsgList;
|
||||
@ -47,7 +53,7 @@ int CCANAnalyzer::Init(TPCANHandle CANDeviceChannel, TPCANBaudrate CANDeviceBaud
|
||||
}
|
||||
else
|
||||
{
|
||||
// mCANReadTimer->start();
|
||||
mCANReadTimer->start(mCANPollPeriod);
|
||||
mIsCANInitialized = true;
|
||||
}
|
||||
|
||||
@ -94,6 +100,8 @@ void CCANAnalyzer::CANTimerExpired()
|
||||
delete NewMessagesList.takeFirst();
|
||||
}
|
||||
|
||||
mDevicePtr->NewMessageParsed();
|
||||
|
||||
|
||||
if(NewMessagesList.isEmpty())
|
||||
{
|
||||
@ -101,43 +109,6 @@ void CCANAnalyzer::CANTimerExpired()
|
||||
return;
|
||||
}
|
||||
|
||||
// for(int i = 0; i < NewMessagesList.size(); i++)
|
||||
// {
|
||||
// if(mLastMessagesList.isEmpty())
|
||||
// {
|
||||
// mLastMessagesList.append(NewMessagesList.at(i));
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //Check if new message ID for this device already exists in the list.
|
||||
// bool found = false;
|
||||
// for(int j = 0; j < mLastMessagesList.size(); j++)
|
||||
// {
|
||||
// if(NewMessagesList[i]->mCANChannel == mLastMessagesList[j]->mCANChannel &&
|
||||
// NewMessagesList[i]->mCANMsgID == mLastMessagesList[j]->mCANMsgID)
|
||||
// {
|
||||
// //This message ID is already populated in the list. Update the value and delete the new instance
|
||||
// mLastMessagesList[j]->mCANMsgData = NewMessagesList[i]->mCANMsgData;
|
||||
// mLastMessagesList[j]->mCANMsgMicrosecs = NewMessagesList[i]->mCANMsgMicrosecs;
|
||||
// mLastMessagesList[j]->mCANMsgMillisecs = NewMessagesList[i]->mCANMsgMillisecs;
|
||||
// mLastMessagesList[j]->mCANMsgMillisecsOverflow = NewMessagesList[i]->mCANMsgMillisecsOverflow;
|
||||
|
||||
// delete NewMessagesList[i];
|
||||
// DeletedPtrs++;
|
||||
// found = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if(!found)
|
||||
// {
|
||||
// //This is the first time we receive this message, just add it to the list.
|
||||
// mLastMessagesList.append(NewMessagesList[i]);
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
NewMessagesList.clear();
|
||||
|
||||
|
||||
@ -21,8 +21,9 @@ public:
|
||||
CPCANInterface *mCANDriverIF;
|
||||
|
||||
QTimer *mCANReadTimer;
|
||||
unsigned int mCANPollPeriod;
|
||||
|
||||
int Init(TPCANHandle CANDeviceChannel, TPCANBaudrate CANDeviceBaudrate, QList<CCANMessage *> *MsgList);
|
||||
int Init(TPCANHandle CANDeviceChannel, TPCANBaudrate CANDeviceBaudrate, QList<CCANMessage *> *MsgList, unsigned int PollPeriod);
|
||||
int ReadCAN();
|
||||
|
||||
QList<CCANMessage *> *mDeviceMessagesList;
|
||||
|
||||
@ -40,6 +40,7 @@ int CCANDatabase::LoadDatabaseFile(QString Filename)
|
||||
|
||||
// Load the database file
|
||||
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Chargement de la base de données %1").arg(Filename),true);
|
||||
status = kvaDbReadFile(mDatabaseDriverHandle, Filename.toLocal8Bit().data());
|
||||
if (status != kvaDbOK)
|
||||
{
|
||||
|
||||
@ -1,9 +1,32 @@
|
||||
#include "CANDevice.h"
|
||||
#include "OtarcikCan.h"
|
||||
|
||||
CCANDevice::CCANDevice(QObject *parent)
|
||||
{
|
||||
mMessageList.clear();
|
||||
mMessagesListLoaded = false;
|
||||
mCANAnalyzer.mDevicePtr = this;
|
||||
mProgramPtr = 0;
|
||||
mCANDeviceDatabaseFilename.clear();
|
||||
mCANDeviceID = -1;
|
||||
mCANDeviceBaudrate = -1;
|
||||
mDeviceDescription.clear();
|
||||
mDeviceName.clear();
|
||||
mDevicePollPeriod = 0;
|
||||
}
|
||||
|
||||
CCANDevice::CCANDevice(CCANDevice &Other)
|
||||
{
|
||||
mMessageList.clear();
|
||||
mMessagesListLoaded = false;
|
||||
mCANAnalyzer.mDevicePtr = this;
|
||||
mProgramPtr = 0;
|
||||
|
||||
mCANDeviceID = Other.mCANDeviceID;
|
||||
mCANDeviceBaudrate = Other.mCANDeviceBaudrate;
|
||||
mCANDeviceDatabaseFilename = Other.mCANDeviceDatabaseFilename;
|
||||
mDeviceName = Other.mDeviceName;
|
||||
mDeviceDescription = Other.mDeviceDescription;
|
||||
}
|
||||
|
||||
CCANDevice::~CCANDevice()
|
||||
@ -14,26 +37,98 @@ CCANDevice::~CCANDevice()
|
||||
}
|
||||
}
|
||||
|
||||
int CCANDevice::Init(QString DatabaseFileName, TPCANHandle CANDeviceID, TPCANBaudrate CANDeviceBaudRate, QString DevDescription, QString DeviceName)
|
||||
int CCANDevice::Init()
|
||||
{
|
||||
mCANDeviceID = CANDeviceID;
|
||||
mCANDeviceBaudrate = CANDeviceBaudRate;
|
||||
mCANDeviceDatabaseFilename = DatabaseFileName;
|
||||
mDeviceDescription = DevDescription;
|
||||
mDeviceName = DeviceName;
|
||||
if(mCANDeviceID < 0 || mCANDeviceBaudrate < 0 || mDevicePollPeriod == 0 || mCANDeviceDatabaseFilename.isEmpty() || mDeviceName.isEmpty())
|
||||
{
|
||||
qDebug("CCANDevice: trying to initialize a CCANDevice with invalid parameters");
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
if(mCANDatabase.Init(DatabaseFileName) == RET_OK)
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Initialisation du dispositif [%1]").arg(mDeviceName));
|
||||
|
||||
if(mCANDatabase.Init(mCANDeviceDatabaseFilename) == RET_OK)
|
||||
{
|
||||
if(mCANDatabase.BuildMessageList(&mMessageList) == RET_OK)
|
||||
{
|
||||
mMessagesListLoaded = true;
|
||||
mProgramPtr->InitCANViewer(&mMessageList);
|
||||
}
|
||||
else
|
||||
{
|
||||
mMessagesListLoaded = false;
|
||||
}
|
||||
}
|
||||
mCANAnalyzer.Init(CANDeviceID,CANDeviceBaudRate,&mMessageList);
|
||||
if(mCANAnalyzer.Init(mCANDeviceID,mCANDeviceBaudrate,&mMessageList,mDevicePollPeriod) != RET_OK)
|
||||
{
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Le dispositif [%1] n'a pas pu s'initialiser").arg(mDeviceName),true,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_ERROR_STATUS);
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Dispositif [%1] initialisé avec succès!").arg(mDeviceName));
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CCANDevice::Init(QString DatabaseFileName, TPCANHandle CANDeviceID, TPCANBaudrate CANDeviceBaudRate, QString DevDescription, QString DeviceName, unsigned int DevicePollPeriod)
|
||||
{
|
||||
mCANDeviceID = CANDeviceID;
|
||||
mCANDeviceBaudrate = CANDeviceBaudRate;
|
||||
mCANDeviceDatabaseFilename = DatabaseFileName;
|
||||
mDeviceDescription = DevDescription;
|
||||
mDeviceName = DeviceName;
|
||||
mDevicePollPeriod = DevicePollPeriod;
|
||||
|
||||
Init();
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CCANDevice::NewMessageParsed()
|
||||
{
|
||||
mProgramPtr->UpdateCANViewerDataRequest(&mMessageList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const CCANDevice &source)
|
||||
{
|
||||
out << source.mCANDeviceID
|
||||
<< source.mCANDeviceBaudrate
|
||||
<< source.mCANDeviceDatabaseFilename
|
||||
<< source.mDeviceDescription
|
||||
<< source.mDeviceName
|
||||
<< source.mDevicePollPeriod;
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, CCANDevice &dest)
|
||||
{
|
||||
in >> dest.mCANDeviceID
|
||||
>> dest.mCANDeviceBaudrate
|
||||
>> dest.mCANDeviceDatabaseFilename
|
||||
>> dest.mDeviceDescription
|
||||
>> dest.mDeviceName
|
||||
>> dest.mDevicePollPeriod;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
//CAREFUL!!! OPERATOR = DOES NOT COPY THE MESSAGES, ONLY THE DEVICE DESCRIPTION !!//
|
||||
CCANDevice& CCANDevice::operator=(const CCANDevice *source)
|
||||
{
|
||||
if(source == this)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
this->mCANDeviceID = source->mCANDeviceID;
|
||||
this->mCANDeviceBaudrate = source->mCANDeviceBaudrate;
|
||||
this->mCANDeviceDatabaseFilename = source->mCANDeviceDatabaseFilename;
|
||||
this->mDeviceDescription = source->mDeviceDescription;
|
||||
this->mDeviceName = source->mDeviceName;
|
||||
this->mDevicePollPeriod = source->mDevicePollPeriod;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -10,15 +10,18 @@
|
||||
#include <QList>
|
||||
#include "PCANBasic.h"
|
||||
|
||||
class COtarcikCan;
|
||||
|
||||
class CCANDevice : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CCANDevice(QObject *parent = 0);
|
||||
CCANDevice(CCANDevice &Other);
|
||||
~CCANDevice();
|
||||
|
||||
int Init(QString DatabaseFileName, TPCANHandle CANDeviceID, TPCANBaudrate CANDeviceBaudRate, QString DevDescription, QString DeviceName);
|
||||
|
||||
int Init(QString DatabaseFileName, TPCANHandle CANDeviceID, TPCANBaudrate CANDeviceBaudRate, QString DevDescription, QString DeviceName, unsigned int DevicePollPeriod);
|
||||
int Init();
|
||||
|
||||
public:
|
||||
TPCANHandle mCANDeviceID;
|
||||
@ -26,6 +29,8 @@ public:
|
||||
QString mCANDeviceDatabaseFilename;
|
||||
QString mDeviceDescription;
|
||||
QString mDeviceName;
|
||||
COtarcikCan *mProgramPtr;
|
||||
unsigned int mDevicePollPeriod;
|
||||
|
||||
bool mMessagesListLoaded;
|
||||
CCANAnalyzer mCANAnalyzer; //The module that handles the USB puck and decodes the data
|
||||
@ -33,9 +38,19 @@ public:
|
||||
|
||||
QList<CCANMessage*> mMessageList;
|
||||
|
||||
CCANDevice &operator=(const CCANDevice *source);
|
||||
|
||||
int NewMessageParsed();
|
||||
|
||||
private:
|
||||
bool mConfigSet;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const CCANDevice &source);
|
||||
QDataStream &operator>>(QDataStream &in, CCANDevice &dest);
|
||||
|
||||
#endif // CANDEVICE_H
|
||||
|
||||
@ -68,20 +68,26 @@ int CCANMessage::UpdateValue(CCANMessage *NewDeviceMessage)
|
||||
|
||||
mCANMsgData = QByteArray(NewDeviceMessage->mCANMsgData);
|
||||
|
||||
// if(NewDeviceMessage->mCANMsgID == 0x524)
|
||||
// int toto = 5;
|
||||
|
||||
mCANRawDataMotorola = mCANRawDataIntel= 0;
|
||||
|
||||
for(int i = 0; i < mCANMsgLength; i++)
|
||||
for(unsigned int i = 0; i < mCANMsgLength; i++)
|
||||
{
|
||||
mCANRawDataIntel += mCANMsgData[i];
|
||||
mCANRawDataMotorola += mCANMsgData[(mCANMsgLength - 1) - i];
|
||||
mCANRawDataIntel += ((unsigned char)(mCANMsgData[i]) & 0xFF);
|
||||
mCANRawDataMotorola += ((unsigned char)(mCANMsgData[(mCANMsgLength - 1) - i]) & 0xFF);
|
||||
|
||||
mCANRawDataIntel <<= 8;
|
||||
mCANRawDataMotorola <<= 8;
|
||||
if(i < mCANMsgLength-1)
|
||||
{
|
||||
mCANRawDataIntel <<= 8;
|
||||
mCANRawDataMotorola <<= 8;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < mSignalsList.size(); i++)
|
||||
{
|
||||
mSignalsList.at(i)->ComputeNewSignalValue(mCANRawDataMotorola,mCANRawDataIntel);
|
||||
mSignalsList.at(i)->ComputeNewSignalValue(mCANRawDataIntel, mCANMsgLength);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,32 +1,45 @@
|
||||
#include "CANSignal.h"
|
||||
#include "defines.h"
|
||||
|
||||
|
||||
CCANSignal::CCANSignal()
|
||||
{
|
||||
mEncoding = CAN_SIGNAL_ENCODING_INVALID;
|
||||
|
||||
}
|
||||
|
||||
int CCANSignal::ComputeNewSignalValue(quint64 MotorolaValue, quint64 IntelValue)
|
||||
int CCANSignal::ComputeNewSignalValue(quint64 NewValue, quint16 MessageSize)
|
||||
{
|
||||
if(mEncoding == CAN_SIGNAL_ENCODING_INTEL)
|
||||
{
|
||||
mRawValue = IntelValue;
|
||||
//TODO: trouver un device qui crache du intel??
|
||||
mRawValue = NewValue;
|
||||
}
|
||||
else if(mEncoding == CAN_SIGNAL_ENCODING_MOTOROLA)
|
||||
{
|
||||
mRawValue = MotorolaValue;
|
||||
//mRawValue = MotorolaValue;
|
||||
mRawValue = NewValue;
|
||||
int StartIndex = mStartBit - (mStartBit % 8) + 7 - (mStartBit % 8);
|
||||
int shift = ((MessageSize * 8) - StartIndex -1);
|
||||
mRawValue >>= shift;
|
||||
quint64 mask = 1;
|
||||
mask <<= mSignalSize;
|
||||
mask -= 1;
|
||||
mRawValue &= mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
mRawValue >>= mStartBit;
|
||||
quint64 mask = ((1 << mSignalSize)-1);
|
||||
mRawValue &= mask;
|
||||
// mRawValue >>= mStartBit;
|
||||
// quint64 mask = ((1 << mSignalSize)-1);
|
||||
// mRawValue &= mask;
|
||||
|
||||
mPhysicalValue = ((double) mRawValue * mValueFactor) + mValueOffset;
|
||||
|
||||
mPhysicalValue = ((signed) mRawValue * mValueFactor) + mValueOffset;
|
||||
// mPhysicalValue = (test * mValueFactor) + mValueOffset;
|
||||
//mPhysicalValue = test;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -49,13 +49,13 @@ public:
|
||||
unsigned int mValueType;
|
||||
double mValueFactor;
|
||||
double mValueOffset;
|
||||
double mMinValue;
|
||||
double mMaxValue;
|
||||
int mMinValue;
|
||||
int mMaxValue;
|
||||
QString mSignalUnit;
|
||||
|
||||
int ComputeNewSignalValue(quint64 MotorolaValue, quint64 IntelValue);
|
||||
int ComputeNewSignalValue(quint64 NewValue, quint16 MessageSize);
|
||||
|
||||
|
||||
private:
|
||||
quint64 mRawValue;
|
||||
double mPhysicalValue;
|
||||
|
||||
|
||||
@ -6,10 +6,25 @@ CCANViewerPage::CCANViewerPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CCANViewerPage)
|
||||
{
|
||||
|
||||
mMsgList = 0;
|
||||
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->mCANDataTableWidget->setColumnCount(6);
|
||||
ui->mCANDataTableWidget->setHorizontalHeaderLabels(QStringList() << "Time" << "Channel" << "Msg ID" << "Msg Type" << "Msg Length" << "Data");
|
||||
|
||||
ui->mCANDataTableWidget->clearContents();
|
||||
ui->mCANDataTableWidget->setRowCount(0);
|
||||
ui->mCANDataTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
|
||||
ui->mCANSignalTableWidget->setColumnCount(4);
|
||||
ui->mCANSignalTableWidget->setHorizontalHeaderLabels(QStringList() << "Nom du signal" << "Val. physique" << "Val. brute" << "Unités");
|
||||
|
||||
|
||||
|
||||
|
||||
connect(ui->mCANDataTableWidget,&QTableWidget::itemSelectionChanged,this,&CCANViewerPage::MessageSelectionChanged);
|
||||
}
|
||||
|
||||
CCANViewerPage::~CCANViewerPage()
|
||||
@ -17,52 +32,167 @@ CCANViewerPage::~CCANViewerPage()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
int CCANViewerPage::UpdateCANTable(QList<CCANMessage *> MsgList)
|
||||
int CCANViewerPage::InitCANTable(QList<CCANMessage *> *MsgList)
|
||||
{
|
||||
for(int Col = 0; Col < ui->mCANDataTableWidget->columnCount(); Col++)
|
||||
if(MsgList == 0)
|
||||
{
|
||||
for(int Row = 0; Row < ui->mCANDataTableWidget->rowCount(); Row++)
|
||||
{
|
||||
delete ui->mCANDataTableWidget->item(Row,Col);
|
||||
}
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
ui->mCANDataTableWidget->clearContents();
|
||||
ui->mCANDataTableWidget->setRowCount(0);
|
||||
|
||||
ui->mCANDataTableWidget->setRowCount(MsgList.size());
|
||||
for(int Msg = 0; Msg < MsgList.size(); Msg++)
|
||||
mMsgList = MsgList;
|
||||
|
||||
int row = ui->mCANDataTableWidget->rowCount();
|
||||
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);
|
||||
ui->mCANDataTableWidget->setItem(row,0,NewItem);
|
||||
|
||||
//Set chanel value
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(MsgList.at(Msg)->mCANChannel));
|
||||
ui->mCANDataTableWidget->setItem(Msg,1,NewItem);
|
||||
//Set Msg name
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(MsgList->at(Msg)->mCANMsgName));
|
||||
ui->mCANDataTableWidget->setItem(row,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);
|
||||
NewItem = new QTableWidgetItem(QString("0x%1").arg(MsgList->at(Msg)->mCANMsgID,0,16));
|
||||
ui->mCANDataTableWidget->setItem(row,2,NewItem);
|
||||
NewItem->setData(Qt::UserRole,MsgList->at(Msg)->mCANMsgID); //Set message ID as reference to easily find the row when updating...
|
||||
|
||||
//Set message type value
|
||||
NewItem = new QTableWidgetItem(QString("0x%1").arg(MsgList.at(Msg)->mCANMsgType,0,16));
|
||||
ui->mCANDataTableWidget->setItem(Msg,3,NewItem);
|
||||
NewItem = new QTableWidgetItem(QString("0x%1").arg(MsgList->at(Msg)->mCANMsgType,0,16));
|
||||
ui->mCANDataTableWidget->setItem(row,3,NewItem);
|
||||
|
||||
//Set message length value
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(MsgList.at(Msg)->mCANMsgLength));
|
||||
ui->mCANDataTableWidget->setItem(Msg,4,NewItem);
|
||||
NewItem = new QTableWidgetItem(QString(" "));
|
||||
ui->mCANDataTableWidget->setItem(row,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);
|
||||
NewItem = new QTableWidgetItem(QString(" "));
|
||||
ui->mCANDataTableWidget->setItem(row,5,NewItem);
|
||||
|
||||
row++;
|
||||
|
||||
|
||||
|
||||
// //Set data value
|
||||
// QString Data;
|
||||
// for(unsigned 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);
|
||||
}
|
||||
// ui->mCANSignalTableWidget->setCurrentItem(ui->mCANDataTableWidget->item(0,0));
|
||||
// MessageSelectionChanged();
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CCANViewerPage::UpdateCANTable(QList<CCANMessage *> *MsgList)
|
||||
{
|
||||
//Find the row of each message and update values in table
|
||||
for(int msg = 0; msg < MsgList->size(); msg++)
|
||||
{
|
||||
int row = 0;
|
||||
for(row = 0; row < ui->mCANDataTableWidget->rowCount(); row++)
|
||||
{
|
||||
// if(ui->mCANDataTableWidget->item(row,2)->text() == QString("0x%1").arg(MsgList->at(msg)->mCANMsgID,0,16))
|
||||
if(ui->mCANDataTableWidget->item(row,2)->data(Qt::UserRole).toUInt() == MsgList->at(msg)->mCANMsgID)
|
||||
{
|
||||
//Set message length value
|
||||
ui->mCANDataTableWidget->item(row,4)->setText(QString("%1").arg(MsgList->at(msg)->mCANMsgLength));
|
||||
|
||||
|
||||
QString Data;
|
||||
for(int byte = 0; byte < MsgList->at(msg)->mCANMsgData.size();byte++)
|
||||
{
|
||||
// Data.append(QString("%1 ").arg((unsigned int)MsgList->at(msg)->mCANMsgData.at(byte),2,16));
|
||||
Data.append(QString().sprintf("%.2X ",(unsigned char)MsgList->at(msg)->mCANMsgData.at(byte)));
|
||||
}
|
||||
ui->mCANDataTableWidget->item(row,5)->setText(Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
// UpdateSignalsTable();
|
||||
MessageSelectionChanged();
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
void CCANViewerPage::MessageSelectionChanged()
|
||||
{
|
||||
if(mMsgList == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ui->mCANSignalTableWidget->clearContents();
|
||||
//Find message based on current table selection
|
||||
int row = ui->mCANDataTableWidget->currentRow();
|
||||
if(row == -1)
|
||||
return;
|
||||
for (int msg = 0; msg < mMsgList->size(); msg++)
|
||||
{
|
||||
unsigned int ID = ui->mCANDataTableWidget->item(row,2)->data(Qt::UserRole).toUInt();
|
||||
if(ID == mMsgList->at(msg)->mCANMsgID)
|
||||
{
|
||||
CCANMessage *Msg = mMsgList->at(msg);
|
||||
ui->mCANSignalTableWidget->clearContents();
|
||||
ui->mCANSignalTableWidget->setRowCount(Msg->mSignalsList.size());
|
||||
|
||||
for(int signal = 0; signal < Msg->mSignalsList.size(); signal++)
|
||||
{
|
||||
//Signal name
|
||||
QTableWidgetItem *NewItem = new QTableWidgetItem(Msg->mSignalsList.at(signal)->mSignalName);
|
||||
ui->mCANSignalTableWidget->setItem(signal,0,NewItem);
|
||||
|
||||
//Phys value
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(Msg->mSignalsList.at(signal)->mPhysicalValue,0,'f',1));
|
||||
ui->mCANSignalTableWidget->setItem(signal,1,NewItem);
|
||||
|
||||
//Raw value
|
||||
NewItem = new QTableWidgetItem(QString("0x%1").arg(Msg->mSignalsList.at(signal)->mRawValue,0,16));
|
||||
ui->mCANSignalTableWidget->setItem(signal,2,NewItem);
|
||||
|
||||
//Units
|
||||
NewItem = new QTableWidgetItem(Msg->mSignalsList.at(signal)->mSignalUnit);
|
||||
ui->mCANSignalTableWidget->setItem(signal,3,NewItem);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int CCANViewerPage::UpdateSignalsTable()
|
||||
{
|
||||
int row = ui->mCANDataTableWidget->currentRow();
|
||||
for (int msg = 0; msg < mMsgList->size(); msg++)
|
||||
{
|
||||
unsigned int ID = ui->mCANDataTableWidget->item(row,2)->data(Qt::UserRole).toUInt();
|
||||
if(ID == mMsgList->at(msg)->mCANMsgID)
|
||||
{
|
||||
CCANMessage *Msg = mMsgList->at(msg);
|
||||
ui->mCANSignalTableWidget->clearContents();
|
||||
ui->mCANSignalTableWidget->setRowCount(Msg->mSignalsList.size());
|
||||
|
||||
for(int signal = 0; signal < Msg->mSignalsList.size(); signal++)
|
||||
{
|
||||
//Signal name
|
||||
ui->mCANSignalTableWidget->item(row,0)->setText(Msg->mSignalsList.at(signal)->mSignalName);
|
||||
|
||||
//Phys value
|
||||
ui->mCANSignalTableWidget->item(row,0)->setText(QString("%1").arg(Msg->mSignalsList.at(signal)->mPhysicalValue,0,'f',1));
|
||||
|
||||
//Raw value
|
||||
ui->mCANSignalTableWidget->item(row,0)->setText(QString("0x%1").arg(Msg->mSignalsList.at(signal)->mRawValue,0,16));
|
||||
|
||||
//Units
|
||||
ui->mCANSignalTableWidget->item(row,0)->setText(Msg->mSignalsList.at(signal)->mSignalUnit);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,15 @@ public:
|
||||
~CCANViewerPage();
|
||||
|
||||
|
||||
int UpdateCANTable(QList<CCANMessage*> MsgList);
|
||||
int UpdateCANTable(QList<CCANMessage*> *MsgList);
|
||||
int InitCANTable(QList<CCANMessage*> *MsgList);
|
||||
int UpdateSignalsTable();
|
||||
|
||||
|
||||
QList<CCANMessage*> *mMsgList;
|
||||
|
||||
public slots:
|
||||
void MessageSelectionChanged();
|
||||
|
||||
private:
|
||||
Ui::CCANViewerPage *ui;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1140</width>
|
||||
<width>1848</width>
|
||||
<height>581</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -18,7 +18,7 @@
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>60</y>
|
||||
<width>1051</width>
|
||||
<width>671</width>
|
||||
<height>411</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -36,6 +36,16 @@
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="mCANSignalTableWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>720</x>
|
||||
<y>60</y>
|
||||
<width>831</width>
|
||||
<height>411</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@ -22,6 +22,14 @@
|
||||
<height>451</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>System</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
||||
@ -2,9 +2,7 @@
|
||||
#include "ui_ProgramSettingsPage.h"
|
||||
|
||||
#include "CANDevice.h"
|
||||
//#include "CANMessage.h"
|
||||
//#include "CANSignal.h"
|
||||
//#include "PCANBasic.h"
|
||||
#include "OtarcikCan.h"
|
||||
|
||||
|
||||
CProgramSettingsPage::CProgramSettingsPage(QWidget *parent) :
|
||||
@ -13,11 +11,13 @@ CProgramSettingsPage::CProgramSettingsPage(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
mProgramPtr = 0;
|
||||
mDevicesList = 0;
|
||||
|
||||
ui->mDBSignalDetailsTable->setColumnCount(10);
|
||||
ui->mDBSignalDetailsTable->setHorizontalHeaderLabels(QStringList() << "Signal" << "Bit No" << "Length" << "Type" << "Max Val" << "Min Val" << "Offset" << "Scale factor" << "Unit" << "Byte order");
|
||||
|
||||
ui->mDevicePollPeriodSpinBx->setRange(200,60000);
|
||||
|
||||
|
||||
ui->mCANBaudrateComboBx->clear();
|
||||
@ -59,10 +59,14 @@ CProgramSettingsPage::CProgramSettingsPage(QWidget *parent) :
|
||||
ui->mDatabaseFileSelectBtn->hide();
|
||||
ui->mCANBaudrateComboBx->setEnabled(false);
|
||||
ui->mCANIDComboBx->setEnabled(false);
|
||||
ui->mDevicePollPeriodSpinBx->setEnabled(false);
|
||||
ui->mCancelModifyParamsBtn->hide();
|
||||
|
||||
|
||||
connect(ui->mDevicesList,&QListWidget::itemSelectionChanged,this,&CProgramSettingsPage::DeviceSelectionChanged);
|
||||
connect(ui->mDBMessagesListWidget,&QListWidget::itemSelectionChanged,this,&CProgramSettingsPage::MessageSelectionChanged);
|
||||
connect(ui->mModifyDevParamsBtn,&QPushButton::clicked,this,&CProgramSettingsPage::ModifyDeviceBtnPressed);
|
||||
connect(ui->mCancelModifyParamsBtn,&QPushButton::clicked,this,&CProgramSettingsPage::CancelModifyDevBtnPressed);
|
||||
// connect(ui->mDBSignalDetailsTable,&QTableWidget::itemSelectionChanged,this,&CProgramSettingsPage::SignalSelectionChanged);
|
||||
|
||||
}
|
||||
@ -128,6 +132,9 @@ int CProgramSettingsPage::UpdatePage()
|
||||
ui->mCANIDComboBx->setCurrentIndex(ui->mCANIDComboBx->findData(Device->mCANDeviceID));
|
||||
ui->mDeviceDescriptionTxtEdit->setPlainText(Device->mDeviceDescription);
|
||||
ui->mDatabaseFileNameLbl->setText(QString("Database: %1").arg(Device->mCANDeviceDatabaseFilename));
|
||||
// ui->mDevicePollPeriodSpinBx->setEnabled(true);
|
||||
ui->mDevicePollPeriodSpinBx->setValue(Device->mDevicePollPeriod);
|
||||
// ui->mDevicePollPeriodSpinBx->setEnabled(false);
|
||||
|
||||
//update device database information
|
||||
ui->mDBMessagesListWidget->clear();
|
||||
@ -208,15 +215,42 @@ int CProgramSettingsPage::UpdateMessageInformation()
|
||||
ui->mDBSignalDetailsTable->setItem(Sig,2,NewItem);
|
||||
|
||||
//Type
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(Signal->mValueType));
|
||||
switch(Signal->mValueType)
|
||||
{
|
||||
case CCANSignal::CAN_SIGNAL_TYPE_INVALID:
|
||||
{
|
||||
NewItem = new QTableWidgetItem(QString("INVALIDE"));
|
||||
break;
|
||||
}
|
||||
case CCANSignal::CAN_SIGNAL_TYPE_SIGNED_INT:
|
||||
{
|
||||
NewItem = new QTableWidgetItem(QString("int"));
|
||||
break;
|
||||
}
|
||||
case CCANSignal::CAN_SIGNAL_TYPE_UNSIGNED_INT:
|
||||
{
|
||||
NewItem = new QTableWidgetItem(QString("uint"));
|
||||
break;
|
||||
}
|
||||
case CCANSignal::CAN_SIGNAL_TYPE_32_BIT_FLOAT:
|
||||
{
|
||||
NewItem = new QTableWidgetItem(QString("Float_32"));
|
||||
break;
|
||||
}
|
||||
case CCANSignal::CAN_SIGNAL_TYPE_64_BIT_DOUBLE:
|
||||
{
|
||||
NewItem = new QTableWidgetItem(QString("Double"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
ui->mDBSignalDetailsTable->setItem(Sig,3,NewItem);
|
||||
|
||||
//Max Val
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(Signal->mMaxValue,0,'f',1));
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(Signal->mMaxValue));
|
||||
ui->mDBSignalDetailsTable->setItem(Sig,4,NewItem);
|
||||
|
||||
//Min Val
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(Signal->mMinValue,0,'f',1));
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(Signal->mMinValue));
|
||||
ui->mDBSignalDetailsTable->setItem(Sig,5,NewItem);
|
||||
|
||||
//Offset
|
||||
@ -232,7 +266,26 @@ int CProgramSettingsPage::UpdateMessageInformation()
|
||||
ui->mDBSignalDetailsTable->setItem(Sig,8,NewItem);
|
||||
|
||||
//Endian
|
||||
NewItem = new QTableWidgetItem(QString("%1").arg(Signal->mValueType));
|
||||
switch(Signal->mEncoding)
|
||||
{
|
||||
case CCANSignal::CAN_SIGNAL_ENCODING_INTEL:
|
||||
{
|
||||
NewItem = new QTableWidgetItem(QString("Intel"));
|
||||
break;
|
||||
}
|
||||
case CCANSignal::CAN_SIGNAL_ENCODING_MOTOROLA:
|
||||
{
|
||||
NewItem = new QTableWidgetItem(QString("Motorola"));
|
||||
break;
|
||||
}
|
||||
case CCANSignal::CAN_SIGNAL_ENCODING_INVALID:
|
||||
{
|
||||
NewItem = new QTableWidgetItem(QString("INVALID"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ui->mDBSignalDetailsTable->setItem(Sig,9,NewItem);
|
||||
|
||||
}
|
||||
@ -259,22 +312,47 @@ void CProgramSettingsPage::ModifyDeviceBtnPressed()
|
||||
{
|
||||
if(mDeviceChangeModeEnabled)
|
||||
{
|
||||
//Save Data
|
||||
ui->mDeviceDescriptionTxtEdit->setEnabled(false);
|
||||
ui->mDatabaseFileSelectBtn->hide();
|
||||
ui->mCANBaudrateComboBx->setEnabled(false);
|
||||
ui->mCANIDComboBx->setEnabled(false);
|
||||
ui->mDevicesList->setEnabled(true);
|
||||
ui->mDevicePollPeriodSpinBx->setEnabled(false);
|
||||
ui->mModifyDevParamsBtn->setText("Modifier");
|
||||
ui->mCancelModifyParamsBtn->hide();
|
||||
mDeviceChangeModeEnabled = false;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Modify data
|
||||
ui->mDeviceDescriptionTxtEdit->setEnabled(true);
|
||||
ui->mDatabaseFileSelectBtn->show();
|
||||
ui->mCANBaudrateComboBx->setEnabled(true);
|
||||
ui->mCANIDComboBx->setEnabled(true);
|
||||
ui->mDevicesList->setEnabled(false);
|
||||
ui->mDevicePollPeriodSpinBx->setEnabled(true);
|
||||
ui->mModifyDevParamsBtn->setText("Sauvegarder");
|
||||
ui->mCancelModifyParamsBtn->show();
|
||||
|
||||
mDeviceChangeModeEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CProgramSettingsPage::CancelModifyDevBtnPressed()
|
||||
{
|
||||
ui->mDeviceDescriptionTxtEdit->setEnabled(false);
|
||||
ui->mDatabaseFileSelectBtn->hide();
|
||||
ui->mCANBaudrateComboBx->setEnabled(false);
|
||||
ui->mCANIDComboBx->setEnabled(false);
|
||||
ui->mDevicesList->setEnabled(true);
|
||||
ui->mDevicePollPeriodSpinBx->setEnabled(false);
|
||||
ui->mModifyDevParamsBtn->setText("Modifier");
|
||||
ui->mCancelModifyParamsBtn->hide();
|
||||
mDeviceChangeModeEnabled = false;
|
||||
|
||||
UpdatePage();
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
class CCANDevice;
|
||||
class CCANMessage;
|
||||
class CCANSignal;
|
||||
class COtarcikCan;
|
||||
|
||||
|
||||
namespace Ui {
|
||||
@ -26,6 +27,8 @@ public:
|
||||
int UpdateMessageInformation();
|
||||
|
||||
|
||||
COtarcikCan *mProgramPtr;
|
||||
|
||||
private:
|
||||
Ui::CProgramSettingsPage *ui;
|
||||
QList<CCANDevice *> *mDevicesList;
|
||||
@ -36,6 +39,7 @@ public slots:
|
||||
void SignalSelectionChanged();
|
||||
void MessageSelectionChanged();
|
||||
void ModifyDeviceBtnPressed();
|
||||
void CancelModifyDevBtnPressed();
|
||||
};
|
||||
|
||||
#endif // PROGRAMSETTINGSPAGE_H
|
||||
|
||||
@ -57,10 +57,10 @@
|
||||
<widget class="QGroupBox" name="mDeviceParamsGroupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<x>270</x>
|
||||
<y>100</y>
|
||||
<width>311</width>
|
||||
<height>331</height>
|
||||
<width>321</width>
|
||||
<height>371</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
@ -128,60 +128,11 @@
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mDeviceDatabaseLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>100</y>
|
||||
<width>111</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fichier database:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mDatabaseFileNameLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>120</y>
|
||||
<width>301</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fichier...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="mDatabaseFileSelectBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<y>120</y>
|
||||
<width>31</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="mModifyDevParamsBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>300</y>
|
||||
<x>220</x>
|
||||
<y>330</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
@ -194,23 +145,115 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<y>210</y>
|
||||
<width>291</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<widget class="QLabel" name="mRefreshRateLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>182</y>
|
||||
<width>181</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Période rafraîchissement (ms):</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="mDeviceDatabaseGrpBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>100</y>
|
||||
<width>301</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Base de données</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="mDatabaseFileNameLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>27</y>
|
||||
<width>301</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fichier...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="mDatabaseFileSelectBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>24</y>
|
||||
<width>31</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mCANBaudrateLbl_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>160</y>
|
||||
<width>81</width>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
<string>CAN Baudrate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="mDevicePollPeriodSpinBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>180</y>
|
||||
<width>91</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="mCancelModifyParamsBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>330</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Annuler</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -30,6 +30,7 @@ COtarcikCan::~COtarcikCan()
|
||||
delete mCANDevicesList.takeFirst();
|
||||
}
|
||||
mCANDevicesList.clear();
|
||||
mMainWindow.mProgramSettingsPage->mProgramPtr = this;
|
||||
|
||||
}
|
||||
|
||||
@ -37,26 +38,83 @@ int COtarcikCan::Start()
|
||||
{
|
||||
mMainWindow.show();
|
||||
|
||||
|
||||
|
||||
CGeneralMessagesLogDispatcher::instance()->BindGuiPageHandle(mMainWindow.mGeneralStatusPage);
|
||||
CGeneralMessagesLogDispatcher::instance()->Init();
|
||||
|
||||
CCANDevice *NewCANDevice = new CCANDevice();
|
||||
mCANDevicesList.append(NewCANDevice);
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Démarrage du logiciel OtarcikCAN"));
|
||||
|
||||
NewCANDevice->Init("IVT-S_all-variations_12082020.dbc",PCAN_USBBUS1,PCAN_BAUD_500K,"Puck CAN USB branchée sur le module Parker qui contrôle la patente", "Module Parker");
|
||||
if(mSystemConfig.LoadConfig(&mCANDevicesList) == RET_OK)
|
||||
{
|
||||
for(int i = 0; i < mCANDevicesList.size(); i++)
|
||||
{
|
||||
mCANDevicesList[i]->mProgramPtr = this;
|
||||
mCANDevicesList.at(i)->Init();
|
||||
|
||||
NewCANDevice = new CCANDevice();
|
||||
mCANDevicesList.append(NewCANDevice);
|
||||
}
|
||||
|
||||
NewCANDevice->Init("Database.dbc",PCAN_USBBUS3,PCAN_BAUD_800K,"Puck CAN USB branchée sur une autre patente", "Module Cossin");
|
||||
|
||||
mMainWindow.mProgramSettingsPage->SetDevicesList(&mCANDevicesList);
|
||||
mMainWindow.mProgramSettingsPage->SetDevicesList(&mCANDevicesList);
|
||||
// CCANDevice *NewCANDevice = new CCANDevice();
|
||||
// mCANDevicesList.append(NewCANDevice);
|
||||
// NewCANDevice->mProgramPtr = this;
|
||||
|
||||
// NewCANDevice->Init("IVT-S_all-variations_12082020.dbc",PCAN_USBBUS1,PCAN_BAUD_500K,"Puck CAN USB branchée sur le module Parker qui contrôle la patente", "Module Parker",1000);
|
||||
|
||||
// NewCANDevice = new CCANDevice();
|
||||
// mCANDevicesList.append(NewCANDevice);
|
||||
// NewCANDevice->mProgramPtr = this;
|
||||
|
||||
// NewCANDevice->Init("mazda_3_2019.dbc",PCAN_USBBUS3,PCAN_BAUD_800K,"Puck CAN USB branchée sur une autre patente", "Module Cossin",200);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int COtarcikCan::UpdateCANViewerDataRequest(QList<CCANMessage *> MsgList)
|
||||
int COtarcikCan::UpdateCANViewerDataRequest(QList<CCANMessage *> *MsgList)
|
||||
{
|
||||
return mMainWindow.mCANViewerPage->UpdateCANTable(MsgList);
|
||||
}
|
||||
|
||||
int COtarcikCan::InitCANViewer(QList<CCANMessage *> *MsgList)
|
||||
{
|
||||
return mMainWindow.mCANViewerPage->InitCANTable(MsgList);
|
||||
}
|
||||
|
||||
|
||||
int COtarcikCan::SaveSystemConfigRequest(QList<CCANDevice *> *DevicesList)
|
||||
{
|
||||
if(DevicesList == 0)
|
||||
{
|
||||
qDebug("COtarcikCan::Trying to save a config with an invalid devices list");
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
if(mSystemConfig.SaveConfig(DevicesList) == RET_OK)
|
||||
{
|
||||
while(mCANDevicesList.size() != 0)
|
||||
{
|
||||
delete mCANDevicesList.takeFirst();
|
||||
}
|
||||
while(DevicesList->size() != 0)
|
||||
{
|
||||
delete DevicesList->takeFirst();
|
||||
}
|
||||
if(mSystemConfig.LoadConfig(&mCANDevicesList) == RET_OK)
|
||||
{
|
||||
for(int i = 0; i < mCANDevicesList.size(); i++)
|
||||
{
|
||||
mCANDevicesList[i]->mProgramPtr = this;
|
||||
mCANDevicesList.at(i)->Init();
|
||||
|
||||
}
|
||||
mMainWindow.mProgramSettingsPage->SetDevicesList(&mCANDevicesList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include "GeneralMessagesLogDispatcher.h"
|
||||
#include "CANDevice.h"
|
||||
#include <QList>
|
||||
#include "SystemConfig.h"
|
||||
|
||||
class COtarcikCan : public QObject
|
||||
{
|
||||
@ -15,11 +16,16 @@ public:
|
||||
explicit COtarcikCan(QObject *parent = 0);
|
||||
~COtarcikCan();
|
||||
CMainWindow mMainWindow;
|
||||
CSystemConfig mSystemConfig;
|
||||
|
||||
int Start();
|
||||
|
||||
|
||||
int UpdateCANViewerDataRequest(QList<CCANMessage*> MsgList);
|
||||
int InitCANViewer(QList<CCANMessage *> *MsgList);
|
||||
int UpdateCANViewerDataRequest(QList<CCANMessage *> *MsgList);
|
||||
|
||||
|
||||
int SaveSystemConfigRequest(QList<CCANDevice*> *DevicesList);
|
||||
|
||||
private:
|
||||
QList<CCANDevice*> mCANDevicesList;
|
||||
|
||||
@ -94,14 +94,14 @@ QList<CCANMessage *> CPCANInterface::ReadCANFullBuffer(unsigned short Channel)
|
||||
CCANMessage *NewMsg = new CCANMessage(Channel,CANMsg,CANTimeStamp);
|
||||
MessagesList.append(NewMsg);
|
||||
|
||||
// We process the received message
|
||||
qDebug("Type: 0x%X ",CANMsg.MSGTYPE);
|
||||
qDebug("ID: 0x%X",CANMsg.ID);
|
||||
qDebug("Length: %d",CANMsg.LEN);
|
||||
qDebug("Time: micros %d - millis %d - overflow %d", CANTimeStamp.micros, CANTimeStamp.millis, CANTimeStamp.millis_overflow);
|
||||
// qDebug("Data: " << GetDataString(CANMsg.DATA, CANMsg.MSGTYPE, GetLengthFromDLC(CANMsg.DLC)) << "\n";
|
||||
qDebug("Count: %d",cnt++);
|
||||
qDebug("----------------------------------------------------------");
|
||||
// // We process the received message
|
||||
// qDebug("Type: 0x%X ",CANMsg.MSGTYPE);
|
||||
// qDebug("ID: 0x%X",CANMsg.ID);
|
||||
// qDebug("Length: %d",CANMsg.LEN);
|
||||
// qDebug("Time: micros %d - millis %d - overflow %d", CANTimeStamp.micros, CANTimeStamp.millis, CANTimeStamp.millis_overflow);
|
||||
//// qDebug("Data: " << //GetDataString(CANMsg.DATA, CANMsg.MSGTYPE, GetLengthFromDLC(CANMsg.DLC)) << "\n";
|
||||
// qDebug("Count: %d",cnt++);
|
||||
// qDebug("----------------------------------------------------------");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
118
Otarcik_CAN/Sources/SystemConfig.cpp
Normal file
118
Otarcik_CAN/Sources/SystemConfig.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
#include "SystemConfig.h"
|
||||
#include "GeneralMessagesLogDispatcher.h"
|
||||
|
||||
CSystemConfig::CSystemConfig()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CSystemConfig::LoadConfig(QList<CCANDevice *> *DevicesList)
|
||||
{
|
||||
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Chargement de la configuration système..."));
|
||||
if(DevicesList == 0)
|
||||
{
|
||||
qDebug("CSystemConfig: Trying to load a config into an invalid devices list");
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Échec de sauvegarde de la config système. Pointeur vers liste de devices invalide!!!"),true,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_ERROR_STATUS);
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
QFile* ConfigFile = new QFile("./Config/Station.cfg");
|
||||
if(ConfigFile)
|
||||
{
|
||||
if(ConfigFile->open(QIODevice::ReadOnly | QIODevice::Unbuffered) == false)
|
||||
{
|
||||
// LoadDefaultSettings(Settings);
|
||||
// SaveSettings(Settings);
|
||||
qDebug("CSystemConfig: Failed to open config file in config loading");
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Échec de sauvegarde de la config système. Impossible d'ouvrir le fichier /Config/Station.cfg"),true,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_ERROR_STATUS);
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// LoadDefaultSettings(Settings);
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Échec de sauvegarde de la config système. Pointeur vers QFile invalide !!!"),true,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_ERROR_STATUS);
|
||||
qDebug("CSystemConfig: Invalid QFile pointer in config loading...");
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
QDataStream * InputStream = new QDataStream(ConfigFile);
|
||||
|
||||
quint32 MagicNbr;// = 0xBAADCAFE;
|
||||
quint32 FileVersion;
|
||||
|
||||
|
||||
*InputStream >> MagicNbr;
|
||||
if(MagicNbr != OTARCIK_CONFIG_FILE_MAGIC_NBR)
|
||||
{
|
||||
// LoadDefaultSettings(Settings);
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
*InputStream >> FileVersion;
|
||||
|
||||
int NbDevices;
|
||||
*InputStream >> NbDevices;
|
||||
for(int i = 0; i < NbDevices; i++)
|
||||
{
|
||||
CCANDevice *NewDevice = new CCANDevice;
|
||||
*InputStream >> *NewDevice;
|
||||
DevicesList->append(NewDevice);
|
||||
}
|
||||
|
||||
|
||||
ConfigFile->close();
|
||||
delete ConfigFile;
|
||||
delete InputStream;
|
||||
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Configuration système chargée avec succès!"));
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CSystemConfig::SaveConfig(QList<CCANDevice *> *DevicesList)
|
||||
{
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Sauvegarde de la configuration système..."));
|
||||
|
||||
QFile *ConfigFile = new QFile("./Config/Station.cfg");
|
||||
if(ConfigFile)
|
||||
{
|
||||
if(ConfigFile->open(QIODevice::WriteOnly | QIODevice::Unbuffered) == false)
|
||||
{
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Échec de sauvegarde de la config système. Impossible d'ouvrir le fichier /Config/Station.cfg"),true,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_ERROR_STATUS);
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Échec de sauvegarde de la config système. Pointeur vers QFile invalide !!!"),true,CGeneralMessagesLogDispatcher::GEN_MSG_TXT_ERROR_STATUS);
|
||||
return RET_GENERAL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
QDataStream * OutputStream = new QDataStream(ConfigFile);
|
||||
|
||||
quint32 MagicNbr = OTARCIK_CONFIG_FILE_MAGIC_NBR;
|
||||
quint32 FileVersion = OTARCIK_CURRENT_CONFIG_FILE_VERSION;
|
||||
|
||||
//Setup the config file header
|
||||
*OutputStream << MagicNbr;
|
||||
*OutputStream << FileVersion;
|
||||
|
||||
//Save the CAN devices config info
|
||||
*OutputStream << DevicesList->size(); //Number of devices
|
||||
for(int i = 0; i < DevicesList->size(); i++)
|
||||
{
|
||||
*OutputStream << *DevicesList->at(i); //Add each device info to config file
|
||||
}
|
||||
|
||||
ConfigFile->flush();
|
||||
ConfigFile->close();
|
||||
|
||||
delete ConfigFile;
|
||||
delete OutputStream;
|
||||
|
||||
CGeneralMessagesLogDispatcher::instance()->AddLogMessage(QString("Configuration système sauvegardée avec succès."));
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
22
Otarcik_CAN/Sources/SystemConfig.h
Normal file
22
Otarcik_CAN/Sources/SystemConfig.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef SYSTEMCONFIG_H
|
||||
#define SYSTEMCONFIG_H
|
||||
|
||||
#include "CANDevice.h"
|
||||
#include <QList>
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
|
||||
#define OTARCIK_CURRENT_CONFIG_FILE_VERSION 0x01
|
||||
#define OTARCIK_CONFIG_FILE_MAGIC_NBR 0xDEADBEEF
|
||||
|
||||
class CSystemConfig
|
||||
{
|
||||
public:
|
||||
CSystemConfig();
|
||||
|
||||
int LoadConfig(QList<CCANDevice*> *DevicesList);
|
||||
int SaveConfig(QList<CCANDevice*> *DevicesList);
|
||||
};
|
||||
|
||||
|
||||
#endif // SYSTEMCONFIG_H
|
||||
Binary file not shown.
@ -22,8 +22,8 @@ QT_BEGIN_MOC_NAMESPACE
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
struct qt_meta_stringdata_CCANViewerPage_t {
|
||||
QByteArrayData data[1];
|
||||
char stringdata0[15];
|
||||
QByteArrayData data[3];
|
||||
char stringdata0[40];
|
||||
};
|
||||
#define QT_MOC_LITERAL(idx, ofs, len) \
|
||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
||||
@ -32,10 +32,13 @@ struct qt_meta_stringdata_CCANViewerPage_t {
|
||||
)
|
||||
static const qt_meta_stringdata_CCANViewerPage_t qt_meta_stringdata_CCANViewerPage = {
|
||||
{
|
||||
QT_MOC_LITERAL(0, 0, 14) // "CCANViewerPage"
|
||||
QT_MOC_LITERAL(0, 0, 14), // "CCANViewerPage"
|
||||
QT_MOC_LITERAL(1, 15, 23), // "MessageSelectionChanged"
|
||||
QT_MOC_LITERAL(2, 39, 0) // ""
|
||||
|
||||
},
|
||||
"CCANViewerPage"
|
||||
"CCANViewerPage\0MessageSelectionChanged\0"
|
||||
""
|
||||
};
|
||||
#undef QT_MOC_LITERAL
|
||||
|
||||
@ -45,21 +48,32 @@ static const uint qt_meta_data_CCANViewerPage[] = {
|
||||
8, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
0, 0, // methods
|
||||
1, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
0, // flags
|
||||
0, // signalCount
|
||||
|
||||
// slots: name, argc, parameters, tag, flags
|
||||
1, 0, 19, 2, 0x0a /* Public */,
|
||||
|
||||
// slots: parameters
|
||||
QMetaType::Void,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
void CCANViewerPage::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
Q_UNUSED(_o);
|
||||
Q_UNUSED(_id);
|
||||
Q_UNUSED(_c);
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
auto *_t = static_cast<CCANViewerPage *>(_o);
|
||||
Q_UNUSED(_t)
|
||||
switch (_id) {
|
||||
case 0: _t->MessageSelectionChanged(); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
Q_UNUSED(_a);
|
||||
}
|
||||
|
||||
@ -89,6 +103,17 @@ void *CCANViewerPage::qt_metacast(const char *_clname)
|
||||
int CCANViewerPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
_id = QWidget::qt_metacall(_c, _id, _a);
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
if (_id < 1)
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
_id -= 1;
|
||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||
if (_id < 1)
|
||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||
_id -= 1;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
QT_WARNING_POP
|
||||
|
||||
@ -22,8 +22,8 @@ QT_BEGIN_MOC_NAMESPACE
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
struct qt_meta_stringdata_CProgramSettingsPage_t {
|
||||
QByteArrayData data[6];
|
||||
char stringdata0[115];
|
||||
QByteArrayData data[7];
|
||||
char stringdata0[141];
|
||||
};
|
||||
#define QT_MOC_LITERAL(idx, ofs, len) \
|
||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
||||
@ -37,12 +37,13 @@ QT_MOC_LITERAL(1, 21, 22), // "DeviceSelectionChanged"
|
||||
QT_MOC_LITERAL(2, 44, 0), // ""
|
||||
QT_MOC_LITERAL(3, 45, 22), // "SignalSelectionChanged"
|
||||
QT_MOC_LITERAL(4, 68, 23), // "MessageSelectionChanged"
|
||||
QT_MOC_LITERAL(5, 92, 22) // "ModifyDeviceBtnPressed"
|
||||
QT_MOC_LITERAL(5, 92, 22), // "ModifyDeviceBtnPressed"
|
||||
QT_MOC_LITERAL(6, 115, 25) // "CancelModifyDevBtnPressed"
|
||||
|
||||
},
|
||||
"CProgramSettingsPage\0DeviceSelectionChanged\0"
|
||||
"\0SignalSelectionChanged\0MessageSelectionChanged\0"
|
||||
"ModifyDeviceBtnPressed"
|
||||
"ModifyDeviceBtnPressed\0CancelModifyDevBtnPressed"
|
||||
};
|
||||
#undef QT_MOC_LITERAL
|
||||
|
||||
@ -52,7 +53,7 @@ static const uint qt_meta_data_CProgramSettingsPage[] = {
|
||||
8, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
4, 14, // methods
|
||||
5, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
@ -60,15 +61,17 @@ static const uint qt_meta_data_CProgramSettingsPage[] = {
|
||||
0, // signalCount
|
||||
|
||||
// slots: name, argc, parameters, tag, flags
|
||||
1, 0, 34, 2, 0x0a /* Public */,
|
||||
3, 0, 35, 2, 0x0a /* Public */,
|
||||
4, 0, 36, 2, 0x0a /* Public */,
|
||||
5, 0, 37, 2, 0x0a /* Public */,
|
||||
1, 0, 39, 2, 0x0a /* Public */,
|
||||
3, 0, 40, 2, 0x0a /* Public */,
|
||||
4, 0, 41, 2, 0x0a /* Public */,
|
||||
5, 0, 42, 2, 0x0a /* Public */,
|
||||
6, 0, 43, 2, 0x0a /* Public */,
|
||||
|
||||
// slots: parameters
|
||||
QMetaType::Void,
|
||||
QMetaType::Void,
|
||||
QMetaType::Void,
|
||||
QMetaType::Void,
|
||||
QMetaType::Void,
|
||||
|
||||
0 // eod
|
||||
@ -84,6 +87,7 @@ void CProgramSettingsPage::qt_static_metacall(QObject *_o, QMetaObject::Call _c,
|
||||
case 1: _t->SignalSelectionChanged(); break;
|
||||
case 2: _t->MessageSelectionChanged(); break;
|
||||
case 3: _t->ModifyDeviceBtnPressed(); break;
|
||||
case 4: _t->CancelModifyDevBtnPressed(); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
@ -119,13 +123,13 @@ int CProgramSettingsPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
if (_id < 4)
|
||||
if (_id < 5)
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
_id -= 4;
|
||||
_id -= 5;
|
||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||
if (_id < 4)
|
||||
if (_id < 5)
|
||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||
_id -= 4;
|
||||
_id -= 5;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ debug/CANViewerPage.o
|
||||
debug/CANDatabase.o
|
||||
debug/CANDevice.o
|
||||
debug/CANSignal.o
|
||||
debug/SystemConfig.o
|
||||
debug/moc_MainWindow.o
|
||||
debug/moc_PCANInterface.o
|
||||
debug/moc_OtarcikCan.o
|
||||
|
||||
@ -11,6 +11,7 @@ release/CANViewerPage.o
|
||||
release/CANDatabase.o
|
||||
release/CANDevice.o
|
||||
release/CANSignal.o
|
||||
release/SystemConfig.o
|
||||
release/moc_MainWindow.o
|
||||
release/moc_PCANInterface.o
|
||||
release/moc_OtarcikCan.o
|
||||
|
||||
@ -23,18 +23,22 @@ class Ui_CCANViewerPage
|
||||
public:
|
||||
QTableWidget *mCANDataTableWidget;
|
||||
QPushButton *mClearCANDataBtn;
|
||||
QTableWidget *mCANSignalTableWidget;
|
||||
|
||||
void setupUi(QWidget *CCANViewerPage)
|
||||
{
|
||||
if (CCANViewerPage->objectName().isEmpty())
|
||||
CCANViewerPage->setObjectName(QString::fromUtf8("CCANViewerPage"));
|
||||
CCANViewerPage->resize(1140, 581);
|
||||
CCANViewerPage->resize(1848, 581);
|
||||
mCANDataTableWidget = new QTableWidget(CCANViewerPage);
|
||||
mCANDataTableWidget->setObjectName(QString::fromUtf8("mCANDataTableWidget"));
|
||||
mCANDataTableWidget->setGeometry(QRect(30, 60, 1051, 411));
|
||||
mCANDataTableWidget->setGeometry(QRect(30, 60, 671, 411));
|
||||
mClearCANDataBtn = new QPushButton(CCANViewerPage);
|
||||
mClearCANDataBtn->setObjectName(QString::fromUtf8("mClearCANDataBtn"));
|
||||
mClearCANDataBtn->setGeometry(QRect(70, 500, 80, 22));
|
||||
mCANSignalTableWidget = new QTableWidget(CCANViewerPage);
|
||||
mCANSignalTableWidget->setObjectName(QString::fromUtf8("mCANSignalTableWidget"));
|
||||
mCANSignalTableWidget->setGeometry(QRect(720, 60, 831, 411));
|
||||
|
||||
retranslateUi(CCANViewerPage);
|
||||
|
||||
|
||||
@ -29,6 +29,12 @@ public:
|
||||
mGenMsgTextEdit = new QTextEdit(CGeneralStatusPage);
|
||||
mGenMsgTextEdit->setObjectName(QString::fromUtf8("mGenMsgTextEdit"));
|
||||
mGenMsgTextEdit->setGeometry(QRect(460, 30, 651, 451));
|
||||
QFont font;
|
||||
font.setFamily(QString::fromUtf8("System"));
|
||||
font.setPointSize(12);
|
||||
font.setBold(true);
|
||||
font.setWeight(75);
|
||||
mGenMsgTextEdit->setFont(font);
|
||||
mGenMsgTextEdit->setReadOnly(true);
|
||||
|
||||
retranslateUi(CGeneralStatusPage);
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QListWidget>
|
||||
#include <QtWidgets/QPushButton>
|
||||
#include <QtWidgets/QSpinBox>
|
||||
#include <QtWidgets/QTableWidget>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
#include <QtWidgets/QWidget>
|
||||
@ -34,12 +35,15 @@ public:
|
||||
QComboBox *mCANIDComboBx;
|
||||
QLabel *mCANBaudrateLbl;
|
||||
QComboBox *mCANBaudrateComboBx;
|
||||
QLabel *mDeviceDatabaseLbl;
|
||||
QLabel *mDatabaseFileNameLbl;
|
||||
QPushButton *mDatabaseFileSelectBtn;
|
||||
QPushButton *mModifyDevParamsBtn;
|
||||
QTextEdit *mDeviceDescriptionTxtEdit;
|
||||
QLabel *label_3;
|
||||
QLabel *mRefreshRateLbl;
|
||||
QGroupBox *mDeviceDatabaseGrpBx;
|
||||
QLabel *mDatabaseFileNameLbl;
|
||||
QPushButton *mDatabaseFileSelectBtn;
|
||||
QLabel *mCANBaudrateLbl_3;
|
||||
QSpinBox *mDevicePollPeriodSpinBx;
|
||||
QPushButton *mCancelModifyParamsBtn;
|
||||
QGroupBox *mDatabaseGroupBox;
|
||||
QLabel *mDBMessageNameLbl;
|
||||
QLabel *mDBMessageIDLbl;
|
||||
@ -68,7 +72,7 @@ public:
|
||||
label_2->setGeometry(QRect(52, 100, 81, 16));
|
||||
mDeviceParamsGroupBox = new QGroupBox(CProgramSettingsPage);
|
||||
mDeviceParamsGroupBox->setObjectName(QString::fromUtf8("mDeviceParamsGroupBox"));
|
||||
mDeviceParamsGroupBox->setGeometry(QRect(280, 100, 311, 331));
|
||||
mDeviceParamsGroupBox->setGeometry(QRect(270, 100, 321, 371));
|
||||
mCANIDLbl = new QLabel(mDeviceParamsGroupBox);
|
||||
mCANIDLbl->setObjectName(QString::fromUtf8("mCANIDLbl"));
|
||||
mCANIDLbl->setGeometry(QRect(10, 40, 91, 16));
|
||||
@ -87,26 +91,40 @@ public:
|
||||
mCANBaudrateComboBx->setObjectName(QString::fromUtf8("mCANBaudrateComboBx"));
|
||||
mCANBaudrateComboBx->setEnabled(true);
|
||||
mCANBaudrateComboBx->setGeometry(QRect(100, 70, 131, 21));
|
||||
mDeviceDatabaseLbl = new QLabel(mDeviceParamsGroupBox);
|
||||
mDeviceDatabaseLbl->setObjectName(QString::fromUtf8("mDeviceDatabaseLbl"));
|
||||
mDeviceDatabaseLbl->setGeometry(QRect(10, 100, 111, 16));
|
||||
mDeviceDatabaseLbl->setFont(font1);
|
||||
mDatabaseFileNameLbl = new QLabel(mDeviceParamsGroupBox);
|
||||
mDatabaseFileNameLbl->setObjectName(QString::fromUtf8("mDatabaseFileNameLbl"));
|
||||
mDatabaseFileNameLbl->setGeometry(QRect(10, 120, 301, 16));
|
||||
mDatabaseFileNameLbl->setFont(font1);
|
||||
mDatabaseFileSelectBtn = new QPushButton(mDeviceParamsGroupBox);
|
||||
mDatabaseFileSelectBtn->setObjectName(QString::fromUtf8("mDatabaseFileSelectBtn"));
|
||||
mDatabaseFileSelectBtn->setGeometry(QRect(280, 120, 31, 22));
|
||||
mModifyDevParamsBtn = new QPushButton(mDeviceParamsGroupBox);
|
||||
mModifyDevParamsBtn->setObjectName(QString::fromUtf8("mModifyDevParamsBtn"));
|
||||
mModifyDevParamsBtn->setGeometry(QRect(20, 300, 80, 22));
|
||||
mModifyDevParamsBtn->setGeometry(QRect(220, 330, 80, 22));
|
||||
mDeviceDescriptionTxtEdit = new QTextEdit(mDeviceParamsGroupBox);
|
||||
mDeviceDescriptionTxtEdit->setObjectName(QString::fromUtf8("mDeviceDescriptionTxtEdit"));
|
||||
mDeviceDescriptionTxtEdit->setGeometry(QRect(10, 180, 291, 101));
|
||||
label_3 = new QLabel(mDeviceParamsGroupBox);
|
||||
label_3->setObjectName(QString::fromUtf8("label_3"));
|
||||
label_3->setGeometry(QRect(10, 160, 81, 16));
|
||||
mDeviceDescriptionTxtEdit->setGeometry(QRect(10, 210, 291, 101));
|
||||
mRefreshRateLbl = new QLabel(mDeviceParamsGroupBox);
|
||||
mRefreshRateLbl->setObjectName(QString::fromUtf8("mRefreshRateLbl"));
|
||||
mRefreshRateLbl->setGeometry(QRect(10, 182, 181, 16));
|
||||
mRefreshRateLbl->setFont(font1);
|
||||
mDeviceDatabaseGrpBx = new QGroupBox(mDeviceParamsGroupBox);
|
||||
mDeviceDatabaseGrpBx->setObjectName(QString::fromUtf8("mDeviceDatabaseGrpBx"));
|
||||
mDeviceDatabaseGrpBx->setGeometry(QRect(10, 100, 301, 51));
|
||||
mDatabaseFileNameLbl = new QLabel(mDeviceDatabaseGrpBx);
|
||||
mDatabaseFileNameLbl->setObjectName(QString::fromUtf8("mDatabaseFileNameLbl"));
|
||||
mDatabaseFileNameLbl->setGeometry(QRect(0, 27, 301, 16));
|
||||
QFont font2;
|
||||
font2.setPointSize(10);
|
||||
font2.setBold(true);
|
||||
font2.setWeight(75);
|
||||
mDatabaseFileNameLbl->setFont(font2);
|
||||
mDatabaseFileSelectBtn = new QPushButton(mDeviceDatabaseGrpBx);
|
||||
mDatabaseFileSelectBtn->setObjectName(QString::fromUtf8("mDatabaseFileSelectBtn"));
|
||||
mDatabaseFileSelectBtn->setGeometry(QRect(270, 24, 31, 22));
|
||||
mCANBaudrateLbl_3 = new QLabel(mDeviceParamsGroupBox);
|
||||
mCANBaudrateLbl_3->setObjectName(QString::fromUtf8("mCANBaudrateLbl_3"));
|
||||
mCANBaudrateLbl_3->setGeometry(QRect(10, 160, 91, 16));
|
||||
mCANBaudrateLbl_3->setFont(font1);
|
||||
mDevicePollPeriodSpinBx = new QSpinBox(mDeviceParamsGroupBox);
|
||||
mDevicePollPeriodSpinBx->setObjectName(QString::fromUtf8("mDevicePollPeriodSpinBx"));
|
||||
mDevicePollPeriodSpinBx->setGeometry(QRect(200, 180, 91, 22));
|
||||
mCancelModifyParamsBtn = new QPushButton(mDeviceParamsGroupBox);
|
||||
mCancelModifyParamsBtn->setObjectName(QString::fromUtf8("mCancelModifyParamsBtn"));
|
||||
mCancelModifyParamsBtn->setGeometry(QRect(30, 330, 80, 22));
|
||||
mDatabaseGroupBox = new QGroupBox(CProgramSettingsPage);
|
||||
mDatabaseGroupBox->setObjectName(QString::fromUtf8("mDatabaseGroupBox"));
|
||||
mDatabaseGroupBox->setGeometry(QRect(620, 100, 851, 491));
|
||||
@ -132,9 +150,9 @@ public:
|
||||
mDBMessageNameLbl_2 = new QLabel(mDatabaseGroupBox);
|
||||
mDBMessageNameLbl_2->setObjectName(QString::fromUtf8("mDBMessageNameLbl_2"));
|
||||
mDBMessageNameLbl_2->setGeometry(QRect(1, 23, 171, 16));
|
||||
QFont font2;
|
||||
font2.setPointSize(8);
|
||||
mDBMessageNameLbl_2->setFont(font2);
|
||||
QFont font3;
|
||||
font3.setPointSize(8);
|
||||
mDBMessageNameLbl_2->setFont(font3);
|
||||
mDBSignalDetailsTable = new QTableWidget(mDatabaseGroupBox);
|
||||
mDBSignalDetailsTable->setObjectName(QString::fromUtf8("mDBSignalDetailsTable"));
|
||||
mDBSignalDetailsTable->setGeometry(QRect(0, 250, 851, 241));
|
||||
@ -152,11 +170,13 @@ public:
|
||||
mDeviceParamsGroupBox->setTitle(QCoreApplication::translate("CProgramSettingsPage", "Param\303\250tres", nullptr));
|
||||
mCANIDLbl->setText(QCoreApplication::translate("CProgramSettingsPage", "Driver CAN ID:", nullptr));
|
||||
mCANBaudrateLbl->setText(QCoreApplication::translate("CProgramSettingsPage", "CAN Baudrate:", nullptr));
|
||||
mDeviceDatabaseLbl->setText(QCoreApplication::translate("CProgramSettingsPage", "Fichier database:", nullptr));
|
||||
mModifyDevParamsBtn->setText(QCoreApplication::translate("CProgramSettingsPage", "Modifier", nullptr));
|
||||
mRefreshRateLbl->setText(QCoreApplication::translate("CProgramSettingsPage", "P\303\251riode rafra\303\256chissement (ms):", nullptr));
|
||||
mDeviceDatabaseGrpBx->setTitle(QCoreApplication::translate("CProgramSettingsPage", "Base de donn\303\251es", nullptr));
|
||||
mDatabaseFileNameLbl->setText(QCoreApplication::translate("CProgramSettingsPage", "Fichier...", nullptr));
|
||||
mDatabaseFileSelectBtn->setText(QCoreApplication::translate("CProgramSettingsPage", "...", nullptr));
|
||||
mModifyDevParamsBtn->setText(QCoreApplication::translate("CProgramSettingsPage", "Modifier", nullptr));
|
||||
label_3->setText(QCoreApplication::translate("CProgramSettingsPage", "Description", nullptr));
|
||||
mCANBaudrateLbl_3->setText(QCoreApplication::translate("CProgramSettingsPage", "CAN Baudrate:", nullptr));
|
||||
mCancelModifyParamsBtn->setText(QCoreApplication::translate("CProgramSettingsPage", "Annuler", nullptr));
|
||||
mDatabaseGroupBox->setTitle(QCoreApplication::translate("CProgramSettingsPage", "Database", nullptr));
|
||||
mDBMessageNameLbl->setText(QCoreApplication::translate("CProgramSettingsPage", "Message Name: ", nullptr));
|
||||
mDBMessageIDLbl->setText(QCoreApplication::translate("CProgramSettingsPage", "Message ID: ", nullptr));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user