diff --git a/AudioGameGUI.pro.user b/AudioGameGUI.pro.user
deleted file mode 100644
index 9375077..0000000
--- a/AudioGameGUI.pro.user
+++ /dev/null
@@ -1,226 +0,0 @@
-
-
-
-
-
- ProjectExplorer.Project.ActiveTarget
- 0
-
-
- ProjectExplorer.Project.EditorSettings
-
- true
- false
- true
-
- Cpp
-
- CppGlobal
-
-
-
- QmlJS
-
- QmlJSGlobal
-
-
- 2
- UTF-8
- false
- 4
- false
- true
- 1
- true
- 0
- true
- 0
- 8
- true
- 1
- true
- true
- true
- false
-
-
-
- ProjectExplorer.Project.PluginSettings
-
-
-
- ProjectExplorer.Project.Target.0
-
- Desktop
- Desktop
- {2a550e7b-41ba-4c4c-9b90-d18a4be629c4}
- 0
- 0
- 0
-
- /home/kretschmerf/projectsbuild-AudioGameGUI-Desktop-Debug
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- false
- true
-
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- -w
- -r
-
- false
-
-
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- -w
- -r
-
- true
- clean
-
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Debug
-
- Qt4ProjectManager.Qt4BuildConfiguration
- 2
- true
-
-
- /home/kretschmerf/projectsbuild-AudioGameGUI-Desktop-Release
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- false
- true
-
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- -w
- -r
-
- false
-
-
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- -w
- -r
-
- true
- clean
-
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Release
-
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- true
-
- 2
-
-
- 0
- Deploy
-
- ProjectExplorer.BuildSteps.Deploy
-
- 1
- Deploy locally
-
- ProjectExplorer.DefaultDeployConfiguration
-
- 1
-
-
- 2
-
- AudioGameGUI
-
- Qt4ProjectManager.Qt4RunConfiguration:/storage/scic/Data/External/Developer/AudioGameGUI/AudioGameGUI.pro
-
- AudioGameGUI.pro
- false
- false
-
- 3768
- true
- false
- false
- false
- true
-
- 1
-
-
-
- ProjectExplorer.Project.TargetCount
- 1
-
-
- ProjectExplorer.Project.Updater.EnvironmentId
- {2ed301e3-4f04-4cfb-b8ea-e4f5caa11dd8}
-
-
- ProjectExplorer.Project.Updater.FileVersion
- 15
-
-
diff --git a/StateMachineController.cpp b/StateMachineController.cpp
index 32c3bef..f8c2224 100644
--- a/StateMachineController.cpp
+++ b/StateMachineController.cpp
@@ -1,6 +1,7 @@
#include "StateMachineController.h"
-StateMachineController::StateMachineController(QObject *parent)
+StateMachineController::StateMachineController(QObject *parent):
+ QObject(parent)
{
// seed randomizer
srand(time(0));
@@ -68,11 +69,21 @@ StateMachineController::StateMachineController(QObject *parent)
logFileThread = new QThread(this);
logFileWriter = new LogFileWriter();
+ socketThread = new QThread(this);
+ socketClient = new SocketClient();
+
/*Thread-safe event communication*/
+
+ /*Main -> Logfile*/
connect(this, SIGNAL(openLogFile(QString)), logFileWriter, SLOT(onOpen(QString)));
connect(this, SIGNAL(closeLogFile()), logFileWriter, SLOT(onClose()));
connect(this, SIGNAL(writeToLogFile(QString, uint, uint, QString)), logFileWriter, SLOT(onWrite(QString, uint, uint, QString)));
connect(nidaq, SIGNAL(writeToLogFile(QString, uint, uint, QString)), logFileWriter, SLOT(onWrite(QString, uint, uint, QString)));
+
+ /*Socket -> Logfile*/
+ connect(socketClient, SIGNAL(socketTrackingResult(QVector)), logFileWriter, SLOT(onWriteTrackingResult(QVector)));
+
+ socketClient->moveToThread(socketThread);
logFileWriter->moveToThread(logFileThread);
logFileThread->start();
}else{
@@ -85,8 +96,19 @@ StateMachineController::StateMachineController(QObject *parent)
StateMachineController::~StateMachineController()
{
+
+ if(logFileThread){
+ logFileThread->quit();
+ logFileThread->wait();
+ }
+ if(socketThread){
+ socketThread->quit();
+ socketThread->wait();
+ }
+
delete nidaq;
delete tdt;
+ delete logFileWriter;
}
void StateMachineController::startStateMachine(audioGameSettings settings)
diff --git a/StateMachineController.h b/StateMachineController.h
index efd1489..03ef2ff 100644
--- a/StateMachineController.h
+++ b/StateMachineController.h
@@ -18,6 +18,7 @@
#include "TimerDialog.h"
#include "NIDAQmxInterface.h"
#include "TDTInterface.h"
+#include "SocketClient.h"
#include "rpcoxlib.h"
#include "LogFileWriter.h"
@@ -45,6 +46,8 @@ class StateMachineController : public QObject
TimerDialog *timerDialog;
NIDAQmxInterface* nidaq;
TDTInterface* tdt;
+ SocketClient* socketClient;
+ QThread* socketThread;
QThread* logFileThread;
LogFileWriter* logFileWriter;