CMS50 Progress Bar stuff

This commit is contained in:
Mark Watkins 2011-06-07 12:23:26 +10:00
parent 7c46b36b53
commit a3fb5b1c34
3 changed files with 38 additions and 26 deletions

View File

@ -8295,7 +8295,7 @@
<sleeplib/machine.h> <sleeplib/machine.h>
<list> <list>
1307412369 /home/mark/projects/git/sleepyhead/src/version.h 1307413369 /home/mark/projects/git/sleepyhead/src/version.h
1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/prs1_loader.h 1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/prs1_loader.h
"machine.h" "machine.h"
@ -8413,7 +8413,7 @@
1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.h 1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.h
"sleeplib/machine_loader.h" "sleeplib/machine_loader.h"
1307412363 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.cpp 1307413299 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.cpp
<wx/log.h> <wx/log.h>
<wx/progdlg.h> <wx/progdlg.h>
"cms50_loader.h" "cms50_loader.h"

View File

@ -32,6 +32,7 @@ bool CMS50Loader::Open(wxString & path,Profile *profile)
// Data Folder // Data Folder
// SpO2 Review.ini // SpO2 Review.ini
// SpO2.ini // SpO2.ini
assert(profile!=NULL);
wxString tmp=path+wxFileName::GetPathSeparator()+wxT("Data"); wxString tmp=path+wxFileName::GetPathSeparator()+wxT("Data");
if ((wxFileExists(path+wxFileName::GetPathSeparator()+wxT("SpO2 Review.ini"))) if ((wxFileExists(path+wxFileName::GetPathSeparator()+wxT("SpO2 Review.ini")))
@ -48,11 +49,17 @@ bool CMS50Loader::Open(wxString & path,Profile *profile)
} }
bool CMS50Loader::OpenCMS50(wxString & path, Profile *profile) bool CMS50Loader::OpenCMS50(wxString & path, Profile *profile)
{ {
wxDir dir;
if (!dir.Open(path)) return false;
list<wxString> files;
wxString filename,pathname; wxString filename,pathname;
list<wxString> files;
wxDir dir;
if (!dir.Open(path)) return false;
if(loader_progress) {
loader_progress->Update(0);
}
bool cont=dir.GetFirst(&filename); bool cont=dir.GetFirst(&filename);
@ -62,6 +69,8 @@ bool CMS50Loader::OpenCMS50(wxString & path, Profile *profile)
files.push_back(pathname); files.push_back(pathname);
} }
cont=dir.GetNext(&filename); cont=dir.GetNext(&filename);
if (loader_progress) loader_progress->Pulse();
} }
int size=files.size(); int size=files.size();
if (size==0) return false; if (size==0) return false;
@ -69,17 +78,31 @@ bool CMS50Loader::OpenCMS50(wxString & path, Profile *profile)
Machine *mach=CreateMachine(profile); Machine *mach=CreateMachine(profile);
int cnt=0; int cnt=0;
for (list<wxString>::iterator n=files.begin();n!=files.end();n++,++cnt) { for (list<wxString>::iterator n=files.begin();n!=files.end();n++,++cnt) {
if (loader_progress) loader_progress->Update((float(cnt)/float(size)*100.0)); if (loader_progress) loader_progress->Update((float(cnt)/float(size)*50.0));
OpenSPORFile((*n),mach,profile); OpenSPORFile((*n),mach,profile);
} }
mach->Save(); mach->Save();
if (loader_progress) loader_progress->Update(100);
return true; return true;
} }
bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile) bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile)
{ {
assert(mach!=NULL);
assert(profile!=NULL);
wxFFile f; wxFFile f;
unsigned char tmp[256]; unsigned char tmp[256];
if (!f.Open(path,wxT("rb"))) return false;
__int16_t data_starts;
__int16_t some_code;
__int16_t some_more_code;
int num_records;
int br;
if (!f.Open(path,wxT("rb")))
return false;
// Find everything after the last _
wxString str=path.AfterLast(wxChar('_')); wxString str=path.AfterLast(wxChar('_'));
wxString id=str.BeforeFirst(wxChar('.')); wxString id=str.BeforeFirst(wxChar('.'));
@ -91,14 +114,6 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile)
if (mach->SessionExists(sessid)) if (mach->SessionExists(sessid))
return false; // Already imported return false; // Already imported
// Find everything after the last _
short data_starts;
short some_code;
int num_records;
short some_more_code;
int br;
br=f.Read(tmp,2); br=f.Read(tmp,2);
if (br!=2) return false; if (br!=2) return false;
@ -223,10 +238,7 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile)
} }
Machine *CMS50Loader::CreateMachine(Profile *profile) Machine *CMS50Loader::CreateMachine(Profile *profile)
{ {
if (!profile) { // shouldn't happen.. assert(profile!=NULL);
wxLogError(wxT("No Profile!"));
return NULL;
}
// NOTE: This only allows for one CMS50 machine per profile.. // NOTE: This only allows for one CMS50 machine per profile..
// Upgrading their oximeter will use this same record.. // Upgrading their oximeter will use this same record..

View File

@ -16,14 +16,14 @@ namespace AutoVersion{
//Standard Version Type //Standard Version Type
static const long MAJOR = 0; static const long MAJOR = 0;
static const long MINOR = 7; static const long MINOR = 7;
static const long BUILD = 3342; static const long BUILD = 3347;
static const long REVISION = 1381; static const long REVISION = 1415;
//Miscellaneous Version Types //Miscellaneous Version Types
static const long BUILDS_COUNT = 520; static const long BUILDS_COUNT = 529;
#define RC_FILEVERSION 0,7,3342,1381 #define RC_FILEVERSION 0,7,3347,1415
#define RC_FILEVERSION_STRING "0, 7, 3342, 1381\0" #define RC_FILEVERSION_STRING "0, 7, 3347, 1415\0"
static const char FULLVERSION_STRING[] = "0.7.3342.1381"; static const char FULLVERSION_STRING[] = "0.7.3347.1415";
//These values are to keep track of your versioning state, don't modify them. //These values are to keep track of your versioning state, don't modify them.
static const long BUILD_HISTORY = 0; static const long BUILD_HISTORY = 0;