104 lines
2.5 KiB
C++
104 lines
2.5 KiB
C++
//
|
|
// Created by tangchao on 2022/6/28.
|
|
//
|
|
|
|
#ifndef XIMEAIMAGERECORDER_CONFIGFILE_H
|
|
#define XIMEAIMAGERECORDER_CONFIGFILE_H
|
|
|
|
#include <iostream>
|
|
#include <iomanip>
|
|
#include <cstdlib>
|
|
#include <libconfig.h++>
|
|
#include <string>
|
|
|
|
#include <QFileInfo>
|
|
#include <QString>
|
|
#include <QCoreApplication>
|
|
#include <QDir>
|
|
|
|
#include "utility_tc.h"
|
|
|
|
using namespace std;
|
|
using namespace libconfig;
|
|
|
|
class Configfile
|
|
{
|
|
|
|
public:
|
|
Configfile();
|
|
void setConfigfilePath(string configfilePath);
|
|
bool isConfigfileExist();
|
|
bool parseConfigfile();
|
|
|
|
bool getSpectralBin(int &spectralBin);
|
|
bool getspatialBin(int &spatialBin);
|
|
bool getEffectiveWindow(int &width, int &offsetx, int &height, int &offsety);
|
|
bool getEffectiveWindowRoi(int &width, int &offsetx);
|
|
bool getWindowOffsety_HeightOfSpectral(int &offsety, int &height, string spectralBinString);//spectralBinString = "bin1"或者”bin2“
|
|
bool getGainOffset(float &gain, float &offset);
|
|
bool getGainOffsetOfSpectralBin1(float &gain, float &offset);
|
|
bool getSN(QString &SN);
|
|
|
|
bool getBufferPolicy(int &bufferPolicy);
|
|
bool getAcqBufferSize(int &acqBufferSize);
|
|
|
|
bool createConfigFile();
|
|
bool updateConfigFile();
|
|
|
|
private:
|
|
string m_configfilePath;
|
|
Config cfg;
|
|
};
|
|
|
|
class ParameterConfigfile
|
|
{
|
|
public:
|
|
ParameterConfigfile();
|
|
void setConfigfilePath(string configfilePath);
|
|
bool isConfigfileExist();
|
|
bool parseConfigfile();
|
|
|
|
bool getFrameRate(int &frameRate);
|
|
bool setFrameRate(int frameRate);
|
|
|
|
bool getExposeTime(float &exposeTime);
|
|
bool setExposeTime(float exposeTime);
|
|
|
|
bool createConfigFile();
|
|
// bool updateConfigFile();
|
|
bool writeConfig2File();
|
|
|
|
string m_configfilePath;
|
|
Config cfg;
|
|
private:
|
|
};
|
|
|
|
class StateOf300tcConfigfile:public ParameterConfigfile
|
|
{
|
|
public:
|
|
StateOf300tcConfigfile();
|
|
|
|
bool getSwitchState(bool &switchState);
|
|
bool setSwitchState(bool switchState);
|
|
|
|
bool getSbgState(int &sbgState);
|
|
bool setSbgState(int sbgState);
|
|
|
|
bool getSbgSolutionMode(int &sbgSolutionMode);
|
|
bool setSbgSolutionMode(int sbgSolutionMode);
|
|
|
|
bool getXimeaState(int &ximeaState);
|
|
bool setXimeaState(int ximeaState);
|
|
|
|
bool getExposeMaxValueOfOneFrame(int &exposeMaxValueOfOneFrame);
|
|
bool setExposeMaxValueOfOneFrame(int exposeMaxValueOfOneFrame);
|
|
|
|
bool createConfigFile();
|
|
|
|
private:
|
|
bool getIntValue(int &value, string field);
|
|
bool setIntValue(int value, string field);
|
|
|
|
};
|
|
#endif //XIMEAIMAGERECORDER_CONFIGFILE_H
|