From 3e64de984eaf76bcdb99a4f27cba39e133202a14 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sun, 20 Nov 2011 12:59:00 +1000 Subject: [PATCH] DeVilbiss Intellipap Loader stub --- SleepLib/loader_plugins/intellipap_loader.cpp | 72 +++++++++++++++++++ SleepLib/loader_plugins/intellipap_loader.h | 54 ++++++++++++++ SleepyHeadQT.pro | 8 ++- preferencesdialog.ui | 3 + 4 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 SleepLib/loader_plugins/intellipap_loader.cpp create mode 100644 SleepLib/loader_plugins/intellipap_loader.h diff --git a/SleepLib/loader_plugins/intellipap_loader.cpp b/SleepLib/loader_plugins/intellipap_loader.cpp new file mode 100644 index 00000000..cc93c35a --- /dev/null +++ b/SleepLib/loader_plugins/intellipap_loader.cpp @@ -0,0 +1,72 @@ +/* + +SleepLib (DeVilbiss) Intellipap Loader Implementation + +Author: Mark Watkins +License: GPL +*/ + +#include "intellipap_loader.h" + +Intellipap::Intellipap(Profile *p,MachineID id) + :CPAP(p,id) +{ + m_class=intellipap_class_name; + properties["Brand"]="DeVilbiss"; + properties["Model"]="Intellipap"; +} + +Intellipap::~Intellipap() +{ +} + +IntellipapLoader::IntellipapLoader() +{ +} + +IntellipapLoader::~IntellipapLoader() +{ +} + +int IntellipapLoader::Open(QString & path,Profile *profile) +{ + return 0; +} + +Machine *IntellipapLoader::CreateMachine(QString serial,Profile *profile) +{ + if (!profile) + return NULL; + qDebug() << "Create Machine " << serial; + + QVector ml=profile->GetMachines(MT_CPAP); + bool found=false; + QVector::iterator i; + for (i=ml.begin(); i!=ml.end(); i++) { + if (((*i)->GetClass()==intellipap_class_name) && ((*i)->properties["Serial"]==serial)) { + MachList[serial]=*i; //static_cast(*i); + found=true; + break; + } + } + if (found) return *i; + + Machine *m=new Intellipap(profile,0); + + MachList[serial]=m; + profile->AddMachine(m); + + m->properties["Serial"]=serial; + return m; +} + + +bool intellipap_initialized=false; +void IntellipapLoader::Register() +{ + if (intellipap_initialized) return; + qDebug() << "Registering IntellipapLoader"; + RegisterLoader(new IntellipapLoader()); + //InitModelMap(); + intellipap_initialized=true; +} diff --git a/SleepLib/loader_plugins/intellipap_loader.h b/SleepLib/loader_plugins/intellipap_loader.h new file mode 100644 index 00000000..5f6f3dd2 --- /dev/null +++ b/SleepLib/loader_plugins/intellipap_loader.h @@ -0,0 +1,54 @@ +#ifndef INTELLIPAP_LOADER_H +#define INTELLIPAP_LOADER_H + +#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 intellipap_data_version=0; +// +//******************************************************************************************** + +class Intellipap:public CPAP +{ +public: + Intellipap(Profile *p,MachineID id=0); + virtual ~Intellipap(); +}; + + +const int intellipap_load_buffer_size=1024*1024; + + +const QString intellipap_class_name="Intellipap"; + +class IntellipapLoader : public MachineLoader +{ +public: + IntellipapLoader(); + virtual ~IntellipapLoader(); + virtual int Open(QString & path,Profile *profile); + virtual int Version() { return intellipap_data_version; } + virtual const QString & ClassName() { return intellipap_class_name; } + Machine *CreateMachine(QString serial,Profile *profile); + static void Register(); +protected: + QString last; + QHash MachList; + /*int OpenMachine(Machine *m,QString path,Profile *profile); + bool ParseProperties(Machine *m,QString filename); + bool OpenSummary(Session *session,QString filename); + bool OpenEvents(Session *session,QString filename); + bool OpenWaveforms(Session *session,QString filename);*/ + + unsigned char * m_buffer; +}; + + +#endif // INTELLIPAP_LOADER_H diff --git a/SleepyHeadQT.pro b/SleepyHeadQT.pro index 0f5d75b4..4c8bd4ee 100644 --- a/SleepyHeadQT.pro +++ b/SleepyHeadQT.pro @@ -67,7 +67,8 @@ SOURCES += main.cpp\ profileselect.cpp \ newprofile.cpp \ exportcsv.cpp \ - common_gui.cpp + common_gui.cpp \ + SleepLib/loader_plugins/intellipap_loader.cpp unix:SOURCES += qextserialport/posix_qextserialport.cpp unix:!macx:SOURCES += qextserialport/qextserialenumerator_unix.cpp @@ -122,7 +123,8 @@ HEADERS += \ profileselect.h \ newprofile.h \ exportcsv.h \ - common_gui.h + common_gui.h \ + SleepLib/loader_plugins/intellipap_loader.h FORMS += \ @@ -157,3 +159,5 @@ OTHER_FILES += \ + + diff --git a/preferencesdialog.ui b/preferencesdialog.ui index 713ae60f..9233bdf2 100644 --- a/preferencesdialog.ui +++ b/preferencesdialog.ui @@ -234,6 +234,9 @@ This takes extra space, and has been known to cause problems on certain computer 2 + + QLCDNumber::Flat +