最新更改
This commit is contained in:
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user