From d0b67b47c16dc350fde79ae0422f677b7784f33b Mon Sep 17 00:00:00 2001 From: tangchao0503 <735056338@qq.com> Date: Wed, 25 Oct 2023 15:33:52 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9Apsdk=E9=87=8D=E5=90=AF=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E9=80=9A=E7=9F=A5=E6=9C=AC=E7=A8=8B=E5=BA=8F=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=9C=AC=E7=A8=8B=E5=BA=8F=E7=9A=84=E7=8A=B6=E6=80=81?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Header_Files/configfile.h | 30 ++++++++- Header_Files/udpserver.h | 4 ++ Source_Files/configfile.cpp | 129 +++++++++++++++++++++++++++++++++++- Source_Files/main.cpp | 2 +- Source_Files/udpserver.cpp | 53 +++++++++++++-- 5 files changed, 208 insertions(+), 10 deletions(-) diff --git a/Header_Files/configfile.h b/Header_Files/configfile.h index 939819f..55061a2 100644 --- a/Header_Files/configfile.h +++ b/Header_Files/configfile.h @@ -68,8 +68,36 @@ public: // bool updateConfigFile(); bool writeConfig2File(); -private: 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 diff --git a/Header_Files/udpserver.h b/Header_Files/udpserver.h index 9de782f..deacd50 100644 --- a/Header_Files/udpserver.h +++ b/Header_Files/udpserver.h @@ -18,6 +18,8 @@ #include "sbgrecorder.h" #include "fileoperation.h" +#include "configfile.h" + extern "C" { // #include @@ -75,6 +77,8 @@ class UdpServer:public QObject QThread * m_recordTempThread; Record300TcTemperature * m_300tcTemperature; + StateOf300tcConfigfile stateOf300tc; + signals: void systemStart(); void systemStop(); diff --git a/Source_Files/configfile.cpp b/Source_Files/configfile.cpp index 9fd1b4c..3f57ec7 100644 --- a/Source_Files/configfile.cpp +++ b/Source_Files/configfile.cpp @@ -554,7 +554,7 @@ bool ParameterConfigfile::getFrameRate(int &frameRate) const Setting &ximeaParam = root["ximeaParam"]; frameRate = ximeaParam.lookup("frameRate"); - std::cout << "----------------"<< frameRate< 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"); +} diff --git a/Source_Files/main.cpp b/Source_Files/main.cpp index 19856d3..efb0d1d 100644 --- a/Source_Files/main.cpp +++ b/Source_Files/main.cpp @@ -3,7 +3,7 @@ int main(int argc, char *argv[]) { - std::cout<<"ximeaAirborneSystem 版本:"<< "39." <getImagerState()>=101 && m_imager->getImagerState()<=103) { - float time = datagramList[1].toFloat();//ms - m_imager->wrapSetExposureTime(time*1000); + float time = datagramList[1].toFloat();//μs + m_imager->wrapSetExposureTime(time); std::cout<<"7,手动设置曝光时间为:" << time <=9没有意义!"<=11没有意义!"<writeDatagram(datagram2send.data(),datagram2send.size(),m_clientIpAddress, 45455); + + stateOf300tc.setSbgState(serialPortStatus); } void UdpServer::sendSbgSolutionModeState(int SolutionMode) @@ -283,6 +317,8 @@ void UdpServer::sendSbgSolutionModeState(int SolutionMode) datagram2send.operator =(status.toStdString().c_str()); m_udpSocket->writeDatagram(datagram2send.data(),datagram2send.size(),m_clientIpAddress, 45455); + + stateOf300tc.setSbgSolutionMode(SolutionMode); } void UdpServer::sendSbgAccuracyState(int Accuracy,int SatelliteCounter) @@ -307,11 +343,13 @@ void UdpServer::sendXimeaImageStatus(int ximeaImageStatus) datagram2send.operator =(status.toStdString().c_str()); m_udpSocket->writeDatagram(datagram2send.data(),datagram2send.size(),m_clientIpAddress, 45455); + + stateOf300tc.setXimeaState(ximeaImageStatus); } void UdpServer::sendXimeaAutoExposeMaxValueOfOneFrame(int autoExposeMaxValueOfOneFrame, double exposeTime) { -// std::cout<<"UdpServer::sendXimeaAutoExposeMaxValueOfOneFrame---------------------:"<< ximeaImageStatus <writeDatagram(datagram2send.data(),datagram2send.size(),m_clientIpAddress, 45455); + + stateOf300tc.setExposeTime(exposeTime); + stateOf300tc.setExposeMaxValueOfOneFrame(autoExposeMaxValueOfOneFrame); } void UdpServer::sendXimeaBinState(int spatialBin, int spectralBin) @@ -343,6 +384,8 @@ void UdpServer::sendXimeaImageFrameRate(double frameRate) datagram2send.operator =(status.toStdString().c_str()); m_udpSocket->writeDatagram(datagram2send.data(),datagram2send.size(),m_clientIpAddress, 45455); + + stateOf300tc.setFrameRate(frameRate); } void UdpServer::sendCopyFileStatus(int fileStatus)