This commit is contained in:
JF
2019-05-03 13:46:54 -04:00
parent de3a417dd3
commit ea4c6769f4
29 changed files with 713 additions and 130 deletions
+5
View File
@@ -11,6 +11,7 @@ CCableTestBench::CCableTestBench(QObject *parent) :
CCableTestBench::~CCableTestBench()
{
delete w;
//mIOInterface.CloseIOModules();
}
int CCableTestBench::Start()
@@ -22,6 +23,8 @@ int CCableTestBench::Start()
mVisualInspPageHandle = w->mVisualInspPage;
mCableTestPageHandle = w->mCableTestPage;
mIOInterface.OpenIOModules();
return 1;
}
@@ -86,4 +89,6 @@ int CCableTestBench::VisualInspectionQuitRequest()
}
w->ShowCableTestPage();
return RET_OK;
}
+3
View File
@@ -7,6 +7,7 @@
#include "Connector.h"
#include "Cable.h"
#include "TestReport.h"
#include "IOModulesInterface.h"
class CMainPage;
@@ -28,6 +29,8 @@ public:
CCableTestPage *mCableTestPageHandle;
CCable mActualCable;
CIOModulesInterface mIOInterface;
int ExecVisualInspectionRequest();
int VisualInspectionQuitRequest();
+61
View File
@@ -0,0 +1,61 @@
#include "CableTestBenchDefs.h"
const int CConnectorDefs::ConnIOMapping[CConnectorDefs::NB_CONNECTOR_TYPE][2] = {
{0,0}, //Unknown
{97,102}, //in 6 pins
{91,104}, //in 14 pins
{73,96}, //in 24 pins
{1,72}, //in 72 pins
{1,90}, //in 90 pins
{1,108}, //in 108 pins
{1,108}, //in 120 pins
{97,102}, //out 6 pins
{91,104}, //out 14 pins
{73,96}, //out 24 pins
{1,72}, //out 72 pins
{1,108}, //out 108 pins
};
const int CConnectorDefs::ConnPinCount[NB_CONNECTOR_TYPE] = {0, 6, 14, 24, 72, 90, 108, 120, 6, 14, 24, 72, 108};
const int CConnectorDefs::GetPinCount(eConnectorType type)
{
if(type < 0 || type >= NB_CONNECTOR_TYPE)
{
return 0;
}
return ConnPinCount[type];
}
const int CConnectorDefs::GetConnectorIOMappingStart(eConnectorType type)
{
if(type < 0 || type >= NB_CONNECTOR_TYPE)
{
return ConnIOMapping[UNKNOWN_CONNECTOR_TYPE][IO_MAPPING_START_INDEX];
}
return ConnIOMapping[type][IO_MAPPING_START_INDEX];
}
const int CConnectorDefs::GetConnectorIOMappingEnd(eConnectorType type)
{
if(type < 0 || type >= NB_CONNECTOR_TYPE)
{
return ConnIOMapping[UNKNOWN_CONNECTOR_TYPE][IO_MAPPING_END_INDEX];
}
return ConnIOMapping[type][IO_MAPPING_END_INDEX];
}
const int * CConnectorDefs::GetConnectorIOMapping(eConnectorType type)
{
if(type < 0 || type >= NB_CONNECTOR_TYPE)
{
return ConnIOMapping[UNKNOWN_CONNECTOR_TYPE];
}
return ConnIOMapping[type];
}
+11 -74
View File
@@ -5,6 +5,8 @@
class CConnectorDefs
{
#define MAX_CONNECTOR_PIN_COUNT 120
#define IO_MAPPING_START_INDEX 0
#define IO_MAPPING_END_INDEX 1
public:
enum eConnectorType
@@ -21,84 +23,19 @@ public:
OUTPUT_14_PINS_CONNECTOR_TYPE,
OUTPUT_24_PINS_CONNECTOR_TYPE,
OUTPUT_72_PINS_CONNECTOR_TYPE,
OUTPUT_108_PINS_CONNECTOR_TYPE
OUTPUT_108_PINS_CONNECTOR_TYPE,
NB_CONNECTOR_TYPE
};
static int GetPinCount(eConnectorType type)
{
switch(type)
{
case INPUT_6_PINS_CONNECTOR_TYPE:
{
return 6;
break;
}
case INPUT_14_PINS_CONNECTOR_TYPE:
{
return 14;
break;
}
case INPUT_24_PINS_CONNECTOR_TYPE:
{
return 24;
break;
}
case INPUT_72_PINS_CONNECTOR_TYPE:
{
return 72;
break;
}
case INPUT_90_PINS_CONNECTOR_TYPE:
{
return 90;
break;
}
case INPUT_108_PINS_CONNECTOR_TYPE:
{
return 108;
break;
}
case INPUT_120_PINS_CONNECTOR_TYPE:
{
return 120;
break;
}
case OUTPUT_6_PINS_CONNECTOR_TYPE:
{
return 6;
break;
}
case OUTPUT_14_PINS_CONNECTOR_TYPE:
{
return 14;
break;
}
case OUTPUT_24_PINS_CONNECTOR_TYPE:
{
return 24;
break;
}
case OUTPUT_72_PINS_CONNECTOR_TYPE:
{
return 72;
break;
}
case OUTPUT_108_PINS_CONNECTOR_TYPE:
{
return 108;
break;
}
default:
{
return 0;
break;
}
static const int ConnIOMapping[NB_CONNECTOR_TYPE][2];
static const int ConnPinCount[NB_CONNECTOR_TYPE];
static const int GetPinCount(eConnectorType type);
static const int GetConnectorIOMappingStart(eConnectorType type);
static const int GetConnectorIOMappingEnd(eConnectorType type);
static const int* GetConnectorIOMapping(eConnectorType type);
}
}
};
#endif // CABLETESTBENCHDEFS_H
+8
View File
@@ -1,10 +1,18 @@
#ifndef CABLETESTENGINE_H
#define CABLETESTENGINE_H
#include "Cable.h"
class CCableTestEngine
{
public:
CCableTestEngine();
private:
CCable *mTestCable;
};
#endif // CABLETESTENGINE_H
+1 -1
View File
@@ -455,7 +455,7 @@
</font>
</property>
<property name="text">
<string>Contrôle du test</string>
<string>Contrôle du test électrique</string>
</property>
</widget>
<widget class="QTextBrowser" name="mTestLogTextBox">
+8 -1
View File
@@ -1,8 +1,10 @@
#include "Connector.h"
#include "GlobalDefine.h"
CConnector::CConnector()
{
mPinCount = 0;
mIOModuleRangeBegin = mIOModuleRangeEnd = 0;
}
int CConnector::GetPinCount()
@@ -12,7 +14,12 @@ int CConnector::GetPinCount()
int CConnector::SetConnectorType(CConnectorDefs::eConnectorType type)
{
mPinCount = CConnectorDefs::GetPinCount(type);
mConnectorType = type;
mPinCount = CConnectorDefs::GetPinCount(type);
mIOModuleRangeBegin = CConnectorDefs::GetConnectorIOMappingStart(type);
mIOModuleRangeEnd = CConnectorDefs::GetConnectorIOMappingEnd(type);
return RET_OK;
}
bool CConnector::IsConnectorDefined()
+4
View File
@@ -3,6 +3,7 @@
#include "CableTestBenchDefs.h"
class CConnector
{
public:
@@ -16,6 +17,9 @@ private:
int mPinCount;
CConnectorDefs::eConnectorType mConnectorType;
int mIOModuleRangeBegin, mIOModuleRangeEnd;
};
+37
View File
@@ -0,0 +1,37 @@
#include "IOModulesInterface.h"
#include "GlobalDefine.h"
#include <QDebug>
CIOModulesInterface::CIOModulesInterface()
{
}
int CIOModulesInterface::OpenIOModules()
{
int ret = SM_Open(&hndl,"192.168.0.52");
if(ret < 0)
{
qDebug("Impossible d'ouvrir le module d'I/O, erreur %d",ret);
return RET_ERROR;
}
qDebug("Module d'I/O ouvert avec succès");
return RET_OK;
}
int CIOModulesInterface::CloseIOModules()
{
int ret = SM_Close(&hndl);
if(ret < 0)
{
qDebug("Impossible de fermer le module d'I/O, erreur %d",ret);
return RET_ERROR;
}
qDebug("Module d'I/O fermé avec succès");
return RET_OK;
}
+18
View File
@@ -0,0 +1,18 @@
#ifndef IOMODULESINTERFACE_H
#define IOMODULESINTERFACE_H
#include "SeaMAX.h"
class CIOModulesInterface
{
public:
CIOModulesInterface();
int OpenIOModules();
int CloseIOModules();
private:
SM_HANDLE hndl;
};
#endif // IOMODULESINTERFACE_H
+10 -18
View File
@@ -1,7 +1,7 @@
#include "MainPage.h"
#include "ui_CMainPage.h"
#include "SeaMAX.h"
//#include "SeaMAX.h"
CMainPage::CMainPage(QWidget *parent) :
QWidget(parent),
@@ -12,24 +12,11 @@ CMainPage::CMainPage(QWidget *parent) :
QFont font;
font.setPointSize(18);
// ui->mConnectorsImgLbl->setPixmap(QPixmap("./images/connecteurs.png").scaled(ui->mConnectorsImgLbl->size()));
// mConnectorSelWidget = new CConnectorSelectWidget();
ui->mMainTabWidget->clear();
// test = new QLabel(this);
// test->setObjectName("test");
// test->setGeometry(QRect(580, 500, 491, 431));
// test->setPixmap(QPixmap("./images/connecteurs.png"));
// test->show();
//connect(ui->mInspVisuelleBtn,SIGNAL(clicked()),this,SLOT(InspVisuelleBtnClicked()));
SM_HANDLE hndl;
SM_Open(&hndl,"192.168.0.101");
// SM_HANDLE hndl;
// SM_Open(&hndl,"192.168.0.101");
@@ -45,7 +32,12 @@ CMainPage::~CMainPage()
int CMainPage::SetTestPageWidget(QWidget *PageHandle)
{
ui->mMainTabWidget->addTab(PageHandle,QIcon(),QString("Câble"));
ui->mMainTabWidget->addTab(PageHandle,QIcon(),QString("Test câble"));
return RET_OK;
}
int CMainPage::SetOptionsPageWidget(QWidget *PageHandle)
{
ui->mMainTabWidget->addTab(PageHandle,QIcon(),QString("Options"));
return RET_OK;
}
+1
View File
@@ -25,6 +25,7 @@ public:
// CConnectorSelectWidget *mConnectorSelWidget;
int SetTestPageWidget(QWidget *PageHandle);
int SetOptionsPageWidget(QWidget *PageHandle);
+12 -3
View File
@@ -8,17 +8,26 @@ MainWindow::MainWindow(QWidget *parent,CCableTestBench* ProgramHandle)
{
resize(1800,890);
mMainPage = new CMainPage();
// mMainPage = new CMainPage();
// mVisualInspPage = new CVisualInspectionPage(this);
// mVisualInspPage->hide();
// mCableTestPage = new CCableTestPage(this);
mMainPage = new CMainPage(this);
mVisualInspPage = new CVisualInspectionPage(this);
mVisualInspPage->hide();
mCableTestPage = new CCableTestPage(this);
mCableTestPage = new CCableTestPage();
mOptionsPage = new COptionsPage();
mMainPage->mProgramHandle = ProgramHandle;
mVisualInspPage->mProgramHandle = ProgramHandle;
mCableTestPage->mProgramHandle = ProgramHandle;
mOptionsPage->mProgramHandle = ProgramHandle;
mMainPage->SetTestPageWidget(mCableTestPage);
mMainPage->SetOptionsPageWidget(mOptionsPage);
//mMainPage->SetTestPageWidget(mCableTestPage);
//setCentralWidget(mVisualInspPage);
+2
View File
@@ -10,6 +10,7 @@
#include "VisualInspectionPage.h"
#include "CableTestPage.h"
#include "VisualInspectionResult.h"
#include "OptionsPage.h"
class CCableTestBench;
@@ -25,6 +26,7 @@ public:
CCableTestBench *mProgramHandle;
CVisualInspectionPage *mVisualInspPage;
CCableTestPage *mCableTestPage;
COptionsPage *mOptionsPage;
int ShowInspectVisuellePage();
int ShowCableTestPage();
+16
View File
@@ -0,0 +1,16 @@
#include "OptionsPage.h"
#include "ui_OptionsPage.h"
COptionsPage::COptionsPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::COptionsPage)
{
ui->setupUi(this);
mProgramHandle = 0;
}
COptionsPage::~COptionsPage()
{
delete ui;
}
+26
View File
@@ -0,0 +1,26 @@
#ifndef OPTIONSPAGE_H
#define OPTIONSPAGE_H
#include <QWidget>
namespace Ui {
class COptionsPage;
}
class CCableTestBench;
class COptionsPage : public QWidget
{
Q_OBJECT
public:
explicit COptionsPage(QWidget *parent = 0);
~COptionsPage();
CCableTestBench *mProgramHandle;
private:
Ui::COptionsPage *ui;
};
#endif // OPTIONSPAGE_H
+221
View File
@@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>COptionsPage</class>
<widget class="QWidget" name="COptionsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1119</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>
<y>40</y>
<width>181</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Paramètres de test</string>
</property>
</widget>
<widget class="QSpinBox" name="mTestHoldTimeHighSpinBx">
<property name="geometry">
<rect>
<x>680</x>
<y>110</y>
<width>61</width>
<height>22</height>
</rect>
</property>
<property name="minimum">
<number>100</number>
</property>
<property name="maximum">
<number>5000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>500</x>
<y>110</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 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>
<width>42</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>192</number>
</property>
</widget>
<widget class="QSpinBox" name="mIPAdd2SpinBox">
<property name="geometry">
<rect>
<x>560</x>
<y>340</y>
<width>42</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>168</number>
</property>
</widget>
<widget class="QSpinBox" name="mIPAdd3SpinBox">
<property name="geometry">
<rect>
<x>610</x>
<y>340</y>
<width>42</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QSpinBox" name="mIPAdd4SpinBox">
<property name="geometry">
<rect>
<x>660</x>
<y>340</y>
<width>42</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>52</number>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>510</x>
<y>310</y>
<width>171</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Adresse IP module I/O</string>
</property>
</widget>
<widget class="QPushButton" name="mApplyAndSaveBtn">
<property name="geometry">
<rect>
<x>390</x>
<y>550</y>
<width>131</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Appliquer &amp;&amp; Sauvegarder</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
+5 -2
View File
@@ -132,8 +132,9 @@ void CConnectorSelectWidget::InputConnectorZoneClicked(CConnectorClickZoneWidget
if(ConClickZone->IsConSelected() == true)
{
ClearAllConnectorsSelections();
mCurSelConnector = CConnectorDefs::UNKNOWN_CONNECTOR_TYPE;
// ClearAllConnectorsSelections();
// mCurSelConnector = CConnectorDefs::UNKNOWN_CONNECTOR_TYPE;
return;
}
else
{
@@ -225,6 +226,8 @@ int CConnectorSelectWidget::ClearAllConnectorsSelections()
{
ClearAllOutputConSelections();
ClearAllInputConSelections();
return RET_OK;
}
CConnectorClickZoneWidget* CConnectorSelectWidget::FindOutputSelectionZone(CConnectorDefs::eConnectorType type)