OSCAR-code/oscar/SleepLib/loader_plugins/cms50f37_loader.h

154 lines
3.3 KiB
C
Raw Normal View History

/* SleepLib CMS50X Loader Header
2014-08-17 23:29:30 +00:00
*
* Copyright (C) 2011-2018 Mark Watkins <mark@jedimark.net>
2014-08-17 23:29:30 +00:00
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of the source code
* for more details. */
2014-08-17 23:29:30 +00:00
#ifndef CMS50F37LOADER_H
#define CMS50F37LOADER_H
#include "SleepLib/serialoximeter.h"
const QString cms50f37_class_name = "CMS50F37";
const int cms50f37_data_version = 0;
/*! \class CMS5037Loader
\brief Bulk Importer for newer CMS50 oximeters
*/
class CMS50F37Loader : public SerialOximeter
{
Q_OBJECT
public:
CMS50F37Loader();
virtual ~CMS50F37Loader();
virtual bool Detect(const QString &path);
virtual int Open(const QString & path);
2014-08-18 00:34:41 +00:00
virtual bool openDevice();
2014-08-17 23:29:30 +00:00
static void Register();
virtual int Version() { return cms50f37_data_version; }
virtual const QString &loaderName() { return cms50f37_class_name; }
virtual MachineInfo newInfo() {
return MachineInfo(MT_OXIMETER, 0, cms50f37_class_name, QObject::tr("Contec"), QObject::tr("CMS50F3.7"), QString(), QString(), QObject::tr("CMS50F"), QDateTime::currentDateTime(), cms50f37_data_version);
}
// Machine *CreateMachine();
virtual void process();
virtual bool isStartTimeValid() { return !cms50dplus; }
2014-08-17 23:29:30 +00:00
2014-08-19 02:44:48 +00:00
virtual QString getUser();
virtual QString getModel();
virtual QString getVendor();
virtual QString getDeviceString();
virtual QDateTime getDateTime(int session);
virtual int getDuration(int session);
virtual int getSessionCount();
virtual int getUserCount();
2014-08-19 02:44:48 +00:00
virtual int getOximeterInfo();
virtual void eraseSession(int user, int session);
2014-08-19 02:44:48 +00:00
virtual void syncClock();
virtual QString getDeviceID();
virtual void setDeviceID(const QString &);
2014-08-19 17:29:39 +00:00
virtual void setDuration(int d) { duration=d; }
2014-08-19 02:44:48 +00:00
virtual bool commandDriven() { return true; }
virtual void getSessionData(int session);
2014-08-19 02:44:48 +00:00
// Switch device to record transmission mode
void requestData();
2014-08-17 23:29:30 +00:00
protected slots:
// virtual void dataAvailable();
virtual void resetImportTimeout();
virtual void startImportTimeout();
virtual void shutdownPorts();
void nextCommand();
protected:
bool readSpoRFile(const QString & path);
2014-08-17 23:29:30 +00:00
virtual void processBytes(QByteArray bytes);
2014-08-18 08:00:21 +00:00
// int doLiveMode();
2014-08-17 23:29:30 +00:00
virtual void killTimers();
2014-08-19 04:01:31 +00:00
void sendCommand(quint8 c);
void sendCommand(quint8 c, quint8 c2);
2014-08-17 23:29:30 +00:00
// Switch device to live streaming mode
virtual void resetDevice();
private:
2014-08-18 14:35:30 +00:00
2014-08-17 23:29:30 +00:00
int sequence;
EventList *PULSE;
EventList *SPO2;
QTime m_time;
QByteArray buffer;
bool started_import;
bool finished_import;
bool started_reading;
bool cms50dplus;
2014-08-17 23:29:30 +00:00
int cb_reset,imp_callbacks;
int received_bytes;
int importCount;
2014-08-17 23:29:30 +00:00
int m_itemCnt;
int m_itemTotal;
2014-08-18 08:00:21 +00:00
QDate imp_date;
QTime imp_time;
2014-08-17 23:29:30 +00:00
QString userName;
2014-08-19 02:44:48 +00:00
unsigned char current_command;
volatile int session_count;
volatile int duration;
volatile int userCount;
volatile int userIdx;
volatile int protocolVersion;
2014-08-19 02:44:48 +00:00
int device_info;
QString model;
QString vendor;
QString devid;
2014-08-19 02:44:48 +00:00
int duration_divisor;
int selected_session;
int timectr;
2014-09-19 03:19:11 +00:00
int modelsegments;
2014-08-17 23:29:30 +00:00
};
#endif // CMS50F37LOADER_H