mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 02:30:44 +00:00
Third cleanup series: the loader_plugins.
This commit is contained in:
parent
1c45e852c9
commit
a7d5bafc9a
@ -78,7 +78,7 @@ QString getIconDir2 (QString givenpath) {
|
||||
}
|
||||
|
||||
/*
|
||||
* getIconMachines returns a list of all Iocn machine folders in the ICON directory
|
||||
* getIconMachines returns a list of all Iocn device folders in the ICON directory
|
||||
*/
|
||||
QStringList getIconMachines (QString iconPath) {
|
||||
QStringList iconMachines;
|
||||
@ -108,7 +108,7 @@ QStringList getIconMachines (QString iconPath) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Find out what machine model this is
|
||||
// Find out what device model this is
|
||||
QFile sumFile (flist.at(0).absoluteFilePath());
|
||||
|
||||
QString line;
|
||||
@ -139,7 +139,7 @@ bool FPIconLoader::Detect(const QString & givenpath)
|
||||
|
||||
QStringList machines = getIconMachines(iconPath);
|
||||
if (machines.length() <= 0)
|
||||
// Did not find any SleepStyle machine directories
|
||||
// Did not find any SleepStyle device directories
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -206,7 +206,7 @@ int FPIconLoader::Open(const QString & path)
|
||||
|
||||
QStringList serialNumbers = getIconMachines(iconPath);
|
||||
if (serialNumbers.length() <= 0)
|
||||
// Did not find any SleepStyle machine directories
|
||||
// Did not find any SleepStyle device directories
|
||||
return false;
|
||||
|
||||
Machine *m;
|
||||
@ -230,7 +230,7 @@ int FPIconLoader::Open(const QString & path)
|
||||
p_profile->DelMachine(m);
|
||||
MachList.erase(MachList.find(info.serial));
|
||||
QMessageBox::warning(nullptr, tr("Import Error"),
|
||||
tr("This Machine Record cannot be imported in this profile.")+"\n\n"+tr("The Day records overlap with already existing content."),
|
||||
tr("This device Record cannot be imported in this profile.")+"\n\n"+tr("The Day records overlap with already existing content."),
|
||||
QMessageBox::Ok);
|
||||
delete m;
|
||||
}
|
||||
@ -508,12 +508,12 @@ hour=(ts >> 12) & 0x1f; */
|
||||
|
||||
// FLW Header Structure
|
||||
// 0x0000-0x01fe
|
||||
// newline (0x0d) seperated list of machine information strings.
|
||||
// newline (0x0d) seperated list of device information strings.
|
||||
// magic? 0201
|
||||
// version 1.5.0
|
||||
// serial number 12 digits
|
||||
// Machine Series "ICON"
|
||||
// Machine Model "Auto"
|
||||
// Device Series "ICON"
|
||||
// Device Model "Auto"
|
||||
// Remainder of header is 0 filled...
|
||||
// 0x01ff 8 bit additive sum checksum byte of previous header bytes
|
||||
|
||||
|
@ -26,7 +26,7 @@ const int fpicon_data_version = 3;
|
||||
//********************************************************************************************
|
||||
|
||||
/*! \class FPIcon
|
||||
\brief F&P Icon customized machine object
|
||||
\brief F&P Icon customized device object
|
||||
*/
|
||||
class FPIcon: public CPAP
|
||||
{
|
||||
@ -68,10 +68,10 @@ class FPIconLoader : public CPAPLoader
|
||||
//! \brief Returns SleepLib database version of this F&P Icon loader
|
||||
virtual int Version() { return fpicon_data_version; }
|
||||
|
||||
//! \brief Returns the machine class name of this CPAP machine, "FPIcon"
|
||||
//! \brief Returns the device class name of this CPAP device, "FPIcon"
|
||||
virtual const QString & loaderName() { return fpicon_class_name; }
|
||||
|
||||
// ! \brief Creates a machine object, indexed by serial number
|
||||
// ! \brief Creates a device object, indexed by serial number
|
||||
//Machine *CreateMachine(QString serial);
|
||||
|
||||
virtual MachineInfo newInfo() {
|
||||
|
@ -238,7 +238,7 @@ int IntellipapLoader::OpenDV5(const QString & path)
|
||||
mode = (set_epap > 0) ? MODE_BILEVEL_FIXED : MODE_APAP;
|
||||
break;
|
||||
default:
|
||||
qDebug() << "New machine mode";
|
||||
qDebug() << "New device mode";
|
||||
}
|
||||
|
||||
if (!info.serial.isEmpty()) {
|
||||
@ -246,7 +246,7 @@ int IntellipapLoader::OpenDV5(const QString & path)
|
||||
}
|
||||
|
||||
if (!mach) {
|
||||
qDebug() << "Couldn't get Intellipap machine record";
|
||||
qDebug() << "Couldn't get Intellipap device record";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -602,11 +602,11 @@ int IntellipapLoader::OpenDV5(const QString & path)
|
||||
// 1a) Flow graph for days without high resolution data is absent
|
||||
// 1b) Pressure graph is high resolution when high res data is available and
|
||||
// only 1 per minute when using low resolution data.
|
||||
// 2) Max and Average leak rates are as reported by DV64 machine but we're
|
||||
// not sure how those measures relate to other machine's data. Leak rate
|
||||
// 2) Max and Average leak rates are as reported by DV64 device but we're
|
||||
// not sure how those measures relate to other device's data. Leak rate
|
||||
// seems to include the intentional mask leak.
|
||||
// 2a) Not sure how SmartLink calculates the pct of time of poor mask fit.
|
||||
// May be same as what we call large leak time for other machines?
|
||||
// May be same as what we call large leak time for other devices?
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct DV6TestedModel
|
||||
@ -1735,7 +1735,7 @@ bool load6HighResData () {
|
||||
#endif
|
||||
if (inSession && sess) {
|
||||
// update min and max
|
||||
// then add to machine
|
||||
// then add to device
|
||||
if (sess->first() == 0)
|
||||
qWarning() << "R.BIN first = 0 - 1284";
|
||||
EventDataType min = flow->Min();
|
||||
@ -2129,7 +2129,7 @@ bool load6HighResData () {
|
||||
if (inPB) RE->AddEvent(REstart,(REend-REstart) / 1000L);
|
||||
***/
|
||||
// update min and max
|
||||
// then add to machine
|
||||
// then add to device
|
||||
if (sess->first() == 0)
|
||||
qWarning() << "R.BIN first = 0 - 1665";
|
||||
EventDataType min = flow->Min();
|
||||
@ -2640,10 +2640,10 @@ bool backup6 (const QString & path) {
|
||||
|
||||
bool init6Environment (const QString & path) {
|
||||
|
||||
// Create Machine database record if it doesn't exist already
|
||||
// Create device database record if it doesn't exist already
|
||||
mach = p_profile->CreateMachine(info);
|
||||
if (mach == nullptr) {
|
||||
qWarning() << "Could not create DV6 Machine data structure";
|
||||
qWarning() << "Could not create DV6 device data structure";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2695,7 +2695,7 @@ int IntellipapLoader::OpenDV6(const QString & path)
|
||||
emit setProgressValue(0);
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
// 1. Prime the machine database's info field with this machine
|
||||
// 1. Prime the device database's info field with this device
|
||||
info = newInfo();
|
||||
|
||||
// 2. VER.BIN - Parse model number, serial, etc. into info structure
|
||||
@ -2717,7 +2717,7 @@ int IntellipapLoader::OpenDV6(const QString & path)
|
||||
emit updateMessage(QObject::tr("Backing up files..."));
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
// 6. Back up data files (must do after parsing VER.BIN, S.BIN, and creating Machine)
|
||||
// 6. Back up data files (must do after parsing VER.BIN, S.BIN, and creating device)
|
||||
if (!backup6(path))
|
||||
return -1;
|
||||
|
||||
|
@ -25,7 +25,7 @@ const int intellipap_data_version = 3;
|
||||
//********************************************************************************************
|
||||
|
||||
/*! \class Intellipap
|
||||
\brief Intellipap customized machine object
|
||||
\brief Intellipap customized device object
|
||||
*/
|
||||
class Intellipap: public CPAP
|
||||
{
|
||||
@ -65,10 +65,10 @@ class IntellipapLoader : public CPAPLoader
|
||||
//! \brief Returns SleepLib database version of this IntelliPap loader
|
||||
virtual int Version() { return intellipap_data_version; }
|
||||
|
||||
//! \brief Returns the machine class name of this IntelliPap, "Intellipap"
|
||||
//! \brief Returns the device class name of this IntelliPap, "Intellipap"
|
||||
virtual const QString &loaderName() { return intellipap_class_name; }
|
||||
|
||||
//! \brief Creates a machine object, indexed by serial number
|
||||
//! \brief Creates a device object, indexed by serial number
|
||||
// Machine *CreateMachine(QString serial);
|
||||
|
||||
//! \brief Registers this MachineLoader with the master list, so Intellipap data can load
|
||||
|
@ -27,7 +27,7 @@ const int mseries_data_version = 2;
|
||||
//********************************************************************************************
|
||||
|
||||
/*! \class MSeries
|
||||
\brief RemStar M-Series customized machine object
|
||||
\brief RemStar M-Series customized device object
|
||||
*/
|
||||
class MSeries: public CPAP
|
||||
{
|
||||
@ -60,7 +60,7 @@ class MSeriesLoader : public MachineLoader
|
||||
//! \brief Return the loaderName, in this case "MSeries"
|
||||
virtual const QString & loaderName() { return mseries_class_name; }
|
||||
|
||||
//! \brief Create a new PRS1 machine record, indexed by Serial number.
|
||||
//! \brief Create a new PRS1 device record, indexed by Serial number.
|
||||
// Machine *CreateMachine(QString serial);
|
||||
|
||||
virtual MachineInfo newInfo() {
|
||||
|
@ -449,7 +449,7 @@ bool PRDS2File::parseDS2Header()
|
||||
qWarning() << "DS2 unexpected middle bytes =" << f << g;
|
||||
}
|
||||
|
||||
QByteArray import_key = readBytes(); // payload key encrypted with machine-specific key
|
||||
QByteArray import_key = readBytes(); // payload key encrypted with device-specific key
|
||||
QByteArray import_key_tag = readBytes(); // tag of import key
|
||||
if (import_key.size() != 32 || import_key_tag.size() != 16) {
|
||||
qWarning() << "DS2 import_key sizes =" << import_key.size() << import_key_tag.size();
|
||||
@ -589,7 +589,7 @@ QStringList PRS1Loader::FindMachinesOnCard(const QString & cardPath)
|
||||
pseries.setSorting(QDir::Name);
|
||||
QFileInfoList plist = pseries.entryInfoList();
|
||||
|
||||
// Look for machine directories (containing a PROP.TXT or properties.txt)
|
||||
// Look for device directories (containing a PROP.TXT or properties.txt)
|
||||
QFileInfoList propertyfiles;
|
||||
for (auto & pfi : plist) {
|
||||
if (pfi.isDir()) {
|
||||
@ -598,18 +598,18 @@ QStringList PRS1Loader::FindMachinesOnCard(const QString & cardPath)
|
||||
QFileInfoList mlist = machineDir.entryInfoList();
|
||||
for (auto & mfi : mlist) {
|
||||
if (QDir::match("PROP*.TXT", mfi.fileName())) {
|
||||
// Found a properties file, this is a machine folder
|
||||
// Found a properties file, this is a device folder
|
||||
propertyfiles.append(mfi);
|
||||
}
|
||||
if (QDir::match("PROP.BIN", mfi.fileName())) {
|
||||
// Found a DreamStation 2 properties file, this is a machine folder
|
||||
// Found a DreamStation 2 properties file, this is a device folder
|
||||
propertyfiles.append(mfi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort machines from oldest to newest.
|
||||
// Sort devices from oldest to newest.
|
||||
std::sort(propertyfiles.begin(), propertyfiles.end(),
|
||||
[](const QFileInfo & a, const QFileInfo & b)
|
||||
{
|
||||
@ -779,7 +779,7 @@ MachineInfo PRS1Loader::PeekInfo(const QString & path)
|
||||
return MachineInfo();
|
||||
}
|
||||
|
||||
// Present information about the newest machine on the card.
|
||||
// Present information about the newest device on the card.
|
||||
QString newpath = machines.last();
|
||||
|
||||
MachineInfo info = newInfo();
|
||||
@ -805,14 +805,14 @@ int PRS1Loader::Open(const QString & selectedPath)
|
||||
}
|
||||
|
||||
QStringList machines = FindMachinesOnCard(path);
|
||||
// Return an error if no machines were found.
|
||||
// Return an error if no devices were found.
|
||||
if (machines.isEmpty()) {
|
||||
qDebug() << "No PRS1 machines found at" << path;
|
||||
qDebug() << "No PRS1 devices found at" << path;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Import each machine, from oldest to newest.
|
||||
// TODO: Loaders should return the set of machines during detection, so that Open() will
|
||||
// Import each device, from oldest to newest.
|
||||
// TODO: Loaders should return the set of devices during detection, so that Open() will
|
||||
// open a unique device, instead of surprising the user.
|
||||
int c = 0;
|
||||
bool failures = false;
|
||||
@ -956,7 +956,7 @@ bool PRS1Loader::CreateMachineFromProperties(QString propertyfile)
|
||||
emit deviceReportsUsageOnly(info);
|
||||
}
|
||||
|
||||
// Which is needed to get the right machine record..
|
||||
// Which is needed to get the right device record..
|
||||
m_ctx->CreateMachineFromInfo(info);
|
||||
|
||||
if (!s_PRS1ModelInfo.IsTested(props)) {
|
||||
@ -1100,7 +1100,7 @@ void PRS1Loader::ScanFiles(const QStringList & paths, int sessionid_base)
|
||||
if (ext == 5) {
|
||||
// Occasionally waveforms in a session can be split into multiple files.
|
||||
//
|
||||
// This seems to happen when the machine begins writing the waveform file
|
||||
// This seems to happen when the device begins writing the waveform file
|
||||
// before realizing that it will hit its 500-file-per-directory limit
|
||||
// for the remaining session files, at which point it appears to write
|
||||
// the rest of the waveform data along with the summary and event files
|
||||
@ -1130,7 +1130,7 @@ void PRS1Loader::ScanFiles(const QStringList & paths, int sessionid_base)
|
||||
|
||||
SessionID chunk_sid = chunk->sessionid;
|
||||
if (i == 0 && chunk_sid != sid) { // log session ID mismatches
|
||||
// This appears to be benign, probably when a card is out of the machine one night and
|
||||
// This appears to be benign, probably when a card is out of the device one night and
|
||||
// then inserted in the morning. It writes out all of the still-in-memory summaries and
|
||||
// events up through the last night (and no waveform data).
|
||||
//
|
||||
@ -1347,8 +1347,8 @@ void PRS1Import::CreateEventChannels(const PRS1DataChunk* chunk)
|
||||
{
|
||||
const QVector<PRS1ParsedEventType> & supported = GetSupportedEvents(chunk);
|
||||
|
||||
// Generate the list of channels created by non-slice events for this machine.
|
||||
// We can't just use the full list of non-slice events, since on some machines
|
||||
// Generate the list of channels created by non-slice events for this device.
|
||||
// We can't just use the full list of non-slice events, since on some devices
|
||||
// PS is generated by slice events (EPAP/IPAP average).
|
||||
// TODO: convert supported to QSet and clean this up.
|
||||
QSet<PRS1ParsedEventType> supportedNonSliceEvents = QSet<PRS1ParsedEventType>::fromList(QList<PRS1ParsedEventType>::fromVector(supported));
|
||||
@ -1589,7 +1589,7 @@ bool PRS1Import::ImportEventChunk(PRS1DataChunk* event)
|
||||
// We can't just call it again here for simplicity, since the timestamps of F3V3 stat events
|
||||
// can go past the end of the slice.
|
||||
} else {
|
||||
// For all other machines, the event's time stamp will be within bounds of its slice, so
|
||||
// For all other devices, the event's time stamp will be within bounds of its slice, so
|
||||
// we can use it to find the current slice.
|
||||
UpdateCurrentSlice(event, t);
|
||||
}
|
||||
@ -1711,7 +1711,7 @@ void PRS1Import::ImportEvent(qint64 t, PRS1ParsedEvent* e)
|
||||
|
||||
// TODO: Filter out duplicate/overlapping PB and RE events.
|
||||
//
|
||||
// These actually get reported by the machines, but they cause "unordered time" warnings
|
||||
// These actually get reported by the devices, but they cause "unordered time" warnings
|
||||
// and they throw off the session statistics. Even official reports show the wrong stats,
|
||||
// for example counting each of 3 duplicate PBs towards the total time in PB.
|
||||
//
|
||||
@ -2508,9 +2508,9 @@ void PRS1Import::ImportWaveforms()
|
||||
// - In the case of multiple discontinuities, fitting them is more complicated
|
||||
// > The down side of this approach is that events won't line up exactly the same as official reports.
|
||||
//
|
||||
// Evidently the machines' internal clock drifts slightly, and in some sessions that
|
||||
// Evidently the devices' internal clock drifts slightly, and in some sessions that
|
||||
// means two adjacent (5-minute) waveform chunks have have a +/- 1 second difference in
|
||||
// their notion of the correct time, since the machines only record time at 1-second
|
||||
// their notion of the correct time, since the devices only record time at 1-second
|
||||
// resolution. Presumably the real drift is fractional, but there's no way to tell from
|
||||
// the data.
|
||||
//
|
||||
@ -2533,7 +2533,7 @@ void PRS1Import::ImportWaveforms()
|
||||
if ((waveform->family == 5 && (waveform->familyVersion == 2 || waveform->familyVersion == 3)) ||
|
||||
(waveform->family == 3 && waveform->familyVersion == 6)){
|
||||
// F5V2, F5V3, and F3V6 use a gain of 0.125 rather than 0.1 to allow for a maximum value of 30 cmH2O
|
||||
pressure_gain = 0.125F; // TODO: this should be parameterized somewhere better, once we have a clear idea of which machines use this
|
||||
pressure_gain = 0.125F; // TODO: this should be parameterized somewhere better, once we have a clear idea of which devices use this
|
||||
}
|
||||
|
||||
// Process interleaved samples
|
||||
@ -2952,7 +2952,7 @@ void PRS1Loader::initChannels()
|
||||
channel.add(GRP_CPAP, chan = new Channel(PRS1_AutoOn = 0xe109, SETTING, MT_CPAP, SESSION,
|
||||
"PRS1AutoOn",
|
||||
QObject::tr("Auto On"),
|
||||
QObject::tr("A few breaths automatically starts machine"),
|
||||
QObject::tr("A few breaths automatically starts device"),
|
||||
QObject::tr("Auto On"),
|
||||
"", LOOKUP, Qt::green));
|
||||
chan->addOption(0, STR_TR_Off);
|
||||
@ -2961,7 +2961,7 @@ void PRS1Loader::initChannels()
|
||||
channel.add(GRP_CPAP, chan = new Channel(PRS1_AutoOff = 0xe10a, SETTING, MT_CPAP, SESSION,
|
||||
"PRS1AutoOff",
|
||||
QObject::tr("Auto Off"),
|
||||
QObject::tr("Machine automatically switches off"),
|
||||
QObject::tr("Device automatically switches off"),
|
||||
QObject::tr("Auto Off"),
|
||||
"", LOOKUP, Qt::green));
|
||||
chan->addOption(0, STR_TR_Off);
|
||||
@ -2970,7 +2970,7 @@ void PRS1Loader::initChannels()
|
||||
channel.add(GRP_CPAP, chan = new Channel(PRS1_MaskAlert = 0xe10b, SETTING, MT_CPAP, SESSION,
|
||||
"PRS1MaskAlert",
|
||||
QObject::tr("Mask Alert"),
|
||||
QObject::tr("Whether or not machine allows Mask checking."),
|
||||
QObject::tr("Whether or not device allows Mask checking."),
|
||||
QObject::tr("Mask Alert"),
|
||||
"", LOOKUP, Qt::green));
|
||||
chan->addOption(0, STR_TR_Off);
|
||||
@ -2979,7 +2979,7 @@ void PRS1Loader::initChannels()
|
||||
channel.add(GRP_CPAP, chan = new Channel(PRS1_ShowAHI = 0xe10c, SETTING, MT_CPAP, SESSION,
|
||||
"PRS1ShowAHI",
|
||||
QObject::tr("Show AHI"),
|
||||
QObject::tr("Whether or not machine shows AHI via built-in display."),
|
||||
QObject::tr("Whether or not device shows AHI via built-in display."),
|
||||
QObject::tr("Show AHI"),
|
||||
"", LOOKUP, Qt::green));
|
||||
chan->addOption(0, STR_TR_Off);
|
||||
@ -3022,7 +3022,7 @@ void PRS1Loader::initChannels()
|
||||
channel.add(GRP_CPAP, chan = new Channel(PRS1_AutoTrial = 0xe117, SETTING, MT_CPAP, SESSION,
|
||||
"PRS1AutoTrial",
|
||||
QObject::tr("Auto-Trial Duration"),
|
||||
QObject::tr("The number of days in the Auto-CPAP trial period, after which the machine will revert to CPAP"),
|
||||
QObject::tr("The number of days in the Auto-CPAP trial period, after which the device will revert to CPAP"),
|
||||
QObject::tr("Auto-Trial Dur."),
|
||||
"", LOOKUP, Qt::black));
|
||||
|
||||
@ -3047,7 +3047,7 @@ void PRS1Loader::initChannels()
|
||||
channel.add(GRP_CPAP, new Channel(PRS1_BND = 0x1159, SPAN, MT_CPAP, SESSION,
|
||||
"PRS1_BND",
|
||||
QObject::tr("Breathing Not Detected"),
|
||||
QObject::tr("A period during a session where the machine could not detect flow."),
|
||||
QObject::tr("A period during a session where the device could not detect flow."),
|
||||
QObject::tr("BND"),
|
||||
STR_UNIT_Unknown,
|
||||
DEFAULT, QColor("light purple")));
|
||||
|
@ -104,9 +104,9 @@ protected:
|
||||
int summary_duration;
|
||||
int m_sessionid_base; // base for inferring session ID from filename
|
||||
|
||||
//! \brief Translate the PRS1-specific machine mode to the importable vendor-neutral enum.
|
||||
//! \brief Translate the PRS1-specific device mode to the importable vendor-neutral enum.
|
||||
CPAPMode importMode(int mode);
|
||||
//! \brief Parse all the chunks in a single machine session
|
||||
//! \brief Parse all the chunks in a single device session
|
||||
bool ParseSession(void);
|
||||
|
||||
//! \brief Cache a single slice from a summary or compliance chunk.
|
||||
@ -211,16 +211,16 @@ class PRS1Loader : public CPAPLoader
|
||||
//! \brief Returns the path of the P-Series folder (whatever case) if present on the card
|
||||
QString GetPSeriesPath(const QString & path);
|
||||
|
||||
//! \brief Returns the path for each machine detected on an SD card, from oldest to newest
|
||||
//! \brief Returns the path for each device detected on an SD card, from oldest to newest
|
||||
QStringList FindMachinesOnCard(const QString & cardPath);
|
||||
|
||||
//! \brief Opens the SD folder structure for this machine, scans for data files and imports any new sessions
|
||||
//! \brief Opens the SD folder structure for this device, scans for data files and imports any new sessions
|
||||
int OpenMachine(const QString & path);
|
||||
|
||||
//! \brief Finds the P0,P1,... session paths and property pathname and returns the base (10 or 16) of the session filenames
|
||||
int FindSessionDirsAndProperties(const QString & path, QStringList & paths, QString & propertyfile);
|
||||
|
||||
//! \brief Reads the model number from the property file, evaluates its capabilities, and returns true if the machine is supported
|
||||
//! \brief Reads the model number from the property file, evaluates its capabilities, and returns true if the device is supported
|
||||
bool CreateMachineFromProperties(QString propertyfile);
|
||||
|
||||
//! \brief Scans the given directories for session data and create an import task for each logical session.
|
||||
|
@ -539,7 +539,7 @@ void PRS1DataChunk::ParseHumidifierSetting50Series(int humid, bool add_setting)
|
||||
|
||||
// Check for truly unexpected values:
|
||||
if (humidlevel > 5) UNEXPECTED_VALUE(humidlevel, "<= 5");
|
||||
//if (!humidifier_present) CHECK_VALUES(humidlevel, 0, 1); // Some machines appear to encode the humidlevel setting even when the humidifier is not present.
|
||||
//if (!humidifier_present) CHECK_VALUES(humidlevel, 0, 1); // Some devices appear to encode the humidlevel setting even when the humidifier is not present.
|
||||
}
|
||||
|
||||
|
||||
@ -1103,7 +1103,7 @@ bool PRS1DataChunk::ReadNormalHeaderV3(RawDataDevice & f)
|
||||
unsigned char * header;
|
||||
QByteArray headerB2;
|
||||
|
||||
// This is a new machine, byte 15 is header data block length
|
||||
// This is a new device, byte 15 is header data block length
|
||||
// followed by variable, data byte pairs
|
||||
do {
|
||||
QByteArray extra = f.read(1);
|
||||
|
@ -503,7 +503,7 @@ public:
|
||||
//! \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.
|
||||
//! \brief Figures out which Compliance Parser to call, based on device 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
|
||||
@ -518,28 +518,28 @@ public:
|
||||
//! \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.
|
||||
//! \brief Figures out which Summary Parser to call, based on device 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
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 0 CPAP/APAP family version 2 or 3 device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 0 CPAP/APAP family version 4 device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 0 CPAP/APAP family version 6 device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 3 ventilator (family version 0 or 3) device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 3 ventilator (family version 6) device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 5 ASV family version 0-2 device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .001 file containing summary data for a family 5 ASV family version 3 device
|
||||
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
|
||||
@ -548,49 +548,49 @@ public:
|
||||
//! \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
|
||||
//! \brief Parse an humidifier setting byte from a .000 or .001 containing compliance/summary data for original System One (50-Series) devices: 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
|
||||
//! \brief Parse an humidifier setting byte from a .000 or .001 containing compliance/summary data for F0V4 and F5V012 (60-Series) devices
|
||||
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)
|
||||
//! \brief Parse an humidifier setting byte from a .000 or .001 containing compliance/summary data for F3V3 devices (differs from other 60-Series devices)
|
||||
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
|
||||
//! \brief Parse humidifier setting bytes from a .000 or .001 containing compliance/summary data for fileversion 3 devices
|
||||
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
|
||||
//! \brief Parse tubing type from a .001 containing summary data for fileversion 3 devices
|
||||
void ParseTubingTypeV3(unsigned char type);
|
||||
|
||||
//! \brief Figures out which Event Parser to call, based on machine family/version and calls it.
|
||||
//! \brief Figures out which Event Parser to call, based on device 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
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 0 CPAP/APAP device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a 60 Series family 0 CPAP/APAP 60 device
|
||||
bool ParseEventsF0V4(void);
|
||||
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a DreamStation family 0 CPAP/APAP machine
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a DreamStation family 0 CPAP/APAP device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 3 ventilator family version 0 or 3 device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 3 ventilator family version 6 device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 0 device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 1 device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 2 device
|
||||
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
|
||||
//! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV family version 3 device
|
||||
bool ParseEventsF5V3(void);
|
||||
|
||||
protected:
|
||||
|
@ -264,7 +264,7 @@ bool PRS1DataChunk::ParseSettingsF5V012(const unsigned char* data, int /*size*/)
|
||||
this->ParseHumidifierSetting50Series(data[0x0d], true);
|
||||
pos = 0xe;
|
||||
} else {
|
||||
// 60-Series machines have a 2-byte humidfier setting.
|
||||
// 60-Series devices have a 2-byte humidfier setting.
|
||||
this->ParseHumidifierSetting60Series(data[0x0d], data[0x0e], true);
|
||||
pos = 0xf;
|
||||
}
|
||||
@ -1002,7 +1002,7 @@ bool PRS1DataChunk::ParseEventsF5V2(void)
|
||||
// Originally based on ParseSummaryF0V6, with changes observed in ASV sample data
|
||||
// based on size, slices 0-5 look similar, and it looks like F0V6 slides 8-B are equivalent to 6-9
|
||||
//
|
||||
// TODO: surely there will be a way to merge these loops and abstract the machine-specific
|
||||
// TODO: surely there will be a way to merge these loops and abstract the device-specific
|
||||
// encodings into another function or class, but that's probably worth pursuing only after
|
||||
// the details have been figured out.
|
||||
bool PRS1DataChunk::ParseSummaryF5V3(void)
|
||||
@ -1015,7 +1015,7 @@ bool PRS1DataChunk::ParseSummaryF5V3(void)
|
||||
int chunk_size = this->m_data.size();
|
||||
static const int minimum_sizes[] = { 1, 0x35, 9, 4, 2, 4, 0x1e, 2, 4, 9 };
|
||||
static const int ncodes = sizeof(minimum_sizes) / sizeof(int);
|
||||
// NOTE: The sizes contained in hblock can vary, even within a single machine, as can the length of hblock itself!
|
||||
// NOTE: The sizes contained in hblock can vary, even within a single device, as can the length of hblock itself!
|
||||
|
||||
// TODO: hardcoding this is ugly, think of a better approach
|
||||
if (chunk_size < minimum_sizes[0] + minimum_sizes[1] + minimum_sizes[2]) {
|
||||
@ -1059,7 +1059,7 @@ bool PRS1DataChunk::ParseSummaryF5V3(void)
|
||||
switch (code) {
|
||||
case 0: // Equipment On
|
||||
CHECK_VALUE(pos, 1); // Always first?
|
||||
//CHECK_VALUES(data[pos], 1, 7); // or 3, or 0? 3 when machine turned on via auto-on, 1 when turned on via button
|
||||
//CHECK_VALUES(data[pos], 1, 7); // or 3, or 0? 3 when device turned on via auto-on, 1 when turned on via button
|
||||
CHECK_VALUE(size, 1);
|
||||
break;
|
||||
case 1: // Settings
|
||||
|
@ -513,7 +513,7 @@ const QVector<PRS1ParsedEventType> ParsedEventsF3V3 = {
|
||||
// 1061, 1061T, 1160P series
|
||||
bool PRS1DataChunk::ParseEventsF3V03(void)
|
||||
{
|
||||
// NOTE: Older ventilators (BiPAP S/T and AVAPS) machines don't use timestamped events like everything else.
|
||||
// NOTE: Older ventilators (BiPAP S/T and AVAPS) devices don't use timestamped events like everything else.
|
||||
// Instead, they use a fixed interval format like waveforms do (see PRS1_HTYPE_INTERVAL).
|
||||
|
||||
if (this->family != 3 || (this->familyVersion != 0 && this->familyVersion != 3)) {
|
||||
@ -605,7 +605,7 @@ bool PRS1DataChunk::ParseEventsF3V03(void)
|
||||
|
||||
// Originally based on ParseSummaryF5V3, with changes observed in ventilator sample data
|
||||
//
|
||||
// TODO: surely there will be a way to merge ParseSummary (FV3) loops and abstract the machine-specific
|
||||
// TODO: surely there will be a way to merge ParseSummary (FV3) loops and abstract the device-specific
|
||||
// encodings into another function or class, but that's probably worth pursuing only after
|
||||
// the details have been figured out.
|
||||
bool PRS1DataChunk::ParseSummaryF3V6(void)
|
||||
@ -618,7 +618,7 @@ bool PRS1DataChunk::ParseSummaryF3V6(void)
|
||||
int chunk_size = this->m_data.size();
|
||||
static const int minimum_sizes[] = { 1, 0x25, 9, 7, 4, 2, 1, 2, 2, 1, 0x18, 2, 4 }; // F5V3 = { 1, 0x38, 4, 2, 4, 0x1e, 2, 4, 9 };
|
||||
static const int ncodes = sizeof(minimum_sizes) / sizeof(int);
|
||||
// NOTE: The sizes contained in hblock can vary, even within a single machine, as can the length of hblock itself!
|
||||
// NOTE: The sizes contained in hblock can vary, even within a single device, as can the length of hblock itself!
|
||||
|
||||
// TODO: hardcoding this is ugly, think of a better approach
|
||||
if (chunk_size < minimum_sizes[0] + minimum_sizes[1] + minimum_sizes[2]) {
|
||||
|
@ -19,7 +19,7 @@ bool PRS1DataChunk::ParseComplianceF0V23(void)
|
||||
qWarning() << "ParseComplianceF0V23 called with family" << this->family << "familyVersion" << this->familyVersion;
|
||||
return false;
|
||||
}
|
||||
// All sample machines with FamilyVersion 3 in the properties.txt file have familyVersion 2 in their .001/.002/.005 files!
|
||||
// All sample devices with FamilyVersion 3 in the properties.txt file have familyVersion 2 in their .001/.002/.005 files!
|
||||
// We should flag an actual familyVersion 3 file if we ever encounter one!
|
||||
CHECK_VALUE(this->familyVersion, 2);
|
||||
|
||||
@ -104,7 +104,7 @@ bool PRS1DataChunk::ParseSummaryF0V23()
|
||||
qWarning() << "ParseSummaryF0V23 called with family" << this->family << "familyVersion" << this->familyVersion;
|
||||
return false;
|
||||
}
|
||||
// All sample machines with FamilyVersion 3 in the properties.txt file have familyVersion 2 in their .001/.002/.005 files!
|
||||
// All sample devices with FamilyVersion 3 in the properties.txt file have familyVersion 2 in their .001/.002/.005 files!
|
||||
// We should flag an actual familyVersion 3 file if we ever encounter one!
|
||||
CHECK_VALUE(this->familyVersion, 2);
|
||||
|
||||
@ -462,7 +462,7 @@ bool PRS1DataChunk::ParseEventsF0V23()
|
||||
qWarning() << "ParseEventsF0V23 called with family" << this->family << "familyVersion" << this->familyVersion;
|
||||
return false;
|
||||
}
|
||||
// All sample machines with FamilyVersion 3 in the properties.txt file have familyVersion 2 in their .001/.002/.005 files!
|
||||
// All sample devices with FamilyVersion 3 in the properties.txt file have familyVersion 2 in their .001/.002/.005 files!
|
||||
// We should flag an actual familyVersion 3 file if we ever encounter one!
|
||||
CHECK_VALUE(this->familyVersion, 2);
|
||||
|
||||
@ -746,7 +746,7 @@ bool PRS1DataChunk::ParseComplianceF0V4(void)
|
||||
// often clock adjustments without corresponding discontinuities in the waveform, and vice versa.
|
||||
// It's possible internal clock inaccuracy causes both independently.
|
||||
//
|
||||
// TODO: why do some machines have lots of these and others none? Maybe cellular modems make daily tweaks?
|
||||
// TODO: why do some devices have lots of these and others none? Maybe cellular modems make daily tweaks?
|
||||
if (false) {
|
||||
long value = data[pos] | data[pos+1]<<8 | data[pos+2]<<16 | data[pos+3]<<24;
|
||||
qDebug() << this->sessionid << "clock changing from" << ts(value * 1000L)
|
||||
@ -932,7 +932,7 @@ bool PRS1DataChunk::ParseSummaryF0V4(void)
|
||||
// often clock adjustments without corresponding discontinuities in the waveform, and vice versa.
|
||||
// It's possible internal clock inaccuracy causes both independently.
|
||||
//
|
||||
// TODO: why do some machines have lots of these and others none? Maybe cellular modems make daily tweaks?
|
||||
// TODO: why do some devices have lots of these and others none? Maybe cellular modems make daily tweaks?
|
||||
if (false) {
|
||||
long value = data[pos] | data[pos+1]<<8 | data[pos+2]<<16 | data[pos+3]<<24;
|
||||
qDebug() << this->sessionid << "clock changing from" << ts(value * 1000L)
|
||||
@ -1550,7 +1550,7 @@ bool PRS1DataChunk::ParseSummaryF0V6(void)
|
||||
int chunk_size = this->m_data.size();
|
||||
static const int minimum_sizes[] = { 1, 0x29, 9, 4, 2, 4, 1, 4, 0x1b, 2, 4, 0x0b, 1, 2, 6 };
|
||||
static const int ncodes = sizeof(minimum_sizes) / sizeof(int);
|
||||
// NOTE: The sizes contained in hblock can vary, even within a single machine, as can the length of hblock itself!
|
||||
// NOTE: The sizes contained in hblock can vary, even within a single device, as can the length of hblock itself!
|
||||
|
||||
// TODO: hardcoding this is ugly, think of a better approach
|
||||
if (chunk_size < minimum_sizes[0] + minimum_sizes[1] + minimum_sizes[2]) {
|
||||
@ -1611,7 +1611,7 @@ bool PRS1DataChunk::ParseSummaryF0V6(void)
|
||||
this->AddEvent(new PRS1ParsedSliceEvent(tt, MaskOff));
|
||||
break;
|
||||
case 8: // vs. 7 in compliance, always follows mask off (except when there's a 5, see below), also longer
|
||||
// Maybe statistics of some kind, given the pressure stats that seem to appear before it on AutoCPAP machines?
|
||||
// Maybe statistics of some kind, given the pressure stats that seem to appear before it on AutoCPAP devices?
|
||||
//CHECK_VALUES(data[pos], 0x02, 0x01); // probably 16-bit value
|
||||
CHECK_VALUE(data[pos+1], 0x00);
|
||||
//CHECK_VALUES(data[pos+2], 0x0d, 0x0a); // probably 16-bit value, maybe OA count?
|
||||
@ -1739,7 +1739,7 @@ bool PRS1DataChunk::ParseSummaryF0V6(void)
|
||||
// The below is based on a combination of the old mainblock parsing for fileVersion == 3
|
||||
// in ParseSummary() and the switch statements of ParseSummaryF0V6.
|
||||
//
|
||||
// Both compliance and summary files (at least for 200X and 400X machines) seem to have
|
||||
// Both compliance and summary files (at least for 200X and 400X devices) seem to have
|
||||
// the same length for this slice, so maybe the settings are the same? At least 0x0a
|
||||
// looks like a pressure in compliance files.
|
||||
bool PRS1DataChunk::ParseSettingsF0V6(const unsigned char* data, int size)
|
||||
@ -1946,7 +1946,7 @@ bool PRS1DataChunk::ParseSettingsF0V6(const unsigned char* data, int size)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x90: // C-Flex+ or A-Flex, depending on machine mode
|
||||
case 0x90: // C-Flex+ or A-Flex, depending on device mode
|
||||
switch (cpapmode) {
|
||||
case PRS1_MODE_CPAP:
|
||||
case PRS1_MODE_CPAPCHECK:
|
||||
@ -2130,7 +2130,7 @@ const QVector<PRS1ParsedEventType> ParsedEventsF0V6 = {
|
||||
PRS1SnoresAtPressureEvent::TYPE,
|
||||
};
|
||||
|
||||
// DreamStation family 0 CPAP/APAP machines (400X-700X, 400G-502G)
|
||||
// DreamStation family 0 CPAP/APAP devices (400X-700X, 400G-502G)
|
||||
// Originally derived from F5V3 parsing + (incomplete) F0V234 parsing + sample data
|
||||
bool PRS1DataChunk::ParseEventsF0V6()
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ void ResmedLoader::initChannels()
|
||||
// RMS9_Temp, RMS9_TempEnable;
|
||||
|
||||
channel.add(GRP_CPAP, chan = new Channel(RMS9_SmartStart = 0xe204, SETTING, MT_CPAP, SESSION,
|
||||
"RMS9_SmartStart", QObject::tr("SmartStart"), QObject::tr("Machine auto starts by breathing"), QObject::tr("Smart Start"), "", LOOKUP, Qt::black));
|
||||
"RMS9_SmartStart", QObject::tr("SmartStart"), QObject::tr("Device auto starts by breathing"), QObject::tr("Smart Start"), "", LOOKUP, Qt::black));
|
||||
|
||||
chan->addOption(0, STR_TR_Off);
|
||||
chan->addOption(1, STR_TR_On);
|
||||
@ -207,7 +207,7 @@ void ResmedLoader::initChannels()
|
||||
chan->addOption(1, QObject::tr("Soft"));
|
||||
|
||||
channel.add(GRP_CPAP, chan = new Channel(RMAS11_SmartStop = 0xe20F, SETTING, MT_CPAP, SESSION,
|
||||
"RMAS11_SmartStop", QObject::tr("SmartStop"), QObject::tr("Machine auto stops by breathing"), QObject::tr("Smart Stop"), "", LOOKUP, Qt::black));
|
||||
"RMAS11_SmartStop", QObject::tr("SmartStop"), QObject::tr("Device auto stops by breathing"), QObject::tr("Smart Stop"), "", LOOKUP, Qt::black));
|
||||
|
||||
chan->addOption(0, STR_TR_Off);
|
||||
chan->addOption(1, STR_TR_On);
|
||||
@ -336,7 +336,7 @@ int ResmedLoader::Open(const QString & dirpath)
|
||||
{
|
||||
qDebug() << "Starting ResmedLoader::Open( with " << dirpath << ")";
|
||||
QString datalogPath;
|
||||
QHash<QString, QString> idmap; // Temporary machine ID properties hash
|
||||
QHash<QString, QString> idmap; // Temporary device ID properties hash
|
||||
|
||||
QString importPath(dirpath);
|
||||
importPath = importPath.replace("\\", "/");
|
||||
@ -387,7 +387,7 @@ int ResmedLoader::Open(const QString & dirpath)
|
||||
|
||||
bool compress_backups = p_profile->session->compressBackupData();
|
||||
|
||||
// Early check for STR.edf file, so we can early exit before creating faulty machine record.
|
||||
// Early check for STR.edf file, so we can early exit before creating faulty device record.
|
||||
// str.edf is the first (primary) file to check, str.edf.gz is the secondary
|
||||
QString pripath = importPath + "STR.edf"; // STR.edf file
|
||||
QString secpath = pripath + STR_ext_gz; // STR.edf.gz file
|
||||
@ -415,16 +415,16 @@ int ResmedLoader::Open(const QString & dirpath)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Create machine object (unless it's already registered)
|
||||
// Create device object (unless it's already registered)
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QDate firstImportDay = QDate().fromString("2010-01-01", "yyyy-MM-dd"); // Before Series 8 machines (I think)
|
||||
QDate firstImportDay = QDate().fromString("2010-01-01", "yyyy-MM-dd"); // Before Series 8 devices (I think)
|
||||
|
||||
Machine *mach = p_profile->lookupMachine(info.serial, info.loadername);
|
||||
if ( mach ) { // we have seen this machine
|
||||
if ( mach ) { // we have seen this device
|
||||
qDebug() << "We have seen this machime";
|
||||
mach->setInfo( info ); // update info
|
||||
QDate lastDate = mach->LastDay(); // use the last day for this machine
|
||||
QDate lastDate = mach->LastDay(); // use the last day for this device
|
||||
firstImportDay = lastDate; // re-import the last day, to pick up partial days
|
||||
QDate purgeDate = mach->purgeDate();
|
||||
if (purgeDate.isValid()) {
|
||||
@ -433,15 +433,15 @@ int ResmedLoader::Open(const QString & dirpath)
|
||||
// firstImportDay = lastDate.addDays(-1); // start the day before, to pick up partial days
|
||||
// firstImportDay = lastDate.addDays(1); // start the day after until we figure out the purge
|
||||
} else { // Starting from new beginnings - new or purged
|
||||
qDebug() << "New machine or just purged";
|
||||
qDebug() << "New device or just purged";
|
||||
p_profile->forceResmedPrefs();
|
||||
int modelNum = info.modelnumber.toInt();
|
||||
if ( modelNum >= 39000 ) {
|
||||
if ( ! AS11TestedModels.contains(modelNum) ) {
|
||||
QMessageBox::information(QApplication::activeWindow(),
|
||||
QObject::tr("Machine Untested"),
|
||||
QObject::tr("Your ResMed CPAP machine (Model %1) has not been tested yet.").arg(info.modelnumber) +"\n\n"+
|
||||
QObject::tr("It seems similar enough to other machines that it might work, but the developers would like a .zip copy of this machine's SD card to make sure it works with OSCAR.")
|
||||
QObject::tr("Device Untested"),
|
||||
QObject::tr("Your ResMed CPAP device (Model %1) has not been tested yet.").arg(info.modelnumber) +"\n\n"+
|
||||
QObject::tr("It seems similar enough to other devices that it might work, but the developers would like a .zip copy of this device's SD card to make sure it works with OSCAR.")
|
||||
,QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
@ -471,7 +471,7 @@ int ResmedLoader::Open(const QString & dirpath)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copy the idmap into machine objects properties, (overwriting any old values)
|
||||
// Copy the idmap into device objects properties, (overwriting any old values)
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
for (auto i=idmap.begin(), idend=idmap.end(); i != idend; i++) {
|
||||
mach->info.properties[i.key()] = i.value();
|
||||
@ -826,7 +826,7 @@ void ResmedLoader::checkSummaryDay( ResMedDay & resday, QDate date, Machine * ma
|
||||
qDebug() << "Starting checkSummary for" << date.toString();
|
||||
#endif
|
||||
if (day && day->hasMachine(mach)) {
|
||||
// Sessions found for this machine, check if only summary info
|
||||
// Sessions found for this device, check if only summary info
|
||||
#ifdef STR_DEBUG
|
||||
qDebug() << "Sessions already found for this date";
|
||||
#endif
|
||||
@ -869,7 +869,7 @@ void ResmedLoader::checkSummaryDay( ResMedDay & resday, QDate date, Machine * ma
|
||||
numPairs++;
|
||||
QList<Session *> sessions = day->getSessions(MT_CPAP, true);
|
||||
// If we have more sessions that we found in the str file,
|
||||
// or if the sessions are for a different machine,
|
||||
// or if the sessions are for a different device,
|
||||
// leave well enough alone and don't re-import the day
|
||||
if (sessions.length() >= numPairs || sessions[0]->machine() != mach) {
|
||||
#ifdef STR_DEBUG
|
||||
@ -931,7 +931,7 @@ int ResmedLoader::ScanFiles(Machine * mach, const QString & datalog_path, QDate
|
||||
|
||||
QDir dir(datalog_path);
|
||||
|
||||
// First list any EDF files in DATALOG folder - Series 9 machines
|
||||
// First list any EDF files in DATALOG folder - Series 9 devices
|
||||
QStringList filter;
|
||||
filter << "*.edf";
|
||||
dir.setNameFilters(filter);
|
||||
@ -1239,9 +1239,9 @@ bool ResmedLoader::ProcessSTRfiles(Machine *mach, QMap<QDate, STRFile> & STRmap,
|
||||
}
|
||||
|
||||
// ResMed and their consistent naming and spacing... :/
|
||||
EDFSignal *maskon = str.lookupLabel("Mask On"); // Series 9 machines
|
||||
EDFSignal *maskon = str.lookupLabel("Mask On"); // Series 9 devices
|
||||
if (!maskon) {
|
||||
maskon = str.lookupLabel("MaskOn"); // Series 1x machines
|
||||
maskon = str.lookupLabel("MaskOn"); // Series 1x devices
|
||||
}
|
||||
EDFSignal *maskoff = str.lookupLabel("Mask Off");
|
||||
if (!maskoff) {
|
||||
@ -1691,7 +1691,7 @@ bool ResmedLoader::ProcessSTRfiles(Machine *mach, QMap<QDate, STRFile> & STRmap,
|
||||
epr--;
|
||||
}
|
||||
int epr_on=0, clin_epr_on=0;
|
||||
if ((sig = str.lookupLabel("S.EPR.EPREnable"))) { // first check machines opinion
|
||||
if ((sig = str.lookupLabel("S.EPR.EPREnable"))) { // first check devices opinion
|
||||
a1x = true;
|
||||
epr_on = EventDataType(sig->dataArray[rec]) * sig->gain + sig->offset;
|
||||
if ( AS_eleven )
|
||||
@ -1847,7 +1847,7 @@ bool ResmedLoader::ProcessSTRfiles(Machine *mach, QMap<QDate, STRFile> & STRmap,
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Parse Identification.tgt file (containing serial number and machine information)
|
||||
// Parse Identification.tgt file (containing serial number and device information)
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// QHash<QString, QString> parseIdentLine( const QString line, MachineInfo * info); // forward
|
||||
// void scanProductObject( QJsonObject product, MachineInfo *info, QHash<QString, QString> *idmap); // forward
|
||||
@ -2471,7 +2471,7 @@ void ResDayTask::run()
|
||||
// sooo... at this point we have
|
||||
// resday record populated with correct STR.edf settings for this date
|
||||
// files list containing unsorted EDF files that match this day
|
||||
// guaranteed no sessions for this day for this machine.
|
||||
// guaranteed no sessions for this day for this device.
|
||||
|
||||
// Need to check overlapping files in session candidates
|
||||
|
||||
@ -2923,13 +2923,13 @@ bool ResmedLoader::LoadEVE(Session *sess, const QString & path)
|
||||
if (sess->checkInside(tt))
|
||||
UA->AddEvent(tt, anno->duration);
|
||||
} else if (matchSignal(CPAP_RERA, anno->text)) {
|
||||
// Not all machines have it, so only create it when necessary..
|
||||
// Not all devices have it, so only create it when necessary..
|
||||
if ( ! RE)
|
||||
RE = sess->AddEventList(CPAP_RERA, EVL_Event);
|
||||
if (sess->checkInside(tt))
|
||||
RE->AddEvent(tt, anno->duration);
|
||||
} else if (matchSignal(CPAP_ClearAirway, anno->text)) {
|
||||
// Not all machines have it, so only create it when necessary..
|
||||
// Not all devices have it, so only create it when necessary..
|
||||
if ( ! CA)
|
||||
CA = sess->AddEventList(CPAP_ClearAirway, EVL_Event);
|
||||
if (sess->checkInside(tt))
|
||||
@ -3379,7 +3379,7 @@ void ResmedLoader::ToTimeDelta(Session *sess, ResMedEDFInfo &edf, EDFSignal &es,
|
||||
startpos = 5; // Shave the first 10 seconds of pressure data
|
||||
tt += rate * startpos;
|
||||
}
|
||||
// Likewise for the values that the machine computes for us, but 20 seconds
|
||||
// Likewise for the values that the device computes for us, but 20 seconds
|
||||
if ((code == CPAP_MinuteVent) || (code == CPAP_RespRate) || (code == CPAP_TidalVolume)) {
|
||||
startpos = 10; // Shave the first 20 seconds of computed data
|
||||
tt += rate * startpos;
|
||||
@ -3564,7 +3564,7 @@ bool matchSignal(ChannelID ch, const QString & name)
|
||||
void setupResMedTranslationMap()
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Translation lookup table for non-english machines
|
||||
// Translation lookup table for non-english devices
|
||||
// Also combine S9, AS10, and AS11 variants
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -68,13 +68,13 @@ class ResmedLoader : public CPAPLoader
|
||||
ResmedLoader();
|
||||
virtual ~ResmedLoader();
|
||||
|
||||
//! \brief Register the ResmedLoader with the list of other machine loaders
|
||||
//! \brief Register the ResmedLoader with the list of other device loaders
|
||||
static void Register();
|
||||
|
||||
//! \brief Detect if the given path contains a valid Folder structure
|
||||
virtual bool Detect(const QString & path);
|
||||
|
||||
//! \brief Look up machine model information of ResMed file structure stored at path
|
||||
//! \brief Look up device model information of ResMed file structure stored at path
|
||||
virtual MachineInfo PeekInfo(const QString & path);
|
||||
|
||||
virtual void checkSummaryDay( ResMedDay & resday, QDate date, Machine * mach );
|
||||
@ -85,7 +85,7 @@ class ResmedLoader : public CPAPLoader
|
||||
//! \brief Returns the version number of this ResMed loader
|
||||
virtual int Version() { return resmed_data_version; }
|
||||
|
||||
//! \brief Returns the Machine class name of this loader. ("ResMed")
|
||||
//! \brief Returns the device class name of this loader. ("ResMed")
|
||||
virtual const QString &loaderName() { return resmed_class_name; }
|
||||
|
||||
virtual MachineInfo newInfo() {
|
||||
|
@ -88,7 +88,7 @@ QString getIconDir (QString givenpath) {
|
||||
}
|
||||
|
||||
/*
|
||||
* getSleepStyleMachines returns a list of all SleepStyle machine folders in the ICON directory
|
||||
* getSleepStyleMachines returns a list of all SleepStyle device folders in the ICON directory
|
||||
*/
|
||||
QStringList getSleepStyleMachines (QString iconPath) {
|
||||
QStringList ssMachines;
|
||||
@ -118,7 +118,7 @@ QStringList getSleepStyleMachines (QString iconPath) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Find out what machine model this is
|
||||
// Find out what device model this is
|
||||
QFile sumFile (flist.at(0).absoluteFilePath());
|
||||
|
||||
QString line;
|
||||
@ -149,7 +149,7 @@ bool SleepStyleLoader::Detect(const QString & givenpath)
|
||||
|
||||
QStringList machines = getSleepStyleMachines(iconPath);
|
||||
if (machines.length() <= 0)
|
||||
// Did not find any SleepStyle machine directories
|
||||
// Did not find any SleepStyle device directories
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -189,7 +189,7 @@ int SleepStyleLoader::Open(const QString & path)
|
||||
|
||||
QStringList serialNumbers = getSleepStyleMachines(iconPath);
|
||||
if (serialNumbers.length() <= 0)
|
||||
// Did not find any SleepStyle machine directories
|
||||
// Did not find any SleepStyle device directories
|
||||
return false;
|
||||
|
||||
Machine *m;
|
||||
@ -211,7 +211,7 @@ int SleepStyleLoader::Open(const QString & path)
|
||||
p_profile->DelMachine(m);
|
||||
MachList.erase(MachList.find(info.serial));
|
||||
QMessageBox::warning(nullptr, tr("Import Error"),
|
||||
tr("This Machine Record cannot be imported in this profile.")+"\n\n"+tr("The Day records overlap with already existing content."),
|
||||
tr("This device Record cannot be imported in this profile.")+"\n\n"+tr("The Day records overlap with already existing content."),
|
||||
QMessageBox::Ok);
|
||||
delete m;
|
||||
}
|
||||
@ -642,7 +642,7 @@ bool SleepStyleLoader::OpenSummary(Machine *mach, const QString & filename)
|
||||
htxt >> version;
|
||||
htxt >> fname;
|
||||
htxt >> serial;
|
||||
htxt >> model; //TODO: Should become Series in machine info???
|
||||
htxt >> model; //TODO: Should become Series in device info???
|
||||
htxt >> type; // SPSAAN etc with 4th character being A (Auto) or C (CPAP)
|
||||
htxt >> unknownident; // Constant, but has different value when version number is different.
|
||||
|
||||
@ -840,7 +840,7 @@ bool SleepStyleLoader::OpenDetail(Machine *mach, const QString & filename)
|
||||
htxt >> version;
|
||||
htxt >> fname;
|
||||
htxt >> serial;
|
||||
htxt >> model; //TODO: Should become Series in machine info???
|
||||
htxt >> model; //TODO: Should become Series in device info???
|
||||
htxt >> type; // SPSAAN etc with 4th character being A (Auto) or C (CPAP)
|
||||
htxt >> unknownident; // Constant, but has different value when version number is different.
|
||||
|
||||
|
@ -26,7 +26,7 @@ const int sleepstyle_data_version = 1;
|
||||
//********************************************************************************************
|
||||
|
||||
/*! \class SleepStyle
|
||||
\brief F&P SleepStyle customized machine object
|
||||
\brief F&P SleepStyle customized device object
|
||||
*/
|
||||
class SleepStyle: public CPAP
|
||||
{
|
||||
@ -70,10 +70,10 @@ class SleepStyleLoader : public CPAPLoader
|
||||
//! \brief Returns SleepLib database version of this F&P SleepStyle loader
|
||||
virtual int Version() { return sleepstyle_data_version; }
|
||||
|
||||
//! \brief Returns the machine class name of this CPAP machine, "SleepStyle"
|
||||
//! \brief Returns the device class name of this CPAP device, "SleepStyle"
|
||||
virtual const QString & loaderName() { return sleepstyle_class_name; }
|
||||
|
||||
// ! \brief Creates a machine object, indexed by serial number
|
||||
// ! \brief Creates a device object, indexed by serial number
|
||||
//Machine *CreateMachine(QString serial);
|
||||
|
||||
QString getSerialPath () {return serialPath;}
|
||||
|
@ -37,7 +37,7 @@ static QSet<QString> s_unexpectedMessages;
|
||||
bool
|
||||
ViatomLoader::Detect(const QString & path)
|
||||
{
|
||||
// This is only used for CPAP machines, when detecting CPAP cards.
|
||||
// This is only used for CPAP devices, when detecting CPAP cards.
|
||||
qDebug() << "ViatomLoader::Detect(" << path << ")";
|
||||
return false;
|
||||
}
|
||||
@ -74,7 +74,7 @@ ViatomLoader::Open(const QStringList & paths)
|
||||
}
|
||||
|
||||
Machine* mach = m_mach;
|
||||
if (imported && mach == nullptr) qWarning() << "No machine record created?";
|
||||
if (imported && mach == nullptr) qWarning() << "No device record created?";
|
||||
if (mach) {
|
||||
qDebug() << "Imported" << imported << "sessions";
|
||||
mach->Save();
|
||||
@ -82,7 +82,7 @@ ViatomLoader::Open(const QStringList & paths)
|
||||
p_profile->StoreMachines();
|
||||
}
|
||||
if (mach && s_unexpectedMessages.count() > 0 && p_profile->session->warnOnUnexpectedData()) {
|
||||
// Compare this to the list of messages previously seen for this machine
|
||||
// Compare this to the list of messages previously seen for this device
|
||||
// and only alert if there are new ones.
|
||||
QSet<QString> newMessages = s_unexpectedMessages - mach->previouslySeenUnexpectedData();
|
||||
if (newMessages.count() > 0) {
|
||||
|
@ -25,7 +25,7 @@ const int weinmann_data_version = 3;
|
||||
//********************************************************************************************
|
||||
|
||||
/*! \class Weinmann
|
||||
\brief Weinmann customized machine object
|
||||
\brief Weinmann customized device object
|
||||
*/
|
||||
class Weinmann: public CPAP
|
||||
{
|
||||
@ -101,13 +101,13 @@ class WeinmannLoader : public CPAPLoader
|
||||
//! \brief Returns SleepLib database version of this Weinmann loader
|
||||
virtual int Version() { return weinmann_data_version; }
|
||||
|
||||
//! \brief Returns the machine loader name of this class
|
||||
//! \brief Returns the device loader name of this class
|
||||
virtual const QString &loaderName() { return weinmann_class_name; }
|
||||
|
||||
int ParseIndex(QFile & wmdata);
|
||||
|
||||
|
||||
//! \brief Creates a machine object, indexed by serial number
|
||||
//! \brief Creates a device object, indexed by serial number
|
||||
// Machine *CreateMachine(QString serial);
|
||||
|
||||
//! \brief Registers this MachineLoader with the master list, so Weinmann data can load
|
||||
|
Loading…
Reference in New Issue
Block a user