76 lines
1.7 KiB
C++
76 lines
1.7 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();
|
|
|
|
private:
|
|
string m_configfilePath;
|
|
Config cfg;
|
|
};
|
|
#endif //XIMEAIMAGERECORDER_CONFIGFILE_H
|