1. 错误控制;
2. 创建配置文件的文件夹;
This commit is contained in:
@ -16,6 +16,8 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
|
||||
#include "utility_tc.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace libconfig;
|
||||
|
||||
|
@ -16,4 +16,8 @@ void bubbleSort(unsigned short * a, int n);
|
||||
|
||||
void swap(unsigned short * a, unsigned short * b);
|
||||
|
||||
bool createDir(QString fullPath);
|
||||
|
||||
QList<QString> getFileInfo(QString file);
|
||||
|
||||
#endif // UTILITY_TC_H
|
||||
|
@ -283,6 +283,9 @@ bool Configfile::createConfigFile()
|
||||
QString output_file = "/media/nvme/300TC/config/ximea.cfg";
|
||||
try
|
||||
{
|
||||
QList<QString> fileInfo = getFileInfo(output_file);
|
||||
bool ret = createDir(fileInfo[0]);
|
||||
|
||||
cfg.writeFile(output_file.toStdString().c_str());
|
||||
cerr << "New configuration successfully written to: " << output_file.toStdString().c_str() << endl;
|
||||
|
||||
|
@ -122,26 +122,19 @@ void UdpServer::processPendingDatagrams()
|
||||
}
|
||||
case 3://系统开始采集高光谱影像
|
||||
{
|
||||
//emit startRecordHyperspectralSignal();//真实的影像开始采集通过惯导中的信号(sbgReady)触发
|
||||
if(m_imager->getImagerState()>=101 && m_imager->getImagerState()<=103)
|
||||
{
|
||||
std::cout<<"3代表系统开始采集高光谱影像!"<<std::endl;
|
||||
m_sbgRecorder->startRecordHyperspectral();
|
||||
|
||||
// if(m_sbgRecorder->getSbgState()==2)//开始采集前还需要判断相机的状态??????????????????????????????????????????
|
||||
// {
|
||||
|
||||
// }
|
||||
// else if(m_sbgRecorder->getSbgState()==3)
|
||||
// {
|
||||
// std::cout<<"系统已经开始采集!"<<std::endl;
|
||||
// }
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 4://系统停止采集高光谱影像
|
||||
{
|
||||
std::cout<<"4代表系统停止采集高光谱影像!"<<std::endl;
|
||||
|
||||
if(m_imager->getImagerState()>=101 && m_imager->getImagerState()<=104)
|
||||
{
|
||||
std::cout<<"4代表系统停止采集高光谱影像!"<<std::endl;
|
||||
m_imager->stopRecord();
|
||||
}
|
||||
|
||||
@ -168,10 +161,13 @@ void UdpServer::processPendingDatagrams()
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
if(m_imager->getImagerState()>=101 && m_imager->getImagerState()<=103)
|
||||
{
|
||||
float time = datagramList[1].toFloat();//ms
|
||||
m_imager->wrapSetExposureTime(time*1000);
|
||||
std::cout<<"7,手动设置曝光时间为:" << time <<std::endl;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -88,3 +88,36 @@ void swap(unsigned short * a, unsigned short * b)
|
||||
*a=*b;
|
||||
*b=tmp;
|
||||
}
|
||||
|
||||
|
||||
bool createDir(QString fullPath)
|
||||
{
|
||||
QDir dir(fullPath);
|
||||
if (dir.exists()) {
|
||||
return true;
|
||||
} else {
|
||||
bool ok = dir.mkpath(fullPath);//创建多级目录
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
QList<QString> getFileInfo(QString file)
|
||||
{
|
||||
QFileInfo fileInfo = QFileInfo(file);
|
||||
|
||||
QString fileName, fileSuffix, filePath;
|
||||
filePath = fileInfo.absolutePath();//绝对路径
|
||||
fileName = fileInfo.fileName();//文件名
|
||||
fileSuffix = fileInfo.suffix();//文件后缀
|
||||
|
||||
// qDebug() << fileName <<endl
|
||||
// << fileSuffix<< endl
|
||||
// << filePath<< endl;
|
||||
|
||||
QList<QString> result;
|
||||
result.append(filePath);
|
||||
result.append(fileName);
|
||||
result.append(fileSuffix);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user