mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-13 01:00:47 +00:00
Connected LCD components in Live Oximetery, added graph hide ability
This commit is contained in:
parent
66e8d249cf
commit
ffca449ac2
@ -24,7 +24,7 @@ const quint64 divisors[] = {
|
|||||||
15552000000ULL, 7776000000ULL, 5184000000ULL, 2419200000ULL, 1814400000ULL, 1209600000L, 604800000L, 259200000L,
|
15552000000ULL, 7776000000ULL, 5184000000ULL, 2419200000ULL, 1814400000ULL, 1209600000L, 604800000L, 259200000L,
|
||||||
172800000L, 86400000, 2880000, 14400000, 7200000, 3600000, 2700000,
|
172800000L, 86400000, 2880000, 14400000, 7200000, 3600000, 2700000,
|
||||||
1800000, 1200000, 900000, 600000, 300000, 120000, 60000, 45000, 30000,
|
1800000, 1200000, 900000, 600000, 300000, 120000, 60000, 45000, 30000,
|
||||||
20000, 15000, 10000, 5000, 2000, 1000, 100, 50, 10, 1
|
20000, 15000, 10000, 5000, 2000, 1000, 500, 100, 50, 10, 1
|
||||||
};
|
};
|
||||||
const int divcnt = sizeof(divisors) / sizeof(quint64);
|
const int divcnt = sizeof(divisors) / sizeof(quint64);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ int CMS50Loader::Open(QString path, Profile *profile)
|
|||||||
startImportTimeout();
|
startImportTimeout();
|
||||||
return 1;
|
return 1;
|
||||||
} else if (path.compare("live") == 0) {
|
} else if (path.compare("live") == 0) {
|
||||||
oxitime = QDateTime::currentDateTime();
|
m_startTime = oxitime = QDateTime::currentDateTime();
|
||||||
setStatus(LIVE);
|
setStatus(LIVE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ void CMS50Loader::processBytes(QByteArray bytes)
|
|||||||
{
|
{
|
||||||
// Sync to start of message type we are interested in
|
// Sync to start of message type we are interested in
|
||||||
quint8 c;
|
quint8 c;
|
||||||
quint8 msgcode = (m_status == IMPORTING) ? 0xf0 : 0x80;
|
quint8 msgcode = 0x80;
|
||||||
|
|
||||||
int idx=0;
|
int idx=0;
|
||||||
int bytesread = bytes.size();
|
int bytesread = bytes.size();
|
||||||
@ -157,17 +157,9 @@ void CMS50Loader::processBytes(QByteArray bytes)
|
|||||||
|
|
||||||
int CMS50Loader::doImportMode()
|
int CMS50Loader::doImportMode()
|
||||||
{
|
{
|
||||||
if (finished_import) {
|
|
||||||
// CMS50E/F continue streaming after import, CMS50D+ stops dead
|
|
||||||
// there is a timer running at this stage that will kill the 50D
|
|
||||||
killTimers();
|
|
||||||
closeDevice();
|
|
||||||
m_importing = false;
|
|
||||||
imp_callbacks = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int hour,minute;
|
|
||||||
int available = buffer.size();
|
int available = buffer.size();
|
||||||
|
Q_ASSERT(!finished_import);
|
||||||
|
int hour,minute;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
while (idx < available) {
|
while (idx < available) {
|
||||||
unsigned char c=(unsigned char)buffer.at(idx);
|
unsigned char c=(unsigned char)buffer.at(idx);
|
||||||
@ -256,16 +248,16 @@ int CMS50Loader::doImportMode()
|
|||||||
} else if (!started_reading) { // have not got a valid trio yet, skip...
|
} else if (!started_reading) { // have not got a valid trio yet, skip...
|
||||||
idx += 1;
|
idx += 1;
|
||||||
} else {
|
} else {
|
||||||
// trio's are over.. finish up.
|
//Completed
|
||||||
|
finished_import = true;
|
||||||
killTimers();
|
killTimers();
|
||||||
closeDevice();
|
closeDevice();
|
||||||
|
|
||||||
started_import = false;
|
|
||||||
started_reading = false;
|
|
||||||
finished_import = true;
|
|
||||||
m_importing = false;
|
m_importing = false;
|
||||||
break;
|
m_status = NEUTRAL;
|
||||||
//Completed
|
emit importComplete(this);
|
||||||
|
return available;
|
||||||
|
imp_callbacks = cb_reset = 0;
|
||||||
|
return available;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,13 +290,6 @@ int CMS50Loader::doLiveMode()
|
|||||||
oxirec.append(OxiRecord(pulse, spo2));
|
oxirec.append(OxiRecord(pulse, spo2));
|
||||||
plethy.append(pwave);
|
plethy.append(pwave);
|
||||||
|
|
||||||
int elapsed = m_time.elapsed();
|
|
||||||
|
|
||||||
// update the graph plots
|
|
||||||
if (elapsed > 1000) {
|
|
||||||
m_time.start();
|
|
||||||
emit updateDisplay(this);
|
|
||||||
}
|
|
||||||
idx += 5;
|
idx += 5;
|
||||||
}
|
}
|
||||||
emit updatePlethy(plethy);
|
emit updatePlethy(plethy);
|
||||||
@ -386,7 +371,7 @@ void CMS50Loader::resetImportTimeout()
|
|||||||
|
|
||||||
if (imp_callbacks != cb_reset) {
|
if (imp_callbacks != cb_reset) {
|
||||||
// Still receiving data.. reset timer
|
// Still receiving data.. reset timer
|
||||||
qDebug() << "Still receiving data in resetImportTimeout()";
|
qDebug() << "Still receiving data in resetImportTimeout()" << imp_callbacks << cb_reset;
|
||||||
if (resetTimer.isActive())
|
if (resetTimer.isActive())
|
||||||
resetTimer.stop();
|
resetTimer.stop();
|
||||||
|
|
||||||
@ -403,9 +388,9 @@ void CMS50Loader::resetImportTimeout()
|
|||||||
resetDevice(); // Send Reset to CMS50D+
|
resetDevice(); // Send Reset to CMS50D+
|
||||||
//started_import = false;
|
//started_import = false;
|
||||||
finished_import = true;
|
finished_import = true;
|
||||||
m_streaming=false;
|
//m_streaming=false;
|
||||||
|
|
||||||
closeDevice();
|
//closeDevice();
|
||||||
//emit transferComplete();
|
//emit transferComplete();
|
||||||
//doImportComplete();
|
//doImportComplete();
|
||||||
return;
|
return;
|
||||||
|
@ -17,15 +17,6 @@
|
|||||||
const QString cms50_class_name = "CMS50";
|
const QString cms50_class_name = "CMS50";
|
||||||
const int cms50_data_version = 4;
|
const int cms50_data_version = 4;
|
||||||
|
|
||||||
struct OxiRecord
|
|
||||||
{
|
|
||||||
quint8 pulse;
|
|
||||||
quint8 spo2;
|
|
||||||
OxiRecord():pulse(0), spo2(0) {}
|
|
||||||
OxiRecord(quint8 p, quint8 s): pulse(p), spo2(s) {}
|
|
||||||
OxiRecord(const OxiRecord & copy) { pulse = copy.pulse; spo2= copy.spo2; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*! \class CMS50Loader
|
/*! \class CMS50Loader
|
||||||
\brief Bulk Importer for CMS50 SPO2Review format.. Deprecated, as the Oximetry module does a better job
|
\brief Bulk Importer for CMS50 SPO2Review format.. Deprecated, as the Oximetry module does a better job
|
||||||
@ -64,8 +55,6 @@ protected:
|
|||||||
int doImportMode();
|
int doImportMode();
|
||||||
int doLiveMode();
|
int doLiveMode();
|
||||||
|
|
||||||
QVector<OxiRecord> oxirec;
|
|
||||||
|
|
||||||
virtual void killTimers();
|
virtual void killTimers();
|
||||||
|
|
||||||
// Switch CMS50D+ device to live streaming mode
|
// Switch CMS50D+ device to live streaming mode
|
||||||
|
@ -53,7 +53,7 @@ void DestroyLoaders()
|
|||||||
|
|
||||||
MachineLoader::MachineLoader() :QObject(nullptr)
|
MachineLoader::MachineLoader() :QObject(nullptr)
|
||||||
{
|
{
|
||||||
m_importing = m_abort = m_streaming = false;
|
m_abort = false;
|
||||||
m_type = MT_UNKNOWN;
|
m_type = MT_UNKNOWN;
|
||||||
m_status = NEUTRAL;
|
m_status = NEUTRAL;
|
||||||
}
|
}
|
||||||
|
@ -49,22 +49,20 @@ class MachineLoader: public QObject
|
|||||||
virtual const QString &ClassName() = 0;
|
virtual const QString &ClassName() = 0;
|
||||||
inline MachineType type() { return m_type; }
|
inline MachineType type() { return m_type; }
|
||||||
|
|
||||||
virtual bool openDevice() { return false; }
|
// virtual bool openDevice() { return false; }
|
||||||
virtual void closeDevice() {}
|
// virtual void closeDevice() {}
|
||||||
virtual bool scanDevice(QString keyword="", quint16 vendor_id=0, quint16 product_id=0) {
|
// virtual bool scanDevice(QString keyword="", quint16 vendor_id=0, quint16 product_id=0) {
|
||||||
Q_UNUSED(keyword)
|
// Q_UNUSED(keyword)
|
||||||
Q_UNUSED(vendor_id)
|
// Q_UNUSED(vendor_id)
|
||||||
Q_UNUSED(product_id)
|
// Q_UNUSED(product_id)
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void queTask(ImportTask * task);
|
void queTask(ImportTask * task);
|
||||||
|
|
||||||
//! \brief Process Task list using all available threads.
|
//! \brief Process Task list using all available threads.
|
||||||
void runTasks();
|
void runTasks();
|
||||||
|
|
||||||
inline bool isStreaming() { return m_streaming; }
|
|
||||||
inline bool isImporting() { return m_importing; }
|
|
||||||
inline bool isAborted() { return m_abort; }
|
inline bool isAborted() { return m_abort; }
|
||||||
void abort() { m_abort = true; }
|
void abort() { m_abort = true; }
|
||||||
|
|
||||||
@ -75,16 +73,16 @@ class MachineLoader: public QObject
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updateProgress(int cnt, int total);
|
void updateProgress(int cnt, int total);
|
||||||
void updateDisplay(MachineLoader *);
|
// void updateDisplay(MachineLoader *);
|
||||||
|
|
||||||
protected slots:
|
//protected slots:
|
||||||
virtual void dataAvailable() {}
|
// virtual void dataAvailable() {}
|
||||||
virtual void resetImportTimeout() {}
|
// virtual void resetImportTimeout() {}
|
||||||
virtual void startImportTimeout() {}
|
// virtual void startImportTimeout() {}
|
||||||
|
|
||||||
protected:
|
//protected:
|
||||||
virtual void killTimers(){}
|
// virtual void killTimers(){}
|
||||||
virtual void resetDevice(){}
|
// virtual void resetDevice(){}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \brief Contains a list of Machine records known by this loader
|
//! \brief Contains a list of Machine records known by this loader
|
||||||
@ -97,8 +95,6 @@ protected:
|
|||||||
int m_currenttask;
|
int m_currenttask;
|
||||||
int m_totaltasks;
|
int m_totaltasks;
|
||||||
|
|
||||||
bool m_streaming;
|
|
||||||
bool m_importing;
|
|
||||||
bool m_abort;
|
bool m_abort;
|
||||||
|
|
||||||
DeviceStatus m_status;
|
DeviceStatus m_status;
|
||||||
|
@ -124,4 +124,9 @@ void SerialOximeter::dataAvailable()
|
|||||||
processBytes(bytes);
|
processBytes(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SerialOximeter::stopRecording()
|
||||||
|
{
|
||||||
|
closeDevice();
|
||||||
|
m_status = NEUTRAL;
|
||||||
|
emit importComplete(this);
|
||||||
|
}
|
||||||
|
@ -19,11 +19,25 @@
|
|||||||
|
|
||||||
const int START_TIMEOUT = 30000;
|
const int START_TIMEOUT = 30000;
|
||||||
|
|
||||||
|
|
||||||
|
struct OxiRecord
|
||||||
|
{
|
||||||
|
quint8 pulse;
|
||||||
|
quint8 spo2;
|
||||||
|
OxiRecord():pulse(0), spo2(0) {}
|
||||||
|
OxiRecord(quint8 p, quint8 s): pulse(p), spo2(s) {}
|
||||||
|
OxiRecord(const OxiRecord & copy) { pulse = copy.pulse; spo2= copy.spo2; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class SerialOximeter : public MachineLoader
|
class SerialOximeter : public MachineLoader
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SerialOximeter() : MachineLoader() {}
|
SerialOximeter() : MachineLoader() {
|
||||||
|
m_importing = m_streaming = false;
|
||||||
|
m_productID = m_vendorID = 0;
|
||||||
|
}
|
||||||
virtual ~SerialOximeter() {}
|
virtual ~SerialOximeter() {}
|
||||||
|
|
||||||
virtual bool Detect(const QString &path)=0;
|
virtual bool Detect(const QString &path)=0;
|
||||||
@ -40,21 +54,32 @@ public:
|
|||||||
virtual bool openDevice();
|
virtual bool openDevice();
|
||||||
virtual void closeDevice();
|
virtual void closeDevice();
|
||||||
|
|
||||||
|
inline bool isStreaming() { return m_streaming; }
|
||||||
|
inline bool isImporting() { return m_importing; }
|
||||||
|
|
||||||
|
|
||||||
virtual void process() {}
|
virtual void process() {}
|
||||||
|
|
||||||
virtual Machine *CreateMachine(Profile *profile)=0;
|
virtual Machine *CreateMachine(Profile *profile)=0;
|
||||||
|
|
||||||
|
QVector<OxiRecord> oxirec;
|
||||||
|
|
||||||
|
QDateTime startTime() { return m_startTime; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void noDeviceFound();
|
void noDeviceFound();
|
||||||
void deviceDetected();
|
void deviceDetected();
|
||||||
void updatePlethy(QByteArray plethy);
|
void updatePlethy(QByteArray plethy);
|
||||||
|
void importComplete(SerialOximeter *);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void dataAvailable();
|
virtual void dataAvailable();
|
||||||
virtual void resetImportTimeout() {}
|
virtual void resetImportTimeout() {}
|
||||||
virtual void startImportTimeout() {}
|
virtual void startImportTimeout() {}
|
||||||
|
|
||||||
|
virtual void stopRecording();
|
||||||
|
// virtual void abortTask();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void processBytes(QByteArray buffer) { Q_UNUSED(buffer) }
|
virtual void processBytes(QByteArray buffer) { Q_UNUSED(buffer) }
|
||||||
|
|
||||||
@ -68,8 +93,14 @@ protected:
|
|||||||
QTimer startTimer;
|
QTimer startTimer;
|
||||||
QTimer resetTimer;
|
QTimer resetTimer;
|
||||||
|
|
||||||
|
QDateTime m_startTime;
|
||||||
|
|
||||||
quint16 m_productID;
|
quint16 m_productID;
|
||||||
quint16 m_vendorID;
|
quint16 m_vendorID;
|
||||||
|
|
||||||
|
bool m_streaming;
|
||||||
|
bool m_importing;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SERIALOXIMETER_H
|
#endif // SERIALOXIMETER_H
|
||||||
|
@ -66,6 +66,8 @@ OximeterImport::OximeterImport(QWidget *parent) :
|
|||||||
dummyday = nullptr;
|
dummyday = nullptr;
|
||||||
session = nullptr;
|
session = nullptr;
|
||||||
ELplethy = nullptr;
|
ELplethy = nullptr;
|
||||||
|
|
||||||
|
pulse = spo2 = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
OximeterImport::~OximeterImport()
|
OximeterImport::~OximeterImport()
|
||||||
@ -205,10 +207,13 @@ void OximeterImport::on_directImportButton_clicked()
|
|||||||
|
|
||||||
// Can't abort this bit or the oximeter will get confused...
|
// Can't abort this bit or the oximeter will get confused...
|
||||||
ui->cancelButton->setVisible(false);
|
ui->cancelButton->setVisible(false);
|
||||||
while (oximodule->isImporting() && !oximodule->isAborted()) {
|
|
||||||
QThread::msleep(50);
|
connect(oximodule, SIGNAL(importComplete(SerialOximeter*)), this, SLOT(finishedImport(SerialOximeter*)));
|
||||||
QApplication::processEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OximeterImport::finishedImport(SerialOximeter * oxi)
|
||||||
|
{
|
||||||
|
disconnect(ui->stopButton, SIGNAL(clicked()), this, SLOT(finishedImport()));
|
||||||
ui->cancelButton->setVisible(true);
|
ui->cancelButton->setVisible(true);
|
||||||
updateStatus(tr("Oximeter import completed.. Processing data"));
|
updateStatus(tr("Oximeter import completed.. Processing data"));
|
||||||
oximodule->process();
|
oximodule->process();
|
||||||
@ -221,7 +226,6 @@ void OximeterImport::on_directImportButton_clicked()
|
|||||||
ui->calendarWidget->setMaximumDate(PROFILE.LastDay());
|
ui->calendarWidget->setMaximumDate(PROFILE.LastDay());
|
||||||
|
|
||||||
on_calendarWidget_clicked(PROFILE.LastDay());
|
on_calendarWidget_clicked(PROFILE.LastDay());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OximeterImport::doUpdateProgress(int v, int t)
|
void OximeterImport::doUpdateProgress(int v, int t)
|
||||||
@ -296,7 +300,7 @@ void OximeterImport::on_liveImportButton_clicked()
|
|||||||
|
|
||||||
connect(oximodule, SIGNAL(updatePlethy(QByteArray)), this, SLOT(on_updatePlethy(QByteArray)));
|
connect(oximodule, SIGNAL(updatePlethy(QByteArray)), this, SLOT(on_updatePlethy(QByteArray)));
|
||||||
ui->liveConnectLabel->setText("Live Oximetery Mode");
|
ui->liveConnectLabel->setText("Live Oximetery Mode");
|
||||||
liveView->setEmptyText(tr("Recording..."));
|
liveView->setEmptyText(tr("Starting up..."));
|
||||||
ui->progressBar->hide();
|
ui->progressBar->hide();
|
||||||
liveView->update();
|
liveView->update();
|
||||||
oximodule->Open("live",p_profile);
|
oximodule->Open("live",p_profile);
|
||||||
@ -304,7 +308,7 @@ void OximeterImport::on_liveImportButton_clicked()
|
|||||||
|
|
||||||
dummyday = new Day(mach);
|
dummyday = new Day(mach);
|
||||||
|
|
||||||
quint32 starttime = QDateTime::currentDateTime().toTime_t();
|
quint32 starttime = oximodule->startTime().toTime_t();
|
||||||
ti = qint64(starttime) * 1000L;
|
ti = qint64(starttime) * 1000L;
|
||||||
start_ti = ti;
|
start_ti = ti;
|
||||||
|
|
||||||
@ -321,32 +325,28 @@ void OximeterImport::on_liveImportButton_clicked()
|
|||||||
|
|
||||||
liveView->setDay(dummyday);
|
liveView->setDay(dummyday);
|
||||||
|
|
||||||
QTime time;
|
updateTimer.setParent(this);
|
||||||
time.start();
|
updateTimer.setInterval(50);
|
||||||
while (oximodule->isStreaming() && !oximodule->isAborted()) {
|
updateTimer.start();
|
||||||
QThread::msleep(50);
|
connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateLiveDisplay()));
|
||||||
QApplication::processEvents();
|
connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(finishedRecording()));
|
||||||
// if (time.elapsed() > 100) {
|
}
|
||||||
time.restart();
|
|
||||||
updateLiveDisplay();
|
void OximeterImport::finishedRecording()
|
||||||
// }
|
{
|
||||||
if (!isVisible()) {
|
updateTimer.stop();
|
||||||
disconnect(oximodule, SIGNAL(updatePlethy(QByteArray)), this, SLOT(on_updatePlethy(QByteArray)));
|
|
||||||
oximodule->closeDevice();
|
oximodule->closeDevice();
|
||||||
delete dummyday;
|
disconnect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateLiveDisplay()));
|
||||||
session = nullptr;
|
disconnect(ui->stopButton, SIGNAL(clicked()), this, SLOT(finishedRecording()));
|
||||||
dummyday = nullptr;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ui->stopButton->setVisible(false);
|
ui->stopButton->setVisible(false);
|
||||||
ui->liveConnectLabel->setText("Live Import Stopped");
|
ui->liveConnectLabel->setText("Live Import Stopped");
|
||||||
liveView->setEmptyText(tr("Live Oximetery Stopped"));
|
liveView->setEmptyText(tr("Live Oximetery Stopped"));
|
||||||
updateStatus(tr("Live Oximetery import has been stopped"));
|
updateStatus(tr("Live Oximetery import has been stopped"));
|
||||||
|
|
||||||
oximodule->closeDevice();
|
|
||||||
disconnect(oximodule, SIGNAL(updatePlethy(QByteArray)), this, SLOT(on_updatePlethy(QByteArray)));
|
disconnect(oximodule, SIGNAL(updatePlethy(QByteArray)), this, SLOT(on_updatePlethy(QByteArray)));
|
||||||
|
|
||||||
|
// Remember to clear sessionlist before deleting dummyday. or it will destroy session.
|
||||||
// delete dummyday;
|
// delete dummyday;
|
||||||
|
|
||||||
//ui->stackedWidget->setCurrentWidget(ui->syncPage);
|
//ui->stackedWidget->setCurrentWidget(ui->syncPage);
|
||||||
@ -356,6 +356,7 @@ void OximeterImport::on_liveImportButton_clicked()
|
|||||||
ui->calendarWidget->setMaximumDate(PROFILE.LastDay());
|
ui->calendarWidget->setMaximumDate(PROFILE.LastDay());
|
||||||
|
|
||||||
plethyGraph->SetMinX(start_ti);
|
plethyGraph->SetMinX(start_ti);
|
||||||
|
liveView->SetXBounds(start_ti, ti, 0, true);
|
||||||
|
|
||||||
plethyGraph->setBlockZoom(false);
|
plethyGraph->setBlockZoom(false);
|
||||||
|
|
||||||
@ -487,6 +488,8 @@ void OximeterImport::updateLiveDisplay()
|
|||||||
if (!session) {
|
if (!session) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ui->showLiveGraphs->isChecked()) {
|
||||||
qint64 sti = ti - 20000;
|
qint64 sti = ti - 20000;
|
||||||
plethyChart->setMinY(ELplethy->Min());
|
plethyChart->setMinY(ELplethy->Min());
|
||||||
plethyChart->setMaxY(ELplethy->Max());
|
plethyChart->setMaxY(ELplethy->Max());
|
||||||
@ -503,20 +506,74 @@ void OximeterImport::updateLiveDisplay()
|
|||||||
session->setMin(OXI_Plethy, ELplethy->Min());
|
session->setMin(OXI_Plethy, ELplethy->Min());
|
||||||
session->setMax(OXI_Plethy, ELplethy->Max());
|
session->setMax(OXI_Plethy, ELplethy->Max());
|
||||||
session->setLast(OXI_Plethy, ti);
|
session->setLast(OXI_Plethy, ti);
|
||||||
session->setCount(OXI_Plethy, session->count(OXI_Plethy));
|
session->setCount(OXI_Plethy, ELplethy->count());
|
||||||
|
|
||||||
for (int i = 0; i < liveView->size(); i++) {
|
for (int i = 0; i < liveView->size(); i++) {
|
||||||
(*liveView)[i]->SetXBounds(sti, ti);
|
(*liveView)[i]->SetXBounds(sti, ti);
|
||||||
}
|
}
|
||||||
|
|
||||||
liveView->updateScale();
|
liveView->updateScale();
|
||||||
liveView->timedRedraw(25);
|
liveView->redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
int size = oximodule->oxirec.size();
|
||||||
|
|
||||||
|
if (size > 0) {
|
||||||
|
int i = oximodule->startTime().secsTo(QDateTime::currentDateTime());
|
||||||
|
|
||||||
|
int seconds = i % 60;
|
||||||
|
int minutes = (i / 60) % 60;
|
||||||
|
int hours = i / 3600;
|
||||||
|
|
||||||
|
size--;
|
||||||
|
|
||||||
|
bool datagood = oximodule->oxirec[size].pulse > 0;
|
||||||
|
|
||||||
|
QString STR_recording = tr("Recording...");
|
||||||
|
QString STR_nofinger = tr("Finger not detected");
|
||||||
|
|
||||||
|
if (datagood & (pulse <= 0)) {
|
||||||
|
updateStatus(STR_recording);
|
||||||
|
liveView->setEmptyText(STR_recording);
|
||||||
|
if (!ui->showLiveGraphs->isChecked()) {
|
||||||
|
liveView->redraw();
|
||||||
|
}
|
||||||
|
} else if (!datagood & (pulse != 0)) {
|
||||||
|
updateStatus(STR_nofinger);
|
||||||
|
liveView->setEmptyText(STR_nofinger);
|
||||||
|
if (!ui->showLiveGraphs->isChecked()) {
|
||||||
|
liveView->redraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pulse = oximodule->oxirec[size].pulse;
|
||||||
|
spo2 = oximodule->oxirec[size].spo2;
|
||||||
|
if (pulse > 0) {
|
||||||
|
ui->pulseDisplay->display(QString().sprintf("%3i", pulse));
|
||||||
|
} else {
|
||||||
|
ui->pulseDisplay->display("---");
|
||||||
|
}
|
||||||
|
if (spo2 > 0) {
|
||||||
|
ui->spo2Display->display(QString().sprintf("%2i", spo2));
|
||||||
|
} else {
|
||||||
|
ui->spo2Display->display("--");
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->lcdDuration->display(QString().sprintf("%02i:%02i:%02i",hours, minutes, seconds));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OximeterImport::on_cancelButton_clicked()
|
void OximeterImport::on_cancelButton_clicked()
|
||||||
{
|
{
|
||||||
|
if (oximodule && oximodule->isStreaming()) {
|
||||||
|
oximodule->closeDevice();
|
||||||
|
}
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OximeterImport::on_showLiveGraphs_clicked(bool checked)
|
||||||
|
{
|
||||||
|
plethyGraph->setVisible(checked);
|
||||||
|
liveView->redraw();
|
||||||
|
}
|
||||||
|
@ -53,13 +53,17 @@ private slots:
|
|||||||
|
|
||||||
void on_cancelButton_clicked();
|
void on_cancelButton_clicked();
|
||||||
|
|
||||||
|
void on_showLiveGraphs_clicked(bool checked);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void on_updatePlethy(QByteArray plethy);
|
void on_updatePlethy(QByteArray plethy);
|
||||||
|
void finishedRecording();
|
||||||
|
void finishedImport(SerialOximeter*);
|
||||||
|
void updateLiveDisplay();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SerialOximeter * detectOximeter();
|
SerialOximeter * detectOximeter();
|
||||||
void updateStatus(QString msg);
|
void updateStatus(QString msg);
|
||||||
void updateLiveDisplay();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::OximeterImport *ui;
|
Ui::OximeterImport *ui;
|
||||||
@ -72,6 +76,11 @@ private:
|
|||||||
SessionBar * sessbar;
|
SessionBar * sessbar;
|
||||||
EventList * ELplethy;
|
EventList * ELplethy;
|
||||||
qint64 start_ti, ti;
|
qint64 start_ti, ti;
|
||||||
|
QTimer updateTimer;
|
||||||
|
|
||||||
|
int pulse;
|
||||||
|
int spo2;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OXIMETERIMPORT_H
|
#endif // OXIMETERIMPORT_H
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>851</width>
|
<width>915</width>
|
||||||
<height>615</height>
|
<height>615</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -620,7 +620,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>4</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="welcomePage">
|
<widget class="QWidget" name="welcomePage">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
@ -895,6 +895,16 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="liveStatusLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Press Start to commence recording</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="frame_3">
|
<widget class="QFrame" name="frame_3">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -910,10 +920,30 @@ p, li { white-space: pre-wrap; }
|
|||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="liveStatusLabel">
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="showLiveGraphs">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Press Start to commence recording</string>
|
<string>Show Live Graphs</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -931,7 +961,28 @@ p, li { white-space: pre-wrap; }
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Duration</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLCDNumber" name="lcdDuration">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="digitCount">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -940,12 +991,67 @@ p, li { white-space: pre-wrap; }
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLCDNumber" name="spo2Display"/>
|
<widget class="QLCDNumber" name="spo2Display">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>60</width>
|
||||||
|
<height>50</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>0</red>
|
||||||
|
<green>106</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>0</red>
|
||||||
|
<green>106</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>127</red>
|
||||||
|
<green>127</green>
|
||||||
|
<blue>127</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="digitCount">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -954,7 +1060,66 @@ p, li { white-space: pre-wrap; }
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLCDNumber" name="pulseDisplay"/>
|
<widget class="QLCDNumber" name="pulseDisplay">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>50</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>85</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="smallDecimalPoint">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="digitCount">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user