Dev
This commit is contained in:
@@ -3,13 +3,15 @@
|
||||
#include "CableTestBenchDefs.h"
|
||||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
#include "TestBenchVersion.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
CCableTestBench::CCableTestBench(QObject *parent) :
|
||||
QObject(parent),
|
||||
mActualCable(CConnectorDefs::UNKNOWN_CONNECTOR_TYPE,&mIOInterface)
|
||||
{
|
||||
w = new MainWindow(0,this);
|
||||
w->setWindowTitle("Cablotron");
|
||||
w->setWindowTitle(QString("Cablotron %1").arg(TEST_BENCH_VERSION));
|
||||
}
|
||||
|
||||
CCableTestBench::~CCableTestBench()
|
||||
@@ -26,15 +28,30 @@ int CCableTestBench::Start()
|
||||
mMainPageHandle = w->mMainPage;
|
||||
mVisualInspPageHandle = w->mVisualInspPage;
|
||||
mCableTestPageHandle = w->mCableTestPage;
|
||||
mOptionsPageHandle = w->mOptionsPage;
|
||||
|
||||
if(mTestBenchOptions.LoadSettingFromFile() == RET_OK)
|
||||
{
|
||||
mOptionsPageHandle->SetCurrentOptions(&mTestBenchOptions);
|
||||
}
|
||||
{
|
||||
mOptionsPageHandle->GetCurrentOptions(&mTestBenchOptions);
|
||||
}
|
||||
|
||||
mCableTestEngine.InitCableTestEngine(this);
|
||||
mCableTestEngine.InitCableTestEngine(this,mTestBenchOptions.mPinHoldTime);
|
||||
|
||||
mIOInterface.OpenIOModules();
|
||||
if(mIOInterface.OpenIOModules(mTestBenchOptions.mIOModuleIPAddress) == RET_ERROR)
|
||||
{
|
||||
mCableTestReport.AddLogEntry("Impossible de communiquer avec le module d'I/O.\nVérifier la connexion ou l'adresse IP.");
|
||||
QMessageBox::critical(0,"Erreur de connexion","Impossible de communiquer avec le module d'I/O.\nVérifier la connexion ou l'adresse IP.");
|
||||
}
|
||||
|
||||
mCableTestPageHandle->mGuiRefreshTimer.start();
|
||||
connect(&mCableTestReport,SIGNAL(NewTestLogEntry(QString)),mCableTestPageHandle,SLOT(AddTestLogEntry(QString)));
|
||||
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -173,22 +190,44 @@ int CCableTestBench::NewCableRequest()
|
||||
mCableTestPageHandle->ResetCable();
|
||||
mCableTestPageHandle->DisableStartTestBtn();
|
||||
mCableTestReport.CreateNewTestReport();
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CCableTestBench::CheckIfReadyForTesting()
|
||||
{
|
||||
bool VisualInspectionDone = false, ConnectorSelected = false, CableConfigured = true;
|
||||
bool VisualInspectionDone = false, ConnectorSelected = false, CableConfigured = false;
|
||||
|
||||
mVisualInspPageHandle->FillVisualInspectionResultReport(mCableTestReport.GetInspectionResult());
|
||||
if(mCableTestReport.GetInspectionResult()->IsVisualInspectionResultComplete() == true)
|
||||
{
|
||||
VisualInspectionDone = true;
|
||||
}
|
||||
//todo, use the options flag to bypass visual inspection
|
||||
VisualInspectionDone = true;
|
||||
if(mTestBenchOptions.mIgnoreVisualInspection)
|
||||
{
|
||||
VisualInspectionDone = true;
|
||||
}
|
||||
|
||||
|
||||
if(mCableTestPageHandle->IsCableConfigured())
|
||||
{
|
||||
CableConfigured = true;
|
||||
mCableTestPageHandle->SetCableConfigureStep(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCableTestPageHandle->SetCableConfigureStep(false);
|
||||
}
|
||||
|
||||
ConnectorSelected = mActualCable.IsCableDefined();
|
||||
if(ConnectorSelected)
|
||||
{
|
||||
mCableTestPageHandle->SetConnectorSelStep();
|
||||
}
|
||||
else
|
||||
{
|
||||
mCableTestPageHandle->SetConnectorSelStep(false);
|
||||
}
|
||||
|
||||
if(VisualInspectionDone && ConnectorSelected && CableConfigured)
|
||||
{
|
||||
@@ -264,7 +303,7 @@ int CCableTestBench::RefreshConnectorsStateRequest()
|
||||
|
||||
int CCableTestBench::SaveReportRequest()
|
||||
{
|
||||
return mCableTestReport.SaveReportToFile();
|
||||
return mCableTestReport.SaveReportToFile(&mTestBenchOptions);
|
||||
}
|
||||
|
||||
int CCableTestBench::OpenReportRequest()
|
||||
@@ -282,7 +321,24 @@ int CCableTestBench::OpenReportRequest()
|
||||
|
||||
QProcess *process = new QProcess;
|
||||
process->start(Command);
|
||||
//QProcess::execute(Command);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CCableTestBench::CableConfigChanged()
|
||||
{
|
||||
CheckIfReadyForTesting();
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CCableTestBench::TestBenchOptionsChanged()
|
||||
{
|
||||
mOptionsPageHandle->GetCurrentOptions(&mTestBenchOptions);
|
||||
mTestBenchOptions.SaveSettingsToFile();
|
||||
|
||||
mCableTestEngine.SetPinHoldTime(mTestBenchOptions.mPinHoldTime);
|
||||
|
||||
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,14 @@
|
||||
#include "TestReport.h"
|
||||
#include "IOModulesInterface.h"
|
||||
#include "CableTestEngine.h"
|
||||
#include "TestBenchSettings.h"
|
||||
|
||||
|
||||
|
||||
class CMainPage;
|
||||
class CVisualInspectionPage;
|
||||
class CCableTestPage;
|
||||
class COptionsPage;
|
||||
|
||||
|
||||
class CCableTestBench : public QObject
|
||||
@@ -29,9 +32,12 @@ public:
|
||||
CMainPage *mMainPageHandle;
|
||||
CVisualInspectionPage *mVisualInspPageHandle;
|
||||
CCableTestPage *mCableTestPageHandle;
|
||||
COptionsPage *mOptionsPageHandle;
|
||||
CCable mActualCable;
|
||||
CCableTestEngine mCableTestEngine;
|
||||
|
||||
CTestBenchSettings mTestBenchOptions;
|
||||
|
||||
|
||||
CIOModulesInterface mIOInterface;
|
||||
|
||||
@@ -45,8 +51,11 @@ public:
|
||||
int RefreshConnectorsStateRequest();
|
||||
int SaveReportRequest();
|
||||
int OpenReportRequest();
|
||||
int CableConfigChanged();
|
||||
|
||||
|
||||
int TestBenchOptionsChanged();
|
||||
|
||||
|
||||
|
||||
CCable *SetSelectedConnector(CConnectorDefs::eConnectorType ConType);
|
||||
|
||||
@@ -12,7 +12,7 @@ CCableTestEngine::~CCableTestEngine()
|
||||
delete mCableTestSMTimer;
|
||||
}
|
||||
|
||||
int CCableTestEngine::InitCableTestEngine(CCableTestBench *ProgramHandle)
|
||||
int CCableTestEngine::InitCableTestEngine(CCableTestBench *ProgramHandle, int PinHoldTime)
|
||||
{
|
||||
mProgramHandle = ProgramHandle;
|
||||
mTestCable = ProgramHandle->GetActualCable();
|
||||
@@ -29,14 +29,20 @@ int CCableTestEngine::InitCableTestEngine(CCableTestBench *ProgramHandle)
|
||||
mCableTestSMTimer->stop();
|
||||
connect(mCableTestSMTimer,SIGNAL(timeout()),this,SLOT(SMTimerExpired()));
|
||||
|
||||
//TODO: Get this from the options page...
|
||||
mPinHoldTime = 300; //ms
|
||||
|
||||
mPinHoldTime = PinHoldTime; //ms
|
||||
|
||||
CableTestEngineStateMachine(CABLE_TEST_TICK_SM_EVENT);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CCableTestEngine::SetPinHoldTime(int HoldTime)
|
||||
{
|
||||
mPinHoldTime = HoldTime;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
void CCableTestEngine::CableTestEngineStateMachine(int Event)
|
||||
{
|
||||
switch(mCableTestSMState)
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
CCableTestEngine();
|
||||
~CCableTestEngine();
|
||||
int InitCableTestEngine(CCableTestBench *ProgramHandle);
|
||||
int InitCableTestEngine(CCableTestBench *ProgramHandle, int PinHoldTime);
|
||||
|
||||
int StartAutomatedTest();
|
||||
int PauseAutomatedTest();
|
||||
@@ -37,6 +37,8 @@ public:
|
||||
int StopManualTest();
|
||||
int ManualPinToggle(int ConnectorPinNbr);
|
||||
|
||||
int SetPinHoldTime(int HoldTime);
|
||||
|
||||
bool IsAutomaticTestRunning();
|
||||
eCableTestEngineMode GetTestEngineCurrentMode();
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ CCableTestPage::CCableTestPage(QWidget *parent) :
|
||||
connect(ui->mConnectorSelectWidget,SIGNAL(ConnectorSelected(CConnectorDefs::eConnectorType)),this,SLOT(ConnectorSelectionChanged(CConnectorDefs::eConnectorType)));
|
||||
ui->mInputTestVisualisationWidget->SetConnectorPinCount(0);
|
||||
ui->mOutputTestVisualisationWidget->SetConnectorPinCount(0);
|
||||
ui->mVisualInspStepChkBx->setCheckable(false);
|
||||
|
||||
|
||||
mGuiRefreshTimer.setSingleShot(false);
|
||||
@@ -47,6 +46,8 @@ CCableTestPage::CCableTestPage(QWidget *parent) :
|
||||
connect(&mGuiRefreshTimer,SIGNAL(timeout()),this,SLOT(GuiRefreshTimerExpired()));
|
||||
connect(ui->mSaveReportBtn,SIGNAL(clicked()),this,SLOT(SaveReportBtnClicked()));
|
||||
connect(ui->mOpenReportBtn,SIGNAL(clicked()),this,SLOT(OpenReportBtnClicked()));
|
||||
connect(ui->mIdentCableEditBox,SIGNAL(textEdited(QString)),this,SLOT(CableConfigTextChanged()));
|
||||
connect(ui->mNomTesteurEditBox,SIGNAL(textEdited(QString)),this,SLOT(CableConfigTextChanged()));
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +57,17 @@ CCableTestPage::CCableTestPage(QWidget *parent) :
|
||||
ui->mStartTestBtn->setEnabled(false);
|
||||
ui->mStartManualTestBtn->setEnabled(false);
|
||||
ui->mOutputTestVisualisationWidget->DisablePinClicks();
|
||||
// ui->mOpenReportBtn->setEnabled(false);
|
||||
|
||||
QPalette pal;
|
||||
pal.setColor(QPalette::WindowText,Qt::red);
|
||||
ui->mVisualInspectionStepLabel->setPalette(pal);
|
||||
ui->mVisualInspectionStepLabel->setText("2. Inspection visuelle: À FAIRE");
|
||||
|
||||
ui->mCableIdentStepLabel->setPalette(pal);
|
||||
ui->mCableIdentStepLabel->setText("1. Identification du câble: À REMPLIR");
|
||||
|
||||
ui->mConnectorSelStepLabel->setPalette(pal);
|
||||
ui->mConnectorSelStepLabel->setText("3. Sélection du connecteur d'entrée: À SÉLECTIONNER");
|
||||
|
||||
|
||||
|
||||
@@ -80,19 +91,66 @@ int CCableTestPage::SetVisualInspectionDone(bool Done)
|
||||
{
|
||||
ui->mInspectionDoneIcon->setPixmap(mInspectionDonePixmap);
|
||||
ui->mExecInspVisuelleBtn->setText(QString("Réviser Inspection").toUtf8());
|
||||
ui->mVisualInspStepChkBx->setCheckable(true);
|
||||
ui->mVisualInspStepChkBx->setChecked(true);
|
||||
ui->mVisualInspStepChkBx->setCheckable(false);
|
||||
|
||||
QPalette pal;
|
||||
pal.setColor(QPalette::WindowText,Qt::darkGreen);
|
||||
ui->mVisualInspectionStepLabel->setPalette(pal);
|
||||
ui->mVisualInspectionStepLabel->setText("2. Inspection visuelle: OK");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->mInspectionDoneIcon->setPixmap(mInspectionNotDonePixmap);
|
||||
ui->mExecInspVisuelleBtn->setText("Effectuer Inspection");
|
||||
ui->mVisualInspStepChkBx->setChecked(false);
|
||||
|
||||
QPalette pal;
|
||||
pal.setColor(QPalette::WindowText,Qt::red);
|
||||
ui->mVisualInspectionStepLabel->setPalette(pal);
|
||||
ui->mVisualInspectionStepLabel->setText("2. Inspection visuelle: À FAIRE");
|
||||
}
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CCableTestPage::SetConnectorSelStep(bool done)
|
||||
{
|
||||
QPalette pal;
|
||||
|
||||
if(done)
|
||||
{
|
||||
pal.setColor(QPalette::WindowText,Qt::darkGreen);
|
||||
ui->mConnectorSelStepLabel->setPalette(pal);
|
||||
ui->mConnectorSelStepLabel->setText("3. Sélection du connecteur d'entrée: OK");
|
||||
}
|
||||
else
|
||||
{
|
||||
pal.setColor(QPalette::WindowText,Qt::red);
|
||||
ui->mConnectorSelStepLabel->setPalette(pal);
|
||||
ui->mConnectorSelStepLabel->setText("3. Sélection du connecteur d'entrée: À SÉLECTIONNER");
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CCableTestPage::SetCableConfigureStep(bool done)
|
||||
{
|
||||
QPalette pal;
|
||||
|
||||
if(done)
|
||||
{
|
||||
pal.setColor(QPalette::WindowText,Qt::darkGreen);
|
||||
ui->mCableIdentStepLabel->setPalette(pal);
|
||||
ui->mCableIdentStepLabel->setText("1. Identification du câble: OK");
|
||||
}
|
||||
else
|
||||
{
|
||||
pal.setColor(QPalette::WindowText,Qt::red);
|
||||
ui->mCableIdentStepLabel->setPalette(pal);
|
||||
ui->mCableIdentStepLabel->setText("1. Identification du câble: À REMPLIR");
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
||||
void CCableTestPage::ConnectorSelectionChanged(CConnectorDefs::eConnectorType ConType)
|
||||
{
|
||||
CCable* Cable;
|
||||
@@ -103,6 +161,8 @@ void CCableTestPage::ConnectorSelectionChanged(CConnectorDefs::eConnectorType Co
|
||||
ui->mInputTestVisualisationWidget->SetConnectorPinCount(Cable->GetInputConnector()->GetPinCount());
|
||||
ui->mOutputTestVisualisationWidget->SetConnectorPinCount(Cable->GetOutputConnector()->GetPinCount());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CCableTestPage::StartTestBtnClicked()
|
||||
@@ -132,12 +192,15 @@ int CCableTestPage::ResetCable()
|
||||
ui->mOutputTestVisualisationWidget->ClearConnectorsLists();
|
||||
|
||||
//Reset cable config zone
|
||||
ui->mIdentCableEditBox->setText(mDefaultCableName);
|
||||
ui->mNomTesteurEditBox->setText(mDefaultInspectorName);
|
||||
// ui->mIdentCableEditBox->setText(mDefaultCableName);
|
||||
// ui->mNomTesteurEditBox->setText(mDefaultInspectorName);
|
||||
|
||||
//Reset Inspection Visuelle result (main program will clear the form)
|
||||
SetVisualInspectionDone(false);
|
||||
|
||||
// SetCableConfigureStep(false);
|
||||
SetConnectorSelStep(false);
|
||||
|
||||
//Clear connector selection zone
|
||||
ui->mConnectorSelectWidget->ClearAllConnectorsSelections();
|
||||
|
||||
@@ -304,3 +367,23 @@ int CCableTestPage::SetAutoTestResult(QString Result, QColor color)
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
bool CCableTestPage::IsCableConfigured()
|
||||
{
|
||||
if(ui->mIdentCableEditBox->text().isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ui->mNomTesteurEditBox->text().isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCableTestPage::CableConfigTextChanged()
|
||||
{
|
||||
mProgramHandle->CableConfigChanged();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ public:
|
||||
void hideEvent(QHideEvent *event);
|
||||
|
||||
int SetVisualInspectionDone(bool Done = true);
|
||||
int SetCableConfigureStep(bool done = true);
|
||||
int SetConnectorSelStep(bool done = true);
|
||||
int ResetCable();
|
||||
int EnableStartTestBtn();
|
||||
int DisableStartTestBtn();
|
||||
@@ -45,6 +47,10 @@ public:
|
||||
|
||||
int FillReportCableParametersData(CCableParametersData* ReportPtr);
|
||||
|
||||
bool IsCableConfigured();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
@@ -72,6 +78,7 @@ public slots:
|
||||
void AddTestLogEntry(QString Entry);
|
||||
void SaveReportBtnClicked();
|
||||
void OpenReportBtnClicked();
|
||||
void CableConfigTextChanged();
|
||||
};
|
||||
|
||||
#endif // CABLETESTPAGE_H
|
||||
|
||||
+44
-56
@@ -316,7 +316,7 @@
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>220</y>
|
||||
<width>491</width>
|
||||
<width>621</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -326,61 +326,10 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="mCableIdentStepChkBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>151</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1. Identification du câble</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="mVisualInspStepChkBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>151</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string extracomment="Test"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2. Inspection visuelle</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="mConSelStepChkBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>191</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>3. Sélection du connecteur d'entrée</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<x>310</x>
|
||||
<y>10</y>
|
||||
<width>121</width>
|
||||
<height>91</height>
|
||||
@@ -419,7 +368,7 @@
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<x>480</x>
|
||||
<y>10</y>
|
||||
<width>111</width>
|
||||
<height>80</height>
|
||||
@@ -445,7 +394,7 @@
|
||||
<widget class="QPushButton" name="mSaveReportBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<x>480</x>
|
||||
<y>100</y>
|
||||
<width>121</width>
|
||||
<height>23</height>
|
||||
@@ -455,6 +404,45 @@
|
||||
<string>Sauvegarder Rapport</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mCableIdentStepLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>201</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1. Identification du câble: À REMPLIR</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mVisualInspectionStepLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>201</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2. Inspection visuelle: À EXÉCUTER</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mConnectorSelStepLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>271</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>3. Sélection du connecteur d'entrée: À SÉLECTIONNER</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="mInspVisuelleLabel_2">
|
||||
<property name="geometry">
|
||||
@@ -493,7 +481,7 @@
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>600</x>
|
||||
<x>720</x>
|
||||
<y>220</y>
|
||||
<width>231</width>
|
||||
<height>131</height>
|
||||
|
||||
@@ -22,10 +22,10 @@ CIOModulesInterface::~CIOModulesInterface()
|
||||
}
|
||||
|
||||
|
||||
int CIOModulesInterface::OpenIOModules()
|
||||
int CIOModulesInterface::OpenIOModules(QString IPAddress)
|
||||
{
|
||||
|
||||
int ret = SM_Open(&hndl,(char*)"192.168.0.52");
|
||||
int ret = SM_Open(&hndl,IPAddress.toAscii().data());
|
||||
if(ret < 0)
|
||||
{
|
||||
qDebug("Impossible d'ouvrir le module d'I/O, erreur %d",ret);
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
CIOModulesInterface();
|
||||
~CIOModulesInterface();
|
||||
|
||||
int OpenIOModules();
|
||||
int OpenIOModules(QString IPAddress);
|
||||
int CloseIOModules();
|
||||
|
||||
int SetOutputs(QBitArray Outputs);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "OptionsPage.h"
|
||||
#include "ui_OptionsPage.h"
|
||||
#include "GlobalDefine.h"
|
||||
#include "CableTestBench.h"
|
||||
#include <QHostAddress>
|
||||
|
||||
COptionsPage::COptionsPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@@ -8,9 +11,49 @@ COptionsPage::COptionsPage(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
|
||||
mProgramHandle = 0;
|
||||
|
||||
connect(ui->mApplyAndSaveBtn,SIGNAL(clicked()),this,SLOT(OptionChanged()));
|
||||
}
|
||||
|
||||
COptionsPage::~COptionsPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
int COptionsPage::GetCurrentOptions(CTestBenchSettings *Settings)
|
||||
{
|
||||
Settings->mPinHoldTime = ui->mTestHoldTimeHighSpinBx->value();
|
||||
Settings->mIgnoreVisualInspection = ui->mIgnoreVisualInspChkBx->isChecked();
|
||||
Settings->mIOModuleIPAddress = QString("%1.%2.%3.%4").arg(ui->mIPAdd1SpinBox->value()).arg(ui->mIPAdd2SpinBox->value()).arg(ui->mIPAdd3SpinBox->value()).arg(ui->mIPAdd4SpinBox->value());
|
||||
Settings->mIncludeLogInReport = ui->mIncludeLogInReportChkBx->isChecked();
|
||||
|
||||
|
||||
|
||||
return RET_OK;
|
||||
|
||||
}
|
||||
|
||||
int COptionsPage::SetCurrentOptions(CTestBenchSettings *Settings)
|
||||
{
|
||||
ui->mTestHoldTimeHighSpinBx->setValue(Settings->mPinHoldTime);
|
||||
ui->mIgnoreVisualInspChkBx->setChecked(Settings->mIgnoreVisualInspection);
|
||||
ui->mIncludeLogInReportChkBx->setChecked(Settings->mIncludeLogInReport);
|
||||
QHostAddress IPAddres(Settings->mIOModuleIPAddress);
|
||||
|
||||
int IPV4 = IPAddres.toIPv4Address();
|
||||
|
||||
ui->mIPAdd4SpinBox->setValue(IPV4 & 0x000000FF);
|
||||
IPV4 >>= 8;
|
||||
ui->mIPAdd3SpinBox->setValue(IPV4 & 0x000000FF);
|
||||
IPV4 >>= 8;
|
||||
ui->mIPAdd2SpinBox->setValue(IPV4 & 0x000000FF);
|
||||
IPV4 >>= 8;
|
||||
ui->mIPAdd1SpinBox->setValue(IPV4 & 0x000000FF);
|
||||
|
||||
}
|
||||
|
||||
void COptionsPage::OptionChanged()
|
||||
{
|
||||
mProgramHandle->TestBenchOptionsChanged();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#define OPTIONSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "TestBenchSettings.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class COptionsPage;
|
||||
@@ -18,9 +20,21 @@ public:
|
||||
~COptionsPage();
|
||||
|
||||
CCableTestBench *mProgramHandle;
|
||||
|
||||
int GetCurrentOptions(CTestBenchSettings *Settings);
|
||||
int SetCurrentOptions(CTestBenchSettings *Settings);
|
||||
|
||||
private:
|
||||
Ui::COptionsPage *ui;
|
||||
|
||||
public slots:
|
||||
|
||||
void OptionChanged();
|
||||
|
||||
signals:
|
||||
void CurrentOptionsChanged();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // OPTIONSPAGE_H
|
||||
|
||||
+35
-76
@@ -6,35 +6,17 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1119</width>
|
||||
<width>564</width>
|
||||
<height>647</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>40</y>
|
||||
<width>181</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Valeurs par défaut</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<x>170</x>
|
||||
<y>40</y>
|
||||
<width>181</width>
|
||||
<height>31</height>
|
||||
@@ -52,7 +34,7 @@
|
||||
<widget class="QSpinBox" name="mTestHoldTimeHighSpinBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>680</x>
|
||||
<x>320</x>
|
||||
<y>110</y>
|
||||
<width>61</width>
|
||||
<height>22</height>
|
||||
@@ -71,7 +53,7 @@
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>500</x>
|
||||
<x>140</x>
|
||||
<y>110</y>
|
||||
<width>171</width>
|
||||
<height>20</height>
|
||||
@@ -86,48 +68,11 @@
|
||||
<string>Temps de maintien haut (ms)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>500</x>
|
||||
<y>150</y>
|
||||
<width>171</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Temps de maintien bas (ms)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="mTestHoldTimeLowSpinBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>680</x>
|
||||
<y>150</y>
|
||||
<width>61</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>5000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="mIPAdd1SpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>510</x>
|
||||
<y>340</y>
|
||||
<x>140</x>
|
||||
<y>311</y>
|
||||
<width>42</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
@@ -142,8 +87,8 @@
|
||||
<widget class="QSpinBox" name="mIPAdd2SpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>560</x>
|
||||
<y>340</y>
|
||||
<x>190</x>
|
||||
<y>311</y>
|
||||
<width>42</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
@@ -158,8 +103,8 @@
|
||||
<widget class="QSpinBox" name="mIPAdd3SpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>610</x>
|
||||
<y>340</y>
|
||||
<x>240</x>
|
||||
<y>311</y>
|
||||
<width>42</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
@@ -171,8 +116,8 @@
|
||||
<widget class="QSpinBox" name="mIPAdd4SpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>660</x>
|
||||
<y>340</y>
|
||||
<x>290</x>
|
||||
<y>311</y>
|
||||
<width>42</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
@@ -187,10 +132,10 @@
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>510</x>
|
||||
<y>310</y>
|
||||
<width>171</width>
|
||||
<height>20</height>
|
||||
<x>140</x>
|
||||
<y>270</y>
|
||||
<width>351</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@@ -199,14 +144,15 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Adresse IP module I/O</string>
|
||||
<string>Adresse IP module I/O
|
||||
(redémarrage de l'application requis)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="mApplyAndSaveBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>550</y>
|
||||
<x>170</x>
|
||||
<y>470</y>
|
||||
<width>131</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@@ -218,8 +164,8 @@
|
||||
<widget class="QCheckBox" name="mIgnoreVisualInspChkBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>500</x>
|
||||
<y>200</y>
|
||||
<x>140</x>
|
||||
<y>160</y>
|
||||
<width>221</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
@@ -228,6 +174,19 @@
|
||||
<string>Ignorer l'inspection visuelle</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="mIncludeLogInReportChkBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>200</y>
|
||||
<width>221</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Inclure LOG dans le rapport</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -1,5 +1,68 @@
|
||||
#include "TestBenchSettings.h"
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
#include "GlobalDefine.h"
|
||||
|
||||
CTestBenchSettings::CTestBenchSettings()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int CTestBenchSettings::SaveSettingsToFile()
|
||||
{
|
||||
QFile *SettingFile = new QFile("./Cablotron.csf");
|
||||
|
||||
if(!SettingFile->open(QIODevice::ReadWrite | QIODevice::Truncate))
|
||||
{
|
||||
delete SettingFile;
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
QDataStream Strm(SettingFile);
|
||||
|
||||
int MagicNbr = 0xC01DCAFE;
|
||||
|
||||
Strm << MagicNbr
|
||||
<< mPinHoldTime
|
||||
<< mIgnoreVisualInspection
|
||||
<< mIOModuleIPAddress
|
||||
<< mIncludeLogInReport;
|
||||
|
||||
SettingFile->close();
|
||||
delete SettingFile;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CTestBenchSettings::LoadSettingFromFile()
|
||||
{
|
||||
QFile *SettingFile = new QFile("./Cablotron.csf");
|
||||
|
||||
if(!SettingFile->open(QIODevice::ReadOnly))
|
||||
{
|
||||
delete SettingFile;
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
QDataStream Strm(SettingFile);
|
||||
|
||||
int MagicNbr;
|
||||
Strm >> MagicNbr;
|
||||
|
||||
if(MagicNbr != (int)0xC01DCAFE)
|
||||
{
|
||||
return RET_ERROR;
|
||||
SettingFile->close();
|
||||
delete SettingFile;
|
||||
}
|
||||
|
||||
Strm >> mPinHoldTime
|
||||
>> mIgnoreVisualInspection
|
||||
>> mIOModuleIPAddress
|
||||
>> mIncludeLogInReport;
|
||||
|
||||
SettingFile->close();
|
||||
delete SettingFile;
|
||||
return RET_OK;
|
||||
|
||||
}
|
||||
|
||||
@@ -7,11 +7,16 @@ class CTestBenchSettings
|
||||
public:
|
||||
CTestBenchSettings();
|
||||
|
||||
int LoadSettings();
|
||||
int LoadSettingFromFile();
|
||||
int SaveSettingsToFile();
|
||||
|
||||
|
||||
int mPinHoldTime;
|
||||
bool mIgnoreVisualInspection;
|
||||
QString mIOModuleIPAddress;
|
||||
bool mIncludeLogInReport;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
+20
-3
@@ -4,6 +4,7 @@
|
||||
#include <QTextStream>
|
||||
#include <QMessageBox>
|
||||
#include <QTextCodec>
|
||||
#include "TestBenchSettings.h"
|
||||
|
||||
CTestReport::CTestReport()
|
||||
{
|
||||
@@ -70,7 +71,7 @@ CAutomatedTestReport *CTestReport::GetAutomatedTestReport()
|
||||
return &mAutomatedTestReport;
|
||||
}
|
||||
|
||||
int CTestReport::SaveReportToFile()
|
||||
int CTestReport::SaveReportToFile(CTestBenchSettings *BenchSettings)
|
||||
{
|
||||
QFile *ReportFile;
|
||||
//QTextStream ReportStream;
|
||||
@@ -102,6 +103,18 @@ int CTestReport::SaveReportToFile()
|
||||
ReportStream << QString("Date de l'essai: ") << QDateTime::currentDateTime().toString("yyyy-MM-dd") << "\n";
|
||||
ReportStream << "Version du logiciel de test: " << mSoftwareVersion << "\n\n";
|
||||
ReportStream << "-----------------------------------------\n";
|
||||
ReportStream << QString("Paramètres du test: \n");
|
||||
ReportStream << QString("Temps de maintien des contacts: %1ms\n").arg(BenchSettings->mPinHoldTime);
|
||||
if(BenchSettings->mIgnoreVisualInspection)
|
||||
{
|
||||
ReportStream << QString("Ignorer inspection visuelle: OUI\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
ReportStream << QString("Ignorer inspection visuelle: NON\n");
|
||||
}
|
||||
ReportStream << QString("Adresse IP des modules d'I/O : %1\n\n").arg(BenchSettings->mIOModuleIPAddress);
|
||||
ReportStream << "-----------------------------------------\n";
|
||||
ReportStream << QString("Paramètres du câble: \n");
|
||||
ReportStream << QString("Identification du câble: ") << mCableParameters.mCableIdentification << "\n";
|
||||
ReportStream << "Station: " << mCableParameters.mStationCodeName << " - "<< mCableParameters.mStationName << "\n";
|
||||
@@ -147,8 +160,12 @@ int CTestReport::SaveReportToFile()
|
||||
ReportStream << QString("\n\n\n Signature de l'opérateur de test: _________________________________________\n\n");
|
||||
ReportStream << QString(" Date: _________________________________________\n\n");
|
||||
ReportStream << "-----------------------------------------\n";
|
||||
ReportStream << "Log du test:\n";
|
||||
ReportStream << mTestLog;
|
||||
|
||||
if(BenchSettings->mIncludeLogInReport)
|
||||
{
|
||||
ReportStream << "Log du test:\n";
|
||||
ReportStream << mTestLog;
|
||||
}
|
||||
|
||||
ReportFile->close();
|
||||
delete ReportFile;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "AutomatedTestReport.h"
|
||||
#include <QObject>
|
||||
|
||||
class CTestBenchSettings;
|
||||
|
||||
class CTestReport : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -24,7 +26,7 @@ public:
|
||||
bool GetGlobalAutoTestResult();
|
||||
|
||||
|
||||
int SaveReportToFile();
|
||||
int SaveReportToFile(CTestBenchSettings *BenchSettings);
|
||||
|
||||
QString GetLastReportFileName();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user