From 7a6af0b78cf3bf746f6871c7d52d3c74befa681a Mon Sep 17 00:00:00 2001 From: MPIBR-kretschmerf <friedrich.kretschmer@brain.mpg.de> Date: Fri, 3 Feb 2017 11:39:36 +0100 Subject: [PATCH] Fixed socket communication for online eye tracker --- AudioGameGUI.pro | 2 ++ SocketClient.cpp | 1 + SocketClient.h | 2 +- StateMachineController.cpp | 4 ++++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AudioGameGUI.pro b/AudioGameGUI.pro index ed3cf8a..63f4146 100644 --- a/AudioGameGUI.pro +++ b/AudioGameGUI.pro @@ -16,6 +16,8 @@ RESOURCES = application.qrc RC_FILE = app.rc QT += axcontainer + +# QT automatically generates the classes from the com object TYPELIBS = $$system(dumpcpp -getfile {D323A622-1D13-11D4-8858-444553540000}) isEmpty(TYPELIBS) { diff --git a/SocketClient.cpp b/SocketClient.cpp index 8c13718..2ddae2b 100644 --- a/SocketClient.cpp +++ b/SocketClient.cpp @@ -92,6 +92,7 @@ void SocketClient::connectToHost() connect(tcpSocket, SIGNAL(connected()), this, SLOT(onConnected())); connect(tcpSocket, SIGNAL(disconnected()), this, SLOT(onDisconnected())); connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(onReadData()), Qt::QueuedConnection); + qDebug() << "Connected"; } } diff --git a/SocketClient.h b/SocketClient.h index aec1e70..61b44c5 100644 --- a/SocketClient.h +++ b/SocketClient.h @@ -21,7 +21,7 @@ class QNetworkSession; #define SOCKET_FILENAME 3 #define SOCKET_TRACKINGRESULT 4 -class SocketClient : public QDialog +class SocketClient : public QObject { Q_OBJECT diff --git a/StateMachineController.cpp b/StateMachineController.cpp index f8c2224..e064f52 100644 --- a/StateMachineController.cpp +++ b/StateMachineController.cpp @@ -3,6 +3,8 @@ StateMachineController::StateMachineController(QObject *parent): QObject(parent) { + qRegisterMetaType<QVector<double>>("QVector<double>"); + // seed randomizer srand(time(0)); timerDialog = new TimerDialog(); @@ -84,6 +86,7 @@ StateMachineController::StateMachineController(QObject *parent): connect(socketClient, SIGNAL(socketTrackingResult(QVector<double>)), logFileWriter, SLOT(onWriteTrackingResult(QVector<double>))); socketClient->moveToThread(socketThread); + socketThread->start(); logFileWriter->moveToThread(logFileThread); logFileThread->start(); }else{ @@ -243,5 +246,6 @@ void StateMachineController::onStateSoundEntered() void StateMachineController::onStatePauseEntered() { qDebug()<<"Pause state entered"; + mainTimer->stop(); timerDialog->removeTimer(); }