ResmedLoader STUB.

This commit is contained in:
Mark Watkins 2011-06-28 12:21:38 +10:00
parent f51982388b
commit a39745ffb8
5 changed files with 154 additions and 8 deletions

View File

@ -0,0 +1,100 @@
/*
SleepLib ResMed Loader Implementation
Author: Mark Watkins <jedimark64@users.sourceforge.net>
License: GPL
*/
#include <QString>
#include <QDateTime>
#include <QDir>
#include <QFile>
#include <QMessageBox>
#include <QProgressBar>
#include "resmed_loader.h"
#include "SleepLib/session.h"
ResmedLoader::ResmedLoader()
{
}
ResmedLoader::~ResmedLoader()
{
}
Machine *ResmedLoader::CreateMachine(QString serial,Profile *profile)
{
qDebug(("Create ResMed Machine "+serial).toLatin1());
assert(profile!=NULL);
vector<Machine *> ml=profile->GetMachines(MT_CPAP);
bool found=false;
for (vector<Machine *>::iterator i=ml.begin(); i!=ml.end(); i++) {
if (((*i)->GetClass()=="ResMed") && ((*i)->properties["Serial"]==serial)) {
ResmedList[serial]=*i; //static_cast<CPAP *>(*i);
found=true;
break;
}
}
if (found) return ResmedList[serial];
Machine *m=new CPAP(profile,0);
ResmedList[serial]=m;
profile->AddMachine(m);
m->properties["Serial"]=serial;
return m;
}
bool ResmedLoader::Open(QString & path,Profile *profile)
{
QString newpath;
QString dirtag="DATALOG";
if (path.endsWith("/"+dirtag)) {
newpath=path;
} else {
newpath=path+"/"+dirtag;
}
QDir dir(newpath);
if ((!dir.exists() || !dir.isReadable()))
return 0;
qDebug(("ResmedLoader::Open newpath="+newpath).toLatin1());
dir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Name);
QFileInfoList flist=dir.entryInfoList();
list<QString> SerialNumbers;
list<QString>::iterator sn;
for (int i=0;i<flist.size();i++) {
QFileInfo fi=flist.at(i);
QString filename=fi.fileName();
}
return 0;
}
void ResInitModelMap()
{
// ModelMap[34]="S9 with some weird feature";
};
bool resmed_initialized=false;
void ResmedLoader::Register()
{
if (resmed_initialized) return;
qDebug("Registering ResmedLoader");
RegisterLoader(new ResmedLoader());
ResInitModelMap();
resmed_initialized=true;
}

View File

@ -0,0 +1,44 @@
/*
SleepLib RESMED Loader Header
Author: Mark Watkins <jedimark64@users.sourceforge.net>
License: GPL
*/
#ifndef RESMED_LOADER_H
#define RESMED_LOADER_H
//#include <map>
//using namespace std;
#include "SleepLib/machine.h" // Base class: MachineLoader
#include "SleepLib/machine_loader.h"
#include "SleepLib/profiles.h"
//********************************************************************************************
/// IMPORTANT!!!
//********************************************************************************************
// Please INCREMENT the following value when making changes to this loaders implementation.
//
const int resmed_data_version=1;
//
//********************************************************************************************
const QString resmed_class_name="ResMed";
class ResmedLoader : public MachineLoader
{
public:
ResmedLoader();
virtual ~ResmedLoader();
virtual bool Open(QString & path,Profile *profile);
virtual int Version() { return resmed_data_version; };
virtual const QString & ClassName() { return resmed_class_name; };
Machine *CreateMachine(QString serial,Profile *profile);
static void Register();
protected:
map<QString,Machine *> ResmedList;
};
#endif // RESMED_LOADER_H

View File

@ -56,7 +56,8 @@ SOURCES += main.cpp\
Graphs/glcommon.cpp \
Graphs/gTitle.cpp \
Graphs/gCandleStick.cpp \
Graphs/gBarChart.cpp
Graphs/gBarChart.cpp \
SleepLib/loader_plugins/resmed_loader.cpp
HEADERS += \
SleepLib/binary_file.h \
@ -90,7 +91,8 @@ HEADERS += \
Graphs/glcommon.h \
Graphs/gTitle.h \
Graphs/gCandleStick.h \
Graphs/gBarChart.h
Graphs/gBarChart.h \
SleepLib/loader_plugins/resmed_loader.h
FORMS += \
daily.ui \

View File

@ -7,11 +7,10 @@ p,a,td,body { font-size: 14px }
</head>
<body leftmargin=0 topmargin=0 rightmargin=0>
<table width="100%" cellspacing=0 cellpadding=0 border=0 >
<tr><td bgcolor="#d0d0d0" colspan=2 cellpadding=6 valign=center align=center>
<font color="black"><h2>Welcome to SleepyHead</h2></font>
</td></tr>
<tr><td bgcolor="#d0d0d0" colspan=2 cellpadding=12 valign=center align=center><font color="black"><h1>Welcome to SleepyHead</h1></font></td></tr>
<tr>
<td valign="top" cellpadding=6>
&nbsp;<br>
<p>This software assists you in reviewing data at home for your CPAP Machine, Oximeter, Sleep Stage monitors, as well as help you track general issues related to sleep health.</p>
<p>Currenly supports the following machines:</p>
<li>Philips Respironics System One</li>
@ -30,8 +29,8 @@ p,a,td,body { font-size: 14px }
<p><b>Copyright:</b> &copy;2011 Mark Watkins (jedimark)</p>
<p><b>License:</b> This software is released freely under the GNU Public License.</p>
<p><i>This software comes with absolutely no warranty, either express of implied. It comes with no guarantee of fitness for any particular purpose.
No guarantees are made to the accuracy or usefulness of any data displayed.</p>
<p><b>It would very unwise to rely soley on this software for making medical decisions. Talk to your doctor.</b></i></p>
No guarantees are made to the accuracy or usefulness of any data displayed.</i></p>
<p><b>It would very unwise to rely soley on this software when making medical decisions. Talk to your doctor.</b></p>
</td></tr>
</table>
</body>

View File

@ -14,7 +14,7 @@
#include "SleepLib/loader_plugins/prs1_loader.h"
#include "SleepLib/loader_plugins/cms50_loader.h"
#include "SleepLib/loader_plugins/zeo_loader.h"
#include "SleepLib/loader_plugins/resmed_loader.h"
int main(int argc, char *argv[])
@ -33,6 +33,7 @@ int main(int argc, char *argv[])
PRS1Loader::Register();
CMS50Loader::Register();
ZEOLoader::Register();
ResmedLoader::Register();