diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2010-12-24 18:58:17 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2010-12-24 18:58:17 +0000 |
commit | e007864f430012ac03455142b3910760df03987d (patch) | |
tree | ed1d358f61ffbd19788670da593e17a20b2a276e /FaceTrackNoIR/SCServer.cpp | |
parent | 53231950ec75f67a931d47b78987a6bcac9d2eb0 (diff) |
Removed QThread reference of protocol server-code.
Have still to adapt some of them though...
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@32 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR/SCServer.cpp')
-rw-r--r-- | FaceTrackNoIR/SCServer.cpp | 59 |
1 files changed, 25 insertions, 34 deletions
diff --git a/FaceTrackNoIR/SCServer.cpp b/FaceTrackNoIR/SCServer.cpp index c948b8a6..9ee52f8d 100644 --- a/FaceTrackNoIR/SCServer.cpp +++ b/FaceTrackNoIR/SCServer.cpp @@ -24,21 +24,12 @@ */
#include "SCServer.h"
-
-//float SCServer::virtPosX = 0.0f;
-//float SCServer::virtPosY = 0.0f;
-//float SCServer::virtPosZ = 0.0f;
-//
-//float SCServer::virtRotX = 0.0f;
-//float SCServer::virtRotY = 0.0f;
-//float SCServer::virtRotZ = 0.0f;
-
/** constructor **/
SCServer::SCServer() {
// Create events
- m_StopThread = CreateEvent(0, TRUE, FALSE, 0);
- m_WaitThread = CreateEvent(0, TRUE, FALSE, 0);
+ //m_StopThread = CreateEvent(0, TRUE, FALSE, 0);
+ //m_WaitThread = CreateEvent(0, TRUE, FALSE, 0);
ProgramName = "";
}
@@ -47,16 +38,16 @@ SCServer::SCServer() { SCServer::~SCServer() {
// Trigger thread to stop
- ::SetEvent(m_StopThread);
+ //::SetEvent(m_StopThread);
// Wait until thread finished
- if (isRunning()) {
- ::WaitForSingleObject(m_WaitThread, INFINITE);
- }
+ //if (isRunning()) {
+ // ::WaitForSingleObject(m_WaitThread, INFINITE);
+ //}
- // Close handles
- ::CloseHandle(m_StopThread);
- ::CloseHandle(m_WaitThread);
+ //// Close handles
+ //::CloseHandle(m_StopThread);
+ //::CloseHandle(m_WaitThread);
//
// Free the DLL
@@ -64,12 +55,12 @@ SCServer::~SCServer() { SCClientLib.unload();
//terminates the QThread and waits for finishing the QThread
- terminate();
- wait();
+ //terminate();
+ //wait();
}
/** QThread run @override **/
-void SCServer::run() {
+void SCServer::sendHeadposeToGame() {
bool blnSimConnectActive = false;
HANDLE hSimConnect = NULL; // Handle to SimConnect
importSimConnect_Open simconnect_open; // SimConnect function(s) in DLL
@@ -109,23 +100,23 @@ float prevPosX, prevPosY, prevPosZ, prevRotX, prevRotY, prevRotZ; forever
{
// Check event for stop thread
- if(::WaitForSingleObject(m_StopThread, 0) == WAIT_OBJECT_0)
- {
- // Set event
- simconnect_close( hSimConnect );
- ::SetEvent(m_WaitThread);
- return;
- }
+ //if(::WaitForSingleObject(m_StopThread, 0) == WAIT_OBJECT_0)
+ //{
+ // // Set event
+// simconnect_close( hSimConnect );
+ // ::SetEvent(m_WaitThread);
+ // return;
+ //}
if (!blnSimConnectActive) {
if (SUCCEEDED(simconnect_open(&hSimConnect, "FaceTrackNoIR", NULL, 0, 0, 0))) {
qDebug() << "SCServer::run() says: SimConnect active!";
blnSimConnectActive = true;
}
- else {
- msleep(5000);
- yieldCurrentThread();
- }
+ //else {
+ // msleep(5000);
+ // yieldCurrentThread();
+ //}
}
else {
//
@@ -148,8 +139,8 @@ float prevPosX, prevPosY, prevPosZ, prevRotX, prevRotY, prevRotZ; prevRotZ = virtRotZ;
// just for lower cpu load
- msleep(15);
- yieldCurrentThread();
+ //msleep(15);
+ //yieldCurrentThread();
}
}
}
|