diff --git a/Building/Linux/BUILD_Linux.md b/Building/Linux/BUILD_Linux.md
index e18e5c67..8b614d73 100644
--- a/Building/Linux/BUILD_Linux.md
+++ b/Building/Linux/BUILD_Linux.md
@@ -1,6 +1,6 @@
You will need either qtcreator or qttools5-dev-tools and a C++ compiler and linker
-Also, you need the packages qt5-default, libqt5serialport5, libqt5serailport5-dev and libqt5opengl5-dev
+Also, you need the packages qt5-default, libqt5serialport5, libqt5serialport5-dev and libqt5opengl5-dev
Oscar can be built without its Help module with Qt5.7 SDK (for Debian Stretch, for example)
diff --git a/Htmldocs/release_notes.html b/Htmldocs/release_notes.html
index da2e14df..dc6a63ba 100644
--- a/Htmldocs/release_notes.html
+++ b/Htmldocs/release_notes.html
@@ -35,6 +35,8 @@
[fix] Fix occasional failure to save imported Viatom data.
[fix] Fix a recurring database upgrade prompt.
[fix] Fix an occasional crash when importing Resmed data.
+ [fix] Add bounds error checking to Resmed input processing.
+ [fix] Fix STR.edf file backup to avoid loss of settings data.
Changes and fixes in OSCAR v1.1.0
diff --git a/oscar/SleepLib/loader_plugins/edfparser.cpp b/oscar/SleepLib/loader_plugins/edfparser.cpp
index 7a1b0452..2da3b70a 100644
--- a/oscar/SleepLib/loader_plugins/edfparser.cpp
+++ b/oscar/SleepLib/loader_plugins/edfparser.cpp
@@ -43,7 +43,9 @@ EDFInfo::~EDFInfo()
{
// if ( fileData ) {
if (fileData.size() > 0) {
+#ifdef EDF_DEBUG
qDebug() << "EDFInfo destructor clearing fileData";
+#endif
fileData.clear();
}
// }
@@ -108,8 +110,10 @@ bool EDFInfo::parseHeader( EDFHeaderRaw *hdrPtr )
edfHdr.version = QString::fromLatin1(hdrPtr->version, 8).toLong(&ok);
if (!ok) {
+#ifdef EDF_DEBUG
qWarning() << "EDFInfo::Parse() Bad Version " << filename;
// sleep(1);
+#endif
fileData.clear();
return false;
}
@@ -127,30 +131,38 @@ bool EDFInfo::parseHeader( EDFHeaderRaw *hdrPtr )
edfHdr.num_header_bytes = QString::fromLatin1(hdrPtr->num_header_bytes, 8).toLong(&ok);
if (!ok) {
+#ifdef EDF_DEBUG
qWarning() << "EDFInfo::Parse() Bad header byte count " << filename;
// sleep(1);
+#endif
fileData.clear();
return false;
}
edfHdr.reserved44=QString::fromLatin1(hdrPtr->reserved, 44).trimmed();
edfHdr.num_data_records = QString::fromLatin1(hdrPtr->num_data_records, 8).toLong(&ok);
if ( (! ok) || (edfHdr.num_data_records < 1) ) {
+#ifdef EDF_DEBUG
qWarning() << "EDFInfo::Parse() Bad data record count " << filename;
// sleep(1);
+#endif
fileData.clear();
return false;
}
edfHdr.duration_Seconds = QString::fromLatin1(hdrPtr->dur_data_records, 8).toDouble(&ok);
if (!ok) {
+#ifdef EDF_DEBUG
qWarning() << "EDFInfo::Parse() Bad duration " << filename;
// sleep(1);
+#endif
fileData.clear();
return false;
}
edfHdr.num_signals = QString::fromLatin1(hdrPtr->num_signals, 4).toLong(&ok);
if ( (! ok) || (edfHdr.num_signals < 1) || (edfHdr.num_signals > 256) ) {
+#ifdef EDF_DEBUG
qWarning() << "EDFInfo::Parse() Bad number of signals " << filename;
// sleep(1);
+#endif
fileData.clear();
return false;
}
@@ -189,7 +201,7 @@ bool EDFInfo::Parse() {
signalList[sig.label].push_back(&sig);
if (eof) {
qWarning() << "EDFInfo::Parse() Early end of file " << filename;
- sleep(1);
+// sleep(1);
fileData.clear();
return false;
}
@@ -280,7 +292,7 @@ EDFHeaderQT * EDFInfo::GetHeader( const QString & name)
QFile fi(name);
if (!fi.open(QFile::ReadOnly)) {
qDebug() << "EDFInfo::Open() Couldn't open file " << name;
- sleep(1);
+// sleep(1);
return nullptr;
}
// fileData = new QByteArray();
@@ -335,8 +347,10 @@ QVector EDFInfo::ReadAnnotations(const char * data, int charLen)
offset = text.toDouble(&ok);
if (!ok) {
+#ifdef EDF_DEBUG
qDebug() << "Faulty offset in annotation record ";
// sleep(1);
+#endif
break;
}
@@ -356,8 +370,10 @@ QVector EDFInfo::ReadAnnotations(const char * data, int charLen)
duration = text.toDouble(&ok);
if (!ok) {
+#ifdef EDF_DEBUG
qDebug() << "Faulty duration in annotation record ";
// sleep(1);
+#endif
break;
}
}
@@ -379,8 +395,10 @@ QVector EDFInfo::ReadAnnotations(const char * data, int charLen)
text = QString::fromUtf8(textStart, textLen);
annoVec.push_back( Annotation( offset, duration, text) );
if (pos >= charLen) {
+#ifdef EDF_DEBUG
qDebug() << "Short EDF Annotations record";
// sleep(1);
+#endif
break;
}
}
diff --git a/oscar/SleepLib/loader_plugins/prs1_loader.cpp b/oscar/SleepLib/loader_plugins/prs1_loader.cpp
index b68975b0..d228076a 100644
--- a/oscar/SleepLib/loader_plugins/prs1_loader.cpp
+++ b/oscar/SleepLib/loader_plugins/prs1_loader.cpp
@@ -4906,7 +4906,7 @@ void PRS1DataChunk::ParseHumidifierSetting60Series(unsigned char humid1, unsigne
} else if (this->familyVersion == 1) {
// F5V1
if (tubepresent) {
- if (tubetemp == 4) UNEXPECTED_VALUE(tubetemp, "!= 4");
+ // all tube temperatures seen
if (tubetemp) {
if (tubehumidlevel == 0 || tubehumidlevel > 3) UNEXPECTED_VALUE(tubehumidlevel, "1-3");
}
@@ -7108,9 +7108,9 @@ bool PRS1DataChunk::ParseSettingsF0V6(const unsigned char* data, int size)
CHECK_VALUE(len, 1);
CHECK_VALUE(data[pos], 0xFF);
break;
- case 0x45: // new to 400G, only in last session?
+ case 0x45: // new to 400G and 500G, appears right after 0x35 (humidifier setting)
CHECK_VALUE(len, 1);
- CHECK_VALUE(data[pos], 1);
+ CHECK_VALUES(data[pos], 0, 1);
break;
default:
UNEXPECTED_VALUE(code, "known setting");
diff --git a/oscar/SleepLib/loader_plugins/resmed_loader.cpp b/oscar/SleepLib/loader_plugins/resmed_loader.cpp
index 8fb5d91e..1ea70943 100644
--- a/oscar/SleepLib/loader_plugins/resmed_loader.cpp
+++ b/oscar/SleepLib/loader_plugins/resmed_loader.cpp
@@ -402,7 +402,7 @@ int ResmedLoader::Open(const QString & dirpath)
} else { // passed the tests, stuff it into the map
QDate date = stredf->edfHdr.startdate_orig.date();
long int days = stredf->GetNumDataRecords();
- qDebug() << strpath.section("/",-2,-1) << "starts at" << date << "for" << days;
+ qDebug() << strpath.section("/",-2,-1) << "starts at" << date << "for" << days << "ends" << date.addDays(days-1);
STRmap[date] = STRFile(strpath, days, stredf);
}
} else {
@@ -466,7 +466,7 @@ int ResmedLoader::Open(const QString & dirpath)
date = stredf->edfHdr.startdate_orig.date();
days = stredf->GetNumDataRecords();
if (STRmap.contains(date)) { // Keep the longer of the two STR files
- qDebug() << filename << "overlaps" << STRmap[date].filename.section("/",-2,-1) << "for" << days;
+ qDebug() << filename << "overlaps" << STRmap[date].filename.section("/",-2,-1) << "for" << days << "ends" << date.addDays(days-1);
if (days <= STRmap[date].days) {
qDebug() << "Skipping" << filename;
delete stredf;
@@ -2541,8 +2541,8 @@ bool ResmedLoader::LoadBRP(Session *sess, const QString & path)
if (max > es.physical_maximum)
max = es.physical_maximum;
- sess->setMin(code, min);
- sess->setMax(code, max);
+ sess->updateMin(code, min);
+ sess->updateMax(code, max);
sess->setPhysMin(code, es.physical_minimum);
sess->setPhysMax(code, es.physical_maximum);
}
@@ -2800,8 +2800,8 @@ bool ResmedLoader::LoadPLD(Session *sess, const QString & path)
}
if (a) {
- sess->setMin(code, a->Min());
- sess->setMax(code, a->Max());
+ sess->updateMin(code, a->Min());
+ sess->updateMax(code, a->Max());
sess->setPhysMin(code, es.physical_minimum);
sess->setPhysMax(code, es.physical_maximum);
a->setDimension(es.physical_dimension);
@@ -2900,8 +2900,8 @@ void ResmedLoader::ToTimeDelta(Session *sess, ResMedEDFInfo &edf, EDFSignal &es,
if ((tmp >= t_min) && (tmp <= t_max))
el->AddEvent(tt, c);
- sess->setMin(code, min);
- sess->setMax(code, max);
+ sess->updateMin(code, min);
+ sess->updateMax(code, max);
sess->setPhysMin(code, es.physical_minimum);
sess->setPhysMax(code, es.physical_maximum);
sess->updateLast(tt);
diff --git a/oscar/SleepLib/session.cpp b/oscar/SleepLib/session.cpp
index 69129777..cff259f0 100644
--- a/oscar/SleepLib/session.cpp
+++ b/oscar/SleepLib/session.cpp
@@ -125,7 +125,7 @@ bool Session::OpenEvents()
// qWarning() << "Error Loading Events" << filename;
return false;
}
- qDebug() << "Loading" << s_machine->loaderName().toLocal8Bit().data() << "Events:" << filename.toLocal8Bit().data();
+// qDebug() << "Loading" << s_machine->loaderName().toLocal8Bit().data() << "Events:" << filename.toLocal8Bit().data();
return s_events_loaded = true;
}
diff --git a/oscar/VERSION b/oscar/VERSION
index 4a96e0dc..8371d901 100644
--- a/oscar/VERSION
+++ b/oscar/VERSION
@@ -1,4 +1,5 @@
// Update the string below to set OSCAR's version and release status.
// See https://semver.org/spec/v2.0.0.html for details on format.
-#define VERSION "1.1.1-alpha-0"
+#define VERSION "1.1.1-rc-1"
+