ResMed Escape, and better brick detection

This commit is contained in:
Mark Watkins 2012-01-26 08:34:21 +10:00
parent 78fb368b60
commit 6b368a0f96
5 changed files with 111 additions and 31 deletions

View File

@ -579,7 +579,8 @@ int ResmedLoader::Open(QString & path,Profile *profile)
sessionid=date.toTime_t(); sessionid=date.toTime_t();
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// Resmed bugs up on the session filenames.. 1 or 2 seconds either way // Resmed bugs up on the session filenames.. More than these 3 seconds
// Moral of the story, when writing firmware and saving in batches, use the same datetimes, // Moral of the story, when writing firmware and saving in batches, use the same datetimes,
// and provide firmware updates for free to your customers. // and provide firmware updates for free to your customers.
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
@ -808,17 +809,23 @@ int ResmedLoader::Open(QString & path,Profile *profile)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
if ((sig=stredf.lookupName("Leak Med"))) { if ((sig=stredf.lookupName("Leak Med"))) {
valmed=sig->data[dn]; valmed=sig->data[dn];
sess->m_gain[CPAP_Leak]=sig->gain*60.0; if (valmed>=0) {
sess->m_valuesummary[CPAP_Leak][valmed]=51; sess->m_gain[CPAP_Leak]=sig->gain*60.0;
sess->m_valuesummary[CPAP_Leak][valmed]=51;
}
} }
if ((sig=stredf.lookupName("Leak 95"))) { if ((sig=stredf.lookupName("Leak 95"))) {
val95=sig->data[dn]; val95=sig->data[dn];
sess->m_valuesummary[CPAP_Leak][val95]=45; if (val95>=0)
sess->m_valuesummary[CPAP_Leak][val95]=45;
} }
if ((sig=stredf.lookupName("Leak Max"))) { if ((sig=stredf.lookupName("Leak Max"))) {
valmax=sig->data[dn]; valmax=sig->data[dn];
sess->setMax(CPAP_Leak,valmax*sig->gain*60.0); if (valmax>=0) {
sess->m_valuesummary[CPAP_Leak][valmax]=4; sess->setMax(CPAP_Leak,valmax*sig->gain*60.0);
sess->m_valuesummary[CPAP_Leak][valmax]=4;
}
} }
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
@ -916,17 +923,46 @@ int ResmedLoader::Open(QString & path,Profile *profile)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
if ((sig=stredf.lookupName("Mask Pres Med"))) { if ((sig=stredf.lookupName("Mask Pres Med"))) {
valmed=sig->data[dn]; valmed=sig->data[dn];
sess->m_gain[CPAP_Pressure]=sig->gain; if (valmed >= 0) {
sess->m_valuesummary[CPAP_Pressure][valmed]=51; sess->m_gain[CPAP_Pressure]=sig->gain;
sess->m_valuesummary[CPAP_Pressure][valmed]=51;
}
} }
if ((sig=stredf.lookupName("Mask Pres 95"))) { if ((sig=stredf.lookupName("Mask Pres 95"))) {
val95=sig->data[dn]; val95=sig->data[dn];
sess->m_valuesummary[CPAP_Pressure][val95]=45; if (val95 >= 0) {
sess->m_valuesummary[CPAP_Pressure][val95]=45;
}
} }
if ((sig=stredf.lookupName("Mask Pres Max"))) { if ((sig=stredf.lookupName("Mask Pres Max"))) {
valmax=sig->data[dn]; valmax=sig->data[dn];
sess->setMax(CPAP_Pressure,valmax*sig->gain); if (valmax >= 0) {
sess->m_valuesummary[CPAP_Pressure][valmax]=4; sess->setMax(CPAP_Pressure,valmax*sig->gain);
sess->m_valuesummary[CPAP_Pressure][valmax]=4;
}
}
/////////////////////////////////////////////////////////////////////
// Therapy Pressure Summary
/////////////////////////////////////////////////////////////////////
if ((sig=stredf.lookupName("Therapy Pres Me"))) {
valmed=sig->data[dn];
if (valmed >= 0) {
//sess->m_gain[CPAP_Pressure]=sig->gain;
//sess->m_valuesummary[CPAP_Pressure][valmed]=51;
}
}
if ((sig=stredf.lookupName("Therapy Pres 95"))) {
val95=sig->data[dn];
if (val95 >= 0) {
// sess->m_valuesummary[CPAP_Pressure][val95]=45;
}
}
if ((sig=stredf.lookupName("Therapy Pres Ma"))) {
valmax=sig->data[dn];
if (valmax >= 0) {
// sess->setMax(CPAP_Pressure,valmax*sig->gain);
// sess->m_valuesummary[CPAP_Pressure][valmax]=4;
}
} }
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
@ -951,17 +987,23 @@ int ResmedLoader::Open(QString & path,Profile *profile)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
if ((sig=stredf.lookupName("Exp Pres Med"))) { if ((sig=stredf.lookupName("Exp Pres Med"))) {
valmed=sig->data[dn]; valmed=sig->data[dn];
sess->m_gain[CPAP_EPAP]=sig->gain; if (valmed>=0) {
sess->m_valuesummary[CPAP_EPAP][valmed]=51; sess->m_gain[CPAP_EPAP]=sig->gain;
sess->m_valuesummary[CPAP_EPAP][valmed]=51;
}
} }
if ((sig=stredf.lookupName("Exp Pres 95"))) { if ((sig=stredf.lookupName("Exp Pres 95"))) {
val95=sig->data[dn]; if (val95>=0) {
sess->m_valuesummary[CPAP_EPAP][val95]=45; val95=sig->data[dn];
sess->m_valuesummary[CPAP_EPAP][val95]=45;
}
} }
if ((sig=stredf.lookupName("Exp Pres Max"))) { if ((sig=stredf.lookupName("Exp Pres Max"))) {
valmax=sig->data[dn]; valmax=sig->data[dn];
sess->setMax(CPAP_EPAP,valmax*sig->gain); if (valmax>=0) {
sess->m_valuesummary[CPAP_EPAP][valmax]=4; sess->setMax(CPAP_EPAP,valmax*sig->gain);
sess->m_valuesummary[CPAP_EPAP][valmax]=4;
}
} }
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
@ -974,23 +1016,31 @@ int ResmedLoader::Open(QString & path,Profile *profile)
} }
if ((sig=stredf.lookupName("OAI"))) { // Obstructive Apnea Index if ((sig=stredf.lookupName("OAI"))) { // Obstructive Apnea Index
tmp=sig->data[dn]*sig->gain; tmp=sig->data[dn]*sig->gain;
sess->setCph(CPAP_Obstructive,tmp); if (tmp>=0) {
sess->setCount(CPAP_Obstructive,tmp*dur); // Converting from indice to counts.. sess->setCph(CPAP_Obstructive,tmp);
sess->setCount(CPAP_Obstructive,tmp*dur); // Converting from indice to counts..
}
} }
if ((sig=stredf.lookupName("HI"))) { // Hypopnea Index if ((sig=stredf.lookupName("HI"))) { // Hypopnea Index
tmp=sig->data[dn]*sig->gain; tmp=sig->data[dn]*sig->gain;
sess->setCph(CPAP_Hypopnea,tmp); if (tmp>=0) {
sess->setCount(CPAP_Hypopnea,tmp*dur); sess->setCph(CPAP_Hypopnea,tmp);
sess->setCount(CPAP_Hypopnea,tmp*dur);
}
} }
if ((sig=stredf.lookupName("UAI"))) { // Unspecified Apnea Index if ((sig=stredf.lookupName("UAI"))) { // Unspecified Apnea Index
tmp=sig->data[dn]*sig->gain; tmp=sig->data[dn]*sig->gain;
sess->setCph(CPAP_Apnea,tmp); if (tmp>=0) {
sess->setCount(CPAP_Apnea,tmp*dur); sess->setCph(CPAP_Apnea,tmp);
sess->setCount(CPAP_Apnea,tmp*dur);
}
} }
if ((sig=stredf.lookupName("CAI"))) { // "Central" Apnea Index if ((sig=stredf.lookupName("CAI"))) { // "Central" Apnea Index
tmp=sig->data[dn]*sig->gain; tmp=sig->data[dn]*sig->gain;
sess->setCph(CPAP_ClearAirway,tmp); if (tmp>=0) {
sess->setCount(CPAP_ClearAirway,tmp*dur); sess->setCph(CPAP_ClearAirway,tmp);
sess->setCount(CPAP_ClearAirway,tmp*dur);
}
} }
} }
@ -1611,6 +1661,9 @@ void ResInitModelMap()
RMS9ModelMap[36006]="S9 VPAP Auto"; RMS9ModelMap[36006]="S9 VPAP Auto";
RMS9ModelMap[36007]="S9 VPAP Adapt"; RMS9ModelMap[36007]="S9 VPAP Adapt";
RMS9ModelMap[36008]="S9 VPAP ST"; RMS9ModelMap[36008]="S9 VPAP ST";
RMS9ModelMap[36141]="S9 Escape";
/* S8 Series /* S8 Series
RMS9ModelMap[33007]="S8 Escape"; RMS9ModelMap[33007]="S8 Escape";
RMS9ModelMap[33039]="S8 Elite II"; RMS9ModelMap[33039]="S8 Elite II";

View File

@ -881,3 +881,26 @@ QDate Profile::LastGoodDay(MachineType mt)
} while (d>=f); } while (d>=f);
return f; //m_first; return f; //m_first;
} }
bool Profile::hasChannel(ChannelID code)
{
QDate d=LastDay();
QDate f=FirstDay();
if (!(d.isValid() && f.isValid())) return false;
QMap<QDate,QList<Day *> >::iterator dit;
bool found=false;
do {
dit=daylist.find(d);
if (dit!=daylist.end()) {
for (int i=0;i<dit.value().size();i++) {
Day *day=dit.value().at(i);
if (day->channelHasData(code)) {
found=true;
break;
}
}
}
if (found) break;
d=d.addDays(-1);
} while (d>=f);
return found;
}

View File

@ -112,6 +112,8 @@ public:
EventDataType calcMax(ChannelID code, MachineType mt=MT_CPAP, QDate start=QDate(), QDate end=QDate()); EventDataType calcMax(ChannelID code, MachineType mt=MT_CPAP, QDate start=QDate(), QDate end=QDate());
EventDataType calcPercentile(ChannelID code, EventDataType percent, MachineType mt=MT_CPAP, QDate start=QDate(), QDate end=QDate()); EventDataType calcPercentile(ChannelID code, EventDataType percent, MachineType mt=MT_CPAP, QDate start=QDate(), QDate end=QDate());
bool hasChannel(ChannelID code);
EventDataType calcSettingsMin(ChannelID code, MachineType mt=MT_CPAP, QDate start=QDate(), QDate end=QDate()); EventDataType calcSettingsMin(ChannelID code, MachineType mt=MT_CPAP, QDate start=QDate(), QDate end=QDate());
EventDataType calcSettingsMax(ChannelID code, MachineType mt=MT_CPAP, QDate start=QDate(), QDate end=QDate()); EventDataType calcSettingsMax(ChannelID code, MachineType mt=MT_CPAP, QDate start=QDate(), QDate end=QDate());

View File

@ -334,6 +334,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
} }
GraphView->setCubeImage(images["nodata"]); GraphView->setCubeImage(images["nodata"]);
GraphView->setEmptyText(tr("No Data")); GraphView->setEmptyText(tr("No Data"));
previous_date=QDate();
} }
Daily::~Daily() Daily::~Daily()
@ -730,7 +731,7 @@ void Daily::Load(QDate date)
if (cpap) { if (cpap) {
float hours=cpap->hours(); float hours=cpap->hours();
if (GraphView->isEmpty() && (hours>0)) { if (GraphView->isEmpty() && (hours>0)) {
if (cpap->machine->GetClass()!=STR_MACH_ResMed) { if (!PROFILE.hasChannel(CPAP_Obstructive) && !PROFILE.hasChannel(CPAP_Hypopnea)) {
GraphView->setCubeImage(images["brick"]); GraphView->setCubeImage(images["brick"]);
GraphView->setEmptyText(tr("No Graphs :(")); GraphView->setEmptyText(tr("No Graphs :("));

View File

@ -10,7 +10,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>640</width> <width>640</width>
<height>429</height> <height>462</height>
</rect> </rect>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
@ -492,16 +492,17 @@ p, li { white-space: pre-wrap; }
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Ignore this, it's not implemented yet.</string> <string>Method of unintentional leaks calculation if not provided by your machine.
Note: Statistical Model is experimental.</string>
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>Total Leaks</string> <string>Mask Profile</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Unintentional Leaks</string> <string>Statistical Model</string>
</property> </property>
</item> </item>
</widget> </widget>
@ -515,7 +516,7 @@ p, li { white-space: pre-wrap; }
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Leak mode</string> <string>Leak calcs</string>
</property> </property>
</widget> </widget>
</item> </item>