More cms50 stub work

This commit is contained in:
Mark Watkins 2011-06-05 21:51:51 +10:00
parent ef6a590c69
commit 508ec5f261
5 changed files with 55 additions and 5 deletions

View File

@ -8231,7 +8231,7 @@
<wx/datectrl.h>
<wx/dateevt.h>
1307245852 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadApp.cpp
1307273168 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadApp.cpp
"wx_pch.h"
<iostream>
<wx/log.h>
@ -8242,6 +8242,7 @@
"SleepyHeadMain.h"
"version.h"
"sleeplib/prs1_loader.h"
"sleeplib/loader_plugins/cms50_loader.h"
"sleeplib/profiles.h"
1307245704 /home/mark/projects/git/sleepyhead/src/SleepyHeadApp.h
@ -8407,3 +8408,10 @@
"tinyxml.h"
<windows.h>
1307273487 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.h
"../machine_loader.h"
1307273113 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.cpp
<wx/log.h>
"cms50_loader.h"

View File

@ -27,6 +27,8 @@
#include "version.h"
#include "sleeplib/prs1_loader.h"
#include "sleeplib/loader_plugins/cms50_loader.h"
#include "sleeplib/profiles.h"
IMPLEMENT_APP(SleepyHeadApp);
@ -56,6 +58,7 @@ bool SleepyHeadApp::OnInit()
SetAppName(_("SleepyHead"));
PRS1Loader::Register();
CMS50Loader::Register();
Profiles::Scan();
//loader_progress->Show();

View File

@ -5,7 +5,9 @@ Author: Mark Watkins <jedimark64@users.sourceforge.net>
License: GPL
*/
#include <wx/log.h>
#include "cms50_loader.h"
#include "../machine.h"
CMS50Loader::CMS50Loader()
{
@ -16,9 +18,43 @@ CMS50Loader::~CMS50Loader()
{
//dtor
}
bool CMS50Loader::Open(wxString & path,Profile *profile)
{
// CMS50 folder structure detection stuff here.
return false;
}
Machine *CreateMachine(Profile *profile)
{
if (!profile) { // shouldn't happen..
wxLogMessage(wxT("No Profile!"));
return NULL;
}
vector<Machine *> ml=profile->GetMachines(MT_OXIMETER);
bool found=false;
for (vector<Machine *>::iterator i=ml.begin(); i!=ml.end(); i++) {
if ((*i)->GetClass()==wxT("CMS50")) {
return (*i);
break;
}
}
wxLogMessage(wxT("Create CMS50"));
Machine *m=new Oximeter(profile,0);
m->SetClass(wxT("CMS50"));
m->properties[wxT("Brand")]=wxT("Contec");
m->properties[wxT("Model")]=wxT("CMS50X");
profile->AddMachine(m);
return m;
}
bool cms50_initialized=false;
static bool cms50_initialized=false;
void CMS50Loader::Register()
{
if (cms50_initialized) return;

View File

@ -8,7 +8,7 @@ License: GPL
#ifndef CMS50LOADER_H
#define CMS50LOADER_H
#include <machine_loader.h>
#include "../machine_loader.h"
class CMS50Loader : public MachineLoader
@ -19,6 +19,8 @@ class CMS50Loader : public MachineLoader
virtual bool Open(wxString & path,Profile *profile);
static void Register();
Machine *CreateMachine(Profile *profile);
protected:
private:
};

View File

@ -23,6 +23,7 @@ extern wxProgressDialog *loader_progress;
map<int,wxString> ModelMap;
// This class technically isn't needed now.. as long as m_class, Brand & Model is set, things should be fine.
PRS1::PRS1(Profile *p,MachineID id):CPAP(p,id)
{
m_class=wxT("PRS1");
@ -52,7 +53,7 @@ PRS1Loader::~PRS1Loader()
Machine *PRS1Loader::CreateMachine(wxString serial,Profile *profile)
{
wxLogMessage(wxT("Create Machine ")+serial);
if (!profile) {
if (!profile) { // shouldn't happen..
wxLogMessage(wxT("No Profile!"));
return NULL;
@ -101,7 +102,7 @@ bool PRS1Loader::Open(wxString & path,Profile *profile)
wxString filename;
bool cont=dir.GetFirst(&filename);
if(!cont) wxLogDebug( wxT("PRS1Loader::Open - Failed to get first directory entry. '") + filename + wxT("'") );
while (cont) {