diff --git a/oscar/SleepLib/loader_plugins/prs1_loader.cpp b/oscar/SleepLib/loader_plugins/prs1_loader.cpp index 1f69d904..d23ae962 100644 --- a/oscar/SleepLib/loader_plugins/prs1_loader.cpp +++ b/oscar/SleepLib/loader_plugins/prs1_loader.cpp @@ -3842,108 +3842,6 @@ bool PRS1DataChunk::ParseSettingsF3V6(const unsigned char* data, int size) } -#if 0 -bool PRS1DataChunk::ParseSummaryF3V6(void) -{ - CPAPMode mode = MODE_UNKNOWN; - EventDataType epap, ipap; - - // TODO: The below mainblock creation is wrong. It should be removed when the summary - // parsing is fixed. - /* Example data block - 000000c6@0000: 00 [10] 01 [00 01 02 01 01 00 02 01 00 04 01 40 07 - 000000c6@0010: 01 60 1e 03 02 0c 14 2c 01 14 2d 01 40 2e 01 02 - 000000c6@0020: 2f 01 00 35 02 28 68 36 01 00 38 01 00 39 01 00 - 000000c6@0030: 3b 01 01 3c 01 80] 02 [00 01 00 01 01 00 02 01 00] - 000000c6@0040: 04 [00 00 28 68] 0c [78 00 2c 6c] 05 [e4 69] 07 [40 40] - 000000c6@0050: 08 [61 60] 0a [00 00 00 00 03 00 00 00 02 00 02 00 - 000000c6@0060: 05 00 2b 11 00 10 2b 5c 07 12 00 00] 03 [00 00 01 - 000000c6@0070: 1a 00 38 04] */ - const unsigned char * data = (unsigned char *)this->m_data.constData(); - if (this->fileVersion == 3) { - // Parse summary structures into bytearray map according to size given in header block - int size = this->m_data.size(); - - int pos = 0; - int bsize; - short val, len; - do { - val = data[pos++]; - auto it = this->hblock.find(val); - if (it == this->hblock.end()) { - qDebug() << "Block parse error in ParseSummary" << this->sessionid; - break; - } - bsize = it.value(); - - if (val != 1) { - if (this->hbdata.contains(val)) { - // We know this is entirely wrong. It will be removed after F3V6 is updated. - //qWarning() << this->sessionid << "duplicate hbdata val" << val; - } - // store the data block for later reference - this->hbdata[val] = QByteArray((const char *)(&data[pos]), bsize); - } else { - if (!this->mainblock.isEmpty()) { - qWarning() << this->sessionid << "duplicate mainblock"; - } - // Parse the nested data structure which contains settings - int p2 = 0; - do { - val = data[pos + p2++]; - len = data[pos + p2++]; - if (this->mainblock.contains(val)) { - qWarning() << this->sessionid << "duplicate mainblock val" << val; - } - this->mainblock[val] = QByteArray((const char *)(&data[pos+p2]), len); - p2 += len; - } while ((p2 < bsize) && ((pos+p2) < size)); - } - pos += bsize; - } while (pos < size); - } - - QMap::iterator it; - - if ((it=this->mainblock.find(0x0a)) != this->mainblock.end()) { - mode = MODE_CPAP; - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PRESSURE, it.value()[0])); - } else if ((it=this->mainblock.find(0x0d)) != this->mainblock.end()) { - mode = MODE_APAP; - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PRESSURE_MIN, it.value()[0])); - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PRESSURE_MAX, it.value()[1])); - } else if ((it=this->mainblock.find(0x0e)) != this->mainblock.end()) { - mode = MODE_BILEVEL_FIXED; - ipap = it.value()[0]; - epap = it.value()[1]; - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_IPAP, ipap)); - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_EPAP, epap)); - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PS, ipap - epap)); - } else if ((it=this->mainblock.find(0x0f)) != this->mainblock.end()) { - mode = MODE_BILEVEL_AUTO_VARIABLE_PS; - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_EPAP_MIN, it.value()[0])); - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_IPAP_MAX, it.value()[1])); - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PS_MIN, it.value()[2])); - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PS_MAX, it.value()[3])); - } else if ((it=this->mainblock.find(0x10)) != this->mainblock.end()) { - mode = MODE_APAP; // Disgusting APAP "IQ" trial - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PRESSURE_MIN, it.value()[0])); - this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PRESSURE_MAX, it.value()[1])); - } - - this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_CPAP_MODE, (int) mode)); - - if ((it=this->hbdata.find(5)) != this->hbdata.end()) { - this->duration = (it.value()[1] << 8 ) + it.value()[0]; - } else { - qWarning() << this->sessionid << "missing summary duration"; - } - - return true; -} -#endif - - bool PRS1DataChunk::ParseSummaryF5V012(void) { const unsigned char * data = (unsigned char *)this->m_data.constData();