diff --git a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp index 0c69e035..01e86e26 100644 --- a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp @@ -326,7 +326,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes) len = lengths[res & 0x1f]; - if (len >= size) + if (len > size) break; if (len == 0) { @@ -427,8 +427,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes) m_importing = true; m_itemCnt=0; - m_itemTotal=5000; - + m_itemTotal=duration; have_perfindex = (res == 0x9); @@ -439,9 +438,8 @@ void CMS50F37Loader::processBytes(QByteArray bytes) cb_reset = 1; + resetTimer.singleShot(2000,this,SLOT(resetImportTimeout())); } - killTimers(); - resetTimer.singleShot(2000,this,SLOT(resetImportTimeout())); break; default: diff --git a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.h b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.h index 3de5d042..8a9a2a0c 100644 --- a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.h +++ b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.h @@ -59,6 +59,8 @@ Q_OBJECT virtual int getSessionCount(); virtual int getOximeterInfo(); + virtual void setDuration(int d) { duration=d; } + virtual bool commandDriven() { return true; } diff --git a/sleepyhead/SleepLib/serialoximeter.h b/sleepyhead/SleepLib/serialoximeter.h index 18957ad2..9ece3347 100644 --- a/sleepyhead/SleepLib/serialoximeter.h +++ b/sleepyhead/SleepLib/serialoximeter.h @@ -86,6 +86,7 @@ public: QDateTime startTime() { return m_startTime; } void setStartTime(QDateTime datetime) { m_startTime = datetime; } virtual bool isStartTimeValid() { return true; } + virtual void setDuration(int) { } virtual qint64 importResolution() { return 1000; } virtual qint64 liveResolution() { return 20; } diff --git a/sleepyhead/oximeterimport.cpp b/sleepyhead/oximeterimport.cpp index b12133fe..0a3f17da 100644 --- a/sleepyhead/oximeterimport.cpp +++ b/sleepyhead/oximeterimport.cpp @@ -253,6 +253,7 @@ void OximeterImport::on_directImportButton_clicked() ui->tableOxiSessions->setItem(i, 0, item); item->setData(Qt::UserRole+1, datetime); item->setData(Qt::UserRole, i); + item->setData(Qt::UserRole+2, duration); item->setFlags(item->flags() & ~Qt::ItemIsEditable); item = new QTableWidgetItem(QString(). sprintf("%ih, %im, %is", h,m,s)); @@ -999,6 +1000,7 @@ void OximeterImport::on_chooseSessionButton_clicked() if (!item) return; QDateTime datetime = item->data(Qt::UserRole+1).toDateTime(); oximodule->setStartTime(datetime); + oximodule->setDuration(item->data(Qt::UserRole+2).toInt()); if (selecting_session) { ui->stackedWidget->setCurrentWidget(ui->directImportPage);