From 33f9062dd85d40ea1d864fd216ca019323be2f02 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Mon, 18 Aug 2014 10:34:41 +1000 Subject: [PATCH] CMS50F37 debug test 4 --- .../loader_plugins/cms50f37_loader.cpp | 29 +++++++++++++++++++ .../SleepLib/loader_plugins/cms50f37_loader.h | 2 ++ 2 files changed, 31 insertions(+) diff --git a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp index 3b78d66f..360b5caf 100644 --- a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp @@ -58,6 +58,35 @@ CMS50F37Loader::~CMS50F37Loader() { } +bool CMS50F37Loader::openDevice() +{ + if (port.isEmpty()) { + if (!scanDevice("",m_vendorID, m_productID)) + return false; + } + serial.setPortName(port); + if (!serial.open(QSerialPort::ReadWrite)) + return false; + + // forward this stuff + + // Set up serial port attributes + serial.setBaudRate(QSerialPort::Baud115200); + serial.setParity(QSerialPort::OddParity); + serial.setStopBits(QSerialPort::OneStop); + serial.setDataBits(QSerialPort::Data8); + serial.setFlowControl(QSerialPort::NoFlowControl); + + m_streaming = true; + m_abort = false; + m_importing = false; + + // connect relevant signals + connect(&serial,SIGNAL(readyRead()), this, SLOT(dataAvailable())); + + return true; +} + bool CMS50F37Loader::Detect(const QString &path) { if (p_profile->oxi->oximeterType() == QString("Contec CMS50F v3.7+")) { diff --git a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.h b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.h index 5ee830e0..16c5aa5c 100644 --- a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.h +++ b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.h @@ -29,6 +29,8 @@ Q_OBJECT virtual bool Detect(const QString &path); virtual int Open(QString path); + virtual bool openDevice(); + static void Register();