Ajout polling du statut du board

This commit is contained in:
2024-02-22 16:11:48 -05:00
parent 098863edb9
commit da2dd28f1c
25 changed files with 1100 additions and 140 deletions
@@ -19,8 +19,8 @@ CCANbusSettingsPage::CCANbusSettingsPage(QWidget *parent) :
mCurModifiedDevConfig = 0;
mDeviceChangeModeEnabled = false;
ui->mDBSignalDetailsTable->setColumnCount(10);
ui->mDBSignalDetailsTable->setHorizontalHeaderLabels(QStringList() << "Signal" << "Bit No" << "Length" << "Type" << "Max Val" << "Min Val" << "Offset" << "Scale factor" << "Unit" << "Byte order");
ui->mDBSignalDetailsTable->setColumnCount(11);
ui->mDBSignalDetailsTable->setHorizontalHeaderLabels(QStringList() << "Signal" << "Bit No" << "Length" << "Type" << "Max Val" << "Min Val" << "Offset" << "Scale factor" << "Unit" << "Byte order" << "Comment");
ui->mDevicePollPeriodSpinBx->setRange(200,60000);
@@ -336,9 +336,12 @@ int CCANbusSettingsPage::UpdateMessageInformation()
}
}
ui->mDBSignalDetailsTable->setItem(Sig,9,NewItem);
//Comment
NewItem = new QTableWidgetItem(Signal.mSignalComment);
ui->mDBSignalDetailsTable->setItem(Sig,10,NewItem);
}
ui->mDBSignalDetailsTable->resizeColumnsToContents();
}
+24 -17
View File
@@ -19,13 +19,20 @@ CGeneralStatusPage::CGeneralStatusPage(QWidget *parent) :
ui->mCANModuleStatusTableWdgt->setColumnCount(3);
ui->mCANModuleStatusTableWdgt->setHorizontalHeaderLabels(QStringList() << "Nom" << "Statut" << "Buffer");
ui->mPuckCANConStatLbl->setVisible(false);
ui->mPuckCANLbl->setVisible(false);
mCPUStateUpdtTimer = new QTimer;
mCPUStateUpdtTimer->setSingleShot(false);
mCPUStateUpdtTimer->setInterval(5000);
connect(mCPUStateUpdtTimer,&QTimer::timeout,this,&CGeneralStatusPage::UpdateBoardStatusTimerExpired);
mCPUStateUpdtTimer->start();
mCPUInterface = 0;
}
CGeneralStatusPage::~CGeneralStatusPage()
{
delete ui;
delete mCPUStateUpdtTimer;
}
int CGeneralStatusPage::SetGeneralMsgText(QStringList Txt)
@@ -129,20 +136,7 @@ int CGeneralStatusPage::SetMQTTConnectionStatus(bool Connected)
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;
}
@@ -158,7 +152,7 @@ int CGeneralStatusPage::UpdateMQTTBufferingStatus(QString Mode, QString FIFOSize
{
ui->mBufferingMode->setText(Mode);
ui->mBufferSizeValue->setText(FIFOSize);
ui->mBufferTimeRemaining->setText(RemainingTime);
// ui->mBufferTimeRemaining->setText(RemainingTime);
return RET_OK;
}
@@ -211,6 +205,14 @@ void CGeneralStatusPage::QuitAppBtnPressed()
mProgramPtr->QuitApplicationRequest();
}
int CGeneralStatusPage::UpdateBoardStatus(CComputerBoardState CPUState)
{
QString BoardState = QString("System Temp: %1C\nCPU VCore: %2V\nSystem 3.3V: %3V\nSystem 5V: %4V").arg(CPUState.mSystemTemperature).arg(CPUState.mCPUVcore).arg(CPUState.mSystem3V3).arg(CPUState.mSystem5V);
ui->mSystemStateLbl->setText(BoardState);
return RET_OK;
}
void CGeneralStatusPage::InternetStatusChanged(bool InternetConnected)
{
if(InternetConnected == true)
@@ -228,3 +230,8 @@ void CGeneralStatusPage::InternetStatusChanged(bool InternetConnected)
ui->mInternetPresentStatLbl->setPalette(pal);
}
}
void CGeneralStatusPage::UpdateBoardStatusTimerExpired()
{
UpdateBoardStatus(mCPUInterface->GetComputerBoardState());
}
@@ -3,6 +3,8 @@
#include <QWidget>
#include "defines.h"
#include "ComputerBoardInterface.h"
#include <QTimer>
namespace Ui {
@@ -27,6 +29,9 @@ public:
};
COtarcikCan *mProgramPtr;
QTimer *mCPUStateUpdtTimer;
CComputerBoardInterface *mCPUInterface;
explicit CGeneralStatusPage(QWidget *parent = 0);
~CGeneralStatusPage();
@@ -39,6 +44,7 @@ public:
int UpdateCANModuleStatus(QString ModuleName, QString ModuleStatus, QString Buffer);
int ClearCANModuleStatusTable();
int UpdateMQTTBufferingStatus(QString Mode, QString FIFOSize, QString RemainingTime);
int UpdateBoardStatus(CComputerBoardState CPUState);
private:
@@ -52,6 +58,7 @@ public slots:
void ClearGenMsgAreaBtnPressed();
void QuitAppBtnPressed();
void InternetStatusChanged(bool InternetConnected);
void UpdateBoardStatusTimerExpired();
};
+30 -70
View File
@@ -47,29 +47,11 @@
<string>Nettoyer</string>
</property>
</widget>
<widget class="QLabel" name="mPuckCANLbl">
<property name="geometry">
<rect>
<x>1220</x>
<y>210</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>1200</x>
<y>240</y>
<y>210</y>
<width>101</width>
<height>16</height>
</rect>
@@ -83,31 +65,11 @@
<string>Client MQTT:</string>
</property>
</widget>
<widget class="QLabel" name="mPuckCANConStatLbl">
<property name="geometry">
<rect>
<x>1300</x>
<y>210</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>1300</x>
<y>240</y>
<y>210</y>
<width>121</width>
<height>16</height>
</rect>
@@ -170,7 +132,7 @@
<property name="geometry">
<rect>
<x>1230</x>
<y>270</y>
<y>240</y>
<width>61</width>
<height>16</height>
</rect>
@@ -188,7 +150,7 @@
<property name="geometry">
<rect>
<x>1300</x>
<y>270</y>
<y>240</y>
<width>121</width>
<height>16</height>
</rect>
@@ -207,10 +169,10 @@
<widget class="QGroupBox" name="MQTTBufferingGrpBx">
<property name="geometry">
<rect>
<x>1210</x>
<y>320</y>
<width>391</width>
<height>141</height>
<x>1460</x>
<y>190</y>
<width>251</width>
<height>91</height>
</rect>
</property>
<property name="title">
@@ -252,24 +214,6 @@
<string>Taille buffer circulaire:</string>
</property>
</widget>
<widget class="QLabel" name="mBufferTimeRemainingLbl">
<property name="geometry">
<rect>
<x>50</x>
<y>90</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Durée restante:</string>
</property>
</widget>
<widget class="QLabel" name="mBufferingMode">
<property name="geometry">
<rect>
@@ -306,13 +250,26 @@
<string>0/5000</string>
</property>
</widget>
<widget class="QLabel" name="mBufferTimeRemaining">
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>1210</x>
<y>290</y>
<width>301</width>
<height>161</height>
</rect>
</property>
<property name="title">
<string>État du système</string>
</property>
<widget class="QLabel" name="mSystemStateLbl">
<property name="geometry">
<rect>
<x>150</x>
<y>90</y>
<width>91</width>
<height>21</height>
<x>10</x>
<y>20</y>
<width>281</width>
<height>131</height>
</rect>
</property>
<property name="font">
@@ -321,7 +278,10 @@
</font>
</property>
<property name="text">
<string>xxx minutes</string>
<string>Système:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</widget>