25개 이상의 토픽을 선택하실 수 없습니다.
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #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;
-
- }
|