add:psdk重启后,通知本程序发送本程序的状态;
This commit is contained in:
@ -554,7 +554,7 @@ bool ParameterConfigfile::getFrameRate(int &frameRate)
|
||||
const Setting &ximeaParam = root["ximeaParam"];
|
||||
frameRate = ximeaParam.lookup("frameRate");
|
||||
|
||||
std::cout << "----------------"<< frameRate<<std::endl;
|
||||
// std::cout << "ParameterConfigfile::getFrameRate:"<< frameRate<<std::endl;
|
||||
return true;
|
||||
}
|
||||
catch(const SettingNotFoundException &nfex)
|
||||
@ -591,7 +591,7 @@ bool ParameterConfigfile::getExposeTime(float &exposeTime)
|
||||
const Setting &ximeaParam = root["ximeaParam"];
|
||||
exposeTime = ximeaParam.lookup("exposeTime");
|
||||
|
||||
std::cout << "----------------"<< exposeTime<<std::endl;
|
||||
// std::cout << "ParameterConfigfile::getExposeTime"<< exposeTime<<std::endl;
|
||||
return true;
|
||||
}
|
||||
catch(const SettingNotFoundException &nfex)
|
||||
@ -628,7 +628,7 @@ bool ParameterConfigfile::writeConfig2File()
|
||||
bool ret = createDir(fileInfo[0]);
|
||||
|
||||
cfg.writeFile(m_configfilePath.c_str());
|
||||
cerr << "New configuration successfully written to: " << m_configfilePath.c_str() << endl;
|
||||
// cerr << "New configuration successfully written to: " << m_configfilePath.c_str() << endl;
|
||||
}
|
||||
catch(const FileIOException &fioex)
|
||||
{
|
||||
@ -637,3 +637,126 @@ bool ParameterConfigfile::writeConfig2File()
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
StateOf300tcConfigfile::StateOf300tcConfigfile()
|
||||
{
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::getIntValue(int &value, string field)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
try
|
||||
{
|
||||
const Setting &ximeaParam = root["ximeaParam"];
|
||||
value = ximeaParam.lookup(field);
|
||||
|
||||
// std::cout << "StateOf300tcConfigfile::getIntValue"<< value<<std::endl;
|
||||
return true;
|
||||
}
|
||||
catch(const SettingNotFoundException &nfex)
|
||||
{
|
||||
cerr << "No setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::setIntValue(int value, string field)
|
||||
{
|
||||
const Setting& root = cfg.getRoot();
|
||||
try
|
||||
{
|
||||
Setting &frameRate2 = root["ximeaParam"][field];
|
||||
frameRate2 = value;
|
||||
|
||||
writeConfig2File();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(const SettingNotFoundException &nfex)
|
||||
{
|
||||
cerr << "No setting in configuration file." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::createConfigFile()
|
||||
{
|
||||
using namespace std;
|
||||
using namespace libconfig;
|
||||
|
||||
Config cfg;
|
||||
|
||||
Setting &root = cfg.getRoot();
|
||||
|
||||
// Add some settings to the configuration.
|
||||
// Setting &SN = root.add("SN", Setting::TypeString) = "0098";
|
||||
// Setting &spatialBin = root.add("spatialBin", Setting::TypeInt) = 2;
|
||||
// Setting &SpectralBin = root.add("spectralBin", Setting::TypeInt) = 2;
|
||||
|
||||
Setting &ximeaParam = root.add("ximeaParam", Setting::TypeGroup);
|
||||
ximeaParam.add("sbgState", Setting::TypeInt) = 0;
|
||||
ximeaParam.add("sbgSolutionMode", Setting::TypeInt) = 0;
|
||||
ximeaParam.add("ximeaState", Setting::TypeInt) = 100;
|
||||
ximeaParam.add("frameRate", Setting::TypeInt) = 0;
|
||||
ximeaParam.add("exposeTime", Setting::TypeFloat) = 0.0;
|
||||
ximeaParam.add("exposeMaxValueOfOneFrame", Setting::TypeInt) = 0;
|
||||
|
||||
|
||||
// Write out the new configuration.
|
||||
try
|
||||
{
|
||||
QList<QString> fileInfo = getFileInfo(QString::fromStdString(m_configfilePath));
|
||||
bool ret = createDir(fileInfo[0]);
|
||||
|
||||
cfg.writeFile(m_configfilePath.c_str());
|
||||
cerr << "New configuration successfully written to: " << m_configfilePath.c_str() << endl;
|
||||
|
||||
}
|
||||
catch(const FileIOException &fioex)
|
||||
{
|
||||
cerr << "I/O error while writing configuration file: " << m_configfilePath.c_str() << endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::getSbgState(int &sbgState)
|
||||
{
|
||||
return getIntValue(sbgState,"sbgState");
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::setSbgState(int sbgState)
|
||||
{
|
||||
return setIntValue(sbgState,"sbgState");
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::getSbgSolutionMode(int &sbgSolutionMode)
|
||||
{
|
||||
return getIntValue(sbgSolutionMode,"sbgSolutionMode");
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::setSbgSolutionMode(int sbgSolutionMode)
|
||||
{
|
||||
return setIntValue(sbgSolutionMode,"sbgSolutionMode");
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::getXimeaState(int &ximeaState)
|
||||
{
|
||||
return getIntValue(ximeaState,"ximeaState");
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::setXimeaState(int ximeaState)
|
||||
{
|
||||
return setIntValue(ximeaState,"ximeaState");
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::getExposeMaxValueOfOneFrame(int &exposeMaxValueOfOneFrame)
|
||||
{
|
||||
return getIntValue(exposeMaxValueOfOneFrame,"exposeMaxValueOfOneFrame");
|
||||
}
|
||||
|
||||
bool StateOf300tcConfigfile::setExposeMaxValueOfOneFrame(int exposeMaxValueOfOneFrame)
|
||||
{
|
||||
return setIntValue(exposeMaxValueOfOneFrame,"exposeMaxValueOfOneFrame");
|
||||
}
|
||||
|
Reference in New Issue
Block a user