Clean up PRS1Import::ParseEvents to remove dead code.

Also reinstate some warnings now that parsers are all working.

No change in functionality.
This commit is contained in:
sawinglogz 2019-10-24 11:07:47 -04:00
parent 2df3325a52
commit d6e4e42f2a

View File

@ -3889,7 +3889,7 @@ bool PRS1Import::ImportCompliance()
} }
if (compliance->duration == 0) { if (compliance->duration == 0) {
// This does occasionally happen and merely indicates a brief session with no useful data. // This does occasionally happen and merely indicates a brief session with no useful data.
//qDebug() << compliance->sessionid << "duration == 0"; qDebug() << compliance->sessionid << "duration == 0";
return false; return false;
} }
session->setSummaryOnly(true); session->setSummaryOnly(true);
@ -6838,65 +6838,27 @@ bool PRS1DataChunk::ParseEvents()
} }
// TODO: Eventually this will be renamed PRS1Import::ImportEvents, once PRS1Import::ParseF*Events have been merged and incorporated. // TODO: This may be merged with PRS1Import::ImportEvents, or it may remain as a wrapper, depending on how multiple event chunks
// The functions are currently different due to different: // are handled. Functions names TBD.
// - Channel list (required and on-demand)
// - Pressure gain (used to create pressure channels)
// - Whether leak should be calculated from total leak
// - Inadvertent inconsistencies
bool PRS1Import::ParseEvents() bool PRS1Import::ParseEvents()
{ {
bool res = false; bool ok = this->ImportEvents();
if (!event) return false;
res = this->ImportEvents();
if (res) { if (ok) {
if (session->count(CPAP_IPAP) > 0) { if (session->count(CPAP_IPAP) > 0) {
// if (session->settings[CPAP_Mode].toInt() != (int)MODE_ASV) { // There was originally some commented-out code that tried to
// session->settings[CPAP_Mode] = MODE_BILEVEL_FIXED; // convert pressure min/max settings into EPAP/IPAP and would
// } // remove any CPAP_Pressure data in the session.
// if (session->settings[CPAP_PresReliefType].toInt() != PR_NONE) {
// session->settings[CPAP_PresReliefType] = PR_BIFLEX;
// }
// EventDataType min = session->settings[CPAP_PressureMin].toDouble();
// EventDataType max = session->settings[CPAP_PressureMax].toDouble();
// session->settings[CPAP_EPAP] = min;
// session->settings[CPAP_IPAP] = max;
// session->settings[CPAP_PS] = max - min;
// session->settings.erase(session->settings.find(CPAP_PressureMin));
// session->settings.erase(session->settings.find(CPAP_PressureMax));
// session->m_valuesummary.erase(session->m_valuesummary.find(CPAP_Pressure));
// session->m_wavg.erase(session->m_wavg.find(CPAP_Pressure));
// session->m_min.erase(session->m_min.find(CPAP_Pressure));
// session->m_max.erase(session->m_max.find(CPAP_Pressure));
// session->m_gain.erase(session->m_gain.find(CPAP_Pressure));
} else { } else {
if (!session->settings.contains(CPAP_Pressure) && !session->settings.contains(CPAP_PressureMin)) { // There was originally some code for single-pressure modes
qWarning() << session->session() << "broken summary, missing pressure"; // that would flag missing pressure and try to infer the
session->settings[CPAP_BrokenSummary] = true; // settings. After fixing the parsers, pressure is never missing,
// so it no longer has any effect.
//session->set_last(session->first()); //
if (session->Min(CPAP_Pressure) == session->Max(CPAP_Pressure)) { // TODO: Remove CPAP_BrokenSummary channel, which is no longer needed.
session->settings[CPAP_Mode] = MODE_CPAP; // no ramp
session->settings[CPAP_Pressure] = session->Min(CPAP_Pressure);
} else {
session->settings[CPAP_Mode] = MODE_APAP;
session->settings[CPAP_PressureMin] = session->Min(CPAP_Pressure);
session->settings[CPAP_PressureMax] = 0; //session->Max(CPAP_Pressure);
}
//session->Set("FlexMode",PR_UNKNOWN);
}
} }
} }
return res; return ok;
} }
@ -7147,7 +7109,7 @@ bool PRS1Import::ParseSession(void)
if (compliance != nullptr) { if (compliance != nullptr) {
ok = ImportCompliance(); ok = ImportCompliance();
if (!ok) { if (!ok) {
//qWarning() << sessionid << "Error parsing compliance, skipping session"; qWarning() << sessionid << "Error parsing compliance, skipping session";
break; break;
} }
} }
@ -7158,7 +7120,7 @@ bool PRS1Import::ParseSession(void)
} }
ok = ImportSummary(); ok = ImportSummary();
if (!ok) { if (!ok) {
//qWarning() << sessionid << "Error parsing summary, skipping session"; qWarning() << sessionid << "Error parsing summary, skipping session";
break; break;
} }
} }