diff --git a/Graphs/graphdata_custom.cpp b/Graphs/graphdata_custom.cpp index 3afaa381..ec8e3f6d 100644 --- a/Graphs/graphdata_custom.cpp +++ b/Graphs/graphdata_custom.cpp @@ -67,6 +67,9 @@ void WaveData::Reload(Day *day) //double t1=MAX(fabs(min_y),fabs(max_y)); // Get clever here.. if (max_y>128) { + double j=MAX(max_y,fabs(min_y)); + min_y=-j; + max_y=j; } else if (max_y>90) { max_y=120; min_y=-120; diff --git a/SleepLib/loader_plugins/resmed_loader.cpp b/SleepLib/loader_plugins/resmed_loader.cpp index ab808453..c9fbe17b 100644 --- a/SleepLib/loader_plugins/resmed_loader.cpp +++ b/SleepLib/loader_plugins/resmed_loader.cpp @@ -267,16 +267,102 @@ bool ResmedLoader::Open(QString & path,Profile *profile) } return 0; } +//bool ResmedLoader::ParseTAL(Machine *mach,Session *sess,EDFParser &edf,int pos) + bool ResmedLoader::LoadEVE(Machine *mach,Session *sess,EDFParser &edf) { QString t; for (int s=0;snr*edf.GetNumDataRecords(); - double duration=edf.GetNumDataRecords()*edf.GetDuration(); - duration/=3600.0; - t.sprintf("EVE: %li %.2f",recs,duration); + long recs=edf.edfsignals[s]->nr*edf.GetNumDataRecords()*2; + double totaldur=edf.GetNumDataRecords()*edf.GetDuration(); + totaldur/=3600.0; + t.sprintf("EVE: %li %.2f",recs,totaldur); qDebug((edf.edfsignals[s]->label+" "+t).toLatin1()); char * data=(char *)edf.edfsignals[s]->data; + long pos=0; + QDateTime tt=edf.startdate; + bool sign; + double d; + bool ok; + double duration=0; + char c; + while (posAddEvent(e); + } else { + if (t!="recording starts") { + qDebug(("Unknown ResMed annotation field: "+t).toLatin1()); + } + } + qDebug((tt.toString("yyyy-MM-dd HH:mm:ss")+t).toLatin1()); + } + if (pos>=recs) { + qDebug(("Short EDF EVE file"+edf.filename).toLatin1()); + break; + } + // pos++; + } + while ((data[pos]==0) && pos=recs) break; + } + // qDebug(data); } } bool ResmedLoader::LoadBRP(Machine *mach,Session *sess,EDFParser &edf) @@ -288,6 +374,10 @@ bool ResmedLoader::LoadBRP(Machine *mach,Session *sess,EDFParser &edf) MachineCode code; if (edf.edfsignals[s]->label=="Flow") code=CPAP_FlowRate; else if (edf.edfsignals[s]->label=="Mask Pres") code=CPAP_MaskPressure; + else { + qDebug(("Unknown Signal "+edf.edfsignals[s]->label).toLatin1()); + continue; + } sess->set_first(edf.startdate); QDateTime e=edf.startdate.addSecs(duration); sess->set_last(e); @@ -302,9 +392,14 @@ bool ResmedLoader::LoadBRP(Machine *mach,Session *sess,EDFParser &edf) } bool ResmedLoader::LoadSAD(Machine *mach,Session *sess,EDFParser &edf) { + // Oximeter bull crap.. } bool ResmedLoader::LoadPLD(Machine *mach,Session *sess,EDFParser &edf) { + QString t; + for (int s=0;slabel).toLatin1()); + } } void ResInitModelMap() diff --git a/SleepLib/machine_common.h b/SleepLib/machine_common.h index 40083c0c..8e3750af 100644 --- a/SleepLib/machine_common.h +++ b/SleepLib/machine_common.h @@ -31,7 +31,9 @@ typedef int ChannelCode; enum MachineCode//:qint16 { // General Event Codes - CPAP_Obstructive=0, CPAP_Hypopnea, CPAP_ClearAirway, CPAP_RERA, CPAP_VSnore, CPAP_FlowLimit, + MC_UNKNOWN=0, + + CPAP_Obstructive, CPAP_Hypopnea, CPAP_ClearAirway, CPAP_RERA, CPAP_VSnore, CPAP_FlowLimit, CPAP_Leak, CPAP_Pressure, CPAP_EAP, CPAP_IAP, CPAP_CSR, CPAP_FlowRate, CPAP_MaskPressure, CPAP_BreathsPerMinute,