2020-01-23 17:51:58 +00:00
|
|
|
/* SleepLib Viatom Loader Header
|
|
|
|
*
|
|
|
|
* Copyright (c) 2019 The OSCAR Team (written by dave madden <dhm@mersenne.com>)
|
|
|
|
*
|
|
|
|
* 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. */
|
|
|
|
|
|
|
|
#ifndef VIATOMLOADER_H
|
|
|
|
#define VIATOMLOADER_H
|
|
|
|
|
|
|
|
#include "SleepLib/machine_loader.h"
|
|
|
|
|
|
|
|
const QString viatom_class_name = "Viatom";
|
|
|
|
const int viatom_data_version = 1;
|
|
|
|
|
|
|
|
|
|
|
|
/*! \class ViatomLoader
|
|
|
|
\brief Unfinished stub for loading Viatom Sleep Ring / Wrist Pulse Oximeter data
|
|
|
|
*/
|
|
|
|
class ViatomLoader : public MachineLoader
|
|
|
|
{
|
|
|
|
public:
|
2020-01-23 20:03:23 +00:00
|
|
|
ViatomLoader() { m_type = MT_OXIMETER; }
|
2020-01-23 17:51:58 +00:00
|
|
|
virtual ~ViatomLoader() { }
|
|
|
|
|
|
|
|
virtual bool Detect(const QString & path);
|
|
|
|
|
|
|
|
virtual int Open(const QString & path);
|
|
|
|
virtual int OpenFile(const QString & filename);
|
2020-01-24 00:11:05 +00:00
|
|
|
Session* ParseFile(const QString & filename);
|
|
|
|
void SaveSessionToDatabase(Session* session);
|
2020-01-23 17:51:58 +00:00
|
|
|
|
2020-01-24 00:25:06 +00:00
|
|
|
static void Register();
|
2020-01-23 17:51:58 +00:00
|
|
|
|
|
|
|
virtual int Version() { return viatom_data_version; }
|
|
|
|
virtual const QString &loaderName() { return viatom_class_name; }
|
|
|
|
|
|
|
|
virtual MachineInfo newInfo() {
|
2020-01-23 20:03:23 +00:00
|
|
|
return MachineInfo(MT_OXIMETER, 0, viatom_class_name, QObject::tr("Viatom"), QString(), QString(), QString(), QObject::tr("Viatom Software"), QDateTime::currentDateTime(), viatom_data_version);
|
2020-01-23 17:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//Machine *CreateMachine();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
private:
|
|
|
|
};
|
|
|
|
|
2020-01-24 20:20:00 +00:00
|
|
|
class ViatomFile
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct Record
|
|
|
|
{
|
|
|
|
unsigned char spo2;
|
|
|
|
unsigned char hr;
|
|
|
|
unsigned char _unk1;
|
|
|
|
unsigned char motion;
|
|
|
|
unsigned char _unk2;
|
|
|
|
};
|
|
|
|
ViatomFile(QFile & file);
|
|
|
|
~ViatomFile() = default;
|
|
|
|
|
|
|
|
bool ParseHeader();
|
|
|
|
QList<Record> ReadData();
|
|
|
|
SessionID sessionid() const { return m_id; }
|
|
|
|
quint64 timestamp() const { return m_timestamp; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
QFile & m_file;
|
|
|
|
quint64 m_timestamp;
|
|
|
|
SessionID m_id;
|
|
|
|
};
|
|
|
|
|
2020-01-23 17:51:58 +00:00
|
|
|
#endif // VIATOMLOADER_H
|