最新更改
This commit is contained in:
@ -49,16 +49,18 @@ int ZZ_ATPControl_Serial_Qt::Initialize(bool bIsUSBMode, std::string ucPortNumbe
|
||||
bool bRes = m_pSerialPort->setBaudRate(m_iBaudRate);
|
||||
if (!bRes)
|
||||
{
|
||||
qDebug() << "Err:setBaudRate Failed.Exit Code:1";
|
||||
//qDebug() << "Err:setBaudRate Failed.Exit Code:1";
|
||||
//std::cout << "Err.setBaudRate Failed" << std::endl;
|
||||
printf("Err:setBaudRate Failed.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
|
||||
bRes = m_pSerialPort->open(QIODevice::ReadWrite);
|
||||
if (!bRes)
|
||||
{
|
||||
qDebug() << "Err:open Failed.Exit Code:2";
|
||||
//qDebug() << "Err:open Failed.Exit Code:2";
|
||||
//std::cout << "Err.open Failed" << std::endl;
|
||||
printf("Err:open Failed.Exit Code:2");
|
||||
return 2;
|
||||
}
|
||||
|
||||
@ -75,7 +77,8 @@ int ZZ_ATPControl_Serial_Qt::Initialize(bool bIsUSBMode, std::string ucPortNumbe
|
||||
std::string::size_type szPostion = m_diDeviceInfo.strSN.find(strDeviceName);
|
||||
if (szPostion == std::string::npos)
|
||||
{
|
||||
qDebug() << "Err:FS serial number not match.Exit Code:3";
|
||||
printf("Err:FS serial number not match.Exit Code:3");
|
||||
//qDebug() << "Err:FS serial number not match.Exit Code:3";
|
||||
//return 3;
|
||||
}
|
||||
else
|
||||
@ -99,19 +102,22 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceInfo(DeviceInfo& Info)
|
||||
int iRes = SendCommand(qbSend);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceInfo Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
iRes = RecvData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceInfo Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
iRes = ParseData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceInfo Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
m_diDeviceInfo.strPN = qbRecv.data();
|
||||
@ -122,19 +128,22 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceInfo(DeviceInfo& Info)
|
||||
iRes = SendCommand(qbSend);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceInfo Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
iRes = RecvData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceInfo Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
iRes = ParseData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceInfo Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
m_diDeviceInfo.strSN = qbRecv.data();
|
||||
@ -154,19 +163,22 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute(DeviceAttribute& Attr)
|
||||
int iRes = SendCommand(qbSend);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
iRes = RecvData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
iRes = ParseData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
m_daDeviceAttr.iMinIntegrationTimeInMS = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||
@ -177,19 +189,22 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute(DeviceAttribute& Attr)
|
||||
iRes = SendCommand(qbSend);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
iRes = RecvData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
iRes = ParseData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
m_daDeviceAttr.iMaxIntegrationTimeInMS = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||
@ -201,13 +216,15 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute(DeviceAttribute& Attr)
|
||||
iRes = SetExposureTime(m_daDeviceAttr.iMinIntegrationTimeInMS);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Call SetExposureTime error.Exit Code:2";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Call SetExposureTime error.Exit Code:2";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:2");
|
||||
//return 2;
|
||||
}
|
||||
iRes = SingleShot(m_daDeviceAttr.iPixels);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Call SingleShot error.Exit Code:3";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Call SingleShot error.Exit Code:3";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:3");
|
||||
return 3;
|
||||
}
|
||||
|
||||
@ -222,19 +239,22 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute(DeviceAttribute& Attr)
|
||||
iRes = SendCommand(qbSend);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
iRes = RecvData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
iRes = ParseData(qbRecv);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
//qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
printf("Err:GetDeviceAttribute Failed,Communication error.Exit Code:1");
|
||||
return 1;
|
||||
}
|
||||
float fWaveLengthCoef[4];
|
||||
|
@ -30,7 +30,8 @@ int DataFileProcessor::WriteWavelengthInfo(float *pfWaveLength, int iLength)
|
||||
bRes = qfData.open(QFile::WriteOnly | QFile::Text | QFile::Truncate);
|
||||
if (!bRes)
|
||||
{
|
||||
qDebug() << "WriteEnvironmentInfo open Failed.";
|
||||
//qDebug() << "WriteEnvironmentInfo open Failed.";
|
||||
printf("WriteWavelengthInfo QFile open Failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -60,26 +61,72 @@ int DataFileProcessor::WriteWavelengthInfo(float *pfWaveLength, int iLength)
|
||||
int DataFileProcessor::WriteData(DataFrame dfDataFrame)
|
||||
{
|
||||
QFile qfData(m_qstrFullFileName);
|
||||
qDebug() << m_qstrFullFileName;
|
||||
bool bRes = qfData.open(QFile::WriteOnly| QIODevice::Append);
|
||||
if (!bRes)
|
||||
{
|
||||
qDebug() << "WriteData open Failed.";
|
||||
printf("WriteData QFile open Failed");
|
||||
return 0;
|
||||
}
|
||||
qfData.write((char*)&dfDataFrame, sizeof(DataFrame));
|
||||
qfData.flush();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DataFileProcessor::LoadWaveLengthFile(QString qstrFileName)
|
||||
{
|
||||
//E:\WavelengthInfo.txt
|
||||
QFile qfWavelength(qstrFileName);
|
||||
//QFile qfWavelength();
|
||||
|
||||
bool bRes = qfWavelength.open(QFile::ReadOnly);
|
||||
if (!bRes)
|
||||
{
|
||||
printf("LoadWaveLengthFile open Failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
QString qsData = qfWavelength.readAll();
|
||||
int iTemp = qsData.size();
|
||||
qsData.remove(iTemp - 1, 1);
|
||||
qsData.remove(0, 14);
|
||||
QStringList qsList = qsData.split(',');
|
||||
for (int i=0;i<qsList.size();i++)
|
||||
{
|
||||
qDebug() << qsList[i];
|
||||
}
|
||||
//iTemp = qsData.size();
|
||||
return;
|
||||
}
|
||||
|
||||
void DataFileProcessor::LoadSingleDataFile(QString qstrFileName)
|
||||
{
|
||||
qstrFileName;
|
||||
QFile qfDataFile(qstrFileName);
|
||||
DataFrame dfTemp;
|
||||
|
||||
bool bRes = qfDataFile.open(QFile::ReadOnly);
|
||||
if (!bRes)
|
||||
{
|
||||
printf("LoadWaveLengthFile open Failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
long long int llCount = (qfDataFile.size()) / (sizeof(DataFrame));
|
||||
for (int i=0;i<llCount;i++)
|
||||
{
|
||||
QByteArray qbDataFrame = qfDataFile.read(sizeof(DataFrame));
|
||||
memcpy(&dfTemp, qbDataFrame, sizeof(DataFrame));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void DataFileProcessor::GenerateFilePath()
|
||||
{
|
||||
m_qdtTime = QDateTime::currentDateTime();
|
||||
// QTimeZone curZone;
|
||||
// m_qdtTime.toTimeZone();
|
||||
QString qstrAddYMD = m_qdtTime.toString("/yyyy_MM_dd");
|
||||
m_qdtTime = m_qdtTime.addSecs(3600 * 8);
|
||||
QString qstrAddHMS = m_qdtTime.toString("hh_mm_ss");
|
||||
|
||||
|
||||
@ -94,7 +141,8 @@ void DataFileProcessor::GenerateFilePath()
|
||||
bool bRes = qdirPathTemp.mkdir(m_qstrFilePath);
|
||||
if (!bRes)
|
||||
{
|
||||
qDebug() << "DataFileProcessor mkdir Failed.";
|
||||
//qDebug() << "DataFileProcessor mkdir Failed.";
|
||||
printf("DataFileProcessor mkdir Failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +152,8 @@ void DataFileProcessor::GenerateFilePath()
|
||||
bool bRes = qdirPathTempA.mkdir(qstrTemp);
|
||||
if (!bRes)
|
||||
{
|
||||
qDebug() << "DataFileProcessor mkdir Failed.";
|
||||
//qDebug() << "DataFileProcessor mkdir Failed.";
|
||||
printf("DataFileProcessor mkdir Failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ public:
|
||||
int WriteWavelengthInfo(float *pfWaveLength, int iLength);
|
||||
int WriteData(DataFrame dfDataFrame);
|
||||
|
||||
void LoadWaveLengthFile(QString qstrFileName);
|
||||
void LoadSingleDataFile(QString qstrFileName);
|
||||
//void SetEnvironmentContex(EContext struEC);
|
||||
//void SetManmadeEnviromentalContext(MEContext struMEC);
|
||||
|
Reference in New Issue
Block a user