From 1ae3a95bd34eb02615651613604c8111da4d3616 Mon Sep 17 00:00:00 2001 From: Richard Freeman Date: Fri, 11 Jan 2013 13:31:10 -0500 Subject: [PATCH] Fix for 60-series BiPap - requires regression testing against non-Bipap and other series. Signed-off-by: Richard Freeman --- SleepLib/loader_plugins/prs1_loader.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/SleepLib/loader_plugins/prs1_loader.cpp b/SleepLib/loader_plugins/prs1_loader.cpp index 66d7c0a5..ffe80889 100644 --- a/SleepLib/loader_plugins/prs1_loader.cpp +++ b/SleepLib/loader_plugins/prs1_loader.cpp @@ -983,11 +983,24 @@ bool PRS1Loader::Parse002(qint32 sequence, quint32 timestamp, unsigned char *buf } break; case 0x02: // Pressure - if (!PRESSURE) { - PRESSURE=session->AddEventList(CPAP_Pressure,EVL_Event,0.1); - if (!PRESSURE) return false; + if (family == 0 && familyVersion >= 4) { // BiPAP Pressure + if (!EPAP) { + if (!(EPAP=session->AddEventList(CPAP_EPAP,EVL_Event,0.1))) return false; + if (!(IPAP=session->AddEventList(CPAP_IPAP,EVL_Event,0.1))) return false; + if (!(PS=session->AddEventList(CPAP_PS,EVL_Event,0.1))) return false; + } + EPAP->AddEvent(t,data[0]=buffer[pos++]); + IPAP->AddEvent(t,data[1]=buffer[pos++]); + PS->AddEvent(t,data[1]-data[0]); + } + else { + if (!PRESSURE) { + PRESSURE=session->AddEventList(CPAP_Pressure,EVL_Event,0.1); + if (!PRESSURE) return false; + } + + PRESSURE->AddEvent(t,buffer[pos++]); } - PRESSURE->AddEvent(t,buffer[pos++]); break; case 0x03: // BIPAP Pressure if (!EPAP) { @@ -1216,6 +1229,8 @@ bool PRS1Loader::OpenFile(Machine *mach, QString filename) sequence=(header[10] << 24) | (header[9] << 16) | (header[8] << 8) | header[7]; timestamp=(header[14] << 24) | (header[13] << 16) | (header[12] << 8) | header[11]; + qDebug() << "family: " << family << " familyversion: " << familyVersion; + if (ext==5) { duration=header[0xf] | header[0x10] << 8; // block duration in seconds Q_UNUSED(duration);