diff --git a/Projects/CodeBlocks/SleepyHead.depend b/Projects/CodeBlocks/SleepyHead.depend index 3f123f8b..d101ccd0 100644 --- a/Projects/CodeBlocks/SleepyHead.depend +++ b/Projects/CodeBlocks/SleepyHead.depend @@ -8295,7 +8295,7 @@ -1307370363 /home/mark/projects/git/sleepyhead/src/version.h +1307372542 /home/mark/projects/git/sleepyhead/src/version.h 1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/prs1_loader.h "machine.h" @@ -8305,14 +8305,14 @@ 1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/machine_loader.h "profiles.h" -1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/profiles.h +1307371998 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/profiles.h "machine.h" "preferences.h" "tinyxml/tinyxml.h" -1307358939 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp +1307372397 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp "wx_pch.h" "version.h" @@ -8368,7 +8368,7 @@ "preferences.h" -1307358939 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/profiles.cpp +1307372029 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/profiles.cpp @@ -8413,7 +8413,7 @@ 1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.h "sleeplib/machine_loader.h" -1307370285 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.cpp +1307372542 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.cpp "cms50_loader.h" diff --git a/src/SleepyHeadMain.cpp b/src/SleepyHeadMain.cpp index 6eb9b502..e836d494 100644 --- a/src/SleepyHeadMain.cpp +++ b/src/SleepyHeadMain.cpp @@ -731,40 +731,22 @@ void Daily::RefreshData() date.SetHour(0); date-=wxTimeSpan::Days(1); - Day *d=NULL; - Day *oxi=NULL; - if (profile->daylist.find(date)!=profile->daylist.end()) { - vector::iterator di; - for (di=profile->daylist[date].begin();di!=profile->daylist[date].end();di++) { - if (!d && ((*di)->machine_type()==MT_CPAP)) { - d=(*di); - UpdateCPAPGraphs(d); - } - if ((*di)->machine_type()==MT_OXIMETER) { - oxi=(*di); - UpdateOXIGraphs(oxi); - } + Day *cpap=profile->GetDay(date,MT_CPAP); + Day *oxi=profile->GetDay(date,MT_OXIMETER); + if (cpap) UpdateCPAPGraphs(cpap); + if (oxi) UpdateOXIGraphs(oxi); - } - } + wxString html=wxT("\n"); - if (d) { - CPAPMode mode=(CPAPMode)d->summary_max(CPAP_Mode); - if (mode!=MODE_BIPAP) { - TAP_EAP->Show(false); - TAP_IAP->Show(false); - TAP->Show(true); - } else { - TAP->Show(false); - TAP_IAP->Show(true); - TAP_EAP->Show(true); - } + CPAPMode mode; + if (cpap) { + mode=(CPAPMode)cpap->summary_max(CPAP_Mode); EventTree->DeleteAllItems(); wxTreeItemId root=EventTree->AddRoot(wxT("Events")); map mcroot; - for (vector::iterator s=d->begin();s!=d->end();s++) { + for (vector::iterator s=cpap->begin();s!=cpap->end();s++) { map >::iterator m; @@ -790,7 +772,7 @@ void Daily::RefreshData() if (code==CPAP_CSR) { t-=wxTimeSpan::Seconds((*(*e))[0]/2); } - EventTree->AppendItem(mcr,t.Format(wxT("%Y-%m-%d %H:%M:%S")),-1,-1); + EventTree->AppendItem(mcr,t.Format(wxT("%Y-%m-%cpap %H:%M:%S")),-1,-1); } } } @@ -798,37 +780,37 @@ void Daily::RefreshData() EventTree->Expand(root); - PRTypes pr=(PRTypes)d->summary_max(CPAP_PressureReliefType); - wxString epr=PressureReliefNames[pr]+wxString::Format(wxT(" x%i"),(int)d->summary_max(CPAP_PressureReliefSetting)); + PRTypes pr=(PRTypes)cpap->summary_max(CPAP_PressureReliefType); + wxString epr=PressureReliefNames[pr]+wxString::Format(wxT(" x%i"),(int)cpap->summary_max(CPAP_PressureReliefSetting)); wxString modestr=CPAPModeNames[mode]; - float ahi=(d->count(CPAP_Obstructive)+d->count(CPAP_Hypopnea)+d->count(CPAP_ClearAirway))/d->hours(); - float csr=(100.0/d->hours())*(d->sum(CPAP_CSR)/3600.0); - float oai=d->count(CPAP_Obstructive)/d->hours(); - float hi=d->count(CPAP_Hypopnea)/d->hours(); - float cai=d->count(CPAP_ClearAirway)/d->hours(); - float rei=d->count(CPAP_RERA)/d->hours(); - float vsi=d->count(CPAP_VSnore)/d->hours(); - float fli=d->count(CPAP_FlowLimit)/d->hours(); -// float p90=d->percentile(CPAP_Pressure,0,0.9); - float eap90=d->percentile(CPAP_EAP,0,0.9); - float iap90=d->percentile(CPAP_IAP,0,0.9); + float ahi=(cpap->count(CPAP_Obstructive)+cpap->count(CPAP_Hypopnea)+cpap->count(CPAP_ClearAirway))/cpap->hours(); + float csr=(100.0/cpap->hours())*(cpap->sum(CPAP_CSR)/3600.0); + float oai=cpap->count(CPAP_Obstructive)/cpap->hours(); + float hi=cpap->count(CPAP_Hypopnea)/cpap->hours(); + float cai=cpap->count(CPAP_ClearAirway)/cpap->hours(); + float rei=cpap->count(CPAP_RERA)/cpap->hours(); + float vsi=cpap->count(CPAP_VSnore)/cpap->hours(); + float fli=cpap->count(CPAP_FlowLimit)/cpap->hours(); +// float p90=cpap->percentile(CPAP_Pressure,0,0.9); + float eap90=cpap->percentile(CPAP_EAP,0,0.9); + float iap90=cpap->percentile(CPAP_IAP,0,0.9); wxString submodel=_("Unknown Model"); - wxString html=wxT("
\n"); + html=html+wxT("\n"); - if (d->machine->properties.find(wxT("SubModel"))!=d->machine->properties.end()) - submodel=wxT("
")+d->machine->properties[wxT("SubModel")]; - html=html+wxT("\n"); + if (cpap->machine->properties.find(wxT("SubModel"))!=cpap->machine->properties.end()) + submodel=wxT("
")+cpap->machine->properties[wxT("SubModel")]; + html=html+wxT("\n"); if (pref.Exists("ShowSerialNumbers") && pref["ShowSerialNumbers"]) { - html=html+wxT("\n"); + html=html+wxT("\n"); } html=html+wxT("\n"); html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); html=html+wxT("\n"); html=html+wxT("\n"); html=html+wxT("\n"); @@ -845,95 +827,121 @@ void Daily::RefreshData() html=html+wxT("\n"); html=html+wxT("\n"); if (mode==MODE_CPAP) { - html=html+wxT("\n"); + html=html+wxT("\n"); } else if (mode==MODE_APAP) { - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); // html=html+wxT("\n"); } else if (mode==MODE_BIPAP) { - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); html=html+wxT("\n"); html=html+wxT("\n"); } - html=html+wxT("\n"); + html=html+wxT("\n"); html=html+wxT("\n"); - - if (oxi) { - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - PULSE->Show(true); - SPO2->Show(true); + if (mode!=MODE_BIPAP) { + TAP_EAP->Show(false); + TAP_IAP->Show(false); + TAP->Show(true); } else { - PULSE->Show(false); - SPO2->Show(false); + TAP->Show(false); + TAP_IAP->Show(true); + TAP_EAP->Show(true); } - fgSizer->Layout(); + FRW->Show(true); + PRD->Show(true); + G_AHI->Show(true); + LEAK->Show(true); + TAP->Show(true); + SF->Show(true); + } else { + TAP_EAP->Show(false); + TAP_IAP->Show(false); + FRW->Show(false); + PRD->Show(false); + G_AHI->Show(false); + LEAK->Show(false); + TAP->Show(false); + SF->Show(false); + } + if (oxi) { + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + PULSE->Show(true); + SPO2->Show(true); + } else { + PULSE->Show(false); + SPO2->Show(false); + } + fgSizer->Layout(); + ScrolledWindow->FitInside(); + + if (cpap) { // fgSizer->Layout(); - ScrolledWindow->FitInside(); html=html+wxT("\n"); - if (d->summary_avg(CPAP_BrokenSummary)==1) { + if (cpap->summary_avg(CPAP_BrokenSummary)==1) { html=html+wxT("\n"); } else { html=html+wxT("\n"); if (mode==MODE_CPAP) { - html=html+wxT("\n"); + html=html+wxT("\n"); } else if (mode==MODE_APAP) { - html=html+wxT("\n"); - html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); } else if (mode==MODE_BIPAP) { - html=html+wxT("\n"); - html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); } - html=html+wxT("\n"); - html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); // check HumidiferStatus.. wxString str; - if (bool(d->summary_max(CPAP_HumidifierStatus))) { - str=wxString::Format(wxT("x%i"),(int)d->summary_max(CPAP_HumidifierSetting)); + if (bool(cpap->summary_max(CPAP_HumidifierStatus))) { + str=wxString::Format(wxT("x%i"),(int)cpap->summary_max(CPAP_HumidifierSetting)); } else str=wxT("No"); html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - html=html+wxT("\n"); - if (bool(d->summary_max(PRS1_SystemResistanceStatus))) { - str=wxString::Format(wxT("x%i"),(int)d->summary_max(PRS1_SystemResistanceSetting)); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + html=html+wxT("\n"); + if (bool(cpap->summary_max(PRS1_SystemResistanceStatus))) { + str=wxString::Format(wxT("x%i"),(int)cpap->summary_max(PRS1_SystemResistanceSetting)); } else str=wxT("No"); html=html+wxT("\n"); } html=html+wxT("\n"); html=html+wxT("\n"); - for (vector::iterator i=d->begin();i!=d->end();i++) { + for (vector::iterator i=cpap->begin();i!=cpap->end();i++) { html=html+wxT("\n"); html=html+wxT("\n"); } - html=html+wxT("
")+_("Machine Information")+wxT("
")+d->machine->properties[wxT("Brand")]+wxT("
")+d->machine->properties[wxT("Model")]+wxT(" ")+d->machine->properties[wxT("ModelNumber")]+submodel+wxT("
")+cpap->machine->properties[wxT("Brand")]+wxT("
")+cpap->machine->properties[wxT("Model")]+wxT(" ")+cpap->machine->properties[wxT("ModelNumber")]+submodel+wxT("
")+d->machine->properties[wxT("Serial")]+wxT("
")+cpap->machine->properties[wxT("Serial")]+wxT("
  
")+_("Sleep Times")+wxT("
")+_("Date")+wxT("")+d->first().Format(wxT("%x"))+wxT("
")+_("Sleep")+wxT("")+d->first().Format(wxT("%H:%M"))+wxT("
")+_("Wake")+wxT("")+d->last().Format(wxT("%H:%M"))+wxT("
")+_("Total Time")+wxT("")+d->total_time().Format(wxT("%H:%M hours"))+wxT("
")+_("Date")+wxT("")+cpap->first().Format(wxT("%x"))+wxT("
")+_("Sleep")+wxT("")+cpap->first().Format(wxT("%H:%M"))+wxT("
")+_("Wake")+wxT("")+cpap->last().Format(wxT("%H:%M"))+wxT("
")+_("Total Time")+wxT("")+cpap->total_time().Format(wxT("%H:%M hours"))+wxT("
  
")+_("Indices")+wxT("
")+_("AHI")+wxT("")+wxString::Format(wxT("%0.2f"),ahi)+wxT("
")+_("Mode")+wxT("")+modestr+wxT("
")+_("Relief")+wxT("")+epr+wxT("
")+_("Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_PressureMin))+wxT("
")+_("Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_PressureMin))+wxT("
")+_("90% Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_weighted_avg(CPAP_PressurePercentValue))+wxT("
")+_("Avg Pressure")+wxT("")+wxString::Format(wxT("%.2fcmH2O"),d->summary_weighted_avg(CPAP_PressureAverage))+wxT("
")+_("Min Reached")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_PressureMinAchieved))+wxT("
")+_("Max Reached")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_max(CPAP_PressureMaxAchieved))+wxT("
")+_("90% Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_weighted_avg(CPAP_PressurePercentValue))+wxT("
")+_("Avg Pressure")+wxT("")+wxString::Format(wxT("%.2fcmH2O"),cpap->summary_weighted_avg(CPAP_PressureAverage))+wxT("
")+_("Min Reached")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_PressureMinAchieved))+wxT("
")+_("Max Reached")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_max(CPAP_PressureMaxAchieved))+wxT("
")+_("90% Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),p90)+wxT("
")+_("Avg IPAP")+wxT("")+wxString::Format(wxT("%.2fcmH2O"),d->summary_avg(BIPAP_IAPAverage))+wxT("
")+_("Avg EPAP")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_avg(BIPAP_EAPAverage))+wxT("
")+_("Min IPAP")+wxT("")+wxString::Format(wxT("%.2fcmH2O"),d->summary_min(BIPAP_IAPMin))+wxT("
")+_("Max IPAP")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_max(BIPAP_IAPMax))+wxT("
")+_("Min EPAP")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(BIPAP_EAPMin))+wxT("
")+_("Max EPAP")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_max(BIPAP_EAPMax))+wxT("
")+_("Avg IPAP")+wxT("")+wxString::Format(wxT("%.2fcmH2O"),cpap->summary_avg(BIPAP_IAPAverage))+wxT("
")+_("Avg EPAP")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_avg(BIPAP_EAPAverage))+wxT("
")+_("Min IPAP")+wxT("")+wxString::Format(wxT("%.2fcmH2O"),cpap->summary_min(BIPAP_IAPMin))+wxT("
")+_("Max IPAP")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_max(BIPAP_IAPMax))+wxT("
")+_("Min EPAP")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(BIPAP_EAPMin))+wxT("
")+_("Max EPAP")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_max(BIPAP_EAPMax))+wxT("
")+_("90% IPAP")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),iap90)+wxT("
")+_("90% EPAP")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),eap90)+wxT("
")+_("Avg Leak")+wxT("")+wxString::Format(wxT("%.2f"),d->summary_weighted_avg(CPAP_LeakAverage))+wxT("
")+_("Avg Leak")+wxT("")+wxString::Format(wxT("%.2f"),cpap->summary_weighted_avg(CPAP_LeakAverage))+wxT("
  
")+_("Oximeter Information")+wxT("
")+_("Pulse Avg")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_avg(OXI_PulseAverage))+wxT("
")+_("Pulse Min")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_min(OXI_PulseMin))+wxT("
")+_("Pulse Max")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_max(OXI_PulseMax))+wxT("
")+_("SpO2 Avg")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_avg(OXI_SPO2Average))+wxT("
")+_("SpO2 Min")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_min(OXI_SPO2Min))+wxT("
")+_("SpO2 Max")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_max(OXI_SPO2Max))+wxT("
")+_("Oximeter Information")+wxT("
")+_("Pulse Avg")+wxT("")+wxString::Format(wxT("%.1fbpm"),oxi->summary_avg(OXI_PulseAverage))+wxT("
")+_("Pulse Min")+wxT("")+wxString::Format(wxT("%.1fbpm"),oxi->summary_min(OXI_PulseMin))+wxT("
")+_("Pulse Max")+wxT("")+wxString::Format(wxT("%.1fbpm"),oxi->summary_max(OXI_PulseMax))+wxT("
")+_("SpO2 Avg")+wxT("")+wxString::Format(wxT("%.1f%%"),oxi->summary_avg(OXI_SPO2Average))+wxT("
")+_("SpO2 Min")+wxT("")+wxString::Format(wxT("%.1f%%"),oxi->summary_min(OXI_SPO2Min))+wxT("
")+_("SpO2 Max")+wxT("")+wxString::Format(wxT("%.1f%%"),oxi->summary_max(OXI_SPO2Max))+wxT("
  
")+_("No System Settings Recorded")+wxT("
")+_("System Settings")+wxT("
")+_("Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_PressureMin))+wxT("
")+_("Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_PressureMin))+wxT("
")+_("Min Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_PressureMin))+wxT("
")+_("Max Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_max(CPAP_PressureMax))+wxT("
")+_("Min Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_PressureMin))+wxT("
")+_("Max Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_max(CPAP_PressureMax))+wxT("
")+_("IPAP Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_PressureMin))+wxT("
")+_("EPAP Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_max(CPAP_PressureMax))+wxT("
")+_("IPAP Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_PressureMin))+wxT("
")+_("EPAP Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_max(CPAP_PressureMax))+wxT("
")+_("Ramp-Time")+wxT("")+wxString::Format(wxT("%imin"),(int)d->summary_max(CPAP_RampTime))+wxT("
")+_("Ramp-Prs.")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_RampStartingPressure))+wxT("
")+_("Ramp-Time")+wxT("")+wxString::Format(wxT("%imin"),(int)cpap->summary_max(CPAP_RampTime))+wxT("
")+_("Ramp-Prs.")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_RampStartingPressure))+wxT("
")+_("Humidifier")+wxT("")+str+wxT("
")+_("System-Lock")+wxT("")+(bool(d->summary_max(PRS1_SystemLockStatus)) ? _("On") : _("Off"))+wxT("
")+_("Auto-Off")+wxT("")+(bool(d->summary_max(PRS1_AutoOff)) ? _("On") : _("Off"))+wxT("
")+_("Mask-Alert")+wxT("")+(bool(d->summary_max(PRS1_MaskAlert)) ? _("On") : _("Off"))+wxT("
")+_("Show-AHI")+wxT("")+(bool(d->summary_max(PRS1_ShowAHI)) ? _("On") : _("Off"))+wxT("
")+_("Hose-Size")+wxT("")+(bool(d->summary_max(PRS1_HoseDiameter)) ? _("22mm") : _("15mm"))+wxT("
")+_("System-Lock")+wxT("")+(bool(cpap->summary_max(PRS1_SystemLockStatus)) ? _("On") : _("Off"))+wxT("
")+_("Auto-Off")+wxT("")+(bool(cpap->summary_max(PRS1_AutoOff)) ? _("On") : _("Off"))+wxT("
")+_("Mask-Alert")+wxT("")+(bool(cpap->summary_max(PRS1_MaskAlert)) ? _("On") : _("Off"))+wxT("
")+_("Show-AHI")+wxT("")+(bool(cpap->summary_max(PRS1_ShowAHI)) ? _("On") : _("Off"))+wxT("
")+_("Hose-Size")+wxT("")+(bool(cpap->summary_max(PRS1_HoseDiameter)) ? _("22mm") : _("15mm"))+wxT("
")+_("Sys-Resist.")+wxT("")+str+wxT("
  
")+_("Session Files")+wxT("
")+(*i)->first().Format(wxT("%d-%m-%Y %H:%M:%S"))+wxT(" ")+wxString::Format(wxT("%05i"),(*i)->session())+wxT("
")+(*i)->last().Format(wxT("%d-%m-%Y %H:%M:%S"))+wxT(" ")+wxString::Format(wxT("%05i"),(*i)->session())+wxT("
"); - html+=wxT(""); - HTMLInfo->SetPage(html); - } else { - HTMLInfo->SetPage(_("No data available for this day")); } + if (!cpap && !oxi) { + html+=_("No data available for this day"); + } + html+=wxT(""); + HTMLInfo->SetPage(html); } void Daily::OnSelectSession( wxCommandEvent& event ) diff --git a/src/libs/sleeplib/loader_plugins/cms50_loader.cpp b/src/libs/sleeplib/loader_plugins/cms50_loader.cpp index 7b95b117..0b1d35da 100644 --- a/src/libs/sleeplib/loader_plugins/cms50_loader.cpp +++ b/src/libs/sleeplib/loader_plugins/cms50_loader.cpp @@ -121,7 +121,7 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile) wxDateTime date; date.ParseFormat(datestr,wxT("%m/%d/%y %H:%M:%S")); - wxLogMessage(datestr); + //wxLogMessage(datestr); f.Seek(data_starts,wxFromStart); buffer=new char [num_records*2]; @@ -146,6 +146,7 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile) int PCnt=0,SCnt=0; //wxDateTime wxDateTime tt=date; + wxDateTime lasttime=date; bool first_p=true,first_s=true; for (int i=2;iAddEvent(new Event(tt,OXI_Pulse,&cp,1)); + if (tt>lasttime) lasttime=tt; if (cp>0) { if (first_p) { PMin=cp; @@ -166,6 +168,7 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile) } if (last_spo2!=cs) { sess->AddEvent(new Event(tt,OXI_SPO2,&cs,1)); + if (tt>lasttime) lasttime=tt; if (cs>0) { if (first_s) { SMin=cs; @@ -183,10 +186,10 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile) if (SMaxAddEvent(new Event(tt,OXI_Pulse,&cp,1)); - sess->AddEvent(new Event(tt,OXI_SPO2,&cs,1)); + if (cp) sess->AddEvent(new Event(tt,OXI_Pulse,&cp,1)); + if (cs) sess->AddEvent(new Event(tt,OXI_SPO2,&cs,1)); - sess->set_last(tt); + sess->set_last(lasttime); wxTimeSpan t=sess->last()-sess->first(); double hours=(t.GetSeconds().GetLo()/3600.0); diff --git a/src/libs/sleeplib/profiles.cpp b/src/libs/sleeplib/profiles.cpp index 8409c5f0..2ede7cfe 100644 --- a/src/libs/sleeplib/profiles.cpp +++ b/src/libs/sleeplib/profiles.cpp @@ -146,6 +146,19 @@ void Profile::AddDay(wxDateTime date,Day *day,MachineType mt) { daylist[date].push_back(day); } +Day * Profile::GetDay(wxDateTime date,MachineType type) +{ + Day *day=NULL; + if (profile->daylist.find(date)!=profile->daylist.end()) { + for (vector::iterator di=profile->daylist[date].begin();di!=profile->daylist[date].end();di++) { + if ((*di)->machine_type()==type) { + day=(*di); + break; + } + } + } + return day; +} /** diff --git a/src/libs/sleeplib/profiles.h b/src/libs/sleeplib/profiles.h index 23c2e1a4..a22e40f3 100644 --- a/src/libs/sleeplib/profiles.h +++ b/src/libs/sleeplib/profiles.h @@ -39,6 +39,7 @@ public: void Import(wxString path); void AddDay(wxDateTime date,Day *day,MachineType mt); + Day * GetDay(wxDateTime date,MachineType type); vector GetMachines(MachineType t); Machine * GetMachine(MachineType t,wxDateTime date); diff --git a/src/version.h b/src/version.h index 407b8798..e1348473 100644 --- a/src/version.h +++ b/src/version.h @@ -16,14 +16,14 @@ namespace AutoVersion{ //Standard Version Type static const long MAJOR = 0; static const long MINOR = 7; - static const long BUILD = 3286; - static const long REVISION = 1070; + static const long BUILD = 3301; + static const long REVISION = 1162; //Miscellaneous Version Types - static const long BUILDS_COUNT = 379; - #define RC_FILEVERSION 0,7,3286,1070 - #define RC_FILEVERSION_STRING "0, 7, 3286, 1070\0" - static const char FULLVERSION_STRING[] = "0.7.3286.1070"; + static const long BUILDS_COUNT = 418; + #define RC_FILEVERSION 0,7,3301,1162 + #define RC_FILEVERSION_STRING "0, 7, 3301, 1162\0" + static const char FULLVERSION_STRING[] = "0.7.3301.1162"; //These values are to keep track of your versioning state, don't modify them. static const long BUILD_HISTORY = 0;