diff --git a/oscar/SleepLib/loader_plugins/cms50f37_loader.cpp b/oscar/SleepLib/loader_plugins/cms50f37_loader.cpp
index f08df943..69c001f0 100644
--- a/oscar/SleepLib/loader_plugins/cms50f37_loader.cpp
+++ b/oscar/SleepLib/loader_plugins/cms50f37_loader.cpp
@@ -71,13 +71,13 @@ bool CMS50F37Loader::openDevice()
b = scanDevice("rfcomm", 0, 0); // Linux
}
if (!b) {
- qWarning() << "No oximeter found";
+ qWarning() << "cms50f37 - No oximeter found";
return false;
}
}
serial.setPortName(port);
if (!serial.open(QSerialPort::ReadWrite)) {
- qDebug() << "Failed to open oximeter";
+ qDebug() << "cms50f37 - Failed to open oximeter";
return false;
}
@@ -198,7 +198,7 @@ QString CMS50F37Loader::getUser()
QApplication::processEvents();
} while (userName.isEmpty() && (time.elapsed() < TIMEOUT));
- qDebug() << "User " << userIdx << " is " << userName;
+ qDebug() << "cms50f37 - User " << userIdx << " is " << userName;
return userName;
}
@@ -214,7 +214,7 @@ QString CMS50F37Loader::getVendor()
QApplication::processEvents();
} while (vendor.isEmpty() && (time.elapsed() < TIMEOUT));
- qDebug() << "Vendor is " << vendor;
+ qDebug() << "cms50f37 - Vendor is " << vendor;
return vendor;
}
@@ -241,14 +241,14 @@ QString CMS50F37Loader::getModel()
duration_divisor = 2;
}
- qDebug() << "Model is " << model;
+ qDebug() << "cms50f37 - Model is " << model;
return model;
}
QString CMS50F37Loader::getDeviceString()
{
QString VendDev = QString("%1 %2").arg(getVendor()).arg(getModel());
- qDebug() << "USB Device String is " << VendDev;
+ qDebug() << "cms50f37 - USB Device String is " << VendDev;
return VendDev;
}
@@ -264,7 +264,7 @@ QString CMS50F37Loader::getDeviceID()
QApplication::processEvents();
} while (devid.isEmpty() && (time.elapsed() < TIMEOUT));
- qDebug() << "Device Id is " << devid;
+ qDebug() << "cms50f37 - Device Id is " << devid;
return devid;
}
@@ -279,7 +279,7 @@ int CMS50F37Loader::getUserCount() // for future use, check, then add select us
QApplication::processEvents();
} while ((userCount < 0) && (time.elapsed() < TIMEOUT));
- qDebug() << "User count is " << userCount;
+ qDebug() << "cms50f37 - User count is " << userCount;
return userCount;
}
@@ -294,7 +294,7 @@ int CMS50F37Loader::getSessionCount()
QApplication::processEvents();
} while ((session_count < 0) && (time.elapsed() < TIMEOUT));
- qDebug() << "Session count is " << session_count;
+ qDebug() << "cms50f37 - Session count is " << session_count;
return session_count;
}
@@ -308,7 +308,7 @@ int CMS50F37Loader::getOximeterInfo()
QApplication::processEvents();
} while ((device_info < 0) && (time.elapsed() < TIMEOUT));
- qDebug() << "Device Info is " << device_info;
+ qDebug() << "cms50f37 - Device Info is " << device_info;
return device_info;
}
@@ -325,7 +325,7 @@ int CMS50F37Loader::getDuration(int session)
QApplication::processEvents();
} while ((duration < 0) && (time.elapsed() < TIMEOUT));
- qDebug() << "Session duration is " << duration << "Divided by " << duration_divisor;
+ qDebug() << "cms50f37 - Session duration is " << duration << "Divided by " << duration_divisor;
return duration / duration_divisor;
}
@@ -351,7 +351,7 @@ QDateTime CMS50F37Loader::getDateTime(int session)
else
datetime = QDateTime(imp_date, imp_time);
- qDebug() << "Oximeter DateTime is " << datetime.toString("yyyy-MMM-dd HH:mm:ssap");
+ qDebug() << "cms50f37 - Oximeter DateTime is " << datetime.toString("yyyy-MMM-dd HH:mm:ssap");
return datetime;
}
@@ -397,7 +397,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
if (res == resimport) break;
}
// add a dummy to make up for it.
- qDebug() << "pB: lost sync, padding...";
+ qDebug() << "cms50f37 - pB: lost sync, padding...";
oxirec->append(OxiRecord(0,0,0));
}
continue;
@@ -418,24 +418,24 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
QString extra = QString(buffer.mid(idx+3, 6));
model += extra.trimmed();
modelsegments++;
- qDebug() << "pB: Model:" << model;
+ qDebug() << "cms50f37 - pB: Model:" << model;
}
break;
case 0x03: // Vendor string
vendor = QString(buffer.mid(idx+2, 7));
- qDebug() << "pB: Vendor:" << vendor;
+ qDebug() << "cms50f37 - pB: Vendor:" << vendor;
break;
case 0x04: // Device Identifiers
devid = QString(buffer.mid(idx+2, 7));
- qDebug() << "pB: Device ID:" << devid;
+ qDebug() << "cms50f37 - pB: Device ID:" << devid;
break;
// COMMAND_GET_USER_INFO
case 0x05: // 5,80,80,f5,f3,e5,f2,80,80
userIdx = buffer.at(idx+2); // for future use
userName = QString(buffer.mid(idx+3).trimmed());
- qDebug() << "pB: 0x05:" << userName;
+ qDebug() << "cms50f37 - pB: 0x05:" << userName;
break;
// Command GET_VERSION
@@ -456,7 +456,8 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
}
else
imp_date = QDate(year,month,day);
- qDebug() << "pB: ymd " << year << month << day << " impDate " << imp_date;
+ qDebug() << "cms50f37 - cms50D+ detected: " << (cms50dplus ? "yes" : "no");
+ qDebug() << "cms50f37 - pB: ymd " << year << month << day << " impDate: " << imp_date;
break;
// COMMAND_GET_SESSION_DURATION
@@ -502,7 +503,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
case 0x12: // 12,80,80,80,82,a6,92,80
tmpstr = QString().sprintf("%02i:%02i:%02i",buffer.at(idx+4), buffer.at(idx+5), buffer.at(idx+6));
imp_time = QTime::fromString(tmpstr, "HH:mm:ss");
- qDebug() << "pB: tmpStr:" << tmpstr << " impTime " << imp_time;
+ qDebug() << "cms50f37 - pB: tmpStr:" << tmpstr << " impTime: " << imp_time;
break;
case 0x13: // 13,80,a0,a0,a0,a0,a0,a0,a0
@@ -513,7 +514,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
case 0x09: // cms50i data sequence
case 0x0f: // f,80,de,c2,de,c2,de,c2 cms50F data...
if (!started_import) {
- qDebug() << "pB: Starting import";
+ qDebug() << "cms50f37 - pB: Starting import";
started_import = true;
started_reading = true;
finished_import = false;
@@ -538,7 +539,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
break;
default:
- qDebug() << "pB: unknown cms50F result?" << hex << (int)res;
+ qDebug() << "cms50f37 - pB: unknown cms50F result?" << hex << (int)res;
break;
}
@@ -548,7 +549,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
pi = buffer.at(idx+4) | (buffer.at(idx+5) << 8);
pulse = buffer.at(idx+3);
spo2 = buffer.at(idx+2);
- qDebug() << "pB: Pulse=" << pulse << "SPO2=" << spo2 << "PI=" << pi;
+// qDebug() << "cms50f37 - pB: Pulse=" << pulse << "SPO2=" << spo2 << "PI=" << pi;
oxirec->append(((spo2 == 0) || (pulse == 0)) ? OxiRecord(0,0,0) : OxiRecord(pulse, spo2, pi));
} else if (res == 0x0f) {
@@ -556,17 +557,17 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
pulse = buffer.at(idx+3);
spo2 = buffer.at(idx+2);
- qDebug() << "pB: Pulse=" << pulse << "SPO2=" << spo2;
+// qDebug() << "cms50f37 - pB: Pulse=" << pulse << "SPO2=" << spo2;
oxirec->append((pulse == 0xff) ? OxiRecord(0,0) : OxiRecord(pulse, spo2));
pulse = buffer.at(idx+5);
spo2 = buffer.at(idx+4);
- qDebug() << "pB: Pulse=" << pulse << "SPO2=" << spo2;
+// qDebug() << "cms50f37 - pB: Pulse=" << pulse << "SPO2=" << spo2;
oxirec->append((pulse == 0xff) ? OxiRecord(0,0) : OxiRecord(pulse, spo2));
pulse = buffer.at(idx+7);
spo2 = buffer.at(idx+6);
- qDebug() << "pB: Pulse=" << pulse << "SPO2=" << spo2;
+// qDebug() << "cms50f37 - pB: Pulse=" << pulse << "SPO2=" << spo2;
oxirec->append((pulse == 0xff) ? OxiRecord(0,0) : OxiRecord(pulse, spo2));
}
@@ -577,9 +578,9 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
if (!started_import) {
// startTimer.singleShot(2000, this, SLOT(requestData()));
- qDebug() << "pB: Read:" << len << size << str.join(",");
+ qDebug() << "cms50f37 - pB: Read:" << len << size << str.join(",");
} else {
- qDebug() << "pB: Import:" << len << size << str.join(",");
+ qDebug() << "cms50f37 - pB: Import:" << len << size << str.join(",");
}
idx += len;
@@ -602,10 +603,10 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
//{
// if (oxirec == nullptr) { // warn
//}
-
+//
// int available = buffer.size();
// int idx = 0;
-
+//
// QByteArray plethy;
// while (idx < available-5) {
// if (((unsigned char)buffer.at(idx) & 0x80) != 0x80) {
@@ -616,14 +617,14 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
// int pbeat=(unsigned char)buffer.at(idx + 2);
// int pulse=((unsigned char)buffer.at(idx + 3) & 0x7f) | ((pbeat & 0x40) << 1);
// int spo2=(unsigned char)buffer.at(idx + 4) & 0x7f;
-
+//
// oxirec->append(OxiRecord(pulse, spo2));
// plethy.append(pwave);
-
+//
// idx += 5;
// }
// emit updatePlethy(plethy);
-
+//
// return idx;
//}
@@ -636,10 +637,10 @@ void CMS50F37Loader::sendCommand(quint8 c)
QString out;
for (int i=0;i < 9;i++)
out += QString().sprintf("%02X ",cmd[i]);
- qDebug() << "Write:" << out;
+ qDebug() << "cms50f37 - Write:" << out;
if (serial.write((char *)cmd, 9) == -1) {
- qDebug() << "Couldn't write data bytes to CMS50F";
+ qDebug() << "cms50f37 - Couldn't write data bytes to CMS50F";
}
}
@@ -652,10 +653,10 @@ void CMS50F37Loader::sendCommand(quint8 c, quint8 c2)
QString out;
for (int i=0; i < 9; ++i)
out += QString().sprintf("%02X ",cmd[i]);
- qDebug() << "Write:" << out;
+ qDebug() << "cms50f37 - Write:" << out;
if (serial.write((char *)cmd, 9) == -1) {
- qDebug() << "Couldn't write data bytes to CMS50F";
+ qDebug() << "cms50f37 - Couldn't write data bytes to CMS50F";
}
}
@@ -669,10 +670,10 @@ void CMS50F37Loader::eraseSession(int user, int session)
QString out;
for (int i=0; i < 9; ++i)
out += QString().sprintf("%02X ",cmd[i]);
- qDebug() << "Erase Session: Write:" << out;
+ qDebug() << "cms50f37 - Erase Session: Write:" << out;
if (serial.write((char *)cmd, 9) == -1) {
- qDebug() << "Couldn't write Erase session bytes to CMS50F";
+ qDebug() << "cms50f37 - Couldn't write Erase session bytes to CMS50F";
}
int z = timectr;
@@ -707,10 +708,10 @@ void CMS50F37Loader::setDeviceID(const QString & newid)
QString out;
for (int i=0; i < 9; ++i)
out += QString().sprintf("%02X ",cmd[i]);
- qDebug() << "setDeviceID: Write:" << out;
+ qDebug() << "cms50f37 - setDeviceID: Write:" << out;
if (serial.write((char *)cmd, 9) == -1) {
- qDebug() << "Couldn't write DeviceID data bytes to CMS50F";
+ qDebug() << "cms50f37 - Couldn't write DeviceID data bytes to CMS50F";
}
// Supposed to return 0x04 command, so reset devid..
@@ -737,7 +738,7 @@ void CMS50F37Loader::syncClock()
timectr = 0;
if (serial.write((char *)datecmd, 9) == -1) {
- qDebug() << "Couldn't write date bytes to CMS50F";
+ qDebug() << "cms50f37 - Couldn't write date bytes to CMS50F";
}
QTime time;
@@ -759,7 +760,7 @@ void CMS50F37Loader::syncClock()
timectr = 0;
if (serial.write((char *)timecmd, 9) == -1) {
- qDebug() << "Couldn't write time bytes to CMS50F";
+ qDebug() << "cms50f37 - Couldn't write time bytes to CMS50F";
}
time.start();
@@ -776,7 +777,7 @@ void CMS50F37Loader::nextCommand()
// Send the next command packet in sequence
sendCommand(cms50_sequence[sequence]);
} else {
- qDebug() << "Run out of startup tasks to do and import failed!";
+ qDebug() << "cms50f37 - Run out of startup tasks to do and import failed!";
}
}
@@ -789,7 +790,7 @@ void CMS50F37Loader::getSessionData(int session)
void CMS50F37Loader::resetDevice()
{
- qDebug() << "Resetting oximeter";
+ qDebug() << "cms50f37 - Resetting oximeter";
sendCommand(COMMAND_CMS50_HELLO1);
QThread::msleep(100);
QApplication::processEvents();
@@ -800,7 +801,7 @@ void CMS50F37Loader::resetDevice()
void CMS50F37Loader::requestData()
{
- qDebug() << "Requesting session data";
+ qDebug() << "cms50f37 - Requesting session data";
sendCommand(COMMAND_GET_SESSION_DATA, selected_session);
}
@@ -822,16 +823,16 @@ void CMS50F37Loader::resetImportTimeout()
if (imp_callbacks != cb_reset) {
// Still receiving data.. reset timer
- qDebug() << "Still receiving data in resetImportTimeout()" << imp_callbacks << cb_reset;
+ qDebug() << "cms50f37 - Still receiving data in resetImportTimeout()" << imp_callbacks << cb_reset;
if (resetTimer.isActive())
resetTimer.stop();
if (!finished_import) resetTimer.singleShot(2000, this, SLOT(resetImportTimeout()));
} else {
- qDebug() << "Oximeter device stopped transmitting.. Transfer complete";
+ qDebug() << "cms50f37 - Oximeter device stopped transmitting.. Transfer complete";
// We were importing, but now are done
if (!finished_import && (started_import && started_reading)) {
- qDebug() << "Switching CMS50F37 back to live mode and finalizing import";
+ qDebug() << "cms50f37 - Switching CMS50F37 back to live mode and finalizing import";
// Turn back on live streaming so the end of capture can be dealt with
@@ -851,7 +852,7 @@ void CMS50F37Loader::resetImportTimeout()
return;
}
- qDebug() << "Should CMS50F37 resetImportTimeout reach here?";
+ qDebug() << "cms50f37 - Should CMS50F37 resetImportTimeout reach here?";
// else what???
}
cb_reset = imp_callbacks;
@@ -869,23 +870,23 @@ bool CMS50F37Loader::readSpoRFile(const QString & path)
{
QFile file(path);
if (!file.exists()) {
- qWarning() << "Can't find the oximeter file: " << path;
+ qWarning() << "cms50f37 - Can't find the oximeter file: " << path;
QMessageBox::warning(nullptr, STR_MessageBox_Error, "
"+tr("Could not find the oximeter file:")+"
"+path+"
");
return false;
}
if (!file.open(QFile::ReadOnly)) {
- qWarning() << "Can't open the oximeter file: " << path;
+ qWarning() << "cms50f37 - Can't open the oximeter file: " << path;
QMessageBox::warning(nullptr, STR_MessageBox_Error, ""+tr("Could not open the oximeter file:")+"
"+path+"
");
return false;
}
bool spo2header = false;
QString ext = path.section('.', -1);
- qDebug() << "Oximeter file extention is " << ext;
+ qDebug() << "cms50f37 - Oximeter file extention is " << ext;
if (ext.compare("spo2",Qt::CaseInsensitive) == 0) {
spo2header = true;
- qDebug() << "Oximeter file looks like an SpO2 type" ;
+ qDebug() << "cms50f37 - Oximeter file looks like an SpO2 type" ;
}
QByteArray data;
@@ -918,7 +919,9 @@ bool CMS50F37Loader::readSpoRFile(const QString & path)
if (dchr[0]) {
QString dstr(dchr);
m_startTime = QDateTime::fromString(dstr, "MM/dd/yy HH:mm:ss");
- if (m_startTime.date().year() < 2000) { m_startTime = m_startTime.addYears(100); }
+ if (m_startTime.date().year() < 2000) {
+ m_startTime = m_startTime.addYears(100);
+ }
} else { // this should probaly find the most recent SH data day
m_startTime = QDateTime(QDate::currentDate(), QTime(0,0,0)); // make it today at midnight
cms50dplus = true;
@@ -931,7 +934,7 @@ bool CMS50F37Loader::readSpoRFile(const QString & path)
quint32 hour, minute, second;
if (data.at(pos) != 1) {
- qWarning() << ".spo2 file" << path << "might be a different";
+ qWarning() << "cms50f37 - .spo2 file" << path << "might be a different";
}
// Unknown cruft header...
@@ -955,7 +958,7 @@ bool CMS50F37Loader::readSpoRFile(const QString & path)
int remainder = filesize - pos;
bytes_per_record = remainder / samples;
- qDebug() << samples << "samples of" << bytes_per_record << "bytes each";
+ qDebug() << "cms50f37 - " << samples << "samples of" << bytes_per_record << "bytes each";
// CMS50I .spo2 data have 4 digits, a 16bit, followed by spo2 then pulse
@@ -1019,7 +1022,7 @@ void CMS50F37Loader::Register()
{
if (cms50f37_initialized) { return; }
- qDebug() << "Registering CMS50F37Loader";
+ qDebug() << "cms50f37 - Registering CMS50F37Loader";
RegisterLoader(new CMS50F37Loader());
cms50f37_initialized = true;
}
diff --git a/oscar/SleepLib/serialoximeter.cpp b/oscar/SleepLib/serialoximeter.cpp
index 15aca26c..3e98e4d4 100644
--- a/oscar/SleepLib/serialoximeter.cpp
+++ b/oscar/SleepLib/serialoximeter.cpp
@@ -30,7 +30,7 @@ bool SerialOximeter::scanDevice(QString keyword, quint16 vendor_id, quint16 prod
static bool dumponce = true;
QStringList ports;
- qDebug() << "Scanning for USB Serial devices";
+ qDebug() << "seroxi - Scanning for USB Serial devices";
QList list=QSerialPortInfo::availablePorts();
// How does the mac detect this as a SPO2 device?
@@ -51,7 +51,7 @@ bool SerialOximeter::scanDevice(QString keyword, quint16 vendor_id, quint16 prod
if (info->hasVendorIdentifier()) // 4292
dbg += QString(" VID: %1").arg(info->vendorIdentifier());
- qDebug() << dbg.toLocal8Bit().data();
+ qDebug() << "seroxi - " << dbg.toLocal8Bit().data();
break;
} else if (dumponce) {
QString dbg=QString("Other Serial Port: Name: %1 Desc: %2 Manufacturer: %3 Location: %4").arg(name).arg(desc).arg(info->manufacturer()).arg(info->systemLocation());
@@ -61,7 +61,7 @@ bool SerialOximeter::scanDevice(QString keyword, quint16 vendor_id, quint16 prod
if (info->hasVendorIdentifier()) // 4292
dbg += QString(" VID: %1").arg(info->vendorIdentifier());
- qDebug() << dbg.toLocal8Bit().data();
+ qDebug() << "seroxi - " << dbg.toLocal8Bit().data();
}
}
dumponce = false;
@@ -69,7 +69,7 @@ bool SerialOximeter::scanDevice(QString keyword, quint16 vendor_id, quint16 prod
return false;
}
if (ports.size()>1) {
- qDebug() << "More than one serial device matching these parameters was found, choosing the first by default";
+ qDebug() << "seroxi - More than one serial device matching these parameters was found, choosing the first by default";
}
port=ports.at(0);
return true;
@@ -81,7 +81,7 @@ void SerialOximeter::closeDevice()
disconnect(&serial,SIGNAL(readyRead()), this, SLOT(dataAvailable()));
serial.close();
m_streaming = false;
- qDebug() << "Port" << port << "closed";
+ qDebug() << "seroxi - Port" << port << "closed";
}
bool SerialOximeter::openDevice()
diff --git a/oscar/oximeterimport.cpp b/oscar/oximeterimport.cpp
index 678344bd..feb7087e 100644
--- a/oscar/oximeterimport.cpp
+++ b/oscar/oximeterimport.cpp
@@ -117,12 +117,15 @@ OximeterImport::OximeterImport(QWidget *parent) :
OximeterImport::~OximeterImport()
{
- if (!dummyday) {
+ if (dummyday != nullptr) {
delete dummyday;
}
- if (!session) {
+ if (session != nullptr) {
delete session;
}
+ if (ELplethy != nullptr) {
+ delete ELplethy;
+ }
disconnect(sessbar, SIGNAL(sessionClicked(Session*)), this, SLOT(onSessionSelected(Session*)));
delete ui;
@@ -146,17 +149,14 @@ void OximeterImport::on_nextButton_clicked()
break;
default:
ui->informationButton->setVisible(true);
-
ui->nextButton->setVisible(true);
-
-
}
ui->stackedWidget->setCurrentIndex(i);
}
void OximeterImport::updateStatus(QString msg)
{
- qDebug() << "updateStatus to " << msg;
+ qDebug() << "oximod - updateStatus to " << msg;
ui->logBox->appendPlainText(msg);
ui->directImportStatus->setText(msg);
ui->liveStatusLabel->setText(msg);
@@ -168,7 +168,7 @@ SerialOximeter * OximeterImport::detectOximeter()
const int PORTSCAN_TIMEOUT=30000;
const int delay=100;
- qDebug() << "Attempt to detect Oximeter";
+ qDebug() << "oximod - Attempt to detect Oximeter";
ui->retryButton->setVisible(false);
QList loaders; // GetOxiLoaders();
@@ -201,9 +201,9 @@ SerialOximeter * OximeterImport::detectOximeter()
oximodule = oxi;
break;
}
- }
+ }
- if (oximodule)
+ if (oximodule)
break;
QThread::msleep(delay);
@@ -237,7 +237,7 @@ void OximeterImport::on_directImportButton_clicked()
ui->informationButton->setVisible(false);
ui->stackedWidget->setCurrentWidget(ui->directImportPage);
- qDebug() << "Direct Import button clicked" ;
+ qDebug() << "oximod - Direct Import button clicked" ;
oximodule = detectOximeter();
if (!oximodule)
return;
@@ -263,6 +263,9 @@ void OximeterImport::on_directImportButton_clicked()
oximodule->resetDevice();
int session_count = oximodule->getSessionCount();
+ QDateTime startTime = QDateTime();
+ int duration = 0;
+ qDebug() << "oximod - Session count: " << session_count;
if (session_count > 1) {
ui->stackedWidget->setCurrentWidget(ui->chooseSessionPage);
@@ -279,13 +282,13 @@ void OximeterImport::on_directImportButton_clicked()
int h, m, s;
for (int i=0; i< session_count; ++i) {
- int duration = oximodule->getDuration(i);
- QDateTime datetime = oximodule->getDateTime(i);
+ duration = oximodule->getDuration(i);
+ startTime = oximodule->getDateTime(i);
h = duration / 3600;
m = (duration / 60) % 60;
s = duration % 60;
- item = new QTableWidgetItem(datetime.date().toString(Qt::SystemLocaleShortDate)+" "+datetime.time().toString("HH:mm:ss"));
+ item = new QTableWidgetItem(startTime.date().toString(Qt::SystemLocaleShortDate)+" "+startTime.time().toString("HH:mm:ss"));
ui->tableOxiSessions->setItem(i, 0, item);
// item->setData(Qt::UserRole+1, datetime);
// item->setData(Qt::UserRole, i);
@@ -306,20 +309,22 @@ void OximeterImport::on_directImportButton_clicked()
return;
} else if (session_count > 0) {
chosen_sessions.push_back(0);
- oximodule->getDuration(0);
- oximodule->setStartTime(oximodule->getDateTime(0));
+ duration = oximodule->getDuration(0);
+ startTime = oximodule->getDateTime(0);
+ oximodule->setStartTime(startTime);
+ qDebug() << "oximod - Session start time: " << startTime.toString();
}
doImport();
}
void OximeterImport::doImport()
{
- qDebug() << "Starting doImport";
+ qDebug() << "oximod - Starting doImport";
if (oximodule->commandDriven()) {
if (chosen_sessions.size() == 0) {
+ qDebug() << "oximod - Chosen session size is zero - quitting";
ui->connectLabel->setText(""+tr("Nothing to import")+"
");
-
updateStatus(tr("Your oximeter did not have any valid sessions."));
ui->cancelButton->setText(tr("Close"));
return;
@@ -329,12 +334,10 @@ void OximeterImport::doImport()
} else {
ui->connectLabel->setText(""+tr("Select upload option on %1").arg(oximodule->loaderName())+"
");
ui->logBox->appendPlainText(tr("You need to tell your oximeter to begin sending data to the computer."));
-
updateStatus(tr("Please connect your oximeter, enter it's menu and select upload to commence data transfer..."));
}
connect(oximodule, SIGNAL(updateProgress(int,int)), this, SLOT(doUpdateProgress(int,int)));
-
oximodule->Open("import");
if (oximodule->commandDriven()) {
@@ -376,7 +379,7 @@ void OximeterImport::finishedImport(SerialOximeter * oxi)
{
Q_UNUSED(oxi);
- qDebug() << "finished Import ";
+ qDebug() << "oximod - finished Import ";
connect(oximodule, SIGNAL(importComplete(SerialOximeter*)), this, SLOT(finishedImport(SerialOximeter*)));
ui->cancelButton->setVisible(true);
@@ -403,7 +406,7 @@ void OximeterImport::on_fileImportButton_clicked()
const QString documentsFolder = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
- qDebug() << "File Import button clicked";
+ qDebug() << "oximod - File Import button clicked";
QString filename = QFileDialog::getOpenFileName(nullptr , tr("Select a valid oximetry data file"), documentsFolder, tr("Oximetry Files (*.spo *.spor *.spo2 *.SpO2 *.dat)"));
@@ -413,7 +416,7 @@ void OximeterImport::on_fileImportButton_clicked()
// Make sure filename dialog had time to close properly..
QApplication::processEvents();
- qDebug() << "Chosen filename is " << filename;
+ qDebug() << "oximod - Chosen filename is " << filename;
QList loaders = GetOxiLoaders();
bool success = false;
@@ -430,7 +433,7 @@ void OximeterImport::on_fileImportButton_clicked()
QMessageBox::warning(this, STR_MessageBox_Warning, tr("No Oximetry module could parse the given file:")+QString("\n\n%1").arg(filename), QMessageBox::Ok);
return;
}
- qDebug() << "Using loader " << oximodule->loaderName();
+ qDebug() << "oximod - Using loader " << oximodule->loaderName();
ui->informationButton->setVisible(false);
importMode = IM_FILE;
@@ -442,14 +445,14 @@ void OximeterImport::on_fileImportButton_clicked()
// oximodule->setStartTime( ??? ); Nope, it was set in the loader module by the file import routime
on_syncButton_clicked();
}
- qDebug() << "Finished file import: Oximodule startTime is " << oximodule->startTime().toString("yyyy-MMM-dd HH:mm:ss");
+ qDebug() << "oximod - Finished file import: Oximodule startTime is " << oximodule->startTime().toString("yyyy-MMM-dd HH:mm:ss");
}
void OximeterImport::on_liveImportButton_clicked()
{
ui->informationButton->setVisible(false);
- qDebug() << "Live Import button clicked";
+ qDebug() << "oximod - Live Import button clicked";
ui->stackedWidget->setCurrentWidget(ui->liveImportPage);
ui->liveImportPage->layout()->addWidget(ui->progressBar);
QApplication::processEvents();
@@ -515,7 +518,7 @@ void OximeterImport::on_liveImportButton_clicked()
void OximeterImport::finishedRecording()
{
- qDebug() << "Finished Recording";
+ qDebug() << "oximod - Finished Recording";
updateTimer.stop();
oximodule->closeDevice();
@@ -539,7 +542,7 @@ void OximeterImport::finishedRecording()
void OximeterImport::on_retryButton_clicked()
{
- qDebug() << "Retry button clicked";
+ qDebug() << "oximod - Retry button clicked";
if (ui->stackedWidget->currentWidget() == ui->directImportPage) {
on_directImportButton_clicked();
} else if (ui->stackedWidget->currentWidget() == ui->liveImportPage) {
@@ -549,7 +552,7 @@ void OximeterImport::on_retryButton_clicked()
void OximeterImport::on_stopButton_clicked()
{
- qDebug() << "Stop button clicked";
+ qDebug() << "oximod - Stop button clicked";
if (oximodule) {
oximodule->abort();
}
@@ -557,8 +560,9 @@ void OximeterImport::on_stopButton_clicked()
void OximeterImport::on_calendarWidget_clicked(const QDate &date)
{
- qDebug() << "Calendar widget clicked " << date.toString("yyyy-MMM-dd");
+ qDebug() << "oximod - Calendar widget clicked " << date.toString("yyyy-MMM-dd");
if (ui->radioSyncCPAP->isChecked()) {
+ qDebug() << "oximod - Syncing to a CPAP session";
Day * day = p_profile->GetGoodDay(date, MT_CPAP);
sessbar->clear();
@@ -580,13 +584,13 @@ void OximeterImport::on_calendarWidget_clicked(const QDate &date)
ui->dateTimeEdit->setDateTime(time);
} else {
ui->sessbarLabel->setText(tr("No CPAP data available on %1").arg(date.toString(Qt::SystemLocaleLongDate)));
- qDebug() << "Using oximeter time " << oximodule->startTime().toString("yyyy-MMM-dd hh:mm:ssap") << "on date " << date.toString(Qt::SystemLocaleLongDate);
+ qDebug() << "oximod - Using oximeter time " << oximodule->startTime().toString("yyyy-MMM-dd hh:mm:ssap") << "on date " << date.toString(Qt::SystemLocaleLongDate);
ui->dateTimeEdit->setDateTime(QDateTime(date,oximodule->startTime().time()));
}
sessbar->update();
} else if (ui->radioSyncOximeter) {
- qDebug() << "Using oximeter date and time";
+ qDebug() << "oximod - Using oximeter date and time";
ui->sessbarLabel->setText(tr("%1").arg(date.toString(Qt::SystemLocaleLongDate)));
ui->dateTimeEdit->setDateTime(QDateTime(date, ui->dateTimeEdit->dateTime().time()));
}
@@ -600,13 +604,13 @@ void OximeterImport::on_calendarWidget_selectionChanged()
void OximeterImport::onSessionSelected(Session * session)
{
QDateTime time=QDateTime::fromMSecsSinceEpoch(session->first(), Qt::LocalTime);
- qDebug() << "Selected session starts at " << time.toString("yyyy-MMM-dd hh:mm:ssap");
+ qDebug() << "oximod - Selected session starts at " << time.toString("yyyy-MMM-dd hh:mm:ssap");
ui->dateTimeEdit->setDateTime(time);
}
void OximeterImport::on_sessionBackButton_clicked()
{
- qDebug() << "Session Back button clicked";
+ qDebug() << "oximod - Session Back button clicked";
int idx = (sessbar->selected()-1);
if (idx >= 0) {
sessbar->setSelected(idx);
@@ -618,7 +622,7 @@ void OximeterImport::on_sessionBackButton_clicked()
void OximeterImport::on_sessionForwardButton_clicked()
{
- qDebug() << "Session Forward button clicked";
+ qDebug() << "oximod - Session Forward button clicked";
int idx = (sessbar->selected()+1);
if (idx < sessbar->count()) {
sessbar->setSelected(idx);
@@ -630,6 +634,7 @@ void OximeterImport::on_sessionForwardButton_clicked()
void OximeterImport::on_radioSyncCPAP_clicked()
{
+ qDebug() << "oximod - Use CPAP Time button clicked";
on_calendarWidget_clicked(oximodule->startTime().date());
ui->syncCPAPGroup->setVisible(true);
@@ -638,15 +643,18 @@ void OximeterImport::on_radioSyncCPAP_clicked()
void OximeterImport::on_radioSyncOximeter_clicked()
{
- qDebug() << "Use OximeterTime button clicked";
+ qDebug() << "oximod - Use OximeterTime button clicked";
ui->syncCPAPGroup->setVisible(false);
if ( oximodule ) {
if (oximodule->isStartTimeValid()) {
- qDebug() << "Oximeter time is valid " << oximodule->startTime().toString("yyyy-MMM-dd HH:mm:ssap");
+ qDebug() << "oximod - Oximeter time is valid " << oximodule->startTime().toString("yyyy-MMM-dd HH:mm:ssap");
ui->calendarWidget->setSelectedDate(oximodule->startTime().date());
ui->dateTimeEdit->setDateTime(oximodule->startTime());
- } else
- qDebug() << "Oximeter time is not valid";
+ } else {
+ qDebug() << "oximod - Oximeter time is not valid" << oximodule->startTime().toString("yyyy-MMM-dd HH:mm:ssap");
+ ui->calendarWidget->setSelectedDate(oximodule->startTime().date());
+ ui->dateTimeEdit->setDateTime(oximodule->startTime());
+ }
}
}
@@ -745,7 +753,7 @@ void OximeterImport::updateLiveDisplay()
void OximeterImport::on_cancelButton_clicked()
{
- qDebug() << "Cancel button clicked";
+ qDebug() << "oximod - Cancel button clicked";
if (oximodule && oximodule->isStreaming()) {
oximodule->closeDevice();
oximodule->trashRecords();
@@ -779,12 +787,12 @@ void OximeterImport::on_informationButton_clicked()
void OximeterImport::on_syncButton_clicked()
{
- qDebug() << "Sync button clicked";
+ qDebug() << "oximod - Sync button clicked";
if (oximodule == nullptr) {
- qCritical() << "OximeterImport::on_syncButton_clicked called when oximodule is null";
+ qCritical() << "oximod - OximeterImport::on_syncButton_clicked called when oximodule is null";
return;
}
- qDebug() << "Oximodule Start Time is " << oximodule->startTime().toString("yyyy-MMM-dd HH.mm.ss") << "Duration: " << oximodule->getDuration(/* dummy */ 0 );
+ qDebug() << "oximod Start Time is " << oximodule->startTime().toString("yyyy-MMM-dd HH.mm.ss") << "Duration: " << oximodule->getDuration(/* dummy */ 0 );
ui->stackedWidget->setCurrentWidget(ui->syncPage);
@@ -795,7 +803,7 @@ void OximeterImport::on_syncButton_clicked()
QDate last = p_profile->LastDay();
QDate oxidate = oximodule->startTime().date();
- qDebug() << "Oximodule start date is " << oxidate.toString("yyyy-MMM-dd");
+ qDebug() << "oximod - start date is " << oxidate.toString("yyyy-MMM-dd");
if ((oxidate >= first) && (oxidate <= last)) {
@@ -826,7 +834,7 @@ void OximeterImport::on_syncButton_clicked()
void OximeterImport::on_saveButton_clicked()
{
- qDebug() << "Oximeter Save button clicked";
+ qDebug() << "oximod - Oximeter Save button clicked";
if (!oximodule) return;
QVector * oxirec = nullptr;
@@ -837,8 +845,10 @@ void OximeterImport::on_saveButton_clicked()
return;
}
oxirec = oximodule->oxisessions[oximodule->startTime()];
- if (oxirec->size() < 10)
+ if (oxirec->size() < 10) {
+ qDebug() << "oximod - oxirec size less than 10 - quitting";
return;
+ }
// this can move to SerialOximeter class process function...
@@ -890,6 +900,7 @@ void OximeterImport::on_saveButton_clicked()
int size = oxirec->size();
// why was I skipping the first sample? not priming it anymore..
+ qDebug() << "oximod = Creating event list for pulse and O2 saturation";
for (int i=0; i < size; ++i) {
OxiRecord * rec = &(*oxirec)[i];
@@ -973,7 +984,6 @@ void OximeterImport::on_saveButton_clicked()
session->setLast(OXI_SPO2, ti);
}
-
if (haveperf && ELperf && lastperf > 0) {
ELperf->AddEvent(ti, lastperf);
session->setLast(OXI_Perf, ti);
@@ -990,6 +1000,8 @@ void OximeterImport::on_saveButton_clicked()
calcSPO2Drop(session);
calcPulseChange(session);
+ qDebug() << "oximod - Setting up machine and session";
+
mach->setModel(oximodule->getModel());
mach->setBrand(oximodule->getVendor());
@@ -1023,11 +1035,15 @@ void OximeterImport::on_saveButton_clicked()
session->setOpened(true);
+ qDebug() << "oximod - Adding session to machine";
mach->AddSession(session);
+ qDebug() << "oximod - Saving machine";
mach->Save();
mach->SaveSummaryCache();
p_profile->StoreMachines();
+ mainwin->EnableTabs(true); // somebody has to do it...
+
mainwin->getDaily()->LoadDate(mainwin->getDaily()->getDate());
mainwin->getOverview()->ReloadGraphs();
@@ -1040,7 +1056,7 @@ void OximeterImport::on_saveButton_clicked()
void OximeterImport::chooseSession()
{
- qDebug() << "Oximeter Choose Session called";
+ qDebug() << "oximod - Oximeter Choose Session called";
selecting_session = false;
ui->stackedWidget->setCurrentWidget(ui->chooseSessionPage);
@@ -1084,7 +1100,7 @@ void OximeterImport::chooseSession()
void OximeterImport::on_chooseSessionButton_clicked()
{
- qDebug() << "Chosen session clicked";
+ qDebug() << "oximod - Chosen session clicked";
ui->chooseSessionButton->setVisible(false);
QTableWidgetItem * item_0 = ui->tableOxiSessions->item(ui->tableOxiSessions->currentRow(),0);
@@ -1151,7 +1167,7 @@ void OximeterImport::on_oximeterType_currentIndexChanged(int index)
ui->oldCMS50specific->setVisible(false);
ui->newCMS50settingsPanel->setVisible(true);
break;
- case 1: // Olds CMS50's
+ case 1: // Old CMS50's
ui->directImportButton->setEnabled(true);
ui->liveImportButton->setEnabled(true);
ui->fileImportButton->setEnabled(true);