Nevar pievienot vairāk kā 25 tēmas
Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
|
- #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;
-
- }
|