diff --git a/SleepyHead.depend b/SleepyHead.depend index bbd8899a..9d0b01a7 100644 --- a/SleepyHead.depend +++ b/SleepyHead.depend @@ -7835,7 +7835,7 @@ "sleeplib/machine.h" "graphs/graph.h" -1306485972 /home/mark/projects/git/sleepyhead/libs/sleeplib/machine.h +1306601639 /home/mark/projects/git/sleepyhead/libs/sleeplib/machine.h @@ -7873,7 +7873,7 @@ -1306587675 /home/mark/projects/git/sleepyhead/version.h +1306639384 /home/mark/projects/git/sleepyhead/version.h 1306549105 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h "machine.h" @@ -7890,7 +7890,7 @@ "preferences.h" "tinyxml/tinyxml.h" -1306587675 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp +1306638297 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp "wx_pch.h" "version.h" @@ -7905,7 +7905,7 @@ "SleepyHeadMain.h" "sleeplib/profiles.h" -1306587051 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp +1306639142 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp @@ -7919,7 +7919,7 @@ -1306560805 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp +1306614082 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp @@ -7951,7 +7951,7 @@ "machine_loader.h" "tinyxml/tinyxml.h" -1306560504 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.cpp +1306607755 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.cpp diff --git a/SleepyHead.layout b/SleepyHead.layout index b8e2cc66..26f08066 100644 --- a/SleepyHead.layout +++ b/SleepyHead.layout @@ -4,17 +4,17 @@ - - + + - + - - + + @@ -26,10 +26,10 @@ - + - + @@ -50,7 +50,7 @@ - + diff --git a/SleepyHeadMain.cpp b/SleepyHeadMain.cpp index 5c2b3ab3..1e279d41 100644 --- a/SleepyHeadMain.cpp +++ b/SleepyHeadMain.cpp @@ -62,48 +62,6 @@ wxString wxbuildinfo(wxbuildinfoformat format) return wxbuild; } - -void SleepyHeadFrame::DoScreenshot( wxCommandEvent &event ) -{ - wxRect r=GetRect(); - -#if defined(__UNIX__) - int cx=r.x, cy=r.y; - ClientToScreen(&cx,&cy); - int border_width = cx - r.x; - int title_bar_height = cy - r.y; - r.width += (border_width * 2); - r.height += title_bar_height + border_width; -#endif - int x=r.x; - int y=r.y; - int w=r.width; - int h=r.height; - - wxScreenDC sdc; - wxMemoryDC mdc; - - wxBitmap bmp(r.width, r.height,-1); - //wxBitMap *bmp=wxEmptyImage(r.width,r.height); - mdc.SelectObject(bmp); - - mdc.Blit((wxCoord)0, (wxCoord)0, (wxCoord)r.width, (wxCoord)r.height, &sdc, (wxCoord)r.x, (wxCoord)r.y); - - mdc.SelectObject(wxNullBitmap); - - wxDateTime d=wxDateTime::Now(); - -// wxDirDialog sfs(this,_("Choose a Directory")); //,wxT(""),wxT(""),style=wxFD_OPEN); - wxString filename=wxSaveFileSelector(_("Please give a filename for the screenshot"),wxT("png"),wxT("Sleepyhead-")+d.Format(wxT("%Y%m%d-%H%M%S")),this); - if (!filename.IsEmpty()) { - if (!filename.Lower().EndsWith(wxT(".png"))) filename+=wxT(".png"); - wxImage img=bmp.ConvertToImage(); - if (!img.SaveFile(filename, wxBITMAP_TYPE_PNG)) { - wxLogError(wxT("Couldn't save screenshot ")+filename); - } - } -} - SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame) : GUIFrame(frame) @@ -133,19 +91,21 @@ SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame) id=pref[wxT("DefaultMachine")].GetInteger(); } - Machine *m=cpap_machines[id]; + if (idGetPageIndex(daily); - if (idx!=wxNOT_FOUND) { - daily->RefreshData(m); + int idx=main_auinotebook->GetPageIndex(daily); + if (idx!=wxNOT_FOUND) { + daily->RefreshData(m); + } + idx=main_auinotebook->GetPageIndex(summary); + if (idx!=wxNOT_FOUND) { + summary->RefreshData(m); + } + summary->Refresh(); + daily->Refresh(); + Refresh(); } - idx=main_auinotebook->GetPageIndex(summary); - if (idx!=wxNOT_FOUND) { - summary->RefreshData(m); - } - summary->Refresh(); - daily->Refresh(); - Refresh(); this->Connect(wxID_ANY, wxEVT_DO_SCREENSHOT, wxCommandEventHandler(SleepyHeadFrame::DoScreenshot)); @@ -246,6 +206,47 @@ void SleepyHeadFrame::OnScreenshot(wxCommandEvent& event) wxCommandEvent MyEvent( wxEVT_DO_SCREENSHOT); wxPostEvent(this, MyEvent); } + +void SleepyHeadFrame::DoScreenshot( wxCommandEvent &event ) +{ + wxRect r=GetRect(); + +#if defined(__UNIX__) + int cx=r.x, cy=r.y; + ClientToScreen(&cx,&cy); + int border_width = cx - r.x; + int title_bar_height = cy - r.y; + r.width += (border_width * 2); + r.height += title_bar_height + border_width; +#endif + int x=r.x; + int y=r.y; + int w=r.width; + int h=r.height; + + wxScreenDC sdc; + wxMemoryDC mdc; + + wxBitmap bmp(r.width, r.height,-1); + //wxBitMap *bmp=wxEmptyImage(r.width,r.height); + mdc.SelectObject(bmp); + + mdc.Blit((wxCoord)0, (wxCoord)0, (wxCoord)r.width, (wxCoord)r.height, &sdc, (wxCoord)r.x, (wxCoord)r.y); + + mdc.SelectObject(wxNullBitmap); + + wxDateTime d=wxDateTime::Now(); + +// wxDirDialog sfs(this,_("Choose a Directory")); //,wxT(""),wxT(""),style=wxFD_OPEN); + wxString filename=wxSaveFileSelector(_("Please give a filename for the screenshot"),wxT("png"),wxT("Sleepyhead-")+d.Format(wxT("%Y%m%d-%H%M%S")),this); + if (!filename.IsEmpty()) { + if (!filename.Lower().EndsWith(wxT(".png"))) filename+=wxT(".png"); + wxImage img=bmp.ConvertToImage(); + if (!img.SaveFile(filename, wxBITMAP_TYPE_PNG)) { + wxLogError(wxT("Couldn't save screenshot ")+filename); + } + } +} void SleepyHeadFrame::OnAbout(wxCommandEvent &event) { @@ -458,6 +459,7 @@ Daily::Daily(wxWindow *win) AddData(flags[9]=new FlagData(PRS1_Unknown0E,1)); FRW->AddLayer(new gLineChart(frw,wxBLACK,200000,true)); + /* FRW->AddLayer(new gLineOverlayBar(flags[0],wxGREEN2,wxT("CSR"))); FRW->AddLayer(new gLineOverlayBar(flags[7],wxRED,wxT("PR"),LOT_Dot)); FRW->AddLayer(new gLineOverlayBar(flags[6],wxYELLOW,wxT("RE"))); FRW->AddLayer(new gLineOverlayBar(flags[9],wxDARK_GREEN,wxT("U0E"))); @@ -465,16 +467,15 @@ Daily::Daily(wxWindow *win) FRW->AddLayer(new gLineOverlayBar(flags[4],wxBLACK,wxT("FL"))); FRW->AddLayer(new gLineOverlayBar(flags[3],wxBLUE,wxT("H"))); FRW->AddLayer(new gLineOverlayBar(flags[2],wxAQUA,wxT("OA"))); - FRW->AddLayer(new gLineOverlayBar(flags[1],wxPURPLE,wxT("CA"))); - FRW->AddLayer(new gLineOverlayBar(flags[0],wxGREEN2,wxT("CSR"))); + FRW->AddLayer(new gLineOverlayBar(flags[1],wxPURPLE,wxT("CA"))); */ SF=new gGraphWindow(ScrolledWindow,-1,wxT("Sleep Flags"),wxPoint(0,0), wxSize(600,150), wxNO_BORDER); SF->SetMargins(10,15,20,80); - SF->LinkZoom(FRW); + // SF->LinkZoom(FRW); #if defined(__UNIX__) - SF->LinkZoom(PRD); // Uncomment to link in more graphs.. Too slow on windows. - SF->LinkZoom(LEAK); + // SF->LinkZoom(PRD); // Uncomment to link in more graphs.. Too slow on windows. + // SF->LinkZoom(LEAK); #endif const int sfc=9; diff --git a/graphs/graph.cpp b/graphs/graph.cpp index 7f848ec8..46e2409e 100644 --- a/graphs/graph.cpp +++ b/graphs/graph.cpp @@ -11,10 +11,10 @@ License: LGPL #include "graph.h" #if !wxCHECK_VERSION(2,9,0) -wxColor zwxYELLOW=wxColor(0xc0,0xc0,0x40,0xff); +wxColor zwxYELLOW=wxColor(0xb0,0xb0,0x40,0xff); wxColor *wxYELLOW=&zwxYELLOW; #endif -wxColor zwxAQUA=wxColor(0x00,0xff,0xff,0xff); +wxColor zwxAQUA=wxColor(0x00,0xaf,0xbf,0xff); wxColor * wxAQUA=&zwxAQUA; wxColor zwxPURPLE=wxColor(0xff,0x40,0xff,0xff); wxColor * wxPURPLE=&zwxPURPLE; @@ -407,7 +407,7 @@ double gGraphWindow::MinX() val=(*l)->MinX(); first=false; } else { - if (val > (*l)->MinX()) val = (*l)->MinX(); + if ((*l)->MinX() < val) val = (*l)->MinX(); } } @@ -426,7 +426,7 @@ double gGraphWindow::MaxX() val=(*l)->MaxX(); first=false; } else { - if (val < (*l)->MinX()) val = (*l)->MaxX(); + if ((*l)->MaxX() > val) val = (*l)->MaxX(); } } return max_x=val; @@ -444,7 +444,7 @@ double gGraphWindow::MinY() val=(*l)->MinY(); first=false; } else { - if (val > (*l)->MinX()) val = (*l)->MinY(); + if ((*l)->MinY() < val) val = (*l)->MinY(); } } return min_y=val; @@ -462,7 +462,7 @@ double gGraphWindow::MaxY() val=(*l)->MaxY(); first=false; } else { - if (val > (*l)->MinX()) val = (*l)->MaxY(); + if ((*l)->MaxY()>val) val = (*l)->MaxY(); } } return max_y=val; @@ -481,7 +481,7 @@ double gGraphWindow::RealMinX() val=(*l)->RealMinX(); first=false; } else { - if (val > (*l)->MinX()) val = (*l)->RealMinX(); + if ((*l)->RealMinX() < val) val = (*l)->RealMinX(); } } return rmin_x=val; @@ -499,7 +499,7 @@ double gGraphWindow::RealMaxX() val=(*l)->RealMaxX(); first=false; } else { - if (val < (*l)->MinX()) val = (*l)->RealMaxX(); + if ((*l)->RealMaxX() > val) val = (*l)->RealMaxX(); } } return rmax_x=val; @@ -517,7 +517,7 @@ double gGraphWindow::RealMinY() val=(*l)->RealMinY(); first=false; } else { - if (val > (*l)->MinX()) val = (*l)->RealMinY(); + if ((*l)->RealMinY() < val) val = (*l)->RealMinY(); } } return rmin_y=val; @@ -535,7 +535,7 @@ double gGraphWindow::RealMaxY() val=(*l)->RealMaxY(); first=false; } else { - if (val > (*l)->MinX()) val = (*l)->RealMaxY(); + if ((*l)->RealMaxY()>val) val = (*l)->RealMaxY(); } } return rmax_y=val; @@ -1215,6 +1215,8 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w) double ymult=height/yy; if (xx<=0) return; + if (yy<=0) + return; // assert(xx>=0); static wxPoint screen[4096]; // max screen size @@ -1226,8 +1228,8 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w) // dc.DrawLine(start_px,start_py,start_px+width,start_py); dc.DrawLine(start_px+width+1,start_py,start_px+width+1,start_py+height+1); - static wxPen pen2(wxDARK_GREY, 1, wxDOT); - static wxPen pen3(*wxGREEN, 2, wxSOLID); + wxPen pen2(wxDARK_GREY, 1, wxDOT); + wxPen pen3(*wxGREEN, 2, wxSOLID); dc.SetPen( pen2 ); dc.DrawLine(start_px,start_py+height+10,start_px+width,start_py+height+10); @@ -1240,6 +1242,7 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w) dc.DrawLine(start_px+py,start_py+height+8,start_px+py,start_py+height+12); DrawYTicks(dc,w); + DrawXTicks(dc,w); wxPen pen(*color[0], 1, wxSOLID); dc.SetPen(pen); @@ -1301,16 +1304,16 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w) if (point[i].x < minx) done=true; } - px=(point[i].x - minx) * xmult; py=height - ((point[i].y - miny) * ymult); - /*if (px<0) { - // high school maths failure.. + + // Can't avoid this.. SetClippingRegion does not work without crashing.. need to find a workaround:( + if (px<0) { px=0; } if (px>width) { px=width; - } */ + } if (accel) { int z=round(px); @@ -1329,7 +1332,7 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w) if (done) break; } - dc.SetClippingRegion(start_px+1,start_py-1,width,height+1); + dc.SetClippingRegion(start_px+1,start_py-1,width,height+2); if (accel) { // dc.DrawLine(1, 1, 1, height); dp=0; @@ -1352,7 +1355,6 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w) } dc.DestroyClippingRegion(); //dc.SetClippingRegion(start_px-1,start_py+height,width+1,w.GetBottomMargin()); - DrawXTicks(dc,w); //dc.DestroyClippingRegion(); } @@ -1593,8 +1595,8 @@ void FlowData::Reload(Day *day) } //wxRealPoint *rpl; MachineCode code=CPAP_FlowRate; - min_x=day->first(CPAP_Pressure).GetMJD(); - max_x=day->last(CPAP_Pressure).GetMJD(); + min_x=day->first().GetMJD(); + max_x=day->last().GetMJD(); max_y=0; bool first=true; for (auto s=day->begin();s!=day->end(); s++) { @@ -1629,12 +1631,12 @@ void FlowData::Reload(Day *day) min_y=floor(min_y); max_y=ceil(max_y); - double t1=MAX(fabs(min_y),fabs(max_y)); + //double t1=MAX(fabs(min_y),fabs(max_y)); - max_y=t1; - min_y=-t1; - min_y=-120; - max_y=120; + //max_y=t1; + //min_y=-t1; + min_y=-100; + max_y=100; real_min_x=min_x; real_min_y=min_y; @@ -1697,16 +1699,21 @@ void PressureData::Reload(Day *day) vc++; } - if ((code==CPAP_Pressure) && (day->summary_max(CPAP_Mode)==MODE_CPAP)) { - min_y=4; - max_y=ceil(max_y+1); - } else { - if (min_y>day->summary_min(CPAP_PressureMin)) min_y=day->summary_min(CPAP_PressureMin); - if (max_ysummary_max(CPAP_PressureMax)) max_y=day->summary_min(CPAP_PressureMax); + /*if ((code==CPAP_Pressure) || (code==CPAP_EAP) || (code==CPAP_IAP)) { + if (day->summary_max(CPAP_Mode)==MODE_CPAP) { + min_y=4; + max_y=ceil(max_y+1); + } else { + if (min_y>day->summary_min(CPAP_PressureMin)) min_y=day->summary_min(CPAP_PressureMin); + if (max_ysummary_max(CPAP_PressureMax)) max_y=day->summary_min(CPAP_PressureMax); //max_y=ceil(day->summary_max(CPAP_PressureMax)); + min_y=floor(min_y); + max_y=ceil(max_y); + } + } else { */ min_y=floor(min_y); max_y=ceil(max_y); - } + //} real_min_x=min_x; real_min_y=min_y; @@ -1860,7 +1867,7 @@ void FlagData::Reload(Day *day) if (v2>max_x) max_x=v2; */ } } - min_y=0; + min_y=-value; max_y=value; np[vc]=c; vc++; diff --git a/libs/sleeplib/machine.cpp b/libs/sleeplib/machine.cpp index 4be84251..06e508d6 100644 --- a/libs/sleeplib/machine.cpp +++ b/libs/sleeplib/machine.cpp @@ -138,21 +138,51 @@ Session *Machine::SessionExists(SessionID session) } void Machine::AddSession(Session *s) { + wxDateTime date=s->first(); + date.ResetTime(); + date-=wxTimeSpan::Day(); + + bool ok=false; + if (day.find(date)!=day.end()) { + wxTimeSpan span=s->first()-day[date]->last(); + if (spanfirst(); + t.ResetTime(); + wxTimeSpan j=s->first()-t; + if (jfirst(); + t.ResetTime(); + wxTimeSpan j=s->first()-t; + if (jsession()]=s; - wxDateTime s1=s->first(); +/* wxDateTime s1=s->first(); wxDateTime s2=s->last(); if (s1==s2) return; // leave this session out of daylist.. it's dodgy. DELETE? wxDateTime date,d1=s1; - d1.ResetTime(); date=d1; - d1.SetHour(16); + d1.SetHour(15); if (s1date) firstday=date; @@ -168,7 +198,6 @@ void Machine::AddSession(Session *s) //wxLogMessage(wxT("Using Day ")+date.Format()+wxT(" to store ")+s1.Format()+wxT(" ")+s2.Format()); day[date]->AddSession(s); - } bool Machine::Load() @@ -679,10 +708,14 @@ double Session::weighted_avg_event_field(MachineCode mc,int field) void Session::AddEvent(Event * e) { events[e->code()].push_back(e); + // if (e->time()>s_last) s_last=e->time(); + // wxLogMessage(e->time().Format(wxT("%Y-%m-%d %H:%M:%S"))+wxString::Format(wxT(" %04i %02i "),e->code(),e->fields())); } void Session::AddWaveform(Waveform *w) { waveforms[w->code()].push_back(w); + //wxLogMessage(w->start().Format(wxT("%Y-%m-%d %H:%M:%S"))+wxT(" ")+w->end().Format(wxT("%Y-%m-%d %H:%M:%S"))+wxString::Format(wxT(" %i %.1f"),w->samples(), w->duration())); + } void Session::TrashEvents() // Trash this sessions Events and release memory. diff --git a/libs/sleeplib/machine.h b/libs/sleeplib/machine.h index 4f1e1e4b..a019a434 100644 --- a/libs/sleeplib/machine.h +++ b/libs/sleeplib/machine.h @@ -44,7 +44,7 @@ wxInt16 { CPAP_PressureMin=0x80, CPAP_PressureMax, CPAP_RampTime, CPAP_RampStartingPressure, CPAP_Mode, CPAP_PressureReliefType, CPAP_PressureReliefSetting, CPAP_HumidifierSetting, CPAP_HumidifierStatus, CPAP_PressureMinAchieved, CPAP_PressureMaxAchieved, CPAP_PressurePercentValue, CPAP_PressurePercentName, CPAP_PressureAverage, CPAP_PressureMedian, - CPAP_LeakMedian,CPAP_LeakMinimum,CPAP_LeakMaximum,CPAP_LeakAverage, + CPAP_LeakMedian,CPAP_LeakMinimum,CPAP_LeakMaximum,CPAP_LeakAverage,CPAP_Duration, // PRS1 Specific Codes PRS1_PressurePulse=0x1000, PRS1_VSnore2, diff --git a/libs/sleeplib/prs1_loader.cpp b/libs/sleeplib/prs1_loader.cpp index 1b906856..02adf17f 100644 --- a/libs/sleeplib/prs1_loader.cpp +++ b/libs/sleeplib/prs1_loader.cpp @@ -259,19 +259,20 @@ int PRS1Loader::OpenMachine(Machine *m,wxString path) delete sess; continue; } - const double ignore_thresh=300.0/3600.0;// Ignore useless sessions under 5 minute - if (sess->hours()<=ignore_thresh) { - delete sess; - continue; - } + wxLogMessage(sess->first().Format(wxT("%Y-%m-%d %H:%M:%S"))+wxT(" ")+sess->last().Format(wxT("%Y-%m-%d %H:%M:%S"))); //sess->SetSessionID(sess->start().GetTicks()); - m->AddSession(sess); if (!s->second[1].IsEmpty()) { if (!OpenEvents(sess,s->second[1])) { wxLogWarning(wxT("PRS1Loader: Couldn't open event file ")+s->second[1]); } } + const double ignore_thresh=300.0/3600.0;// Ignore useless sessions under 5 minute + if (sess->hours()<=ignore_thresh) { + delete sess; + continue; + } + m->AddSession(sess); if (!s->second[2].IsEmpty()) { if (!OpenWaveforms(sess,s->second[2])) { @@ -279,16 +280,30 @@ int PRS1Loader::OpenMachine(Machine *m,wxString path) } } + if (sess->summary.find(CPAP_Obstructive)!=sess->summary.end()) { + sess->summary[CPAP_Obstructive]=(long)sess->count_events(CPAP_Obstructive); + sess->summary[CPAP_Hypopnea]=(long)sess->count_events(CPAP_Hypopnea); + sess->summary[CPAP_ClearAirway]=(long)sess->count_events(CPAP_ClearAirway); + sess->summary[CPAP_RERA]=(long)sess->count_events(CPAP_RERA); + sess->summary[CPAP_FlowLimit]=(long)sess->count_events(CPAP_FlowLimit); + } sess->summary[CPAP_CSR]=sess->sum_event_field(CPAP_CSR,0); sess->summary[CPAP_VSnore]=(long)sess->count_events(CPAP_VSnore); sess->summary[PRS1_VSnore2]=sess->sum_event_field(PRS1_VSnore2,0); - sess->summary[CPAP_PressureMedian]=sess->avg_event_field(CPAP_Pressure,0); - sess->summary[CPAP_PressureAverage]=sess->weighted_avg_event_field(CPAP_Pressure,0); - sess->summary[CPAP_PressureMinAchieved]=sess->min_event_field(CPAP_Pressure,0); - sess->summary[CPAP_PressureMaxAchieved]=sess->max_event_field(CPAP_Pressure,0); + if (sess->count_events(CPAP_IAP)>0) { + sess->summary[CPAP_PressureMedian]=(sess->avg_event_field(CPAP_EAP,0)+sess->avg_event_field(CPAP_IAP,0))/2.0; + sess->summary[CPAP_PressureAverage]=(sess->weighted_avg_event_field(CPAP_IAP,0)+sess->weighted_avg_event_field(CPAP_EAP,0))/2.0; + sess->summary[CPAP_PressureMinAchieved]=sess->min_event_field(CPAP_IAP,0); + sess->summary[CPAP_PressureMaxAchieved]=sess->max_event_field(CPAP_EAP,0); + } else { + sess->summary[CPAP_PressureMedian]=sess->avg_event_field(CPAP_Pressure,0); + sess->summary[CPAP_PressureAverage]=sess->weighted_avg_event_field(CPAP_Pressure,0); + sess->summary[CPAP_PressureMinAchieved]=sess->min_event_field(CPAP_Pressure,0); + sess->summary[CPAP_PressureMaxAchieved]=sess->max_event_field(CPAP_Pressure,0); + } sess->summary[CPAP_LeakMinimum]=sess->min_event_field(CPAP_Leak,0); sess->summary[CPAP_LeakMaximum]=sess->max_event_field(CPAP_Leak,0); // should be merged.. @@ -346,6 +361,7 @@ bool PRS1Loader::OpenSummary(Session *session,wxString filename) if (!date.IsValid()) return false; + memset(m_buffer,0,size); unsigned char * buffer=m_buffer; br=f.Read(buffer,size); if (brset_first(date); + session->set_last(date); double max; session->summary[CPAP_PressureMin]=(double)buffer[0x03]/10.0; session->summary[CPAP_PressureMax]=max=(double)buffer[0x04]/10.0; @@ -383,6 +400,8 @@ bool PRS1Loader::OpenSummary(Session *session,wxString filename) session->summary[PRS1_ShowAHI]=(buffer[0x0c]&0x04)==0x04; int duration=buffer[0x14] | (buffer[0x15] << 8); + session->summary[CPAP_Duration]=(long)duration; + wxLogMessage(wxString::Format(wxT("%i"),duration)); float hours=float(duration)/3600.0; session->set_hours(hours); @@ -397,13 +416,14 @@ bool PRS1Loader::OpenSummary(Session *session,wxString filename) if (max==0) { session->summary[CPAP_PressureAverage]=session->summary[CPAP_PressureMin]; } + if (size==0x4d) { - session->summary[CPAP_Obstructive]=(long)buffer[0x1C] | (buffer[0x1D] << 8); - session->summary[CPAP_ClearAirway]=(long)buffer[0x20] | (buffer[0x21] << 8); - session->summary[CPAP_Hypopnea]=(long)buffer[0x2A] | (buffer[0x2B] << 8); - session->summary[CPAP_RERA]=(long)buffer[0x2E] | (buffer[0x2F] << 8); - session->summary[CPAP_FlowLimit]=(long)buffer[0x30] | (buffer[0x31] << 8); - + session->summary[CPAP_Obstructive]=(long)buffer[0x1C] | (buffer[0x1D] << 8); + session->summary[CPAP_ClearAirway]=(long)buffer[0x20] | (buffer[0x21] << 8); + session->summary[CPAP_Hypopnea]=(long)buffer[0x2A] | (buffer[0x2B] << 8); + session->summary[CPAP_RERA]=(long)buffer[0x2E] | (buffer[0x2F] << 8); + session->summary[CPAP_FlowLimit]=(long)buffer[0x30] | (buffer[0x31] << 8); + } return true; } @@ -466,8 +486,10 @@ bool PRS1Loader::Parse002(Session *session,unsigned char *buffer,int size,time_t session->AddEvent(new Event(tt,PRS1_VSnore2, {data1})); } } else if (code==0x03) { - session->AddEvent(new Event(t,CPAP_EAP, {data0,data1})); - session->AddEvent(new Event(t,CPAP_IAP, {data1})); + data0/=10.0; + data1/=10.0; + session->AddEvent(new Event(t,CPAP_EAP, {data1,data0})); + session->AddEvent(new Event(t,CPAP_IAP, {data0})); } else { session->AddEvent(new Event(t,cpapcode, {data0,data1})); } @@ -655,6 +677,7 @@ bool PRS1Loader::OpenWaveforms(Session *session,wxString filename) } Waveform *w=new Waveform(start,CPAP_FlowRate,data,samples,duration,min,max); + //wxLogMessage(wxString::Format(wxT("%i %i %i %i %i"),start,samples,duration,min,max)); session->AddWaveform(w); //wxLogMessage(wxT("Done PRS1 Waveforms ")+filename); return true; diff --git a/version.h b/version.h index 9b2ee28a..4f0ddd69 100644 --- a/version.h +++ b/version.h @@ -4,7 +4,7 @@ namespace AutoVersion{ //Date Version Types - static const char DATE[] = "28"; + static const char DATE[] = "29"; static const char MONTH[] = "05"; static const char YEAR[] = "2011"; static const char UBUNTU_VERSION_STYLE[] = "11.05"; @@ -16,14 +16,14 @@ namespace AutoVersion{ //Standard Version Type static const long MAJOR = 0; static const long MINOR = 7; - static const long BUILD = 1639; - static const long REVISION = 3455; + static const long BUILD = 1721; + static const long REVISION = 3923; //Miscellaneous Version Types - static const long BUILDS_COUNT = 5668; - #define RC_FILEVERSION 0,7,1639,3455 - #define RC_FILEVERSION_STRING "0, 7, 1639, 3455\0" - static const char FULLVERSION_STRING[] = "0.7.1639.3455"; + static const long BUILDS_COUNT = 5906; + #define RC_FILEVERSION 0,7,1721,3923 + #define RC_FILEVERSION_STRING "0, 7, 1721, 3923\0" + static const char FULLVERSION_STRING[] = "0.7.1721.3923"; //These values are to keep track of your versioning state, don't modify them. static const long BUILD_HISTORY = 62;