Remove F0V4 logic from F0V23 event parser and vice versa. No change in functionality.

This commit is contained in:
sawinglogz 2019-10-03 19:06:06 -04:00
parent 06098b9033
commit 2f46036a01

View File

@ -3100,7 +3100,7 @@ bool PRS1Import::ParseF0Events()
} }
bool PRS1DataChunk::ParseEventsF0V23(CPAPMode mode) bool PRS1DataChunk::ParseEventsF0V23(CPAPMode /*mode*/)
{ {
if (this->family != 0 || this->familyVersion < 2 || this->familyVersion > 3) { if (this->family != 0 || this->familyVersion < 2 || this->familyVersion > 3) {
qWarning() << "ParseEventsF0V23 called with family" << this->family << "familyVersion" << this->familyVersion; qWarning() << "ParseEventsF0V23 called with family" << this->family << "familyVersion" << this->familyVersion;
@ -3155,28 +3155,14 @@ bool PRS1DataChunk::ParseEventsF0V23(CPAPMode mode)
case 0x00: // Unknown 00 case 0x00: // Unknown 00
this->AddEvent(new PRS1UnknownValueEvent(code, t, buffer[pos++])); this->AddEvent(new PRS1UnknownValueEvent(code, t, buffer[pos++]));
if (((this->family == 0) && (this->familyVersion == 4))){
pos++;
}
break; break;
case 0x01: // Unknown case 0x01: // Unknown
if ((this->family == 0) && (this->familyVersion == 4)) { this->AddEvent(new PRS1UnknownValueEvent(code, t, 0));
this->AddEvent(new PRS1PressureSetEvent(t, buffer[pos++]));
} else {
this->AddEvent(new PRS1UnknownValueEvent(code, t, 0));
}
break; break;
case 0x02: // Pressure case 0x02: // Pressure
if ((this->family == 0) && (this->familyVersion == 4)) { // BiPAP Pressure this->AddEvent(new PRS1PressureSetEvent(t, buffer[pos++]));
data0 = buffer[pos++];
data1 = buffer[pos++];
this->AddEvent(new PRS1IPAPSetEvent(t, data1));
this->AddEvent(new PRS1EPAPSetEvent(t, data0)); // EPAP needs to be added second to calculate PS
} else {
this->AddEvent(new PRS1PressureSetEvent(t, buffer[pos++]));
}
break; break;
case 0x03: // BIPAP Pressure case 0x03: // BIPAP Pressure
@ -3223,14 +3209,6 @@ bool PRS1DataChunk::ParseEventsF0V23(CPAPMode mode)
data1 = buffer[pos+1]; data1 = buffer[pos+1];
pos += 2; pos += 2;
if (this->familyVersion == 4) {
// might not doublerize on older machines?
// data0 *= 2;
}
// data1 = buffer[pos++];
//tt = t - qint64((data0+data1)*2) * 1000L;
this->AddEvent(new PRS1UnknownValueEvent(code, t, data0)); // FIXME this->AddEvent(new PRS1UnknownValueEvent(code, t, data0)); // FIXME
break; break;
@ -3240,11 +3218,12 @@ bool PRS1DataChunk::ParseEventsF0V23(CPAPMode mode)
case 0x0e: // Unknown case 0x0e: // Unknown
data0 = buffer[pos + 1] << 8 | buffer[pos]; data0 = buffer[pos + 1] << 8 | buffer[pos];
/*
if (this->familyVersion == 4) { if (this->familyVersion == 4) {
// might not doublerize on older machines? // might not doublerize on older machines?
data0 *= 2; data0 *= 2;
} }
*/
pos += 2; pos += 2;
data1 = buffer[pos++]; data1 = buffer[pos++];
this->AddEvent(new PRS1UnknownValueEvent(code, t - data1, data0)); // TODO: start time should probably match PB below this->AddEvent(new PRS1UnknownValueEvent(code, t - data1, data0)); // TODO: start time should probably match PB below
@ -3252,27 +3231,28 @@ bool PRS1DataChunk::ParseEventsF0V23(CPAPMode mode)
case 0x0f: // Cheyne Stokes Respiration case 0x0f: // Cheyne Stokes Respiration
data0 = (buffer[pos + 1] << 8 | buffer[pos]); data0 = (buffer[pos + 1] << 8 | buffer[pos]);
/*
if (this->familyVersion == 4) { if (this->familyVersion == 4) {
// might not doublerize on older machines // might not doublerize on older machines
data0 *= 2; data0 *= 2;
} }
*/
pos += 2; pos += 2;
data1 = buffer[pos++]; data1 = buffer[pos++];
if (this->familyVersion == 2 || this->familyVersion == 3) {
// TODO: this fixed some timing errors on parsing/import, but may have broken drawing, since OSCAR // TODO: this fixed some timing errors on parsing/import, but may have broken drawing, since OSCAR
// apparently does treat a span's timestamp as an endpoint (at least when drawing, see gFlagsLine::paint)! // apparently does treat a span's timestamp as an endpoint (at least when drawing, see gFlagsLine::paint)!
this->AddEvent(new PRS1PeriodicBreathingEvent(t - data1 - data0, data0)); // PB event appears data1 seconds after conclusion this->AddEvent(new PRS1PeriodicBreathingEvent(t - data1 - data0, data0)); // PB event appears data1 seconds after conclusion
} else {
this->AddEvent(new PRS1PeriodicBreathingEvent(t - data1, data0)); // TODO: this should probably be the same as F0V23, but it hasn't been tested
}
break; break;
case 0x10: // Large Leak case 0x10: // Large Leak
data0 = buffer[pos + 1] << 8 | buffer[pos]; data0 = buffer[pos + 1] << 8 | buffer[pos];
/*
if (this->familyVersion == 4) { if (this->familyVersion == 4) {
// might not doublerize on older machines // might not doublerize on older machines
data0 *= 2; data0 *= 2;
} }
*/
pos += 2; pos += 2;
data1 = buffer[pos++]; data1 = buffer[pos++];
this->AddEvent(new PRS1LargeLeakEvent(t - data1, data0)); // TODO: start time should probably match PB above this->AddEvent(new PRS1LargeLeakEvent(t - data1, data0)); // TODO: start time should probably match PB above
@ -3283,17 +3263,6 @@ bool PRS1DataChunk::ParseEventsF0V23(CPAPMode mode)
data1 = buffer[pos++]; data1 = buffer[pos++];
this->AddEvent(new PRS1TotalLeakEvent(t, data0)); this->AddEvent(new PRS1TotalLeakEvent(t, data0));
this->AddEvent(new PRS1SnoreEvent(t, data1)); this->AddEvent(new PRS1SnoreEvent(t, data1));
if ((this->family == 0) && (this->familyVersion == 4)) {
// EPAP / Flex Pressure
data0 = buffer[pos++];
// Perhaps this check is not necessary, as it will theoretically add extra resolution to pressure chart
// for bipap models and above???
if (mode <= MODE_BILEVEL_FIXED) {
this->AddEvent(new PRS1PressureReliefEvent(t, data0));
}
}
break; break;
case 0x12: // Summary case 0x12: // Summary
@ -3305,17 +3274,7 @@ bool PRS1DataChunk::ParseEventsF0V23(CPAPMode mode)
// Could end here, but I've seen data sets valid data after!!! // Could end here, but I've seen data sets valid data after!!!
break; break;
/*
case 0x14: // DreamStation Hypopnea
data0 = buffer[pos++];
this->AddEvent(new PRS1HypopneaEvent(t - data0, data0));
break;
case 0x15: // DreamStation Hypopnea
data0 = buffer[pos++];
this->AddEvent(new PRS1HypopneaEvent(t - data0, data0));
break;
*/
default: default:
// ERROR!!! // ERROR!!!
qWarning() << "Some new fandangled PRS1 code detected in" << this->sessionid << hex qWarning() << "Some new fandangled PRS1 code detected in" << this->sessionid << hex
@ -3385,28 +3344,19 @@ bool PRS1DataChunk::ParseEventsF0V4(CPAPMode mode)
case 0x00: // Unknown 00 case 0x00: // Unknown 00
this->AddEvent(new PRS1UnknownValueEvent(code, t, buffer[pos++])); this->AddEvent(new PRS1UnknownValueEvent(code, t, buffer[pos++]));
if (((this->family == 0) && (this->familyVersion == 4))){ pos++; // TODO
pos++;
}
break; break;
case 0x01: // Unknown case 0x01: // Unknown
if ((this->family == 0) && (this->familyVersion == 4)) { this->AddEvent(new PRS1PressureSetEvent(t, buffer[pos++]));
this->AddEvent(new PRS1PressureSetEvent(t, buffer[pos++]));
} else {
this->AddEvent(new PRS1UnknownValueEvent(code, t, 0));
}
break; break;
case 0x02: // Pressure case 0x02: // Pressure
if ((this->family == 0) && (this->familyVersion == 4)) { // BiPAP Pressure //if ((this->family == 0) && (this->familyVersion == 4)) { // BiPAP Pressure
data0 = buffer[pos++]; data0 = buffer[pos++];
data1 = buffer[pos++]; data1 = buffer[pos++];
this->AddEvent(new PRS1IPAPSetEvent(t, data1)); this->AddEvent(new PRS1IPAPSetEvent(t, data1));
this->AddEvent(new PRS1EPAPSetEvent(t, data0)); // EPAP needs to be added second to calculate PS this->AddEvent(new PRS1EPAPSetEvent(t, data0)); // EPAP needs to be added second to calculate PS
} else {
this->AddEvent(new PRS1PressureSetEvent(t, buffer[pos++]));
}
break; break;
case 0x03: // BIPAP Pressure case 0x03: // BIPAP Pressure
@ -3453,13 +3403,8 @@ bool PRS1DataChunk::ParseEventsF0V4(CPAPMode mode)
data1 = buffer[pos+1]; data1 = buffer[pos+1];
pos += 2; pos += 2;
if (this->familyVersion == 4) { // might not doublerize on older machines?
// might not doublerize on older machines? //data0 *= 2;
// data0 *= 2;
}
// data1 = buffer[pos++];
//tt = t - qint64((data0+data1)*2) * 1000L;
this->AddEvent(new PRS1UnknownValueEvent(code, t, data0)); // FIXME this->AddEvent(new PRS1UnknownValueEvent(code, t, data0)); // FIXME
break; break;
@ -3470,11 +3415,7 @@ bool PRS1DataChunk::ParseEventsF0V4(CPAPMode mode)
case 0x0e: // Unknown case 0x0e: // Unknown
data0 = buffer[pos + 1] << 8 | buffer[pos]; data0 = buffer[pos + 1] << 8 | buffer[pos];
if (this->familyVersion == 4) { data0 *= 2;
// might not doublerize on older machines?
data0 *= 2;
}
pos += 2; pos += 2;
data1 = buffer[pos++]; data1 = buffer[pos++];
this->AddEvent(new PRS1UnknownValueEvent(code, t - data1, data0)); // TODO: start time should probably match PB below this->AddEvent(new PRS1UnknownValueEvent(code, t - data1, data0)); // TODO: start time should probably match PB below
@ -3482,27 +3423,22 @@ bool PRS1DataChunk::ParseEventsF0V4(CPAPMode mode)
case 0x0f: // Cheyne Stokes Respiration case 0x0f: // Cheyne Stokes Respiration
data0 = (buffer[pos + 1] << 8 | buffer[pos]); data0 = (buffer[pos + 1] << 8 | buffer[pos]);
if (this->familyVersion == 4) { data0 *= 2;
// might not doublerize on older machines
data0 *= 2;
}
pos += 2; pos += 2;
data1 = buffer[pos++]; data1 = buffer[pos++];
/*
if (this->familyVersion == 2 || this->familyVersion == 3) { if (this->familyVersion == 2 || this->familyVersion == 3) {
// TODO: this fixed some timing errors on parsing/import, but may have broken drawing, since OSCAR // TODO: this fixed some timing errors on parsing/import, but may have broken drawing, since OSCAR
// apparently does treat a span's timestamp as an endpoint (at least when drawing, see gFlagsLine::paint)! // apparently does treat a span's timestamp as an endpoint (at least when drawing, see gFlagsLine::paint)!
this->AddEvent(new PRS1PeriodicBreathingEvent(t - data1 - data0, data0)); // PB event appears data1 seconds after conclusion this->AddEvent(new PRS1PeriodicBreathingEvent(t - data1 - data0, data0)); // PB event appears data1 seconds after conclusion
} else { } else {
this->AddEvent(new PRS1PeriodicBreathingEvent(t - data1, data0)); // TODO: this should probably be the same as F0V23, but it hasn't been tested */
} this->AddEvent(new PRS1PeriodicBreathingEvent(t - data1, data0)); // TODO: this should probably be the same as F0V23, but it hasn't been tested
break; break;
case 0x10: // Large Leak case 0x10: // Large Leak
data0 = buffer[pos + 1] << 8 | buffer[pos]; data0 = buffer[pos + 1] << 8 | buffer[pos];
if (this->familyVersion == 4) { data0 *= 2;
// might not doublerize on older machines
data0 *= 2;
}
pos += 2; pos += 2;
data1 = buffer[pos++]; data1 = buffer[pos++];
this->AddEvent(new PRS1LargeLeakEvent(t - data1, data0)); // TODO: start time should probably match PB above this->AddEvent(new PRS1LargeLeakEvent(t - data1, data0)); // TODO: start time should probably match PB above
@ -3514,15 +3450,13 @@ bool PRS1DataChunk::ParseEventsF0V4(CPAPMode mode)
this->AddEvent(new PRS1TotalLeakEvent(t, data0)); this->AddEvent(new PRS1TotalLeakEvent(t, data0));
this->AddEvent(new PRS1SnoreEvent(t, data1)); this->AddEvent(new PRS1SnoreEvent(t, data1));
if ((this->family == 0) && (this->familyVersion == 4)) { // EPAP / Flex Pressure
// EPAP / Flex Pressure data0 = buffer[pos++];
data0 = buffer[pos++];
// Perhaps this check is not necessary, as it will theoretically add extra resolution to pressure chart // Perhaps this check is not necessary, as it will theoretically add extra resolution to pressure chart
// for bipap models and above??? // for bipap models and above???
if (mode <= MODE_BILEVEL_FIXED) { if (mode <= MODE_BILEVEL_FIXED) {
this->AddEvent(new PRS1PressureReliefEvent(t, data0)); this->AddEvent(new PRS1PressureReliefEvent(t, data0));
}
} }
break; break;