Code cleanup

This commit is contained in:
2023-01-28 09:01:02 -05:00
parent eeb1d04f9b
commit 74b6a23045
24 changed files with 1548 additions and 1442 deletions
@@ -0,0 +1,6 @@
#include "CANDataLogger.h"
CCANDataLogger::CCANDataLogger()
{
}
@@ -0,0 +1,11 @@
#ifndef CANDATALOGGER_H
#define CANDATALOGGER_H
class CCANDataLogger
{
public:
CCANDataLogger();
};
#endif // CANDATALOGGER_H
@@ -46,7 +46,7 @@ CCANDevice::~CCANDevice()
int CCANDevice::Init()
{
if(mDeviceConfigInfo.mCANDeviceID < 0 || mDeviceConfigInfo.mCANDeviceBaudrate < 0 || mDeviceConfigInfo.mDevicePollPeriod == 0 || mDeviceConfigInfo.mCANDeviceDatabaseFilename.isEmpty() || mDeviceConfigInfo.mDeviceName.isEmpty())
if(mDeviceConfigInfo.mCANDeviceID < 0 || mDeviceConfigInfo.mCANDeviceBaudrate < 0 || mDeviceConfigInfo.mDevicePollPeriod == 0 || mDeviceConfigInfo.mCANDeviceDatabaseFilename.isEmpty() == true || mDeviceConfigInfo.mDeviceName.isEmpty() == true)
{
qDebug("CCANDevice: trying to initialize a CCANDevice with invalid parameters");
return RET_GENERAL_ERROR;
@@ -96,9 +96,6 @@ int CCANDevice::NewMessageParsed()
}
QDataStream &operator<<(QDataStream &out, const CCANDevice &source)
{
out << source.mDeviceConfigInfo;
@@ -30,7 +30,7 @@ int CCANMessage::SetDataFromDriver(quint32 Channel, TPCANMsg CANMsg, TPCANTimest
mCANMsgLength = (unsigned char)CANMsg.LEN;
mCANMsgType = CANMsg.MSGTYPE;
//mCANMsgData = QByteArray((const char*)&CANMsg.DATA);
for(int i = 0; i < mCANMsgLength; i++)
for(unsigned int i = 0; i < mCANMsgLength; i++)
{
mCANMsgData.append(CANMsg.DATA[i]);
}
@@ -50,6 +50,7 @@ int CCANMessage::AddSignal(CCANSignal *NewSignal)
}
mSignalsList.append(NewSignal);
return RET_OK;
}
int CCANMessage::UpdateValue(CCANMessage *NewDeviceMessage)
@@ -90,6 +91,7 @@ int CCANMessage::UpdateValue(CCANMessage *NewDeviceMessage)
mSignalsList.at(i)->ComputeNewSignalValue(mCANRawDataIntel, mCANMsgLength);
}
return RET_OK;
}
@@ -29,18 +29,13 @@ int CCANSignal::ComputeNewSignalValue(quint64 NewValue, quint16 MessageSize)
}
else
{
//TODO: À faire!!!
return RET_GENERAL_ERROR;
}
// mRawValue >>= mStartBit;
// quint64 mask = ((1 << mSignalSize)-1);
// mRawValue &= mask;
mPhysicalValue = ((signed) mRawValue * mValueFactor) + mValueOffset;
// mPhysicalValue = (test * mValueFactor) + mValueOffset;
//mPhysicalValue = test;
return RET_OK;
}
+3 -1
View File
@@ -109,7 +109,7 @@ int CCANViewerPage::UpdateCANTable(QList<CCANMessage *> *MsgList)
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)));
Data.append(QString().asprintf("%.2X ",(unsigned char)MsgList->at(msg)->mCANMsgData.at(byte)));
}
ui->mCANDataTableWidget->item(row,5)->setText(Data);
}
@@ -195,4 +195,6 @@ int CCANViewerPage::UpdateSignalsTable()
}
}
}
return RET_OK;
}
@@ -19,6 +19,7 @@ CGeneralStatusPage::~CGeneralStatusPage()
int CGeneralStatusPage::SetGeneralMsgText(QStringList Txt)
{
Q_UNUSED(Txt)
/*if you're populating the text box programatically, is to use textEdit->setTextColor(QColor&).You can create the QColor object yourself, or use one of the predefined colours in the Qt namespace (Qt::black, Qt::red, etc). It will apply the specified colour to any text you add, until it is called again with a different one.*/
return RET_OK;
+1 -1
View File
@@ -80,7 +80,7 @@ QList<CCANMessage *> CPCANInterface::ReadCANFullBuffer(unsigned short Channel)
TPCANMsg CANMsg;
TPCANTimestamp CANTimeStamp;
TPCANStatus stsResult;
int cnt = 0;
//int cnt = 0;
QList<CCANMessage *> MessagesList;
MessagesList.clear();