Changement de l'identification des pucks CAN par device ID plutôt que par Handle
This commit is contained in:
@@ -42,7 +42,7 @@ CCANbusSettingsPage::CCANbusSettingsPage(QWidget *parent) :
|
||||
ui->mCANBaudrateComboBx->addItem("PCAN_BAUD_5K",QVariant(PCAN_BAUD_5K));
|
||||
|
||||
|
||||
ui->mCANIDComboBx->addItem("PCAN_USBBUS1",QVariant(PCAN_USBBUS1));
|
||||
/* ui->mCANIDComboBx->addItem("PCAN_USBBUS1",QVariant(PCAN_USBBUS1));
|
||||
ui->mCANIDComboBx->addItem("PCAN_USBBUS2",QVariant(PCAN_USBBUS2));
|
||||
ui->mCANIDComboBx->addItem("PCAN_USBBUS3",QVariant(PCAN_USBBUS3));
|
||||
ui->mCANIDComboBx->addItem("PCAN_USBBUS4",QVariant(PCAN_USBBUS4));
|
||||
@@ -57,13 +57,14 @@ CCANbusSettingsPage::CCANbusSettingsPage(QWidget *parent) :
|
||||
ui->mCANIDComboBx->addItem("PCAN_USBBUS13",QVariant(PCAN_USBBUS13));
|
||||
ui->mCANIDComboBx->addItem("PCAN_USBBUS14",QVariant(PCAN_USBBUS14));
|
||||
ui->mCANIDComboBx->addItem("PCAN_USBBUS15",QVariant(PCAN_USBBUS15));
|
||||
ui->mCANIDComboBx->addItem("PCAN_USBBUS16",QVariant(PCAN_USBBUS16));
|
||||
ui->mCANIDComboBx->addItem("PCAN_USBBUS16",QVariant(PCAN_USBBUS16));*/
|
||||
|
||||
|
||||
ui->mDeviceDescriptionTxtEdit->setEnabled(false);
|
||||
ui->mDatabaseFileSelectBtn->hide();
|
||||
ui->mCANBaudrateComboBx->setEnabled(false);
|
||||
ui->mCANIDComboBx->setEnabled(false);
|
||||
//ui->mCANIDComboBx->setEnabled(false);
|
||||
ui->mCANDeviceIDSpinBx->setEnabled(false); //JFM 2023-06-02
|
||||
ui->mDevicePollPeriodSpinBx->setEnabled(false);
|
||||
ui->mCancelModifyParamsBtn->hide();
|
||||
ui->mDeviceNameEditBx->setEnabled(false);
|
||||
@@ -147,7 +148,10 @@ int CCANbusSettingsPage::UpdatePage()
|
||||
//update device information
|
||||
ui->mDeviceNameEditBx->setPlainText(DevConfigInfo->mDeviceName);
|
||||
ui->mCANBaudrateComboBx->setCurrentIndex(ui->mCANBaudrateComboBx->findData(DevConfigInfo->mCANDeviceBaudrate));
|
||||
ui->mCANIDComboBx->setCurrentIndex(ui->mCANIDComboBx->findData(DevConfigInfo->mCANDeviceID));
|
||||
|
||||
//ui->mCANIDComboBx->setCurrentIndex(ui->mCANIDComboBx->findData(DevConfigInfo->mCANDeviceID)); //JFM 2023-06-02
|
||||
ui->mCANDeviceIDSpinBx->setValue(DevConfigInfo->mCANDeviceID);
|
||||
|
||||
ui->mDeviceDescriptionTxtEdit->setPlainText(DevConfigInfo->mDeviceDescription);
|
||||
|
||||
QFileInfo FileInfo(DevConfigInfo->mCANDeviceDatabaseFilename);
|
||||
@@ -359,7 +363,10 @@ int CCANbusSettingsPage::ModifyDeviceConfig()
|
||||
CCANDeviceConfig *ModifiedDevice = mCurModifiedDevConfig; //mDeviceConfigList.at(index);
|
||||
|
||||
ModifiedDevice->mCANDeviceBaudrate = ui->mCANBaudrateComboBx->currentData().toInt();
|
||||
|
||||
ModifiedDevice->mCANDeviceID = ui->mCANIDComboBx->currentData().toInt();
|
||||
ModifiedDevice->mCANDeviceID = ui->mCANDeviceIDSpinBx->value(); //JFM 2023-06-02
|
||||
|
||||
ModifiedDevice->mCANDeviceDatabaseFilename = ui->mDatabaseFileNameLbl->toolTip(); //The full path is stored in the tooltip!
|
||||
ModifiedDevice->mDeviceDescription = ui->mDeviceDescriptionTxtEdit->toPlainText();
|
||||
ModifiedDevice->mDeviceName = ui->mDeviceNameEditBx->toPlainText();
|
||||
@@ -373,7 +380,8 @@ int CCANbusSettingsPage::ModifyDeviceConfig()
|
||||
ui->mDeviceDescriptionTxtEdit->setEnabled(false);
|
||||
ui->mDatabaseFileSelectBtn->hide();
|
||||
ui->mCANBaudrateComboBx->setEnabled(false);
|
||||
ui->mCANIDComboBx->setEnabled(false);
|
||||
// ui->mCANIDComboBx->setEnabled(false); //JFM 2023-06-02
|
||||
ui->mCANDeviceIDSpinBx->setEnabled(false);
|
||||
ui->mDevicesList->setEnabled(true);
|
||||
ui->mDevicePollPeriodSpinBx->setEnabled(false);
|
||||
ui->mModifyDevParamsBtn->setText("Modifier");
|
||||
@@ -392,7 +400,9 @@ int CCANbusSettingsPage::ModifyDeviceConfig()
|
||||
ui->mDeviceDescriptionTxtEdit->setEnabled(true);
|
||||
ui->mDatabaseFileSelectBtn->show();
|
||||
ui->mCANBaudrateComboBx->setEnabled(true);
|
||||
ui->mCANIDComboBx->setEnabled(true);
|
||||
// ui->mCANIDComboBx->setEnabled(true); //JFM 2023-06-02
|
||||
ui->mCANDeviceIDSpinBx->setEnabled(true);
|
||||
|
||||
ui->mDevicesList->setEnabled(false);
|
||||
ui->mDevicePollPeriodSpinBx->setEnabled(true);
|
||||
ui->mModifyDevParamsBtn->setText("Sauvegarder");
|
||||
@@ -411,7 +421,9 @@ void CCANbusSettingsPage::CancelModifyDevBtnPressed()
|
||||
ui->mDeviceDescriptionTxtEdit->setEnabled(false);
|
||||
ui->mDatabaseFileSelectBtn->hide();
|
||||
ui->mCANBaudrateComboBx->setEnabled(false);
|
||||
ui->mCANIDComboBx->setEnabled(false);
|
||||
//ui->mCANIDComboBx->setEnabled(false);
|
||||
ui->mCANDeviceIDSpinBx->setEnabled(false);
|
||||
|
||||
ui->mDevicesList->setEnabled(true);
|
||||
ui->mDevicePollPeriodSpinBx->setEnabled(false);
|
||||
ui->mModifyDevParamsBtn->setText("Modifier");
|
||||
@@ -449,7 +461,10 @@ void CCANbusSettingsPage::AddDeviceBtnPressed()
|
||||
//update device information
|
||||
ui->mDeviceNameEditBx->setPlainText(NewDevConfig->mDeviceName);
|
||||
ui->mCANBaudrateComboBx->setCurrentIndex(ui->mCANBaudrateComboBx->findData(NewDevConfig->mCANDeviceBaudrate));
|
||||
ui->mCANIDComboBx->setCurrentIndex(ui->mCANIDComboBx->findData(NewDevConfig->mCANDeviceID));
|
||||
|
||||
ui->mCANIDComboBx->setCurrentIndex(ui->mCANIDComboBx->findData(NewDevConfig->mCANDeviceID)); //JFM 2023-06-02
|
||||
ui->mCANDeviceIDSpinBx->setValue(NewDevConfig->mCANDeviceID);
|
||||
|
||||
ui->mDeviceDescriptionTxtEdit->setPlainText(NewDevConfig->mDeviceDescription);
|
||||
ui->mDatabaseFileNameLbl->setText(NewDevConfig->mCANDeviceDatabaseFilename);
|
||||
ui->mDatabaseFileNameLbl->setToolTip(NewDevConfig->mCANDeviceDatabaseFilename);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>20</y>
|
||||
<width>231</width>
|
||||
<width>321</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -28,7 +28,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Paramètres de la station Otarcik</string>
|
||||
<string>Paramètres CAN de la station Otarcik</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="mDevicesList">
|
||||
@@ -70,9 +70,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<y>66</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
<height>10</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@@ -81,20 +81,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Driver CAN ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="mCANIDComboBx">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>59</y>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
<string>CAN Device ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mCANBaudrateLbl">
|
||||
@@ -253,6 +240,22 @@
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="mCANDeviceIDSpinBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>60</y>
|
||||
<width>71</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="mDatabaseGroupBox">
|
||||
<property name="geometry">
|
||||
@@ -403,6 +406,19 @@
|
||||
<string>Supprimer</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="mCANIDComboBx">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>790</x>
|
||||
<y>20</y>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "ui_GeneralStatusPage.h"
|
||||
#include "QStringList"
|
||||
#include <QScrollBar>
|
||||
#include <QLibrary>
|
||||
|
||||
CGeneralStatusPage::CGeneralStatusPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@@ -10,6 +11,8 @@ CGeneralStatusPage::CGeneralStatusPage(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->mClearGenMsgTxtBtn,&QPushButton::clicked,this,&CGeneralStatusPage::ClearGenMsgAreaBtnPressed);
|
||||
SetMQTTConnectionStatus(false);
|
||||
SetCANConnectionStatus(false);
|
||||
}
|
||||
|
||||
CGeneralStatusPage::~CGeneralStatusPage()
|
||||
@@ -95,3 +98,43 @@ void CGeneralStatusPage::ClearGenMsgAreaBtnPressed()
|
||||
mGenMsgListBoxTextLines.clear();
|
||||
ui->mGenMsgTextEdit->clear();
|
||||
}
|
||||
|
||||
int CGeneralStatusPage::SetMQTTConnectionStatus(bool Connected)
|
||||
{
|
||||
if(Connected)
|
||||
{
|
||||
ui->mClientMQTTConnStatLbl->setText("CONNECTÉ");
|
||||
QPalette pal = QPalette(ui->mClientMQTTConnStatLbl->palette());
|
||||
pal.setColor(QPalette::WindowText,QColor(Qt::darkGreen));
|
||||
ui->mClientMQTTConnStatLbl->setPalette(pal);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->mClientMQTTConnStatLbl->setText("DÉCONNECTÉ");
|
||||
QPalette pal = QPalette(ui->mClientMQTTConnStatLbl->palette());
|
||||
pal.setColor(QPalette::WindowText,QColor(Qt::red));
|
||||
ui->mClientMQTTConnStatLbl->setPalette(pal);
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CGeneralStatusPage::SetCANConnectionStatus(bool Connected)
|
||||
{
|
||||
if(Connected)
|
||||
{
|
||||
ui->mPuckCANConStatLbl->setText("CONNECTÉE");
|
||||
QPalette pal = QPalette(ui->mPuckCANConStatLbl->palette());
|
||||
pal.setColor(QPalette::WindowText,QColor(Qt::darkGreen));
|
||||
ui->mPuckCANConStatLbl->setPalette(pal);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->mPuckCANConStatLbl->setText("DÉCONNECTÉE");
|
||||
QPalette pal = QPalette(ui->mPuckCANConStatLbl->palette());
|
||||
pal.setColor(QPalette::WindowText,QColor(Qt::red));
|
||||
ui->mPuckCANConStatLbl->setPalette(pal);
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@ public:
|
||||
int SetGeneralMsgText(QStringList Txt);
|
||||
int AddGeneralMsgBoxLineEntry(QString LineTxt);
|
||||
|
||||
int SetMQTTConnectionStatus(bool Connected);
|
||||
int SetCANConnectionStatus(bool Connected);
|
||||
|
||||
|
||||
private:
|
||||
Ui::CGeneralStatusPage *ui;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1725</width>
|
||||
<height>527</height>
|
||||
<height>628</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -47,6 +47,82 @@
|
||||
<string>Nettoyer</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mPuckCANLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>520</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Puck CAN:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mClientMQTTLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>550</y>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Client MQTT:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mPuckCANConStatLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>470</x>
|
||||
<y>520</y>
|
||||
<width>121</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Déconnectée</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mClientMQTTConnStatLbl">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>470</x>
|
||||
<y>550</y>
|
||||
<width>121</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Déconnecté</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
Reference in New Issue
Block a user