mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 02:30:44 +00:00
Move PRS1DataChunk into parser header and clean up dependencies.
Also move some previously static functions into their associated classes,
which lets us remove a few unnecessary wrapper functions used for testing.
No change in functionality.
Use git blame dd9a087
to follow the history before this refactoring.
This commit is contained in:
parent
0a996cde73
commit
daaed2de79
@ -2288,6 +2288,22 @@ bool PRS1DataChunk::ParseEventsF5V2(void)
|
||||
}
|
||||
|
||||
|
||||
PRS1Import::~PRS1Import()
|
||||
{
|
||||
delete compliance;
|
||||
delete summary;
|
||||
for (auto & e : m_event_chunks.values()) {
|
||||
delete e;
|
||||
}
|
||||
for (int i=0;i < waveforms.size(); ++i) {
|
||||
delete waveforms.at(i);
|
||||
}
|
||||
for (auto & c : oximetry) {
|
||||
delete c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PRS1Import::CreateEventChannels(const PRS1DataChunk* chunk)
|
||||
{
|
||||
const QVector<PRS1ParsedEventType> & supported = GetSupportedEvents(chunk);
|
||||
|
@ -56,218 +56,8 @@ struct PRS1Waveform {
|
||||
};
|
||||
|
||||
|
||||
/*! \class PRS1DataChunk
|
||||
* \brief Representing a chunk of event/summary/waveform data after the header is parsed. */
|
||||
class PRS1DataChunk
|
||||
{
|
||||
public:
|
||||
/*
|
||||
PRS1DataChunk() {
|
||||
fileVersion = 0;
|
||||
blockSize = 0;
|
||||
htype = 0;
|
||||
family = 0;
|
||||
familyVersion = 0;
|
||||
ext = 255;
|
||||
sessionid = 0;
|
||||
timestamp = 0;
|
||||
|
||||
duration = 0;
|
||||
|
||||
m_filepos = -1;
|
||||
m_index = -1;
|
||||
}
|
||||
*/
|
||||
PRS1DataChunk(class RawDataDevice & f, class PRS1Loader* loader);
|
||||
~PRS1DataChunk();
|
||||
inline int size() const { return m_data.size(); }
|
||||
|
||||
QByteArray m_header;
|
||||
QByteArray m_data;
|
||||
QByteArray m_headerblock;
|
||||
QList<class PRS1ParsedEvent*> m_parsedData;
|
||||
|
||||
QString m_path;
|
||||
qint64 m_filepos; // file offset
|
||||
int m_index; // nth chunk in file
|
||||
inline void SetIndex(int index) { m_index = index; }
|
||||
|
||||
// Common fields
|
||||
quint8 fileVersion;
|
||||
quint16 blockSize;
|
||||
quint8 htype;
|
||||
quint8 family;
|
||||
quint8 familyVersion;
|
||||
quint8 ext;
|
||||
SessionID sessionid;
|
||||
quint32 timestamp;
|
||||
|
||||
// Waveform-specific fields
|
||||
quint16 interval_count;
|
||||
quint8 interval_seconds;
|
||||
int duration;
|
||||
QList<PRS1Waveform> waveformInfo;
|
||||
|
||||
// V3 normal/non-waveform fields
|
||||
QMap<unsigned char, short> hblock;
|
||||
|
||||
QMap<unsigned char, QByteArray> mainblock;
|
||||
QMap<unsigned char, QByteArray> hbdata;
|
||||
|
||||
// Trailing common fields
|
||||
quint8 storedChecksum; // header checksum stored in file, last byte of m_header
|
||||
quint8 calcChecksum; // header checksum as calculated when parsing
|
||||
quint32 storedCrc; // header + data CRC stored in file, last 2-4 bytes of chunk
|
||||
quint32 calcCrc; // header + data CRC as calculated when parsing
|
||||
|
||||
//! \brief Calculate a simplistic hash to check whether two chunks are identical.
|
||||
inline quint64 hash(void) const { return ((((quint64) this->calcCrc) << 32) | this->timestamp); }
|
||||
|
||||
//! \brief Parse and return the next chunk from a PRS1 file
|
||||
static PRS1DataChunk* ParseNext(class RawDataDevice & f, class PRS1Loader* loader);
|
||||
|
||||
//! \brief Read and parse the next chunk header from a PRS1 file
|
||||
bool ReadHeader(class RawDataDevice & f);
|
||||
|
||||
//! \brief Read the chunk's data from a PRS1 file and calculate its CRC, must be called after ReadHeader
|
||||
bool ReadData(class RawDataDevice & f);
|
||||
|
||||
//! \brief Figures out which Compliance Parser to call, based on machine family/version and calls it.
|
||||
bool ParseCompliance(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .000 file containing compliance data for a P25x brick
|
||||
bool ParseComplianceF0V23(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .000 file containing compliance data for a P256x brick
|
||||
bool ParseComplianceF0V4(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .000 file containing compliance data for a x00V brick
|
||||
bool ParseComplianceF0V5(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .000 file containing compliance data for a DreamStation 200X brick
|
||||
bool ParseComplianceF0V6(void);
|
||||
|
||||
//! \brief Figures out which Summary Parser to call, based on machine family/version and calls it.
|
||||
bool ParseSummary();
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 0 CPAP/APAP family version 2 or 3 machine
|
||||
bool ParseSummaryF0V23(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 0 CPAP/APAP family version 4 machine
|
||||
bool ParseSummaryF0V4(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 0 CPAP/APAP family version 6 machine
|
||||
bool ParseSummaryF0V6(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 3 ventilator (family version 0 or 3) machine
|
||||
bool ParseSummaryF3V03(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 3 ventilator (family version 6) machine
|
||||
bool ParseSummaryF3V6(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 5 ASV family version 0-2 machine
|
||||
bool ParseSummaryF5V012(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 5 ASV family version 3 machine
|
||||
bool ParseSummaryF5V3(void);
|
||||
|
||||
//! \brief Parse a flex setting byte from a .000 or .001 containing compliance/summary data for CPAP/APAP family versions 2, 3, 4, or 5
|
||||
void ParseFlexSettingF0V2345(quint8 flex, int prs1mode);
|
||||
|
||||
//! \brief Parse a flex setting byte from a .000 or .001 containing compliance/summary data for ASV family versions 0, 1, or 2
|
||||
void ParseFlexSettingF5V012(quint8 flex, int prs1mode);
|
||||
|
||||
//! \brief Parse an humidifier setting byte from a .000 or .001 containing compliance/summary data for original System One (50-Series) machines: F0V23 and F5V0
|
||||
void ParseHumidifierSetting50Series(int humid, bool add_setting=false);
|
||||
|
||||
//! \brief Parse an humidifier setting byte from a .000 or .001 containing compliance/summary data for F0V4 and F5V012 (60-Series) machines
|
||||
void ParseHumidifierSetting60Series(unsigned char humid1, unsigned char humid2, bool add_setting=false);
|
||||
|
||||
//! \brief Parse an humidifier setting byte from a .000 or .001 containing compliance/summary data for F3V3 machines (differs from other 60-Series machines)
|
||||
void ParseHumidifierSettingF3V3(unsigned char humid1, unsigned char humid2, bool add_setting=false);
|
||||
|
||||
//! \brief Parse humidifier setting bytes from a .000 or .001 containing compliance/summary data for fileversion 3 machines
|
||||
void ParseHumidifierSettingV3(unsigned char byte1, unsigned char byte2, bool add_setting=false);
|
||||
|
||||
//! \brief Parse tubing type from a .001 containing summary data for fileversion 3 machines
|
||||
void ParseTubingTypeV3(unsigned char type);
|
||||
|
||||
//! \brief Figures out which Event Parser to call, based on machine family/version and calls it.
|
||||
bool ParseEvents(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 0 CPAP/APAP machine
|
||||
bool ParseEventsF0V23(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a 60 Series family 0 CPAP/APAP 60machine
|
||||
bool ParseEventsF0V4(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a DreamStation family 0 CPAP/APAP machine
|
||||
bool ParseEventsF0V6(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 3 ventilator family version 0 or 3 machine
|
||||
bool ParseEventsF3V03(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 3 ventilator family version 6 machine
|
||||
bool ParseEventsF3V6(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 0 machine
|
||||
bool ParseEventsF5V0(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 1 machine
|
||||
bool ParseEventsF5V1(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 2 machine
|
||||
bool ParseEventsF5V2(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 3 machine
|
||||
bool ParseEventsF5V3(void);
|
||||
|
||||
protected:
|
||||
class PRS1Loader* loader;
|
||||
|
||||
//! \brief Add a parsed event to the chunk
|
||||
void AddEvent(class PRS1ParsedEvent* event);
|
||||
|
||||
//! \brief Read and parse the non-waveform header data from a V2 PRS1 file
|
||||
bool ReadNormalHeaderV2(class RawDataDevice & f);
|
||||
|
||||
//! \brief Read and parse the non-waveform header data from a V3 PRS1 file
|
||||
bool ReadNormalHeaderV3(class RawDataDevice & f);
|
||||
|
||||
//! \brief Read and parse the waveform-specific header data from a PRS1 file
|
||||
bool ReadWaveformHeader(class RawDataDevice & f);
|
||||
|
||||
//! \brief Extract the stored CRC from the end of the data of a PRS1 chunk
|
||||
bool ExtractStoredCrc(int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF0V23(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF0V45(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF0V6(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF5V012(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF5V3(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF3V03(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF3V6(const unsigned char* data, int size);
|
||||
};
|
||||
|
||||
|
||||
#if UNITTEST_MODE
|
||||
QString _PRS1ParsedEventName(PRS1ParsedEvent* e);
|
||||
QMap<QString,QString> _PRS1ParsedEventContents(PRS1ParsedEvent* e);
|
||||
#endif
|
||||
|
||||
class PRS1DataChunk;
|
||||
class PRS1ParsedEvent;
|
||||
|
||||
class PRS1Loader;
|
||||
|
||||
@ -282,13 +72,7 @@ public:
|
||||
session = nullptr;
|
||||
m_currentSliceInitialized = false;
|
||||
}
|
||||
virtual ~PRS1Import() {
|
||||
delete compliance;
|
||||
delete summary;
|
||||
for (auto & e : m_event_chunks.values()) { delete e; }
|
||||
for (int i=0;i < waveforms.size(); ++i) { delete waveforms.at(i); }
|
||||
for (auto & c : oximetry) { delete c; }
|
||||
}
|
||||
virtual ~PRS1Import();
|
||||
|
||||
//! \brief PRS1Import thread starts execution here.
|
||||
virtual void run();
|
||||
|
@ -61,8 +61,9 @@ static QString hex(int i)
|
||||
}
|
||||
|
||||
#define ENUMSTRING(ENUM) case ENUM: s = QStringLiteral(#ENUM); break
|
||||
static QString parsedEventTypeName(PRS1ParsedEventType t)
|
||||
QString PRS1ParsedEvent::typeName() const
|
||||
{
|
||||
PRS1ParsedEventType t = m_type;
|
||||
QString s;
|
||||
switch (t) {
|
||||
ENUMSTRING(EV_PRS1_RAW);
|
||||
@ -116,8 +117,9 @@ static QString parsedEventTypeName(PRS1ParsedEventType t)
|
||||
return s.mid(8).toLower(); // lop off initial EV_PRS1_
|
||||
}
|
||||
|
||||
static QString parsedSettingTypeName(PRS1ParsedSettingType t)
|
||||
QString PRS1ParsedSettingEvent::settingName() const
|
||||
{
|
||||
PRS1ParsedSettingType t = m_setting;
|
||||
QString s;
|
||||
switch (t) {
|
||||
ENUMSTRING(PRS1_SETTING_CPAP_MODE);
|
||||
@ -172,8 +174,9 @@ static QString parsedSettingTypeName(PRS1ParsedSettingType t)
|
||||
return s.mid(13).toLower(); // lop off initial PRS1_SETTING_
|
||||
}
|
||||
|
||||
static QString parsedModeName(int m)
|
||||
QString PRS1ParsedSettingEvent::modeName() const
|
||||
{
|
||||
int m = value();
|
||||
QString s;
|
||||
switch ((PRS1Mode) m) {
|
||||
ENUMSTRING(PRS1_MODE_UNKNOWN); // TODO: Remove this when all the parsers are complete.
|
||||
@ -197,7 +200,7 @@ static QString parsedModeName(int m)
|
||||
return s.mid(10).toLower(); // lop off initial PRS1_MODE_
|
||||
}
|
||||
|
||||
static QString timeStr(int t)
|
||||
QString PRS1ParsedEvent::timeStr(int t)
|
||||
{
|
||||
int h = t / 3600;
|
||||
int m = (t - (h * 3600)) / 60;
|
||||
@ -224,16 +227,6 @@ static QString byteList(QByteArray data, int limit=-1)
|
||||
return s;
|
||||
}
|
||||
|
||||
QString _PRS1ParsedEventName(PRS1ParsedEvent* e)
|
||||
{
|
||||
return parsedEventTypeName(e->m_type);
|
||||
}
|
||||
|
||||
QMap<QString,QString> _PRS1ParsedEventContents(PRS1ParsedEvent* e)
|
||||
{
|
||||
return e->contents();
|
||||
}
|
||||
|
||||
|
||||
QMap<QString,QString> PRS1IntervalBoundaryEvent::contents(void)
|
||||
{
|
||||
@ -275,11 +268,11 @@ QMap<QString,QString> PRS1ParsedSettingEvent::contents(void)
|
||||
QMap<QString,QString> out;
|
||||
QString v;
|
||||
if (m_setting == PRS1_SETTING_CPAP_MODE) {
|
||||
v = parsedModeName(value());
|
||||
v = modeName();
|
||||
} else {
|
||||
v = QString::number(value());
|
||||
}
|
||||
out[parsedSettingTypeName(m_setting)] = v;
|
||||
out[settingName()] = v;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,8 @@
|
||||
#include "SleepLib/session.h"
|
||||
|
||||
//********************************************************************************************
|
||||
// Internal PRS1 parsed data types
|
||||
// MARK: -
|
||||
// MARK: Internal PRS1 parsed data types
|
||||
//********************************************************************************************
|
||||
|
||||
// For new events, add an enum here and then a class below with an PRS1_*_EVENT macro
|
||||
@ -134,12 +135,13 @@ public:
|
||||
float m_gain;
|
||||
PRS1ParsedEventUnit m_unit;
|
||||
|
||||
inline float value(void) { return (m_value * m_gain) + m_offset; }
|
||||
inline float value(void) const { return (m_value * m_gain) + m_offset; }
|
||||
|
||||
static const PRS1ParsedEventType TYPE = EV_PRS1_UNKNOWN;
|
||||
static constexpr float GAIN = 1.0;
|
||||
static const PRS1ParsedEventUnit UNIT = PRS1_UNIT_NONE;
|
||||
|
||||
QString typeName(void) const;
|
||||
virtual QMap<QString,QString> contents(void) = 0;
|
||||
|
||||
protected:
|
||||
@ -147,6 +149,7 @@ protected:
|
||||
: m_type(type), m_start(start), m_duration(0), m_value(0), m_offset(0.0), m_gain(GAIN), m_unit(UNIT)
|
||||
{
|
||||
}
|
||||
static QString timeStr(int t);
|
||||
public:
|
||||
virtual ~PRS1ParsedEvent()
|
||||
{
|
||||
@ -263,6 +266,10 @@ public:
|
||||
PRS1ParsedSettingType m_setting;
|
||||
|
||||
PRS1ParsedSettingEvent(PRS1ParsedSettingType setting, int value) : PRS1ParsedValueEvent(TYPE, 0, value), m_setting(setting) {}
|
||||
|
||||
protected:
|
||||
QString settingName(void) const;
|
||||
QString modeName(void) const;
|
||||
};
|
||||
|
||||
class PRS1ScaledSettingEvent : public PRS1ParsedSettingEvent
|
||||
@ -409,4 +416,217 @@ enum PRS1Mode {
|
||||
const QVector<PRS1ParsedEventType> & GetSupportedEvents(const class PRS1DataChunk* chunk);
|
||||
|
||||
|
||||
//********************************************************************************************
|
||||
// MARK: -
|
||||
//********************************************************************************************
|
||||
|
||||
struct PRS1Waveform;
|
||||
|
||||
/*! \class PRS1DataChunk
|
||||
* \brief Representing a chunk of event/summary/waveform data after the header is parsed. */
|
||||
class PRS1DataChunk
|
||||
{
|
||||
public:
|
||||
/*
|
||||
PRS1DataChunk() {
|
||||
fileVersion = 0;
|
||||
blockSize = 0;
|
||||
htype = 0;
|
||||
family = 0;
|
||||
familyVersion = 0;
|
||||
ext = 255;
|
||||
sessionid = 0;
|
||||
timestamp = 0;
|
||||
|
||||
duration = 0;
|
||||
|
||||
m_filepos = -1;
|
||||
m_index = -1;
|
||||
}
|
||||
*/
|
||||
PRS1DataChunk(class RawDataDevice & f, class PRS1Loader* loader);
|
||||
~PRS1DataChunk();
|
||||
inline int size() const { return m_data.size(); }
|
||||
|
||||
QByteArray m_header;
|
||||
QByteArray m_data;
|
||||
QByteArray m_headerblock;
|
||||
QList<class PRS1ParsedEvent*> m_parsedData;
|
||||
|
||||
QString m_path;
|
||||
qint64 m_filepos; // file offset
|
||||
int m_index; // nth chunk in file
|
||||
inline void SetIndex(int index) { m_index = index; }
|
||||
|
||||
// Common fields
|
||||
quint8 fileVersion;
|
||||
quint16 blockSize;
|
||||
quint8 htype;
|
||||
quint8 family;
|
||||
quint8 familyVersion;
|
||||
quint8 ext;
|
||||
SessionID sessionid;
|
||||
quint32 timestamp;
|
||||
|
||||
// Waveform-specific fields
|
||||
quint16 interval_count;
|
||||
quint8 interval_seconds;
|
||||
int duration;
|
||||
QList<PRS1Waveform> waveformInfo;
|
||||
|
||||
// V3 normal/non-waveform fields
|
||||
QMap<unsigned char, short> hblock;
|
||||
|
||||
QMap<unsigned char, QByteArray> mainblock;
|
||||
QMap<unsigned char, QByteArray> hbdata;
|
||||
|
||||
// Trailing common fields
|
||||
quint8 storedChecksum; // header checksum stored in file, last byte of m_header
|
||||
quint8 calcChecksum; // header checksum as calculated when parsing
|
||||
quint32 storedCrc; // header + data CRC stored in file, last 2-4 bytes of chunk
|
||||
quint32 calcCrc; // header + data CRC as calculated when parsing
|
||||
|
||||
//! \brief Calculate a simplistic hash to check whether two chunks are identical.
|
||||
inline quint64 hash(void) const { return ((((quint64) this->calcCrc) << 32) | this->timestamp); }
|
||||
|
||||
//! \brief Parse and return the next chunk from a PRS1 file
|
||||
static PRS1DataChunk* ParseNext(class RawDataDevice & f, class PRS1Loader* loader);
|
||||
|
||||
//! \brief Read and parse the next chunk header from a PRS1 file
|
||||
bool ReadHeader(class RawDataDevice & f);
|
||||
|
||||
//! \brief Read the chunk's data from a PRS1 file and calculate its CRC, must be called after ReadHeader
|
||||
bool ReadData(class RawDataDevice & f);
|
||||
|
||||
//! \brief Figures out which Compliance Parser to call, based on machine family/version and calls it.
|
||||
bool ParseCompliance(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .000 file containing compliance data for a P25x brick
|
||||
bool ParseComplianceF0V23(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .000 file containing compliance data for a P256x brick
|
||||
bool ParseComplianceF0V4(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .000 file containing compliance data for a x00V brick
|
||||
bool ParseComplianceF0V5(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .000 file containing compliance data for a DreamStation 200X brick
|
||||
bool ParseComplianceF0V6(void);
|
||||
|
||||
//! \brief Figures out which Summary Parser to call, based on machine family/version and calls it.
|
||||
bool ParseSummary();
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 0 CPAP/APAP family version 2 or 3 machine
|
||||
bool ParseSummaryF0V23(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 0 CPAP/APAP family version 4 machine
|
||||
bool ParseSummaryF0V4(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 0 CPAP/APAP family version 6 machine
|
||||
bool ParseSummaryF0V6(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 3 ventilator (family version 0 or 3) machine
|
||||
bool ParseSummaryF3V03(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 3 ventilator (family version 6) machine
|
||||
bool ParseSummaryF3V6(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 5 ASV family version 0-2 machine
|
||||
bool ParseSummaryF5V012(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 5 ASV family version 3 machine
|
||||
bool ParseSummaryF5V3(void);
|
||||
|
||||
//! \brief Parse a flex setting byte from a .000 or .001 containing compliance/summary data for CPAP/APAP family versions 2, 3, 4, or 5
|
||||
void ParseFlexSettingF0V2345(quint8 flex, int prs1mode);
|
||||
|
||||
//! \brief Parse a flex setting byte from a .000 or .001 containing compliance/summary data for ASV family versions 0, 1, or 2
|
||||
void ParseFlexSettingF5V012(quint8 flex, int prs1mode);
|
||||
|
||||
//! \brief Parse an humidifier setting byte from a .000 or .001 containing compliance/summary data for original System One (50-Series) machines: F0V23 and F5V0
|
||||
void ParseHumidifierSetting50Series(int humid, bool add_setting=false);
|
||||
|
||||
//! \brief Parse an humidifier setting byte from a .000 or .001 containing compliance/summary data for F0V4 and F5V012 (60-Series) machines
|
||||
void ParseHumidifierSetting60Series(unsigned char humid1, unsigned char humid2, bool add_setting=false);
|
||||
|
||||
//! \brief Parse an humidifier setting byte from a .000 or .001 containing compliance/summary data for F3V3 machines (differs from other 60-Series machines)
|
||||
void ParseHumidifierSettingF3V3(unsigned char humid1, unsigned char humid2, bool add_setting=false);
|
||||
|
||||
//! \brief Parse humidifier setting bytes from a .000 or .001 containing compliance/summary data for fileversion 3 machines
|
||||
void ParseHumidifierSettingV3(unsigned char byte1, unsigned char byte2, bool add_setting=false);
|
||||
|
||||
//! \brief Parse tubing type from a .001 containing summary data for fileversion 3 machines
|
||||
void ParseTubingTypeV3(unsigned char type);
|
||||
|
||||
//! \brief Figures out which Event Parser to call, based on machine family/version and calls it.
|
||||
bool ParseEvents(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 0 CPAP/APAP machine
|
||||
bool ParseEventsF0V23(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a 60 Series family 0 CPAP/APAP 60machine
|
||||
bool ParseEventsF0V4(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a DreamStation family 0 CPAP/APAP machine
|
||||
bool ParseEventsF0V6(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 3 ventilator family version 0 or 3 machine
|
||||
bool ParseEventsF3V03(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 3 ventilator family version 6 machine
|
||||
bool ParseEventsF3V6(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 0 machine
|
||||
bool ParseEventsF5V0(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 1 machine
|
||||
bool ParseEventsF5V1(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 2 machine
|
||||
bool ParseEventsF5V2(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 3 machine
|
||||
bool ParseEventsF5V3(void);
|
||||
|
||||
protected:
|
||||
class PRS1Loader* loader;
|
||||
|
||||
//! \brief Add a parsed event to the chunk
|
||||
void AddEvent(class PRS1ParsedEvent* event);
|
||||
|
||||
//! \brief Read and parse the non-waveform header data from a V2 PRS1 file
|
||||
bool ReadNormalHeaderV2(class RawDataDevice & f);
|
||||
|
||||
//! \brief Read and parse the non-waveform header data from a V3 PRS1 file
|
||||
bool ReadNormalHeaderV3(class RawDataDevice & f);
|
||||
|
||||
//! \brief Read and parse the waveform-specific header data from a PRS1 file
|
||||
bool ReadWaveformHeader(class RawDataDevice & f);
|
||||
|
||||
//! \brief Extract the stored CRC from the end of the data of a PRS1 chunk
|
||||
bool ExtractStoredCrc(int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF0V23(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF0V45(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF0V6(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF5V012(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF5V3(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF3V03(const unsigned char* data, int size);
|
||||
|
||||
//! \brief Parse a settings slice from a .000 and .001 file
|
||||
bool ParseSettingsF3V6(const unsigned char* data, int size);
|
||||
};
|
||||
|
||||
|
||||
#endif // PRS1PARSER_H
|
||||
|
@ -9,6 +9,9 @@
|
||||
#include "prs1tests.h"
|
||||
#include "sessiontests.h"
|
||||
|
||||
#include "../SleepLib/loader_plugins/prs1_loader.h"
|
||||
#include "../SleepLib/loader_plugins/prs1_parser.h"
|
||||
|
||||
#define TESTDATA_PATH "./testdata/"
|
||||
|
||||
static PRS1Loader* s_loader = nullptr;
|
||||
@ -227,11 +230,11 @@ void ChunkToYaml(QTextStream & out, PRS1DataChunk* chunk, bool ok)
|
||||
dump_data = false;
|
||||
out << " events:" << '\n';
|
||||
for (auto & e : chunk->m_parsedData) {
|
||||
QString name = _PRS1ParsedEventName(e);
|
||||
QString name = e->typeName();
|
||||
if (name == "raw" || name == "unknown") {
|
||||
dump_data = true;
|
||||
}
|
||||
QMap<QString,QString> contents = _PRS1ParsedEventContents(e);
|
||||
QMap<QString,QString> contents = e->contents();
|
||||
if (name == "setting" && contents.size() == 1) {
|
||||
out << " - set_" << contents.firstKey() << ": " << contents.first() << '\n';
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
#define PRS1TESTS_H
|
||||
|
||||
#include "AutoTest.h"
|
||||
#include "../SleepLib/loader_plugins/prs1_loader.h"
|
||||
|
||||
class PRS1Tests : public QObject
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user