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