ResMed pressure storage fixes, Added Purge Machine feature back

This commit is contained in:
Mark Watkins 2014-08-05 05:57:48 +10:00
parent 5ef1d90414
commit 754b79b096
13 changed files with 422 additions and 179 deletions

View File

@ -991,12 +991,15 @@ QString Day::getPressureRelief()
ChannelID pr_level_chan = loader->PresReliefLevel();
ChannelID pr_mode_chan = loader->PresReliefMode();
if ((pr_level_chan != NoChannel) && settingExists(pr_level_chan)) {
int pr_level = qRound(settings_wavg(pr_level_chan));
if ((pr_mode_chan != NoChannel) && settingExists(pr_mode_chan)) {
int pr_mode = qRound(settings_wavg(pr_mode_chan));
pr_str = QObject::tr("%1%2").arg(loader->PresReliefLabel()).
arg(schema::channel[pr_mode_chan].option(pr_mode));
if (pr_mode > 0) pr_str += QString(" %1").arg(schema::channel[pr_level_chan].option(pr_level));
pr_str = QObject::tr("%1%2").arg(loader->PresReliefLabel()).arg(schema::channel[pr_mode_chan].option(pr_mode));
int pr_level = -1;
if (pr_level_chan != NoChannel && settingExists(pr_level_chan)) {
pr_level = qRound(settings_wavg(pr_level_chan));
}
if (pr_level >= 0) pr_str += QString(" %1").arg(schema::channel[pr_level_chan].option(pr_level));
} else pr_str = STR_TR_None;
return pr_str;
}

View File

@ -2000,7 +2000,7 @@ void PRS1Loader::Register()
"PRS1FlexMode", QObject::tr("Flex Mode"),
QObject::tr("PRS1 pressure relief mode."),
QObject::tr("Flex Mode"),
"", DEFAULT, Qt::green));
"", LOOKUP, Qt::green));
chan->addOption(FLEX_None, STR_TR_None);
@ -2015,35 +2015,121 @@ void PRS1Loader::Register()
QObject::tr("Flex Level"),
QObject::tr("PRS1 pressure relief setting."),
QObject::tr("Flex Level"),
"", DEFAULT, Qt::blue));
"", LOOKUP, Qt::blue));
chan->addOption(0, STR_TR_Off);
chan->addOption(1, QObject::tr("x1"));
chan->addOption(2, QObject::tr("x2"));
chan->addOption(3, QObject::tr("x3"));
channel.add(GRP_CPAP, chan = new Channel(PRS1_HumidStatus = 0xe101, SETTING, SESSION,
"PRS1HumidStat",
QObject::tr("Humidifier Status"),
QObject::tr("PRS1 humidifier connected?"),
QObject::tr("Humidifier Status"),
"", DEFAULT, Qt::green));
chan->addOption(0, STR_TR_No);
chan->addOption(1, STR_TR_Yes);
channel.add(GRP_CPAP, chan = new Channel(PRS1_HumidLevel = 0xe102, SETTING, SESSION,
"PRS1HumidLevel",
QObject::tr("Humidification Level"),
QObject::tr("PRS1 Humidification level"),
QObject::tr("Humid. Lvl."),
"", DEFAULT, Qt::green));
chan->addOption(0, STR_TR_Off);
chan->addOption(1, QObject::tr("x1"));
chan->addOption(2, QObject::tr("x2"));
chan->addOption(3, QObject::tr("x3"));
chan->addOption(4, QObject::tr("x4"));
chan->addOption(5, QObject::tr("x5"));
channel.add(GRP_CPAP, chan = new Channel(PRS1_HumidStatus = 0xe101, SETTING, SESSION,
"PRS1HumidStat",
QObject::tr("Humidifier Status"),
QObject::tr("PRS1 humidifier connected?"),
QObject::tr("Humidifier Status"),
"", LOOKUP, Qt::green));
chan->addOption(0, QObject::tr("Disconnected"));
chan->addOption(1, QObject::tr("Connected"));
channel.add(GRP_CPAP, chan = new Channel(PRS1_HumidLevel = 0xe102, SETTING, SESSION,
"PRS1HumidLevel",
QObject::tr("Humidification Level"),
QObject::tr("PRS1 Humidification level"),
QObject::tr("Humid. Lvl."),
"", LOOKUP, Qt::green));
chan->addOption(0, STR_TR_Off);
chan->addOption(1, QObject::tr("x1"));
chan->addOption(2, QObject::tr("x2"));
chan->addOption(3, QObject::tr("x3"));
chan->addOption(4, QObject::tr("x4"));
chan->addOption(5, QObject::tr("x5"));
channel.add(GRP_CPAP, chan = new Channel(PRS1_SysOneResistStat = 0xe103, SETTING, SESSION,
"SysOneResistStat",
QObject::tr("System One Resistance Status"),
QObject::tr("System One Resistance Status"),
QObject::tr("Sys1 Resist. Status"),
"", LOOKUP, Qt::green));
chan->addOption(0, STR_TR_Off);
chan->addOption(1, STR_TR_On);
channel.add(GRP_CPAP, chan = new Channel(PRS1_SysOneResistSet = 0xe104, SETTING, SESSION,
"SysOneResistSet",
QObject::tr("System One Resistance Setting"),
QObject::tr("System One Mask Resistance Setting"),
QObject::tr("Sys1 Resist. Set"),
"", LOOKUP, Qt::green));
chan->addOption(0, STR_TR_Off);
chan->addOption(1, QObject::tr("x1"));
chan->addOption(2, QObject::tr("x2"));
chan->addOption(3, QObject::tr("x3"));
chan->addOption(4, QObject::tr("x4"));
chan->addOption(5, QObject::tr("x5"));
channel.add(GRP_CPAP, chan = new Channel(PRS1_HoseDiam = 0xe107, SETTING, SESSION,
"PRS1HoseDiam",
QObject::tr("Hose Diameter"),
QObject::tr("Diameter of primary CPAP hose"),
QObject::tr("Hose Diameter"),
"", LOOKUP, Qt::green));
chan->addOption(0, QObject::tr("22mm"));
chan->addOption(1, QObject::tr("15mm"));
channel.add(GRP_CPAP, chan = new Channel(PRS1_SysOneResistStat = 0xe108, SETTING, SESSION,
"SysOneLock",
QObject::tr("System One Resistance Lock"),
QObject::tr("Whether System One resistance settings are available to you."),
QObject::tr("Sys1 Resist. Lock"),
"", LOOKUP, Qt::green));
chan->addOption(0, STR_TR_Off);
chan->addOption(1, STR_TR_On);
channel.add(GRP_CPAP, chan = new Channel(PRS1_AutoOn = 0xe109, SETTING, SESSION,
"PRS1AutoOn",
QObject::tr("Auto On"),
QObject::tr("A few breaths automatically starts machine"),
QObject::tr("Auto On"),
"", LOOKUP, Qt::green));
chan->addOption(0, STR_TR_Off);
chan->addOption(1, STR_TR_On);
channel.add(GRP_CPAP, chan = new Channel(PRS1_AutoOff = 0xe10a, SETTING, SESSION,
"PRS1AutoOff",
QObject::tr("Auto Off"),
QObject::tr("Machine automatically switches off"),
QObject::tr("Auto Off"),
"", LOOKUP, Qt::green));
chan->addOption(0, STR_TR_Off);
chan->addOption(1, STR_TR_On);
channel.add(GRP_CPAP, chan = new Channel(PRS1_MaskAlert = 0xe10b, SETTING, SESSION,
"PRS1MaskAlert",
QObject::tr("Mask Alert"),
QObject::tr("Whether or not machine allows Mask checking."),
QObject::tr("Mask Alert"),
"", LOOKUP, Qt::green));
chan->addOption(0, STR_TR_Off);
chan->addOption(1, STR_TR_On);
channel.add(GRP_CPAP, chan = new Channel(PRS1_MaskAlert = 0xe10c, SETTING, SESSION,
"PRS1ShowAHI",
QObject::tr("Show AHI"),
QObject::tr("Whether or not machine shows AHI via LCD panel."),
QObject::tr("Show AHI"),
"", LOOKUP, Qt::green));
chan->addOption(0, STR_TR_Off);
chan->addOption(1, STR_TR_On);
// <channel id="0xe10d" class="setting" scope="!session" name="PRS1Mode" details="PAP Mode" label="PAP Mode" type="integer" link="0x1200">
// <Option id="0" value="CPAP"/>
// <Option id="1" value="Auto"/>
// <Option id="2" value="BIPAP"/>
// <Option id="3" value="AutoSV"/>
// </channel>
QString unknowndesc=QObject::tr("Unknown PRS1 Code %1");
QString unknownname=QObject::tr("PRS1_%1");

View File

@ -718,26 +718,59 @@ void ResmedImport::run()
// Save maskon time in session setting so we can use it later to avoid doubleups.
sess->settings[RMS9_MaskOnTime] = R.maskon;
// Grab all the system settings
if (R.set_pressure >= 0) sess->settings[CPAP_Pressure] = R.set_pressure;
if (R.min_pressure >= 0) sess->settings[CPAP_PressureMin] = R.min_pressure;
if (R.max_pressure >= 0) sess->settings[CPAP_PressureMax] = R.max_pressure;
if (R.ps >= 0) sess->settings[CPAP_PS] = R.ps;
if (R.min_ps >= 0) sess->settings[CPAP_PSMin] = R.min_ps;
if (R.max_ps >= 0) sess->settings[CPAP_PSMax] = R.max_ps;
if (R.epap >= 0) sess->settings[CPAP_EPAP] = R.epap;
if (R.max_epap >= 0) sess->settings[CPAP_EPAPHi] = R.max_epap;
if (R.min_epap >= 0) sess->settings[CPAP_EPAPLo] = R.min_epap;
if (R.ipap >= 0) sess->settings[CPAP_IPAP] = R.ipap;
if (R.max_ipap >= 0) sess->settings[CPAP_IPAPHi] = R.max_ipap;
if (R.min_ipap >= 0) sess->settings[CPAP_IPAPLo] = R.min_ipap;
if (R.mode >= 0) sess->settings[CPAP_Mode] = R.mode;
if (R.mode >= 0) {
sess->settings[CPAP_Mode] = R.mode;
if (R.mode == MODE_CPAP) {
if (R.set_pressure >= 0) {
sess->settings[CPAP_Pressure] = R.set_pressure;
}
} else if (R.mode == MODE_APAP) {
if (R.min_pressure >= 0) sess->settings[CPAP_PressureMin] = R.min_pressure;
if (R.max_pressure >= 0) sess->settings[CPAP_PressureMax] = R.max_pressure;
} else if (R.mode == MODE_BILEVEL_FIXED) {
if (R.epap >= 0) sess->settings[CPAP_EPAP] = R.epap;
if (R.ipap >= 0) sess->settings[CPAP_IPAP] = R.ipap;
if (R.ps >= 0) sess->settings[CPAP_PS] = R.ps;
} else if (R.mode == MODE_BILEVEL_AUTO_FIXED_PS) {
if (R.min_epap >= 0) sess->settings[CPAP_EPAPLo] = R.min_epap;
if (R.max_ipap >= 0) sess->settings[CPAP_IPAPHi] = R.max_ipap;
if (R.ps >= 0) sess->settings[CPAP_PS] = R.ps;
} else if (R.mode == MODE_ASV) {
if (R.epap >= 0) sess->settings[CPAP_EPAP] = R.epap;
if (R.min_ps >= 0) sess->settings[CPAP_PSMin] = R.min_ps;
if (R.max_ps >= 0) sess->settings[CPAP_PSMax] = R.max_ps;
if (R.max_ipap >= 0) sess->settings[CPAP_IPAPHi] = R.max_ipap;
} else if (R.mode == MODE_ASV_VARIABLE_EPAP) {
if (R.max_epap >= 0) sess->settings[CPAP_EPAPHi] = R.max_epap;
if (R.min_epap >= 0) sess->settings[CPAP_EPAPLo] = R.min_epap;
if (R.max_ipap >= 0) sess->settings[CPAP_IPAPHi] = R.max_ipap;
if (R.min_ipap >= 0) sess->settings[CPAP_IPAPLo] = R.min_ipap;
if (R.min_ps >= 0) sess->settings[CPAP_PSMin] = R.min_ps;
if (R.max_ps >= 0) sess->settings[CPAP_PSMax] = R.max_ps;
}
} else {
if (R.set_pressure >= 0) sess->settings[CPAP_Pressure] = R.set_pressure;
if (R.min_pressure >= 0) sess->settings[CPAP_PressureMin] = R.min_pressure;
if (R.max_pressure >= 0) sess->settings[CPAP_PressureMax] = R.max_pressure;
if (R.max_epap >= 0) sess->settings[CPAP_EPAPHi] = R.max_epap;
if (R.min_epap >= 0) sess->settings[CPAP_EPAPLo] = R.min_epap;
if (R.max_ipap >= 0) sess->settings[CPAP_IPAPHi] = R.max_ipap;
if (R.min_ipap >= 0) sess->settings[CPAP_IPAPLo] = R.min_ipap;
if (R.min_ps >= 0) sess->settings[CPAP_PSMin] = R.min_ps;
if (R.max_ps >= 0) sess->settings[CPAP_PSMax] = R.max_ps;
if (R.ps >= 0) sess->settings[CPAP_PS] = R.ps;
if (R.epap >= 0) sess->settings[CPAP_EPAP] = R.epap;
if (R.ipap >= 0) sess->settings[CPAP_IPAP] = R.ipap;
}
if (R.epr >= 0) {
sess->settings[RMS9_EPR] = (int)R.epr;
}
if (R.epr_level >= 0) {
sess->settings[RMS9_EPRLevel] = (int)R.epr_level;
if (R.epr > 0) {
if (R.epr_level >= 0) {
sess->settings[RMS9_EPRLevel] = (int)R.epr_level;
}
}
}
// Ignore all the rest of the sumary data, because there is enough available to calculate it with higher accuracy.
@ -784,25 +817,60 @@ void ResmedImportStage2::run()
sess->SetChanged(true);
// First take the settings
if (R.set_pressure >= 0)
sess->settings[CPAP_Pressure] = R.set_pressure;
if (R.min_pressure >= 0) sess->settings[CPAP_PressureMin] = R.min_pressure;
if (R.max_pressure >= 0) sess->settings[CPAP_PressureMax] = R.max_pressure;
if (R.ps >= 0) sess->settings[CPAP_PS] = R.ps;
if (R.min_ps >= 0) sess->settings[CPAP_PSMin] = R.min_ps;
if (R.max_ps >= 0) sess->settings[CPAP_PSMax] = R.max_ps;
if (R.epap >= 0) sess->settings[CPAP_EPAP] = R.epap;
if (R.max_epap >= 0) sess->settings[CPAP_EPAPHi] = R.max_epap;
if (R.min_epap >= 0) sess->settings[CPAP_EPAPLo] = R.min_epap;
if (R.ipap >= 0) sess->settings[CPAP_IPAP] = R.ipap;
if (R.max_ipap >= 0) sess->settings[CPAP_IPAPHi] = R.max_ipap;
if (R.min_ipap >= 0) sess->settings[CPAP_IPAPLo] = R.min_ipap;
if (R.mode >= 0) sess->settings[CPAP_Mode] = R.mode;
if (R.mode >= 0) {
sess->settings[CPAP_Mode] = R.mode;
if (R.mode == MODE_CPAP) {
if (R.set_pressure >= 0) {
sess->settings[CPAP_Pressure] = R.set_pressure;
}
} else if (R.mode == MODE_APAP) {
if (R.min_pressure >= 0) sess->settings[CPAP_PressureMin] = R.min_pressure;
if (R.max_pressure >= 0) sess->settings[CPAP_PressureMax] = R.max_pressure;
} else if (R.mode == MODE_BILEVEL_FIXED) {
if (R.epap >= 0) sess->settings[CPAP_EPAP] = R.epap;
if (R.ipap >= 0) sess->settings[CPAP_IPAP] = R.ipap;
if (R.ps >= 0) sess->settings[CPAP_PS] = R.ps;
} else if (R.mode == MODE_BILEVEL_AUTO_FIXED_PS) {
if (R.min_epap >= 0) sess->settings[CPAP_EPAPLo] = R.min_epap;
if (R.max_ipap >= 0) sess->settings[CPAP_IPAPHi] = R.max_ipap;
if (R.ps >= 0) sess->settings[CPAP_PS] = R.ps;
} else if (R.mode == MODE_ASV) {
if (R.epap >= 0) sess->settings[CPAP_EPAP] = R.epap;
if (R.min_ps >= 0) sess->settings[CPAP_PSMin] = R.min_ps;
if (R.max_ps >= 0) sess->settings[CPAP_PSMax] = R.max_ps;
if (R.max_ipap >= 0) sess->settings[CPAP_IPAPHi] = R.max_ipap;
} else if (R.mode == MODE_ASV_VARIABLE_EPAP) {
if (R.max_epap >= 0) sess->settings[CPAP_EPAPHi] = R.max_epap;
if (R.min_epap >= 0) sess->settings[CPAP_EPAPLo] = R.min_epap;
if (R.max_ipap >= 0) sess->settings[CPAP_IPAPHi] = R.max_ipap;
if (R.min_ipap >= 0) sess->settings[CPAP_IPAPLo] = R.min_ipap;
if (R.min_ps >= 0) sess->settings[CPAP_PSMin] = R.min_ps;
if (R.max_ps >= 0) sess->settings[CPAP_PSMax] = R.max_ps;
}
} else {
if (R.set_pressure >= 0) sess->settings[CPAP_Pressure] = R.set_pressure;
if (R.min_pressure >= 0) sess->settings[CPAP_PressureMin] = R.min_pressure;
if (R.max_pressure >= 0) sess->settings[CPAP_PressureMax] = R.max_pressure;
if (R.max_epap >= 0) sess->settings[CPAP_EPAPHi] = R.max_epap;
if (R.min_epap >= 0) sess->settings[CPAP_EPAPLo] = R.min_epap;
if (R.max_ipap >= 0) sess->settings[CPAP_IPAPHi] = R.max_ipap;
if (R.min_ipap >= 0) sess->settings[CPAP_IPAPLo] = R.min_ipap;
if (R.min_ps >= 0) sess->settings[CPAP_PSMin] = R.min_ps;
if (R.max_ps >= 0) sess->settings[CPAP_PSMax] = R.max_ps;
if (R.ps >= 0) sess->settings[CPAP_PS] = R.ps;
if (R.epap >= 0) sess->settings[CPAP_EPAP] = R.epap;
if (R.ipap >= 0) sess->settings[CPAP_IPAP] = R.ipap;
}
if (R.epr >= 0) {
sess->settings[RMS9_EPR] = (int)R.epr;
}
if (R.epr_level >= 0) {
sess->settings[RMS9_EPRLevel] = (int)R.epr_level;
if (R.epr > 0) {
if (R.epr_level >= 0) {
sess->settings[RMS9_EPRLevel] = (int)R.epr_level;
}
}
}
if (R.leakmax >= 0) sess->setMax(CPAP_Leak, R.leakmax);
if (R.leakmax >= 0) sess->setMin(CPAP_Leak, 0);
@ -2373,16 +2441,14 @@ void ResmedLoader::Register()
qDebug() << "Registering ResmedLoader";
RegisterLoader(new ResmedLoader());
ResInitModelMap();
resmed_initialized = true;
using namespace schema;
Channel * chan = nullptr;
channel.add(GRP_CPAP, chan = new Channel(RMS9_EPR = 0xe201, SETTING, SESSION,
"EPR", QObject::tr("EPR Mode"),
QObject::tr("ResMed Exhale Pressure Relief Mode."),
QObject::tr("EPR Mode"),
"", DEFAULT, Qt::green));
"EPR", QObject::tr("EPR"),
QObject::tr("ResMed Exhale Pressure Relief"),
QObject::tr("EPR"),
"", LOOKUP, Qt::green));
chan->addOption(0, STR_TR_Off);
@ -2393,13 +2459,16 @@ void ResmedLoader::Register()
"EPRLevel", QObject::tr("EPR Level"),
QObject::tr("Exhale Pressure Relief Level"),
QObject::tr("EPR Level"),
"", DEFAULT, Qt::blue));
"", LOOKUP, Qt::blue));
chan->addOption(0, QObject::tr("0cmH2O"));
chan->addOption(1, QObject::tr("1cmH2O"));
chan->addOption(2, QObject::tr("2cmH2O"));
chan->addOption(3, QObject::tr("3cmH2O"));
chan->addOption(4, QObject::tr("Patient"));
chan->addOption(4, QObject::tr("Patient")); // Think this isn't real..
ResInitModelMap();
resmed_initialized = true;
}
////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -51,6 +51,20 @@ MachineLoader * lookupLoader(Machine * m)
QHash<QString, QHash<QString, Machine *> > MachineList;
void MachineLoader::removeMachine(Machine * m)
{
m_machlist.removeAll(m);
QHash<QString, QHash<QString, Machine *> >::iterator mlit = MachineList.find(m->loaderName());
if (mlit != MachineList.end()) {
QHash<QString, Machine *>::iterator mit = mlit.value().find(m->serial());
if (mit != mlit.value().end()) {
mlit.value().erase(mit);
}
}
}
Machine * MachineLoader::CreateMachine(MachineInfo info, MachineID id)
{
Q_ASSERT(p_profile != nullptr);

View File

@ -84,6 +84,8 @@ class MachineLoader: public QObject
QMutex sessionMutex;
QMutex saveMutex;
void removeMachine(Machine * m);
signals:
void updateProgress(int cnt, int total);

View File

@ -508,7 +508,8 @@ void Profile::AddMachine(Machine *m)
}
machlist[m->id()] = m;
};
}
void Profile::DelMachine(Machine *m)
{
if (!m) {
@ -516,8 +517,9 @@ void Profile::DelMachine(Machine *m)
return;
}
m->loader()->removeMachine(m);
machlist.erase(machlist.find(m->id()));
};
}
// Potential Memory Leak Here..

View File

@ -118,11 +118,11 @@ void init()
schema::channel.add(GRP_CPAP, new Channel(CPAP_PressureMin = 0x1020, SETTING, SESSION,
"PressureMin", QObject::tr("Min Pressure") , QObject::tr("Minimum Therapy Pressure"),
QObject::tr("Pr. Min"), STR_UNIT_CMH2O, DEFAULT, QColor("black")));
QObject::tr("Pressure Min"), STR_UNIT_CMH2O, DEFAULT, QColor("black")));
schema::channel.add(GRP_CPAP, new Channel(CPAP_PressureMax = 0x1021, SETTING, SESSION,
"PressureMax", QObject::tr("Max Pressure"), QObject::tr("Maximum Therapy Pressure"),
QObject::tr("Pr. Max"), STR_UNIT_CMH2O, DEFAULT, QColor("black")));
QObject::tr("Pressure Max"), STR_UNIT_CMH2O, DEFAULT, QColor("black")));
schema::channel.add(GRP_CPAP, new Channel(CPAP_RampTime = 0x1022, SETTING, SESSION,
"RampTime", QObject::tr("Ramp Time") , QObject::tr("Ramp Delay Period"),
@ -130,7 +130,7 @@ void init()
schema::channel.add(GRP_CPAP, new Channel(CPAP_RampPressure = 0x1023, SETTING, SESSION,
"RampPressure", QObject::tr("Ramp Pressure"), QObject::tr("Starting Ramp Pressure"),
QObject::tr("Ramp Pr."), STR_UNIT_CMH2O, DEFAULT, QColor("black")));
QObject::tr("Ramp Pressure"), STR_UNIT_CMH2O, DEFAULT, QColor("black")));
schema::channel.add(GRP_CPAP, new Channel(CPAP_Ramp = 0x1027, SPAN, SESSION,
@ -398,7 +398,8 @@ void init()
Channel *ch;
schema::channel.add(GRP_CPAP, ch = new Channel(CPAP_Mode = 0x1200, SETTING, SESSION,
"PAPMode", QObject::tr("PAP Mode"),
QObject::tr("PAP Mode"), QObject::tr("PAP_Mode"), STR_UNIT_Unknown,
QObject::tr("PAP Device Mode"),
QObject::tr("PAP Mode"), QString(),
LOOKUP, Qt::black));
ch->addOption(0, STR_TR_Unknown);
@ -478,14 +479,6 @@ void init()
RMS9_E02 = schema::channel["RMS9_E02"].id();
RMS9_SetPressure = schema::channel["SetPressure"].id(); // TODO: this isn't needed anymore
CPAP_HumidSetting = schema::channel["HumidSet"].id();
PRS1_SysLock = schema::channel["SysLock"].id();
PRS1_SysOneResistStat = schema::channel["SysOneResistStat"].id();
PRS1_SysOneResistSet = schema::channel["SysOneResistSet"].id();
PRS1_HoseDiam = schema::channel["HoseDiam"].id();
PRS1_AutoOn = schema::channel["AutoOn"].id();
PRS1_AutoOff = schema::channel["AutoOff"].id();
PRS1_MaskAlert = schema::channel["MaskAlert"].id();
PRS1_ShowAHI = schema::channel["ShowAHI"].id();
INTELLIPAP_Unknown1 = schema::channel["IntUnk1"].id();
INTELLIPAP_Unknown2 = schema::channel["IntUnk2"].id();
// OXI_Pulse=schema::channel["Pulse"].id();

View File

@ -61,6 +61,7 @@ class Channel
const int &id() { return m_id; }
const ChanType &type() { return m_type; }
const DataType &datatype() { return m_datatype; }
const QString &code() { return m_code; }
const QString &fullname() { return m_fullname; }
const QString &description() { return m_description; }

View File

@ -65,8 +65,10 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
lastcpapday=nullptr;
QList<int> a;
a.push_back(300);
a.push_back(this->width()-300);
int panel_width = 350;
a.push_back(panel_width);
a.push_back(this->width() - panel_width);
ui->splitter_2->setStretchFactor(1,1);
ui->splitter_2->setSizes(a);
ui->splitter_2->setStretchFactor(1,1);
@ -933,7 +935,7 @@ QString Daily::getSessionInformation(Day * cpap, Day * oxi, Day * stage, Day * p
sess->settings[SESSION_ENABLED]=true;
}
bool b=sess->settings[SESSION_ENABLED].toBool();
html+=QString("<tr>"
html+=QString("<tr class='datarow'>"
"<td width=26><a href='toggle"+type+"session=%1'>"
"<img src='qrc:/icons/session-%4.png' width=24px></a></td>"
"<td align=center>%5</td>"
@ -970,7 +972,64 @@ QString Daily::getMachineSettings(Day * cpap) {
return html;
}
ChannelID pr_level_chan = NoChannel;
QMap<QString, QString> other;
QHash<ChannelID, QVariant>::iterator it = cpap->sessions.at(0)->settings.begin();
QHash<ChannelID, QVariant>::iterator it_end = cpap->sessions.at(0)->settings.end();
QMap<int, QString> first;
for (; it != it_end; ++it) {
ChannelID code = it.key();
if ((code <= 1) || (code == RMS9_MaskOnTime)) continue;
schema::Channel & chan = schema::channel[code];
QString data;
if (chan.datatype() == schema::LOOKUP) {
data = chan.option(it.value().toInt());
} else if (chan.datatype() == schema::BOOL) {
data = (it.value().toBool() ? STR_TR_Yes : STR_TR_No);
} else if (chan.datatype() == schema::DOUBLE) {
data = QString().number(it.value().toDouble(),'f',1) + " "+chan.units();
} else {
data = it.value().toString() + " "+ chan.units();
}
QString tmp = QString("<tr class='datarow'><td><a class='info' href='#'>%1<span>%2</span></a></td><td colspan=4>%3</td></tr>")
.arg(schema::channel[code].label())
.arg(schema::channel[code].description())
.arg(data);
if ((code == CPAP_Mode)
|| (code == CPAP_IPAP)
|| (code == CPAP_EPAP)
|| (code == CPAP_IPAPHi)
|| (code == CPAP_EPAPHi)
|| (code == CPAP_IPAPLo)
|| (code == CPAP_EPAPLo)
|| (code == CPAP_PressureMin)
|| (code == CPAP_PressureMax)
|| (code == CPAP_Pressure)
|| (code == CPAP_PSMin)
|| (code == CPAP_PSMax)
|| (code == CPAP_PS)) {
first[code] = tmp;
} else {
other[schema::channel[code].label()] = tmp;
}
}
ChannelID order[] = { CPAP_Mode, CPAP_Pressure, CPAP_PressureMin, CPAP_PressureMax, CPAP_EPAP, CPAP_EPAPLo, CPAP_EPAPHi, CPAP_IPAP, CPAP_IPAPLo, CPAP_IPAPHi, CPAP_PS, CPAP_PSMin, CPAP_PSMax };
int os = sizeof(order) / sizeof(ChannelID);
for (int i=0 ;i < os; ++i) {
if (first.contains(order[i])) html += first[order[i]];
}
for (QMap<QString,QString>::iterator it = other.begin(); it != other.end(); ++it) {
html += it.value();
}
/* ChannelID pr_level_chan = NoChannel;
ChannelID pr_mode_chan = NoChannel;
ChannelID hum_stat_chan = NoChannel;
ChannelID hum_level_chan = NoChannel;
@ -997,7 +1056,7 @@ QString Daily::getMachineSettings(Day * cpap) {
html+=QString("<tr><td><a class='info' href='#'>"+schema::channel[hum_level_chan].label()+"<span>%1</span></a></td><td colspan=4>%2</td></tr>")
.arg(schema::channel[hum_level_chan].description())
.arg(humid == 0 ? STR_GEN_Off : "x"+QString::number(humid));
}
} */
html+="</table>";
html+="<hr/>\n";
}
@ -1150,7 +1209,7 @@ QString Daily::getStatisticsInfo(Day * cpap,Day * oxi,Day *pos)
}
}
html+=QString("<tr><td align=left class='info' onmouseover=\"style.color='blue';\" onmouseout=\"style.color='"+COLOR_Text.name()+"';\">%1<span>%6</span></td><td>%2</td><td>%3</td><td>%4</td><td>%5</td></tr>")
html+=QString("<tr class='datarow'><td align=left class='info' onmouseover=\"style.color='blue';\" onmouseout=\"style.color='"+COLOR_Text.name()+"';\">%1<span>%6</span></td><td>%2</td><td>%3</td><td>%4</td><td>%5</td></tr>")
.arg(schema::channel[code].label())
.arg(mn,0,'f',2)
.arg(med,0,'f',2)
@ -1282,6 +1341,10 @@ void Daily::Load(QDate date)
QString html="<html><head><style type='text/css'>"
"p,a,td,body { font-family: '"+QApplication::font().family()+"'; }"
"p,a,td,body { font-size: "+QString::number(QApplication::font().pointSize() + 2)+"px; }"
"tr.datarow:nth-child(even) {"
"background-color: #f8f8f8;"
"}"
"</style>"
"<link rel='stylesheet' type='text/css' href='qrc:/docs/tooltips.css' />"
"<script language='javascript'><!--"

View File

@ -72,49 +72,6 @@ Important: One id code per item, DO NOT CHANGE ID NUMBERS!!!
</group>
<group name="PRS1">
<!-- PRS1 Settings -->
<channel id="0xe103" class="setting" scope="!session" name="SysOneResistStat" details="System One Resistance Status" label="S1 Resist. Status" type="bool">
<Option id="0" value="Off"/>
<Option id="1" value="On"/>
</channel>
<channel id="0xe104" class="setting" scope="!session" name="SysOneResistSet" details="System One Resistance Setting" label="S1 Resist. Setting" type="integer">
<Option id="0" value="Off"/>
<Option id="1" value="x1"/>
<Option id="2" value="x2"/>
<Option id="3" value="x3"/>
<Option id="4" value="x4"/>
<Option id="5" value="x5"/>
</channel>
<channel id="0xe107" class="setting" scope="!session" name="HoseDiam" details="Hose Diameter" label="Hose Diameter" type="bool">
<Option id="0" value="22mm"/>
<Option id="1" value="15mm"/>
</channel>
<channel id="0xe108" class="setting" scope="!session" name="SysLock" details="System Lock Status" label="Sys Lock" type="bool">
<Option id="0" value="Off"/>
<Option id="1" value="On"/>
</channel>
<channel id="0xe109" class="setting" scope="!session" name="AutoOn" details="Auto On" label="Auto On" type="bool">
<Option id="0" value="Off"/>
<Option id="1" value="On"/>
</channel>
<channel id="0xe10a" class="setting" scope="!session" name="AutoOff" details="Auto Off" label="Auto Off" type="bool">
<Option id="0" value="Off"/>
<Option id="1" value="On"/>
</channel>
<channel id="0xe10b" class="setting" scope="!session" name="MaskAlert" details="Mask Alert" label="Mask Alert" type="bool">
<Option id="0" value="Off"/>
<Option id="1" value="On"/>
</channel>
<channel id="0xe10c" class="setting" scope="!session" name="ShowAHI" details="Show AHI" label="Show AHI" type="bool">
<Option id="0" value="Off"/>
<Option id="1" value="On"/>
</channel>
<channel id="0xe10d" class="setting" scope="!session" name="PRS1Mode" details="PAP Mode" label="PAP Mode" type="integer" link="0x1200">
<Option id="0" value="CPAP"/>
<Option id="1" value="Auto"/>
<Option id="2" value="BIPAP"/>
<Option id="3" value="AutoSV"/>
</channel>
</group>
<group name="RMS9">
<!-- RESMED Settings -->

View File

@ -446,12 +446,12 @@ QIcon getCPAPIcon(QString mach_class)
void MainWindow::PopulatePurgeMenu()
{
QList<QAction *> actions = ui->menu_Rebuild_CPAP_Data->actions();
ui->menu_Rebuild_CPAP_Data->disconnect(ui->menu_Rebuild_CPAP_Data, SIGNAL(triggered(QAction*)), this, SLOT(on_actionPurgeMachine(QAction *)));
ui->menu_Rebuild_CPAP_Data->disconnect(ui->menu_Rebuild_CPAP_Data, SIGNAL(triggered(QAction*)), this, SLOT(on_actionRebuildCPAP(QAction *)));
ui->menu_Rebuild_CPAP_Data->clear();
ui->menuPurge_CPAP_Data->disconnect(ui->menuPurge_CPAP_Data, SIGNAL(triggered(QAction*)), this, SLOT(on_actionPurgeMachine(QAction *)));
ui->menuPurge_CPAP_Data->clear();
QList<Machine *> machines = p_profile->GetMachines(MT_CPAP);
for (int i=0; i < machines.size(); ++i) {
Machine *mach = machines.at(i);
@ -464,8 +464,16 @@ void MainWindow::PopulatePurgeMenu()
action->setIcon(getCPAPIcon(mach->loaderName()));
action->setData(mach->loaderName()+":"+mach->serial());
ui->menu_Rebuild_CPAP_Data->addAction(action);
action = new QAction(name.replace("&","&&"), ui->menuPurge_CPAP_Data);
action->setIconVisibleInMenu(true);
action->setIcon(getCPAPIcon(mach->loaderName()));
action->setData(mach->loaderName()+":"+mach->serial());
ui->menuPurge_CPAP_Data->addAction(action);
}
ui->menu_Rebuild_CPAP_Data->connect(ui->menu_Rebuild_CPAP_Data, SIGNAL(triggered(QAction*)), this, SLOT(on_actionPurgeMachine(QAction*)));
ui->menu_Rebuild_CPAP_Data->connect(ui->menu_Rebuild_CPAP_Data, SIGNAL(triggered(QAction*)), this, SLOT(on_actionRebuildCPAP(QAction*)));
ui->menuPurge_CPAP_Data->connect(ui->menuPurge_CPAP_Data, SIGNAL(triggered(QAction*)), this, SLOT(on_actionPurgeMachine(QAction*)));
}
QString GenerateWelcomeHTML();
@ -1870,7 +1878,7 @@ void MainWindow::on_actionPurge_Current_Day_triggered()
getDaily()->LoadDate(date);
}
void MainWindow::on_actionPurgeMachine(QAction *action)
void MainWindow::on_actionRebuildCPAP(QAction *action)
{
QString data = action->data().toString();
QString cls = data.section(":",0,0);
@ -1885,12 +1893,6 @@ void MainWindow::on_actionPurgeMachine(QAction *action)
}
}
if (!mach) return;
purgeMachine(mach);
}
void MainWindow::purgeMachine(Machine * mach)
{
// detect backups
QString bpath = mach->getBackupPath();
bool backups = (dirCount(bpath) > 0) ? true : false;
@ -1918,6 +1920,64 @@ void MainWindow::purgeMachine(Machine * mach)
return;
}
}
purgeMachine(mach);
if (backups) {
importCPAP(ImportPath(mach->getBackupPath(), lookupLoader(mach)), tr("Please wait, importing from backup folder(s)..."));
} else {
if (QMessageBox::information(this, STR_MessageBox_Warning,
tr("Because there are no internal backups to rebuild from, you will have to restore from your own.")+"\n\n"+
tr("Would you like to import from your own backups now? (you will have no data visible for this machine until you do)"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
on_action_Import_Data_triggered();
} else {
}
}
if (overview) overview->ReloadGraphs();
if (daily) {
daily->clearLastDay(); // otherwise Daily will crash
daily->ReloadGraphs();
}
GenerateStatistics();
p_profile->Save();
}
void MainWindow::on_actionPurgeMachine(QAction *action)
{
QString data = action->data().toString();
QString cls = data.section(":",0,0);
QString serial = data.section(":", 1);
QList<Machine *> machines = p_profile->GetMachines(MT_CPAP);
Machine * mach = nullptr;
for (int i=0; i < machines.size(); ++i) {
Machine * m = machines.at(i);
if ((m->loaderName() == cls) && (m->serial() == serial)) {
mach = m;
break;
}
}
if (!mach) return;
if (QMessageBox::question(this, STR_MessageBox_Warning, "<p><b>"+STR_MessageBox_Warning+":</b> "+tr("You are about to <font size=+2>obliterate</font> SleepyHead's machine database for the following machine:")+"</p>"+
"<p>"+mach->brand() + " " + mach->model() + " " +
mach->modelnumber() + " (" + mach->serial() + ")" + "</p>"+
"<p>"+tr("Note as a precaution, the backup folder will be left in place.")+"</p>"+
"<p>"+tr("Are you <b>absolutely sure</b> you want to proceed?")+"</p>", QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
purgeMachine(mach);
p_profile->DelMachine(mach);
delete mach;
PopulatePurgeMenu();
}
}
void MainWindow::purgeMachine(Machine * mach)
{
// detect backups
daily->Unload(daily->getDate());
// Technicially the above won't sessions under short session limit.. Using Purge to clean up the rest.
@ -1947,26 +2007,6 @@ void MainWindow::purgeMachine(Machine * mach)
}
GenerateStatistics();
QApplication::processEvents();
if (backups) {
importCPAP(ImportPath(mach->getBackupPath(), lookupLoader(mach)), tr("Please wait, importing from backup folder(s)..."));
} else {
if (QMessageBox::information(this, STR_MessageBox_Warning,
tr("Because there are no internal backups to rebuild from, you will have to restore from your own.")+"\n\n"+
tr("Would you like to import from your own backups now? (you will have no data visible for this machine until you do)"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
on_action_Import_Data_triggered();
} else {
}
}
if (overview) overview->ReloadGraphs();
if (daily) {
daily->clearLastDay(); // otherwise Daily will crash
daily->ReloadGraphs();
}
GenerateStatistics();
p_profile->Save();
}
void MainWindow::keyPressEvent(QKeyEvent *event)

View File

@ -307,6 +307,8 @@ class MainWindow : public QMainWindow
void on_reportModeStandard_clicked();
void on_actionRebuildCPAP(QAction *action);
void on_actionPurgeMachine(QAction *action);
void on_reportModeRange_clicked();

View File

@ -986,14 +986,14 @@ color: yellow;</string>
</widget>
</item>
<item>
<widget class="QWebView" name="welcomeView" native="true">
<widget class="QWebView" name="welcomeView">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="url" stdset="0">
<property name="url">
<url>
<string>about:blank</string>
</url>
@ -1023,14 +1023,14 @@ color: yellow;</string>
<number>0</number>
</property>
<item>
<widget class="QWebView" name="statisticsView" native="true">
<widget class="QWebView" name="statisticsView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="url" stdset="0">
<property name="url">
<url>
<string>about:blank</string>
</url>
@ -1293,7 +1293,7 @@ color: yellow;</string>
<number>0</number>
</property>
<item>
<widget class="QWebView" name="webView" native="true">
<widget class="QWebView" name="webView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -1312,7 +1312,7 @@ color: yellow;</string>
<height>200</height>
</size>
</property>
<property name="url" stdset="0">
<property name="url">
<url>
<string>qrc:/docs/index.html</string>
</url>
@ -1498,7 +1498,7 @@ QToolBox::tab:selected {
<x>0</x>
<y>0</y>
<width>180</width>
<height>597</height>
<height>596</height>
</rect>
</property>
<property name="palette">
@ -1912,7 +1912,7 @@ border: 2px solid #56789a; border-radius: 30px;
<x>0</x>
<y>0</y>
<width>180</width>
<height>597</height>
<height>596</height>
</rect>
</property>
<property name="palette">
@ -2944,7 +2944,7 @@ border-radius: 10px;
</widget>
</item>
<item>
<widget class="QWebView" name="bookmarkView" native="true">
<widget class="QWebView" name="bookmarkView">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -3045,7 +3045,7 @@ border-radius: 10px;
<property name="styleSheet">
<string notr="true">background: rgb(163, 190, 255)</string>
</property>
<property name="url" stdset="0">
<property name="url">
<url>
<string>about:blank</string>
</url>
@ -3060,7 +3060,7 @@ border-radius: 10px;
<x>0</x>
<y>0</y>
<width>180</width>
<height>597</height>
<height>596</height>
</rect>
</property>
<property name="mouseTracking">
@ -3093,7 +3093,7 @@ border-radius: 10px;
<number>0</number>
</property>
<item>
<widget class="QWebView" name="recordsBox" native="true">
<widget class="QWebView" name="recordsBox">
<property name="font">
<font>
<pointsize>10</pointsize>
@ -3102,7 +3102,7 @@ border-radius: 10px;
<property name="styleSheet">
<string notr="true">background: rgb(163, 190, 255)</string>
</property>
<property name="url" stdset="0">
<property name="url">
<url>
<string>about:blank</string>
</url>
@ -3122,7 +3122,7 @@ border-radius: 10px;
<x>0</x>
<y>0</y>
<width>975</width>
<height>20</height>
<height>22</height>
</rect>
</property>
<property name="sizePolicy">
@ -3194,7 +3194,13 @@ border-radius: 10px;
</property>
<addaction name="actionPurgeCurrentDaysOximetry"/>
</widget>
<widget class="QMenu" name="menuPurge_CPAP_Data">
<property name="title">
<string>Purge ALL CPAP Data</string>
</property>
</widget>
<addaction name="actionPurge_Current_Day"/>
<addaction name="menuPurge_CPAP_Data"/>
<addaction name="separator"/>
<addaction name="menuPurge_Oximetery_Data"/>
</widget>
@ -3462,7 +3468,7 @@ border-radius: 10px;
<string>Toggle &amp;Line Cursor</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
<string>Ctrl+L</string>
</property>
</action>
<action name="actionFoo">
@ -3470,6 +3476,11 @@ border-radius: 10px;
<string>Foo</string>
</property>
</action>
<action name="action">
<property name="text">
<string> </string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>