Corrections & développement (suite)

This commit is contained in:
2023-06-17 12:58:31 -04:00
parent abc91f1932
commit 7bbf2cb812
16 changed files with 526 additions and 53 deletions
+16 -14
View File
@@ -146,22 +146,24 @@ CMQTTMessage CCANDataLogger::GetMQTTMessage(CCANMessage *Msg, bool Format )
QString SignalData;
CCANSignal Signal = Msg->mSignalsList.at(signal);
#ifdef FORCE_FLOAT_REPRESENTATION
//JFM 2023-06-16 changé pour forcer toujours à float
SignalData = QString("\"%1\":%2").arg(Signal.mSignalName).arg(Signal.mPhysicalValue,0,'f',1);
// if(Signal.mValueType == CCANSignal::CAN_SIGNAL_TYPE_UNSIGNED_INT)
// {
// SignalData = QString("\"%1\":%2").arg(Signal.mSignalName).arg((quint64)Signal.mPhysicalValue);
// }
// else if(Signal.mValueType == CCANSignal::CAN_SIGNAL_TYPE_SIGNED_INT)
// {
// SignalData = QString("\"%1\":%2").arg(Signal.mSignalName).arg((qint64)Signal.mPhysicalValue);
// }
// else if(Signal.mValueType == CCANSignal::CAN_SIGNAL_TYPE_32_BIT_FLOAT ||
// Signal.mValueType == CCANSignal::CAN_SIGNAL_TYPE_64_BIT_DOUBLE)
// {
// SignalData = QString("\"%1\":%2").arg(Signal.mSignalName).arg(Signal.mPhysicalValue,0,'f',1);
// }
#else
if(Signal.mValueType == CCANSignal::CAN_SIGNAL_TYPE_UNSIGNED_INT)
{
SignalData = QString("\"%1\":%2").arg(Signal.mSignalName).arg((quint64)Signal.mPhysicalValue);
}
else if(Signal.mValueType == CCANSignal::CAN_SIGNAL_TYPE_SIGNED_INT)
{
SignalData = QString("\"%1\":%2").arg(Signal.mSignalName).arg((qint64)Signal.mPhysicalValue);
}
else if(Signal.mValueType == CCANSignal::CAN_SIGNAL_TYPE_32_BIT_FLOAT ||
Signal.mValueType == CCANSignal::CAN_SIGNAL_TYPE_64_BIT_DOUBLE)
{
SignalData = QString("\"%1\":%2").arg(Signal.mSignalName).arg(Signal.mPhysicalValue,0,'f',1);
}
#endif
MsgPayload.append(SignalData);
if(signal < Msg->mSignalsList.size()-1)
+1 -14
View File
@@ -11,12 +11,6 @@ CCANDevice::CCANDevice(QObject *parent)
mMessagesListLoaded = false;
mCANAnalyzer.mDevicePtr = this;
mProgramPtr = 0;
// mCANDeviceDatabaseFilename.clear();
// mCANDeviceID = -1;
// mCANDeviceBaudrate = -1;
// mDeviceDescription.clear();
// mDeviceName.clear();
// mDevicePollPeriod = 0;
}
CCANDevice::CCANDevice(CCANDeviceConfig &SysConfig, CMQTTClientWrapper *MQTTClient, QString DeviceTopicPrefix)
@@ -30,12 +24,6 @@ CCANDevice::CCANDevice(CCANDeviceConfig &SysConfig, CMQTTClientWrapper *MQTTClie
mCANMQTTClient = MQTTClient;
mDeviceTopicPrefix = DeviceTopicPrefix;
// mCANDeviceID = SysConfig.mCANDeviceID;
// mCANDeviceBaudrate = SysConfig.mCANDeviceBaudrate;
// mCANDeviceDatabaseFilename = SysConfig.mCANDeviceDatabaseFilename;
// mDeviceName = SysConfig.mDeviceName;
// mDeviceDescription = SysConfig.mDeviceDescription;
// mDevicePollPeriod = SysConfig.mDevicePollPeriod;
}
CCANDevice::~CCANDevice()
@@ -61,7 +49,6 @@ int CCANDevice::Init()
if(mCANDatabase.BuildMessageList(&mMessageList,mDeviceConfigInfo.mDeviceName) == RET_OK)
{
mMessagesListLoaded = true;
mProgramPtr->InitCANViewer(&mMessageList,this);
}
else
{
@@ -107,7 +94,7 @@ int CCANDevice::Init(QString DatabaseFileName, TPCANHandle CANDeviceID, TPCANBau
int CCANDevice::NewMessageParsed(int BufferSize)
{
mCANDataLogger.LogNewData(&mMessageList);
mProgramPtr->UpdateCANViewerDataRequest(&mMessageList,mDeviceConfigInfo.mDeviceName);
mProgramPtr->UpdateCANViewerDataRequest(&mMessageList);
mProgramPtr->UpdateCANModuleStatusRequest(mDeviceConfigInfo.mDeviceName,"NOUPDATE",QString("%1").arg(BufferSize));
for(int i = 0; i < mMessageList.size(); i++)
+14 -1
View File
@@ -51,11 +51,24 @@
<rect>
<x>1190</x>
<y>60</y>
<width>501</width>
<width>451</width>
<height>411</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="mCopyJSonToClipboardBtn">
<property name="geometry">
<rect>
<x>1210</x>
<y>480</y>
<width>80</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Copier</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
@@ -16,6 +16,9 @@ CGeneralStatusPage::CGeneralStatusPage(QWidget *parent) :
ui->mCANModuleStatusTableWdgt->setColumnCount(3);
ui->mCANModuleStatusTableWdgt->setHorizontalHeaderLabels(QStringList() << "Nom" << "Statut" << "Buffer");
ui->mPuckCANConStatLbl->setVisible(false);
ui->mPuckCANLbl->setVisible(false);
}
CGeneralStatusPage::~CGeneralStatusPage()
@@ -142,6 +145,13 @@ int CGeneralStatusPage::SetCANConnectionStatus(bool Connected)
return RET_OK;
}
int CGeneralStatusPage::ClearCANModuleStatusTable()
{
ui->mCANModuleStatusTableWdgt->clearContents();
ui->mCANModuleStatusTableWdgt->setRowCount(0);
return RET_OK;
}
int CGeneralStatusPage::UpdateCANModuleStatus(QString ModuleName, QString ModuleStatus, QString Buffer)
{
QList<QTableWidgetItem *> Items = ui->mCANModuleStatusTableWdgt->findItems(ModuleName,Qt::MatchFixedString);
@@ -33,6 +33,7 @@ public:
int SetMQTTConnectionStatus(bool Connected);
int SetCANConnectionStatus(bool Connected);
int UpdateCANModuleStatus(QString ModuleName, QString ModuleStatus, QString Buffer);
int ClearCANModuleStatusTable();
private:
+1 -1
View File
@@ -22,7 +22,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
ui(new Ui::CMainWindow)
{
ui->setupUi(this);
QMainWindow::statusBar()->showMessage("V1.00");
QMainWindow::statusBar()->showMessage("V1.01");
mGeneralStatusPage = new CGeneralStatusPage(this);
mMainWindowWidget = new QTabWidget(this);
+1 -2
View File
@@ -25,8 +25,7 @@ public:
int Start();
int InitCANViewer(QList<CCANMessage *> *MsgList, CCANDevice *Device);
int UpdateCANViewerDataRequest(QList<CCANMessage *> *MsgList, QString DeviceName);
int UpdateCANViewerDataRequest(QList<CCANMessage *> *MsgList);
int SaveCANDevicesConfigRequest(QList<CCANDeviceConfig*> *DevicesConfigList);
+1
View File
@@ -7,6 +7,7 @@
#define MQTT_CLIENT_RECONNECT_TIMEOUT 5000 //Time in ms between reconnect attemps to MQTT broker when connection is lost
//#define USE_TOPIC_PREFIX
#define FORCE_FLOAT_REPRESENTATION
enum eOtarcikGeneralReturns
{
+1
View File
@@ -5,6 +5,7 @@
int main(int argc, char *argv[])
{
QApplication::setStyle("windows");
QApplication a(argc, argv);
COtarcikCan OtarcikCanProgram; //Instanciate the program