71 lines
1.3 KiB
C++
71 lines
1.3 KiB
C++
#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
|
|
<< mExecSecondPass;
|
|
|
|
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
|
|
>> mExecSecondPass;
|
|
|
|
SettingFile->close();
|
|
delete SettingFile;
|
|
return RET_OK;
|
|
|
|
}
|