From 4d1b947e22e5891f6a94a1558e92a44001200ebc Mon Sep 17 00:00:00 2001 From: sawinglogz <3787776-sawinglogz@users.noreply.gitlab.com> Date: Mon, 27 May 2019 10:25:57 -0400 Subject: [PATCH] Split PRS1Import::ParseSummary into ImportSummar/ParseSummary. --- oscar/SleepLib/loader_plugins/prs1_loader.cpp | 35 +++++++++++-------- oscar/SleepLib/loader_plugins/prs1_loader.h | 3 ++ 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/oscar/SleepLib/loader_plugins/prs1_loader.cpp b/oscar/SleepLib/loader_plugins/prs1_loader.cpp index db7d2eb5..791ec2e6 100644 --- a/oscar/SleepLib/loader_plugins/prs1_loader.cpp +++ b/oscar/SleepLib/loader_plugins/prs1_loader.cpp @@ -4048,7 +4048,8 @@ bool PRS1DataChunk::ParseSummaryF0V6() return true; } -bool PRS1Import::ParseSummary() + +bool PRS1Import::ImportSummary() { if (!summary) return false; @@ -4060,7 +4061,23 @@ bool PRS1Import::ParseSummary() session->set_first(qint64(summary->timestamp) * 1000L); + session->setPhysMax(CPAP_LeakTotal, 120); + session->setPhysMin(CPAP_LeakTotal, 0); + session->setPhysMax(CPAP_Pressure, 25); + session->setPhysMin(CPAP_Pressure, 4); + session->setPhysMax(CPAP_IPAP, 25); + session->setPhysMin(CPAP_IPAP, 4); + session->setPhysMax(CPAP_EPAP, 25); + session->setPhysMin(CPAP_EPAP, 4); + session->setPhysMax(CPAP_PS, 25); + session->setPhysMin(CPAP_PS, 0); + + return this->ParseSummary(); +} + +bool PRS1Import::ParseSummary() +{ // TODO: The below is probably wrong. It should move to PRS1DataChunk when it gets fixed. /* Example data block 000000c6@0000: 00 [10] 01 [00 01 02 01 01 00 02 01 00 04 01 40 07 @@ -4108,19 +4125,6 @@ bool PRS1Import::ParseSummary() // Family 3 = BIPAP AVAPS // Family 5 = BIPAP AutoSV - - - session->setPhysMax(CPAP_LeakTotal, 120); - session->setPhysMin(CPAP_LeakTotal, 0); - session->setPhysMax(CPAP_Pressure, 25); - session->setPhysMin(CPAP_Pressure, 4); - session->setPhysMax(CPAP_IPAP, 25); - session->setPhysMin(CPAP_IPAP, 4); - session->setPhysMax(CPAP_EPAP, 25); - session->setPhysMin(CPAP_EPAP, 4); - session->setPhysMax(CPAP_PS, 25); - session->setPhysMin(CPAP_PS, 0); - switch (summary->family) { case 0: if (summary->familyVersion == 6) { @@ -4183,6 +4187,7 @@ bool PRS1Import::ParseSummary() ////////////////////////////////////////////////////////////////////////////////////////// } + bool PRS1Import::ParseEvents() { bool res = false; @@ -4461,7 +4466,7 @@ bool PRS1Import::ParseSession(void) bool save = false; session = new Session(mach, sessionid); - if ((compliance && ParseCompliance()) || (summary && ParseSummary())) { + if ((compliance && ParseCompliance()) || (summary && ImportSummary())) { if (event && !ParseEvents()) { } diff --git a/oscar/SleepLib/loader_plugins/prs1_loader.h b/oscar/SleepLib/loader_plugins/prs1_loader.h index 6563e6f1..511b7958 100644 --- a/oscar/SleepLib/loader_plugins/prs1_loader.h +++ b/oscar/SleepLib/loader_plugins/prs1_loader.h @@ -223,6 +223,9 @@ public: //! \brief As it says on the tin.. Parses .001 files for bricks. bool ParseCompliance(); + //! \brief Imports the .002 summary file. + bool ImportSummary(); + //! \brief Figures out which Summary Parser to call, based on machine family/version and calls it. bool ParseSummary();