1.air部署,细节待修改
This commit is contained in:
124
Source/Settings/SysConfigger.cpp
Normal file
124
Source/Settings/SysConfigger.cpp
Normal file
@ -0,0 +1,124 @@
|
||||
#include "SysConfigger.h"
|
||||
|
||||
|
||||
ZZ_SysConfigger::ZZ_SysConfigger(QObject* parent /*= nullptr*/)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_qstrDeviceConfigFilePath = "E:/WorkSpace/git/IRIS_FODIS/IRIS_FODIS/Settings/DeviceSettings.ini";
|
||||
#else
|
||||
m_qstrDeviceSettingsFilePath = "/home/data/Setting/DeviceSettings.ini";
|
||||
#endif // DEBUG
|
||||
|
||||
m_qsDeviceSettings = NULL;
|
||||
}
|
||||
|
||||
|
||||
ZZ_SysConfigger::~ZZ_SysConfigger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ZZ_SysConfigger::Initialize()
|
||||
{
|
||||
if (m_qsDeviceSettings != NULL)
|
||||
{
|
||||
delete m_qsDeviceSettings;
|
||||
}
|
||||
m_qsDeviceSettings = new QSettings(m_qstrDeviceSettingsFilePath, QSettings::IniFormat);
|
||||
}
|
||||
|
||||
//void ZZ_SysConfigger::SetContext(OneFSContext struOFSC)
|
||||
//{
|
||||
// m_struOneFSContext = struOFSC;
|
||||
//}
|
||||
|
||||
bool ZZ_SysConfigger::LoadSettings_FS(OneFSContext &struOFSC)
|
||||
{
|
||||
bool bRes = true;
|
||||
////
|
||||
QString qstrTemp = m_qsDeviceSettings->value(QString("FS/Model"), "Null").toString();
|
||||
if(qstrTemp == "Null")
|
||||
{
|
||||
qDebug() << "FS Model Value Err.";
|
||||
return false;
|
||||
}
|
||||
m_struOneFSContext.ucDeviceModel = ZZ_MISCDEF::IRIS::GetIndex(qstrTemp.toStdString());
|
||||
////
|
||||
qstrTemp = m_qsDeviceSettings->value(QString("FS/Port"), "Null").toString();
|
||||
if (qstrTemp == "Null")
|
||||
{
|
||||
qDebug() << "FS Port Value Err.";
|
||||
return false;
|
||||
}
|
||||
m_struOneFSContext.strInterface = qstrTemp.toStdString();
|
||||
////
|
||||
qstrTemp = m_qsDeviceSettings->value(QString("FS/UID"), "Null").toString();
|
||||
if (qstrTemp == "Null")
|
||||
{
|
||||
qDebug() << "FS UID Value Err.";
|
||||
return false;
|
||||
}
|
||||
m_struOneFSContext.strSN = qstrTemp.toStdString();
|
||||
////
|
||||
float fAEMax = m_qsDeviceSettings->value(QString("FS/AEMax"), -1).toFloat();
|
||||
if (fAEMax == -1)
|
||||
{
|
||||
qDebug() << "FS AEMax Value Err.";
|
||||
return false;
|
||||
}
|
||||
m_struOneFSContext.fMaxFactor = fAEMax;
|
||||
////
|
||||
float fAEMin = m_qsDeviceSettings->value(QString("FS/AEMin"), -1).toFloat();
|
||||
if (fAEMin == -1)
|
||||
{
|
||||
qDebug() << "FS AEMin Value Err.";
|
||||
return false;
|
||||
}
|
||||
m_struOneFSContext.fMinFactor = fAEMin;
|
||||
////
|
||||
long lDepth = m_qsDeviceSettings->value(QString("FS/Depth"), -1).toInt();
|
||||
if (lDepth == -1)
|
||||
{
|
||||
qDebug() << "FS Depth Value Err.";
|
||||
return false;
|
||||
}
|
||||
m_struOneFSContext.lDepth = lDepth;
|
||||
////
|
||||
double dMSI= m_qsDeviceSettings->value(QString("FS/MinSI"), -1).toDouble();
|
||||
if (dMSI == -1)
|
||||
{
|
||||
qDebug() << "FS MinSI Value Err.";
|
||||
return false;
|
||||
}
|
||||
m_struOneFSContext.dMinSamplingInterval = dMSI;
|
||||
////
|
||||
struOFSC = m_struOneFSContext;
|
||||
////
|
||||
return bRes;
|
||||
}
|
||||
|
||||
bool ZZ_SysConfigger::LoadSettings_GPS(GPSInfo &struGPSC)
|
||||
{
|
||||
bool bRes = true;
|
||||
////
|
||||
QString qstrTemp = m_qsDeviceSettings->value(QString("GPS/Port"), "Null").toString();
|
||||
if (qstrTemp == "Null")
|
||||
{
|
||||
qDebug() << "GPS Port Value Err.";
|
||||
return false;
|
||||
}
|
||||
m_struGPSContext.qstrInterfaceName = qstrTemp;
|
||||
////
|
||||
qstrTemp = m_qsDeviceSettings->value(QString("GPS/Baud"), "Null").toString();
|
||||
if (qstrTemp == "Null")
|
||||
{
|
||||
qDebug() << "GPS Port Value Err.";
|
||||
return false;
|
||||
}
|
||||
m_struGPSContext.iBaud = qstrTemp.toInt();
|
||||
////
|
||||
struGPSC = m_struGPSContext;
|
||||
////
|
||||
return true;
|
||||
}
|
31
Source/Settings/SysConfigger.h
Normal file
31
Source/Settings/SysConfigger.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
#include "ZZ_Types.h"
|
||||
using namespace ZZ_MISCDEF::ZZ_RUNPARAMS;
|
||||
using namespace ZZ_MISCDEF::MISC_DETECTOR;
|
||||
|
||||
class ZZ_SysConfigger :public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ZZ_SysConfigger(QObject* parent = nullptr);
|
||||
virtual ~ZZ_SysConfigger();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
OneFSContext m_struOneFSContext;
|
||||
GPSInfo m_struGPSContext;
|
||||
|
||||
QString m_qstrDeviceSettingsFilePath;
|
||||
QSettings* m_qsDeviceSettings;
|
||||
|
||||
public:
|
||||
void Initialize();
|
||||
|
||||
//void SetContext(OneFSContext struOFSC);
|
||||
|
||||
bool LoadSettings_FS(OneFSContext &struOFSC);
|
||||
bool LoadSettings_GPS(GPSInfo &struGPSC);
|
||||
};
|
Reference in New Issue
Block a user