95 lines
1.9 KiB
C++
95 lines
1.9 KiB
C++
#include "CableTestBench.h"
|
|
#include <QDateTime>
|
|
|
|
CCableTestBench::CCableTestBench(QObject *parent) :
|
|
QObject(parent),
|
|
mActualCable(CConnectorDefs::UNKNOWN_CONNECTOR_TYPE)
|
|
{
|
|
w = new MainWindow(0,this);
|
|
}
|
|
|
|
CCableTestBench::~CCableTestBench()
|
|
{
|
|
delete w;
|
|
//mIOInterface.CloseIOModules();
|
|
}
|
|
|
|
int CCableTestBench::Start()
|
|
{
|
|
// w->showMaximized();
|
|
w->show();
|
|
|
|
mMainPageHandle = w->mMainPage;
|
|
mVisualInspPageHandle = w->mVisualInspPage;
|
|
mCableTestPageHandle = w->mCableTestPage;
|
|
|
|
mIOInterface.OpenIOModules();
|
|
|
|
return 1;
|
|
}
|
|
|
|
|
|
quint8 CCableTestBench::DecToBCDByte(const quint8 byte)
|
|
{
|
|
quint8 out = 0;
|
|
|
|
out = ((byte/10) << 4) + (byte%10);
|
|
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
quint16 CCableTestBench::DecToBCDWord(const quint16 word)
|
|
{
|
|
quint16 out = 0;
|
|
quint16 temp = 0;
|
|
|
|
out = word % 10;
|
|
temp = (((word /10) % 10) << 4);
|
|
out += temp;
|
|
temp = (((word / 100) % 10) << 8);
|
|
out += temp;
|
|
temp = (((word / 1000) % 10) << 12);
|
|
out += temp;
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
int CCableTestBench::ExecVisualInspectionRequest()
|
|
{
|
|
qDebug("Exec Visual Inspection clicked");
|
|
|
|
// mCableTestPageHandle->SetVisualInspectionDone(true);
|
|
w->ShowInspectVisuellePage();
|
|
return RET_OK;
|
|
}
|
|
|
|
CCable* CCableTestBench::SetSelectedConnector(CConnectorDefs::eConnectorType ConType)
|
|
{
|
|
if(mActualCable.DefineCableByInputConnector(ConType) == RET_ERROR)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
return &mActualCable;
|
|
}
|
|
|
|
int CCableTestBench::VisualInspectionQuitRequest()
|
|
{
|
|
mVisualInspPageHandle->FillVisualInspectionResultReport(mCableTestReport.GetInspectionResult());
|
|
if(mCableTestReport.GetInspectionResult()->IsVisualInspectionResultComplete() == true)
|
|
{
|
|
mCableTestPageHandle->SetVisualInspectionDone(true);
|
|
}
|
|
else
|
|
{
|
|
mCableTestPageHandle->SetVisualInspectionDone(false);
|
|
}
|
|
|
|
w->ShowCableTestPage();
|
|
|
|
return RET_OK;
|
|
}
|