mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Add sanity check for STR file
This commit is contained in:
parent
3886543c40
commit
a094aee728
@ -483,7 +483,10 @@ int ResmedLoader::Open(const QString & dirpath)
|
|||||||
// Build a Date map of all records in STR.edf files, populating ResDayList
|
// Build a Date map of all records in STR.edf files, populating ResDayList
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ProcessSTRfiles(mach, STRmap, firstImportDay);
|
if ( ! ProcessSTRfiles(mach, STRmap, firstImportDay) ) {
|
||||||
|
qCritical() << "ProcessSTR failed, abandoning this import";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// We are done with the Parsed STR EDF objects, so delete them
|
// We are done with the Parsed STR EDF objects, so delete them
|
||||||
for (auto it=STRmap.begin(), end=STRmap.end(); it != end; ++it) {
|
for (auto it=STRmap.begin(), end=STRmap.end(); it != end; ++it) {
|
||||||
@ -915,7 +918,7 @@ QString ResmedLoader::Backup(const QString & fullname, const QString & backup_pa
|
|||||||
|
|
||||||
|
|
||||||
// This function parses a list of STR files and creates a date ordered map of individual records
|
// This function parses a list of STR files and creates a date ordered map of individual records
|
||||||
void ResmedLoader::ProcessSTRfiles(Machine *mach, QMap<QDate, STRFile> & STRmap, QDate firstImport)
|
bool ResmedLoader::ProcessSTRfiles(Machine *mach, QMap<QDate, STRFile> & STRmap, QDate firstImport)
|
||||||
{
|
{
|
||||||
Q_UNUSED(mach)
|
Q_UNUSED(mach)
|
||||||
|
|
||||||
@ -971,6 +974,10 @@ void ResmedLoader::ProcessSTRfiles(Machine *mach, QMap<QDate, STRFile> & STRmap,
|
|||||||
if (!maskeventcount) {
|
if (!maskeventcount) {
|
||||||
maskeventcount = str.lookupLabel("MaskEvents");
|
maskeventcount = str.lookupLabel("MaskEvents");
|
||||||
}
|
}
|
||||||
|
if ( !maskon || !maskoff || !maskeventcount ) {
|
||||||
|
qCritical() << "Corrupt or untranslated STR.edf file";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
EDFSignal *sig = nullptr;
|
EDFSignal *sig = nullptr;
|
||||||
|
|
||||||
@ -1415,6 +1422,7 @@ void ResmedLoader::ProcessSTRfiles(Machine *mach, QMap<QDate, STRFile> & STRmap,
|
|||||||
#ifdef STR_DEBUG
|
#ifdef STR_DEBUG
|
||||||
qDebug() << "Finished ProcessSTR";
|
qDebug() << "Finished ProcessSTR";
|
||||||
#endif
|
#endif
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -138,7 +138,7 @@ class ResmedLoader : public CPAPLoader
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \brief The STR.edf file is a unique edf file with many signals
|
//! \brief The STR.edf file is a unique edf file with many signals
|
||||||
void ProcessSTRfiles(Machine *, QMap<QDate, STRFile> &, QDate);
|
bool ProcessSTRfiles(Machine *, QMap<QDate, STRFile> &, QDate);
|
||||||
|
|
||||||
//! \brief Scan for new files to import, group into sessions and add to task que
|
//! \brief Scan for new files to import, group into sessions and add to task que
|
||||||
int ScanFiles(Machine * mach, const QString & datalog_path, QDate firstImport);
|
int ScanFiles(Machine * mach, const QString & datalog_path, QDate firstImport);
|
||||||
|
Loading…
Reference in New Issue
Block a user