[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [labplot] src/backend/datasources: [live data] fix using local socket
From: Stefan Gerlach <null () kde ! org>
Date: 2018-06-30 13:19:24
Message-ID: E1fZFme-000082-SU () code ! kde ! org
[Download RAW message or body]
Git commit 792c6b53b25bfd0a76155f7db26aea9926a540d6 by Stefan Gerlach.
Committed on 30/06/2018 at 13:15.
Pushed by sgerlach into branch 'master'.
[live data] fix using local socket
M +1 -1 src/backend/datasources/LiveDataSource.cpp
M +2 -1 src/backend/datasources/LiveDataSource.h
M +6 -4 src/backend/datasources/filters/AsciiFilter.cpp
https://commits.kde.org/labplot/792c6b53b25bfd0a76155f7db26aea9926a540d6
diff --git a/src/backend/datasources/LiveDataSource.cpp \
b/src/backend/datasources/LiveDataSource.cpp index 44dea50e..1b610989 100644
--- a/src/backend/datasources/LiveDataSource.cpp
+++ b/src/backend/datasources/LiveDataSource.cpp
@@ -599,7 +599,7 @@ void LiveDataSource::read() {
dynamic_cast<AsciiFilter*>(m_filter)->readFromLiveDeviceNotFile(*m_device, this);
break;
case LocalSocket:
- DEBUG("reading from local socket. state before abort = " << \
m_localSocket->state()); + DEBUG("reading from local socket. state before abort = " \
<< ENUM_TO_STRING(QLocalSocket, LocalSocketState, m_localSocket->state())); \
m_localSocket->abort(); m_localSocket->connectToServer(m_localSocketName, \
QLocalSocket::ReadOnly); DEBUG("reading from local socket. state after reconnect = " \
<< m_localSocket->state());
diff --git a/src/backend/datasources/LiveDataSource.h \
b/src/backend/datasources/LiveDataSource.h index b9bee9f3..bf9c442e 100644
--- a/src/backend/datasources/LiveDataSource.h
+++ b/src/backend/datasources/LiveDataSource.h
@@ -5,6 +5,7 @@
--------------------------------------------------------------------
Copyright : (C) 2017 Fabian Kristof (fkristofszabolcs@gmail.com)
Copyright : (C) 2017-2018 Alexander Semke (alexander.semke@web.de)
+ Copyright : (C) 2018 Stefan Gerlach (stefan.gerlach@uni.kn)
***************************************************************************/
@@ -32,8 +33,8 @@
#include "backend/spreadsheet/Spreadsheet.h"
#include "backend/matrix/Matrix.h"
-#include <QSerialPort>
#include <QtNetwork/QLocalSocket>
+#include <QSerialPort>
#include <QTimer>
class QString;
diff --git a/src/backend/datasources/filters/AsciiFilter.cpp \
b/src/backend/datasources/filters/AsciiFilter.cpp index 09e1847f..cb25f9b4 100644
--- a/src/backend/datasources/filters/AsciiFilter.cpp
+++ b/src/backend/datasources/filters/AsciiFilter.cpp
@@ -747,12 +747,14 @@ qint64 AsciiFilterPrivate::readFromLiveDevice(QIODevice& \
device, AbstractDataSou #endif
while (!device.atEnd()) {
- DEBUG(" reading type = " << readingType);
+ DEBUG(" reading type = " << ENUM_TO_STRING(LiveDataSource, ReadingType, \
readingType)); + DEBUG(" source type = " << ENUM_TO_STRING(LiveDataSource, \
SourceType, spreadsheet->sourceType())); if (readingType != \
LiveDataSource::ReadingType::TillEnd) {
- // local socket and UDP socket needs read(), all other need readLine()
+ // local socket needs readAll(), UDP socket needs read(), all other need \
readLine() //TODO: check serial port
- if (spreadsheet->sourceType() == LiveDataSource::SourceType::LocalSocket
- || spreadsheet->sourceType() == LiveDataSource::SourceType::NetworkUdpSocket)
+ if (spreadsheet->sourceType() == LiveDataSource::SourceType::LocalSocket)
+ newData[newDataIdx++] = device.readAll();
+ else if (spreadsheet->sourceType() == \
LiveDataSource::SourceType::NetworkUdpSocket) newData[newDataIdx++] = \
device.read(device.bytesAvailable()); else {
if (!device.canReadLine())
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic