add:psdk重启后,通知本程序发送本程序的状态;

This commit is contained in:
tangchao0503
2023-10-25 15:33:52 +08:00
parent 7fa3b70d10
commit d0b67b47c1
5 changed files with 208 additions and 10 deletions

View File

@ -55,7 +55,18 @@ UdpServer::UdpServer()
connect(m_imager, SIGNAL(frameRateSignal(double)),this, SLOT(sendXimeaImageFrameRate(double)));
connect(m_copyFile, SIGNAL(copyFileStatus(int)),this, SLOT(sendCopyFileStatus(int)));
QString ximeaParamCfgFile = "/media/nvme/300TC/config/StateOf300tc.cfg";
stateOf300tc.setConfigfilePath(ximeaParamCfgFile.toStdString());
if(!stateOf300tc.isConfigfileExist())
stateOf300tc.createConfigFile();
stateOf300tc.parseConfigfile();
stateOf300tc.setSbgState(0);
stateOf300tc.setSbgSolutionMode(0);
stateOf300tc.setXimeaState(100);
stateOf300tc.setFrameRate(0);
stateOf300tc.setExposeTime(0);
stateOf300tc.setExposeMaxValueOfOneFrame(0);
//当软件不正常关闭并且重启后通知其他psdk程序
m_clientIpAddress=QHostAddress(QHostAddress::LocalHost);
@ -76,7 +87,6 @@ UdpServer::UdpServer()
QString Temperature300tcCSVPath = QDir::cleanPath(QString::fromStdString("/media/nvme/300TC/programRunLog/300tcTemperature") + QDir::separator() + "300tcTemperature_" + currentTime + ".csv");
emit record300tcTemperatureSignal(Temperature300tcCSVPath);
std::cout<<"UdpServer::UdpServer--------:System ready!"<<std::endl;
}
@ -178,8 +188,8 @@ void UdpServer::processPendingDatagrams()
{
if(m_imager->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 <<std::endl;
}
@ -208,8 +218,30 @@ void UdpServer::processPendingDatagrams()
break;
}
case 10:
{
std::cout<<"10代表!"<<std::endl;
int sbgState,sbgSolutionMode,ximeaState,frameRate,exposeMaxValueOfOneFrame;
float exposeTime;
stateOf300tc.getSbgState(sbgState);
stateOf300tc.getSbgSolutionMode(sbgSolutionMode);
stateOf300tc.getXimeaState(ximeaState);
stateOf300tc.getFrameRate(frameRate);
stateOf300tc.getExposeTime(exposeTime);
stateOf300tc.getExposeMaxValueOfOneFrame(exposeMaxValueOfOneFrame);
sendSerialPortStatus(sbgState);
sendSbgSolutionModeState(sbgSolutionMode);
sendXimeaImageStatus(ximeaState);
sendXimeaAutoExposeMaxValueOfOneFrame(exposeMaxValueOfOneFrame, exposeTime);
sendXimeaImageFrameRate(frameRate);
break;
}
default:
std::cout<<">=9没有意义!"<<std::endl;
std::cout<<">=11没有意义!"<<std::endl;
break;
}
@ -271,6 +303,8 @@ void UdpServer::sendSerialPortStatus(int serialPortStatus)
datagram2send.operator =(status.toStdString().c_str());
m_udpSocket->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 <<std::endl;
// std::cout<<"UdpServer::sendXimeaAutoExposeMaxValueOfOneFrame---------------------:"<< exposeTime << " " << autoExposeMaxValueOfOneFrame <<std::endl;
QByteArray datagram2send;
@ -319,6 +357,9 @@ void UdpServer::sendXimeaAutoExposeMaxValueOfOneFrame(int autoExposeMaxValueOfOn
datagram2send.operator =(status.toStdString().c_str());
m_udpSocket->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)