summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-04-04 19:58:09 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-04-04 19:58:09 +0000
commitd3456cb84b428b2f5070517d6e571f6b2724dd24 (patch)
treeb4885f52965952f8a4a529bce3edadc6dc425867
parent28c091a886e6c98f41d3f5f8b153768b4a589fcd (diff)
Move protocols to DLL: TrackIR
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@61 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r--FTNoIR_Protocol_FG/FGTypes.h (renamed from FaceTrackNoIR/FGTypes.h)0
-rw-r--r--FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp32
-rw-r--r--FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h6
-rw-r--r--FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj4
-rw-r--r--FTNoIR_Protocol_FTIR/FTIRTypes.h (renamed from FaceTrackNoIR/FTIRTypes.h)0
-rw-r--r--FTNoIR_Protocol_FTIR/FTNoIR_FTIRcontrols.ui (renamed from FaceTrackNoIR/FTNoIR_FTIRcontrols.ui)0
-rw-r--r--FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp (renamed from FaceTrackNoIR/FTIRServer.cpp)332
-rw-r--r--FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h (renamed from FaceTrackNoIR/FTIRServer.h)68
-rw-r--r--FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.vcproj332
-rw-r--r--FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h2
-rw-r--r--FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp9
-rw-r--r--FaceTrackNoIR.sln6
-rw-r--r--FaceTrackNoIR.suobin367104 -> 373248 bytes
-rw-r--r--FaceTrackNoIR/FGServer.cpp336
-rw-r--r--FaceTrackNoIR/FGServer.h106
-rw-r--r--FaceTrackNoIR/FTNoIR_FGcontrols.ui279
-rw-r--r--FaceTrackNoIR/FaceApp.cpp2
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp47
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.h11
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.vcproj176
-rw-r--r--FaceTrackNoIR/tracker.cpp25
-rw-r--r--FaceTrackNoIR/tracker.h4
-rw-r--r--bin/FaceTrackNoIR.exebin663552 -> 618496 bytes
-rw-r--r--bin/Settings/Wings of Prey.ini2
24 files changed, 661 insertions, 1118 deletions
diff --git a/FaceTrackNoIR/FGTypes.h b/FTNoIR_Protocol_FG/FGTypes.h
index 949dc213..949dc213 100644
--- a/FaceTrackNoIR/FGTypes.h
+++ b/FTNoIR_Protocol_FG/FGTypes.h
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp
index cb03c70e..95c83958 100644
--- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp
+++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp
@@ -33,6 +33,9 @@
*/
#include "ftnoir_protocol_fg.h"
+// For Todd
+//#define SEND_ASCII_DATA
+
/** constructor **/
FTNoIR_Protocol_FG::FTNoIR_Protocol_FG()
{
@@ -97,6 +100,10 @@ int no_bytes;
QHostAddress sender;
quint16 senderPort;
+#ifdef SEND_ASCII_DATA
+char data[100];
+#endif
+
//
// Copy the Raw measurements directly to the client.
//
@@ -112,6 +119,22 @@ quint16 senderPort;
// Try to send an UDP-message to the FlightGear
//
+#ifdef SEND_ASCII_DATA
+ sprintf_s(data, "%.4f;%.4f;%.4f;%.2f;%.2f;%.2f\n\0", FlightData.x, FlightData.y, FlightData.z, FlightData.p, FlightData.h, FlightData.r);
+
+ if (outSocket != 0) {
+ no_bytes = outSocket->writeDatagram((const char *) &data, strlen( data ), destIP, destPort);
+ if ( no_bytes > 0) {
+ qDebug() << "FGServer::writePendingDatagrams says: bytes send =" << data;
+ }
+ else {
+ qDebug() << "FGServer::writePendingDatagrams says: nothing sent!";
+ }
+ }
+
+#endif
+
+ #ifndef SEND_ASCII_DATA
//! [1]
// no_bytes = outSocket->writeDatagram((const char *) &FlightData, sizeof( FlightData ), QHostAddress::LocalHost, 5550);
if (outSocket != 0) {
@@ -123,6 +146,7 @@ quint16 senderPort;
qDebug() << "FGServer::writePendingDatagrams says: nothing sent!";
}
}
+ #endif
//
// FlightGear keeps sending data, so we must read that here.
@@ -208,13 +232,15 @@ FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol()
//
// Constructor for server-settings-dialog
//
-FGControls::FGControls( QWidget *parent, Qt::WindowFlags f ) :
-QWidget( parent , f)
+FGControls::FGControls() :
+QWidget()
{
ui.setupUi( this );
QPoint offsetpos(100, 100);
- this->move(parent->pos() + offsetpos);
+ //if (parent) {
+ // this->move(parent->pos() + offsetpos);
+ //}
// Connect Qt signals to member-functions
connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h
index 220dc60d..45188257 100644
--- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h
+++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h
@@ -1,5 +1,5 @@
/********************************************************************************
-* FaceTrackNoIR This program is a private project of the some enthusiastic *
+* FaceTrackNoIR This program is a private project of some enthusiastic *
* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
@@ -31,7 +31,7 @@
#include "..\ftnoir_protocol_base\ftnoir_protocol_base.h"
#include "ui_FTNoIR_FGcontrols.h"
-#include "..\facetracknoir\FGTypes.h"
+#include "FGTypes.h"
#include <QThread>
#include <QUdpSocket>
#include <QMessageBox>
@@ -70,7 +70,7 @@ class FGControls: public QWidget, Ui::UICFGControls, public IProtocolDialog
Q_OBJECT
public:
- explicit FGControls( QWidget *parent=0, Qt::WindowFlags f=0 );
+ explicit FGControls();
virtual ~FGControls();
void showEvent ( QShowEvent * event );
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj
index eae8510a..2a84fa7a 100644
--- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj
+++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.vcproj
@@ -178,6 +178,10 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
+ RelativePath=".\FGTypes.h"
+ >
+ </File>
+ <File
RelativePath="..\FTNoIR_Protocol_Base\ftnoir_Protocol_base.h"
>
</File>
diff --git a/FaceTrackNoIR/FTIRTypes.h b/FTNoIR_Protocol_FTIR/FTIRTypes.h
index f238762c..f238762c 100644
--- a/FaceTrackNoIR/FTIRTypes.h
+++ b/FTNoIR_Protocol_FTIR/FTIRTypes.h
diff --git a/FaceTrackNoIR/FTNoIR_FTIRcontrols.ui b/FTNoIR_Protocol_FTIR/FTNoIR_FTIRcontrols.ui
index a2d06d2a..a2d06d2a 100644
--- a/FaceTrackNoIR/FTNoIR_FTIRcontrols.ui
+++ b/FTNoIR_Protocol_FTIR/FTNoIR_FTIRcontrols.ui
diff --git a/FaceTrackNoIR/FTIRServer.cpp b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp
index 7268d1dc..59ea086b 100644
--- a/FaceTrackNoIR/FTIRServer.cpp
+++ b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp
@@ -1,9 +1,12 @@
/********************************************************************************
-* FTIRServer FTIRServer is the Class, that communicates headpose-data *
-* to games, using the NPClient.dll. *
+* FaceTrackNoIR This program is a private project of the some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
-* Ron Hendriks (Testing and Research) *
+* Ron Hendriks (Researching and Testing) *
+* *
+* Homepage *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
@@ -18,18 +21,20 @@
* You should have received a copy of the GNU General Public License along *
* with this program; if not, see <http://www.gnu.org/licenses/>. *
* *
+* FTIRServer FTIRServer is the Class, that communicates headpose-data *
+* to games, using the NPClient.dll. *
********************************************************************************/
/*
Modifications (last one on top):
+ 20110401 - WVR: Moved protocol to a DLL, convenient for installation etc.
20101224 - WVR: Base class is no longer inheriting QThread. sendHeadposeToGame
is called from run() of Tracker.cpp
- 20101127 - WVR: Added TrackIR.exe process for EZCA etc...
- 20101023 - WVR: Added TIRViews for FS2004, Combat FS3, etc...
*/
-#include "FTIRServer.h"
+#include "ftnoir_protocol_ftir.h"
/** constructor **/
-FTIRServer::FTIRServer() {
+FTNoIR_Protocol_FTIR::FTNoIR_Protocol_FTIR()
+{
loadSettings();
ProgramName = "";
dummyTrackIR = 0;
@@ -38,8 +43,8 @@ FTIRServer::FTIRServer() {
}
/** destructor **/
-FTIRServer::~FTIRServer() {
-
+FTNoIR_Protocol_FTIR::~FTNoIR_Protocol_FTIR()
+{
//
// Destroy the File-mapping
//
@@ -67,146 +72,90 @@ FTIRServer::~FTIRServer() {
{
qDebug() << "~FTIRServer says: some error occurred";
}
-
}
-/** destructor **/
-void FTIRServer::stopServer() {
-
- ////
- //// Destroy the File-mapping
- ////
- //FTIRDestroyMapping();
-
- ////
- //// Free the DLL's
- ////
- //try {
- // FTIRClientLib.unload();
- // if (useTIRViews && FTIRViewsLib.isLoaded()) {
- // FTIRViewsLib.unload();
- // }
- //}
- //catch (...)
- //{
- // qDebug() << "~FTIRServer says: some error occurred";
- //}
-
- ////
- //// Kill the dummy TrackIR process.
- ////
- //qDebug() << "FTIRServer::~FTIRServer() about to kill TrackIR.exe process";
- //try {
- // if (dummyTrackIR) {
- // dummyTrackIR->kill();
- // }
- //}
- //catch (...)
- // {
- // qDebug() << "~FTIRServer says: some error occurred";
- //}
-
+/** helper to Auto-destruct **/
+void FTNoIR_Protocol_FTIR::Release()
+{
+ delete this;
}
-//
-// Update Headpose in Game.
-//
-void FTIRServer::sendHeadposeToGame() {
-
- //
- // Check if the pointer is OK and wait for the Mutex.
- // Use the setposition in the (special) DLL, to write the headpose-data.
- //
- if ( (pMemData != NULL) && (WaitForSingleObject(hFTIRMutex, 100) == WAIT_OBJECT_0) ) {
- setposition (virtPosX, virtPosY, virtPosZ, virtRotZ, virtRotX, virtRotY );
- ReleaseMutex(hFTIRMutex);
- }
+void FTNoIR_Protocol_FTIR::Initialize()
+{
+ return;
}
//
-// Create a memory-mapping to the TrackIR data.
-// It contains the tracking data, a handle to the main-window and the program-name of the Game!
-//
+// Scale the measured value to the Joystick values
//
-bool FTIRServer::FTIRCreateMapping( HANDLE handle )
-{
- qDebug() << "FTIRCreateMapping says: Starting Function";
-
- //
- // A FileMapping is used to create 'shared memory' between the FTIRServer and the FTClient.
- //
- // Try to create a FileMapping to the Shared Memory.
- // If one already exists: close it.
- //
- hFTIRMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 ,
- sizeof( TRACKIRDATA ) + sizeof( HANDLE ) + 100,
- (LPCSTR) FTIR_MM_DATA );
-
- if ( hFTIRMemMap != 0 ) {
- qDebug() << "FTIRCreateMapping says: FileMapping Created!" << hFTIRMemMap;
- }
-
- if ( ( hFTIRMemMap != 0 ) && ( (long) GetLastError == ERROR_ALREADY_EXISTS ) ) {
- CloseHandle( hFTIRMemMap );
- hFTIRMemMap = 0;
- }
-
- //
- // Create a new FileMapping, Read/Write access
- //
- hFTIRMemMap = OpenFileMappingA( FILE_MAP_ALL_ACCESS , false , (LPCSTR) FTIR_MM_DATA );
- if ( ( hFTIRMemMap != 0 ) ) {
- qDebug() << "FTIRCreateMapping says: FileMapping Created again:" << hFTIRMemMap;
- pMemData = (FTIRMemMap *) MapViewOfFile(hFTIRMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(TRACKIRDATA) + sizeof(hFTIRMemMap) + 100);
- if (pMemData != NULL) {
- pMemData->RegisteredHandle = handle; // The game uses the handle, to send a message that the Program-Name was set!
- }
- hFTIRMutex = CreateMutexA(NULL, false, FTIR_MUTEX);
+float FTNoIR_Protocol_FTIR::scale2AnalogLimits( float x, float min_x, float max_x ) {
+double y;
+double local_x;
+
+ local_x = x;
+ if (local_x > max_x) {
+ local_x = max_x;
}
- else {
- QMessageBox::information(0, "FaceTrackNoIR error", QString("FTIRServer Error! \n"));
- return false;
+ if (local_x < min_x) {
+ local_x = min_x;
}
+ y = ( NP_AXIS_MAX * local_x ) / max_x;
- return true;
+ return (float) y;
}
//
-// Destory the FileMapping to the shared memory
+// Load the current Settings from the currently 'active' INI-file.
//
-void FTIRServer::FTIRDestroyMapping()
-{
- if ( pMemData != NULL ) {
- UnmapViewOfFile ( pMemData );
- }
-
- if (hFTIRMutex != 0) {
- CloseHandle( hFTIRMutex );
- }
- hFTIRMutex = 0;
-
- if (hFTIRMemMap != 0) {
- CloseHandle( hFTIRMemMap );
- }
- hFTIRMemMap = 0;
+void FTNoIR_Protocol_FTIR::loadSettings() {
+ QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
+ QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
+ QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
+
+ iniFile.beginGroup ( "FTIR" );
+ useTIRViews = iniFile.value ( "useTIRViews", 0 ).toBool();
+ iniFile.endGroup ();
}
//
-// Get the program-name from the client (Game!).
+// Update Headpose in Game.
//
-QString FTIRServer::GetProgramName() {
-QString *str;
+void FTNoIR_Protocol_FTIR::sendHeadposeToGame( T6DOF *headpose ) {
+float virtPosX;
+float virtPosY;
+float virtPosZ;
- str = new QString("Test");
- return *str;
+float virtRotX;
+float virtRotY;
+float virtRotZ;
+
+ //
+ // Copy the Raw measurements directly to the client.
+ //
+ virtRotX = scale2AnalogLimits (headpose->position.pitch, -180.0f, 180.0f);
+ virtRotY = scale2AnalogLimits (headpose->position.yaw, -180.0f, 180.0f);
+ virtRotZ = scale2AnalogLimits (headpose->position.roll, -180.0f, 180.0f);
+
+ virtPosX = scale2AnalogLimits (headpose->position.x * 10.0f, -500.0f, 500.0f);
+ virtPosY = scale2AnalogLimits (headpose->position.y * 10.0f, -500.0f, 500.0f);
+ virtPosZ = scale2AnalogLimits (headpose->position.z * 10.0f, -500.0f, 500.0f);
+
+ //
+ // Check if the pointer is OK and wait for the Mutex.
+ // Use the setposition in the (special) DLL, to write the headpose-data.
+ //
+ if ( (pMemData != NULL) && (WaitForSingleObject(hFTIRMutex, 100) == WAIT_OBJECT_0) ) {
+ setposition (virtPosX, virtPosY, virtPosZ, virtRotZ, virtRotX, virtRotY );
+ ReleaseMutex(hFTIRMutex);
+ }
}
//
// Check if the Client DLL exists and load it (to test it), if so.
// Returns 'true' if all seems OK.
//
-bool FTIRServer::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol_FTIR::checkServerInstallationOK( HANDLE handle )
{
QSettings settings("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER)
QString aLocation; // Location of Client DLL
@@ -269,7 +218,7 @@ bool FTIRServer::checkServerInstallationOK( HANDLE handle )
// This should do the trick
//
QString program = "TrackIR.exe";
- dummyTrackIR = new QProcess(this);
+ dummyTrackIR = new QProcess();
dummyTrackIR->start(program);
} catch(...) {
@@ -322,52 +271,103 @@ bool FTIRServer::checkServerInstallationOK( HANDLE handle )
}
//
-// Scale the measured value to the Joystick values
+// Create a memory-mapping to the TrackIR data.
+// It contains the tracking data, a handle to the main-window and the program-name of the Game!
//
-float FTIRServer::scale2AnalogLimits( float x, float min_x, float max_x ) {
-double y;
-double local_x;
-
- local_x = x;
- if (local_x > max_x) {
- local_x = max_x;
+//
+bool FTNoIR_Protocol_FTIR::FTIRCreateMapping( HANDLE handle )
+{
+ qDebug() << "FTIRCreateMapping says: Starting Function";
+
+ //
+ // A FileMapping is used to create 'shared memory' between the FTIRServer and the FTClient.
+ //
+ // Try to create a FileMapping to the Shared Memory.
+ // If one already exists: close it.
+ //
+ hFTIRMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 ,
+ sizeof( TRACKIRDATA ) + sizeof( HANDLE ) + 100,
+ (LPCSTR) FTIR_MM_DATA );
+
+ if ( hFTIRMemMap != 0 ) {
+ qDebug() << "FTIRCreateMapping says: FileMapping Created!" << hFTIRMemMap;
}
- if (local_x < min_x) {
- local_x = min_x;
+
+ if ( ( hFTIRMemMap != 0 ) && ( (long) GetLastError == ERROR_ALREADY_EXISTS ) ) {
+ CloseHandle( hFTIRMemMap );
+ hFTIRMemMap = 0;
}
- y = ( NP_AXIS_MAX * local_x ) / max_x;
- return (float) y;
+ //
+ // Create a new FileMapping, Read/Write access
+ //
+ hFTIRMemMap = OpenFileMappingA( FILE_MAP_ALL_ACCESS , false , (LPCSTR) FTIR_MM_DATA );
+ if ( ( hFTIRMemMap != 0 ) ) {
+ qDebug() << "FTIRCreateMapping says: FileMapping Created again:" << hFTIRMemMap;
+ pMemData = (FTIRMemMap *) MapViewOfFile(hFTIRMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(TRACKIRDATA) + sizeof(hFTIRMemMap) + 100);
+ if (pMemData != NULL) {
+ pMemData->RegisteredHandle = handle; // The game uses the handle, to send a message that the Program-Name was set!
+ }
+ hFTIRMutex = CreateMutexA(NULL, false, FTIR_MUTEX);
+ }
+ else {
+ QMessageBox::information(0, "FaceTrackNoIR error", QString("FTIRServer Error! \n"));
+ return false;
+ }
+
+ return true;
}
//
-// Load the current Settings from the currently 'active' INI-file.
+// Destory the FileMapping to the shared memory
//
-void FTIRServer::loadSettings() {
+void FTNoIR_Protocol_FTIR::FTIRDestroyMapping()
+{
+ if ( pMemData != NULL ) {
+ UnmapViewOfFile ( pMemData );
+ }
+
+ if (hFTIRMutex != 0) {
+ CloseHandle( hFTIRMutex );
+ }
+ hFTIRMutex = 0;
+
+ if (hFTIRMemMap != 0) {
+ CloseHandle( hFTIRMemMap );
+ }
+ hFTIRMemMap = 0;
- QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
+}
- QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
- QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
- iniFile.beginGroup ( "FTIR" );
- useTIRViews = iniFile.value ( "useTIRViews", 0 ).toBool();
- iniFile.endGroup ();
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol object.
+
+// Export both decorated and undecorated names.
+// GetProtocol - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol()
+{
+ return new FTNoIR_Protocol_FTIR;
}
+//*******************************************************************************************************
+// FaceTrackNoIR Client Settings-dialog.
+//*******************************************************************************************************
+
//
// Constructor for server-settings-dialog
//
-FTIRControls::FTIRControls( QWidget *parent, Qt::WindowFlags f ) :
-QWidget( parent , f)
+FTIRControls::FTIRControls() :
+QWidget()
{
QString aFileName; // File Path and Name
ui.setupUi( this );
- QPoint offsetpos(100, 100);
- this->move(parent->pos() + offsetpos);
-
// Connect Qt signals to member-functions
connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
@@ -382,7 +382,7 @@ QWidget( parent , f)
else {
ui.chkTIRViews->setEnabled ( true );
}
-
+
// Load the settings from the current .INI-file
loadSettings();
}
@@ -394,6 +394,23 @@ FTIRControls::~FTIRControls() {
qDebug() << "~FTIRControls() says: started";
}
+void FTIRControls::Release()
+{
+ delete this;
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void FTIRControls::Initialize(QWidget *parent) {
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
//
// OK clicked on server-dialog
//
@@ -444,7 +461,6 @@ void FTIRControls::doCancel() {
// Load the current Settings from the currently 'active' INI-file.
//
void FTIRControls::loadSettings() {
-
qDebug() << "loadSettings says: Starting ";
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
@@ -458,14 +474,12 @@ void FTIRControls::loadSettings() {
iniFile.endGroup ();
settingsDirty = false;
-
}
//
// Save the current Settings to the currently 'active' INI-file.
//
void FTIRControls::save() {
-
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
@@ -478,4 +492,16 @@ void FTIRControls::save() {
settingsDirty = false;
}
-//END
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Protocol-settings dialog object.
+
+// Export both decorated and undecorated names.
+// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
+
+FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLDIALOGHANDLE __stdcall GetProtocolDialog( )
+{
+ return new FTIRControls;
+}
diff --git a/FaceTrackNoIR/FTIRServer.h b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h
index 98bba55c..f1d169f7 100644
--- a/FaceTrackNoIR/FTIRServer.h
+++ b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h
@@ -1,9 +1,12 @@
/********************************************************************************
-* FTIRServer FTIRServer is the Class, that communicates headpose-data *
-* to games, using the NPClient.dll. *
+* FaceTrackNoIR This program is a private project of some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
* *
* Copyright (C) 2010 Wim Vriend (Developing) *
-* Ron Hendriks (Testing and Research) *
+* Ron Hendriks (Researching and Testing) *
+* *
+* Homepage *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
@@ -18,47 +21,41 @@
* You should have received a copy of the GNU General Public License along *
* with this program; if not, see <http://www.gnu.org/licenses/>. *
* *
+* FTIRServer FTIRServer is the Class, that communicates headpose-data *
+* to games, using the NPClient.dll. *
********************************************************************************/
#pragma once
#ifndef INCLUDED_FTIRSERVER_H
#define INCLUDED_FTIRSERVER_H
-
-#include "FTNoIR_cxx_protocolserver.h"
+
+#include "..\ftnoir_protocol_base\ftnoir_protocol_base.h"
+#include "ui_FTNoIR_FTIRcontrols.h"
#include "FTIRTypes.h"
-#include <QString>
#include <QMessageBox>
#include <QSettings>
-#include <QFile>
-#include <QApplication>
-#include <QDebug>
-#include <QMutex>
#include <QLibrary>
#include <QProcess>
+#include <QDebug>
+#include <QFile>
+#include "Windows.h"
+//#include "math.h"
typedef void (WINAPI *importSetPosition)(float x, float y, float z, float xRot, float yRot, float zRot);
typedef void (WINAPI *importTIRViewsStart)(void);
typedef void (WINAPI *importTIRViewsStop)(void);
-#include "ui_FTNoIR_FTIRcontrols.h"
-
-using namespace std;
-using namespace v4friend::ftnoir;
-class FTIRServer : public ProtocolServerBase {
- Q_OBJECT
-
-public:
+class FTNoIR_Protocol_FTIR : public IProtocol
+{
+public:
+ FTNoIR_Protocol_FTIR();
+ ~FTNoIR_Protocol_FTIR();
- // public member methods
- FTIRServer();
- ~FTIRServer();
- QString GetProgramName();
+ void Release();
+ void Initialize();
- // protected member methods
-protected:
bool checkServerInstallationOK( HANDLE handle );
- void sendHeadposeToGame();
- void stopServer();
+ void sendHeadposeToGame( T6DOF *headpose );
private:
bool FTIRCreateMapping(HANDLE handle);
@@ -82,26 +79,21 @@ private:
float scale2AnalogLimits( float x, float min_x, float max_x );
void loadSettings();
-public:
- void setVirtRotX(float rot) { virtRotX = scale2AnalogLimits (rot, -180.0f, 180.0f); }
- void setVirtRotY(float rot) { virtRotY = scale2AnalogLimits (rot, -180.0f, 180.0f); }
- void setVirtRotZ(float rot) { virtRotZ = scale2AnalogLimits (rot, -180.0f, 180.0f); }
-
- void setVirtPosX(float pos) { virtPosX = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
- void setVirtPosY(float pos) { virtPosY = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
- void setVirtPosZ(float pos) { virtPosZ = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
};
-// Widget that has controls for FTIR server-settings.
-class FTIRControls: public QWidget, public Ui::UICFTIRControls
+// Widget that has controls for FTNoIR protocol client-settings.
+class FTIRControls: public QWidget, Ui::UICFTIRControls, public IProtocolDialog
{
Q_OBJECT
public:
- explicit FTIRControls( QWidget *parent=0, Qt::WindowFlags f=0 );
+ explicit FTIRControls();
virtual ~FTIRControls();
void showEvent ( QShowEvent * event );
+ void Release(); // Member functions which are accessible from outside the DLL
+ void Initialize(QWidget *parent);
+
private:
Ui::UICFTIRControls ui;
void loadSettings();
@@ -114,8 +106,8 @@ private slots:
void doOK();
void doCancel();
void chkTIRViewsChanged() { settingsDirty = true; };
+ void settingChanged() { settingsDirty = true; };
};
-
#endif//INCLUDED_FTIRSERVER_H
//END
diff --git a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.vcproj b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.vcproj
new file mode 100644
index 00000000..ca3f797e
--- /dev/null
+++ b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.vcproj
@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="FTNoIR_Protocol_FTIR"
+ ProjectGUID="{BC5B8583-036A-4A9B-84AE-01158EE6F5A4}"
+ RootNamespace="FTNoIR_Protocol_FTIR"
+ Keyword="Qt4VSv1.0"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)/bin"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".\GeneratedFiles;&quot;$(QTDIR)\include&quot;;&quot;.\GeneratedFiles\$(ConfigurationName)&quot;;&quot;$(QTDIR)\include\qtmain&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtNetwork&quot;;&quot;$(QTDIR)\include\QtGui&quot;;.\"
+ PreprocessorDefinitions="UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_THREAD_SUPPORT;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;FTNOIR_PROTOCOL_BASE_LIB"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="qtmain.lib QtCore4.lib QtGui4.lib QtNetwork4.lib"
+ OutputFile="$(OutDir)\$(ProjectName).dll"
+ AdditionalLibraryDirectories="$(QTDIR)\lib"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;.\"
+ PreprocessorDefinitions="UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_THREAD_SUPPORT,QT_CORE_LIB,FTNOIR_PROTOCOL_FTIR_LIB"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="qtmaind.lib QtCored4.lib"
+ OutputFile="$(OutDir)\$(ProjectName).dll"
+ AdditionalLibraryDirectories="$(QTDIR)\lib"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;cxx;c;def"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\ftnoir_Protocol_FTIR.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\FTIRTypes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\FTNoIR_Protocol_Base\ftnoir_Protocol_base.h"
+ >
+ </File>
+ <File
+ RelativePath="..\FTNoIR_Protocol_Base\ftnoir_Protocol_base_global.h"
+ >
+ </File>
+ <File
+ RelativePath=".\FTNoIR_Protocol_FTIR.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DFTNOIR_PROTOCOL_BASE_LIB -D_WINDLL -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;$(QTDIR)\include\qtmain\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;.\.&quot; &quot;.\FTNoIR_Protocol_FTIR.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_CORE_LIB -DFTNOIR_PROTOCOL_FTIR_LIB -D_WINDLL -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;$(QTDIR)\include\qtmain\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;.\.&quot; &quot;.\FTNoIR_Protocol_FTIR.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Form Files"
+ Filter="ui"
+ UniqueIdentifier="{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"
+ >
+ <File
+ RelativePath=".\FTNoIR_FTIRcontrols.ui"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Uic&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="$(QTDIR)\bin\uic.exe"
+ Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Uic&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="$(QTDIR)\bin\uic.exe"
+ Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="qrc;*"
+ UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
+ ParseFiles="false"
+ >
+ </Filter>
+ <Filter
+ Name="Generated Files"
+ Filter="moc;h;cpp"
+ UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"
+ SourceControlFiles="false"
+ >
+ <File
+ RelativePath=".\GeneratedFiles\ui_FTNoIR_FTIRcontrols.h"
+ >
+ </File>
+ <Filter
+ Name="Release"
+ Filter="cpp;moc"
+ SourceControlFiles="false"
+ >
+ <File
+ RelativePath=".\GeneratedFiles\Release\moc_FTNoIR_Protocol_FTIR.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Debug"
+ Filter="cpp;moc"
+ SourceControlFiles="false"
+ >
+ <File
+ RelativePath=".\GeneratedFiles\Debug\moc_FTNoIR_Protocol_FTIR.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="lupdateOnBuild"
+ Value="0"
+ />
+ <Global
+ Name="MocDir"
+ Value=".\GeneratedFiles\$(ConfigurationName)"
+ />
+ <Global
+ Name="MocOptions"
+ Value=""
+ />
+ <Global
+ Name="QtVersion Win32"
+ Value="QT462_VS2005"
+ />
+ <Global
+ Name="RccDir"
+ Value=".\GeneratedFiles"
+ />
+ <Global
+ Name="UicDir"
+ Value=".\GeneratedFiles"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h
index b5d644fd..51c22027 100644
--- a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h
+++ b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h
@@ -57,7 +57,7 @@ class FTNClientControls: public QWidget, Ui::UICFTNClientControls, public ITrack
Q_OBJECT
public:
- explicit FTNClientControls( QWidget *parent=0, Qt::WindowFlags f=0 );
+ explicit FTNClientControls();
virtual ~FTNClientControls();
void showEvent ( QShowEvent * event );
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp
index ba140cbb..8887deb0 100644
--- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp
+++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp
@@ -215,16 +215,11 @@ FTNOIR_TRACKER_BASE_EXPORT TRACKERHANDLE __stdcall GetTracker()
//
// Constructor for server-settings-dialog
//
-FTNClientControls::FTNClientControls( QWidget *parent, Qt::WindowFlags f ) :
-QWidget( parent , f)
+FTNClientControls::FTNClientControls() :
+QWidget()
{
ui.setupUi( this );
- QPoint offsetpos(100, 100);
- if (parent) {
- this->move(parent->pos() + offsetpos);
- }
-
// Connect Qt signals to member-functions
connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
diff --git a/FaceTrackNoIR.sln b/FaceTrackNoIR.sln
index 633d424d..8ad3d09b 100644
--- a/FaceTrackNoIR.sln
+++ b/FaceTrackNoIR.sln
@@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FTNoIR_FaceAPI_EXE", "faceA
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FTNoIR_Protocol_FG", "FTNoIR_Protocol_FG\FTNoIR_Protocol_FG.vcproj", "{7C77C833-5687-4A35-B219-4CF4D3D8E626}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FTNoIR_Protocol_FTIR", "FTNoIR_Protocol_FTIR\FTNoIR_Protocol_FTIR.vcproj", "{BC5B8583-036A-4A9B-84AE-01158EE6F5A4}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -52,6 +54,10 @@ Global
{7C77C833-5687-4A35-B219-4CF4D3D8E626}.Debug|Win32.Build.0 = Debug|Win32
{7C77C833-5687-4A35-B219-4CF4D3D8E626}.Release|Win32.ActiveCfg = Release|Win32
{7C77C833-5687-4A35-B219-4CF4D3D8E626}.Release|Win32.Build.0 = Release|Win32
+ {BC5B8583-036A-4A9B-84AE-01158EE6F5A4}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BC5B8583-036A-4A9B-84AE-01158EE6F5A4}.Debug|Win32.Build.0 = Debug|Win32
+ {BC5B8583-036A-4A9B-84AE-01158EE6F5A4}.Release|Win32.ActiveCfg = Release|Win32
+ {BC5B8583-036A-4A9B-84AE-01158EE6F5A4}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/FaceTrackNoIR.suo b/FaceTrackNoIR.suo
index 9f9c2c5c..73e03dea 100644
--- a/FaceTrackNoIR.suo
+++ b/FaceTrackNoIR.suo
Binary files differ
diff --git a/FaceTrackNoIR/FGServer.cpp b/FaceTrackNoIR/FGServer.cpp
deleted file mode 100644
index 66cc1d5d..00000000
--- a/FaceTrackNoIR/FGServer.cpp
+++ /dev/null
@@ -1,336 +0,0 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2010 Wim Vriend (Developing) *
-* Ron Hendriks (Researching and Testing) *
-* *
-* Homepage *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the *
-* Free Software Foundation; either version 3 of the License, or (at your *
-* option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but *
-* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
-* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
-* more details. *
-* *
-* You should have received a copy of the GNU General Public License along *
-* with this program; if not, see <http://www.gnu.org/licenses/>. *
-* *
-* FGServer FGServer is the Class, that communicates headpose-data *
-* to FlightGear, using UDP. *
-* It is based on the (Linux) example made by Melchior FRANZ. *
-********************************************************************************/
-/*
- Modifications (last one on top):
- 20101224 - WVR: Base class is no longer inheriting QThread. sendHeadposeToGame
- is called from run() of Tracker.cpp
-*/
-#include <QtGui>
-#include <QtNetwork>
-#include "FGServer.h"
-#include "Tracker.h"
-#include <Winsock.h>
-
-/** constructor **/
-FGServer::FGServer( Tracker *parent ) {
-
- // Save the parent
- headTracker = parent;
- loadSettings();
-}
-
-/** destructor **/
-FGServer::~FGServer() {
- if (inSocket != 0) {
- inSocket->close();
- delete inSocket;
- }
-
- if (outSocket != 0) {
- outSocket->close();
- delete outSocket;
- }
-}
-
-//
-// Update Headpose in Game.
-//
-void FGServer::sendHeadposeToGame() {
-int no_bytes;
-QHostAddress sender;
-quint16 senderPort;
-
- //
- // Copy the Raw measurements directly to the client.
- //
- TestData.x = virtPosX;
- TestData.y = virtPosY;
- TestData.z = virtPosZ;
- TestData.p = virtRotX;
- TestData.h = virtRotY;
- TestData.r = virtRotZ;
- TestData.status = fg_cmd;
-
- //
- // Try to send an UDP-message to the FlightGear
- //
-
- //! [1]
-// no_bytes = outSocket->writeDatagram((const char *) &TestData, sizeof( TestData ), QHostAddress::LocalHost, 5550);
- if (outSocket != 0) {
- no_bytes = outSocket->writeDatagram((const char *) &TestData, sizeof( TestData ), destIP, destPort);
- if ( no_bytes > 0) {
- // qDebug() << "FGServer::writePendingDatagrams says: bytes send =" << no_bytes << sizeof( double );
- }
- else {
- qDebug() << "FGServer::writePendingDatagrams says: nothing sent!";
- }
- }
-
- //
- // FlightGear keeps sending data, so we must read that here.
- //
- if (inSocket != 0) {
- while (inSocket->hasPendingDatagrams()) {
-
- QByteArray datagram;
- datagram.resize(inSocket->pendingDatagramSize());
-
- inSocket->readDatagram( (char * ) &cmd, sizeof(cmd), &sender, &senderPort);
-
- fg_cmd = cmd; // Let's just accept that command for now...
- if ( cmd > 0 ) {
- qDebug() << "FGServer::sendHeadposeToGame hasPendingDatagrams, cmd = " << cmd;
- headTracker->handleGameCommand ( cmd ); // Send it upstream, for the Tracker to handle
- }
- }
- }
-}
-
-//
-// Check if the Client DLL exists and load it (to test it), if so.
-// Returns 'true' if all seems OK.
-//
-bool FGServer::checkServerInstallationOK( HANDLE handle )
-{
- // Init. the data
- TestData.x = 0.0f;
- TestData.y = 0.0f;
- TestData.z = 0.0f;
- TestData.h = 0.0f;
- TestData.p = 0.0f;
- TestData.r = 0.0f;
- TestData.status = 0;
- fg_cmd = 1;
-
- inSocket = 0;
- outSocket = 0;
-
- //
- // Create UDP-sockets.
- //
- if (inSocket == 0) {
- qDebug() << "FGServer::sendHeadposeToGame creating insocket";
- inSocket = new QUdpSocket();
-
- // Connect the inSocket to the port, to receive messages
- if (!inSocket->bind(QHostAddress::Any, destPort+1)) {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to bind UDP-port",QMessageBox::Ok,QMessageBox::NoButton);
- delete inSocket;
- inSocket = 0;
- return false;
- }
- }
-
- if (outSocket == 0) {
- outSocket = new QUdpSocket();
- }
-
- return true;
-}
-
-//
-// Load the current Settings from the currently 'active' INI-file.
-//
-void FGServer::loadSettings() {
-
- QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
-
- QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
- QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
-
- iniFile.beginGroup ( "FG" );
-
- bool blnLocalPC = iniFile.value ( "LocalPCOnly", 1 ).toBool();
- if (blnLocalPC) {
- destIP = QHostAddress::LocalHost;
- }
- else {
- QString destAddr = iniFile.value ( "IP-1", 192 ).toString() + "." + iniFile.value ( "IP-2", 168 ).toString() + "." + iniFile.value ( "IP-3", 2 ).toString() + "." + iniFile.value ( "IP-4", 1 ).toString();
- destIP = QHostAddress( destAddr );
- }
- destPort = iniFile.value ( "PortNumber", 5550 ).toInt();
-
- iniFile.endGroup ();
-}
-
-//
-// Constructor for server-settings-dialog
-//
-FGControls::FGControls( QWidget *parent, Qt::WindowFlags f ) :
-QWidget( parent , f)
-{
- ui.setupUi( this );
-
- QPoint offsetpos(100, 100);
- this->move(parent->pos() + offsetpos);
-
- // Connect Qt signals to member-functions
- connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
- connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
- connect(ui.chkLocalPC, SIGNAL(stateChanged(int)), this, SLOT(chkLocalPCOnlyChanged()));
- connect(ui.spinIPFirstNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinIPSecondNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinIPThirdNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
-
- // Load the settings from the current .INI-file
- loadSettings();
-}
-
-//
-// Destructor for server-dialog
-//
-FGControls::~FGControls() {
- qDebug() << "~FGControls() says: started";
-}
-
-//
-// OK clicked on server-dialog
-//
-void FGControls::doOK() {
- save();
- this->close();
-}
-
-// override show event
-void FGControls::showEvent ( QShowEvent * event ) {
- loadSettings();
-}
-
-//
-// Cancel clicked on server-dialog
-//
-void FGControls::doCancel() {
- //
- // Ask if changed Settings should be saved
- //
- if (settingsDirty) {
- int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard );
-
- qDebug() << "doCancel says: answer =" << ret;
-
- switch (ret) {
- case QMessageBox::Save:
- save();
- this->close();
- break;
- case QMessageBox::Discard:
- this->close();
- break;
- case QMessageBox::Cancel:
- // Cancel was clicked
- break;
- default:
- // should never be reached
- break;
- }
- }
- else {
- this->close();
- }
-}
-
-//
-// Load the current Settings from the currently 'active' INI-file.
-//
-void FGControls::loadSettings() {
-
-// qDebug() << "loadSettings says: Starting ";
- QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
-
- QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
- QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
-
-// qDebug() << "loadSettings says: iniFile = " << currentFile;
-
- iniFile.beginGroup ( "FG" );
- ui.chkLocalPC->setChecked (iniFile.value ( "LocalPCOnly", 1 ).toBool());
-
- ui.spinIPFirstNibble->setValue( iniFile.value ( "IP-1", 192 ).toInt() );
- ui.spinIPSecondNibble->setValue( iniFile.value ( "IP-2", 168 ).toInt() );
- ui.spinIPThirdNibble->setValue( iniFile.value ( "IP-3", 2 ).toInt() );
- ui.spinIPFourthNibble->setValue( iniFile.value ( "IP-4", 1 ).toInt() );
-
- ui.spinPortNumber->setValue( iniFile.value ( "PortNumber", 5550 ).toInt() );
- iniFile.endGroup ();
-
- chkLocalPCOnlyChanged();
- settingsDirty = false;
-
-}
-
-//
-// Save the current Settings to the currently 'active' INI-file.
-//
-void FGControls::save() {
-
- QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
-
- QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
- QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
-
- iniFile.beginGroup ( "FG" );
- iniFile.setValue ( "LocalPCOnly", ui.chkLocalPC->isChecked() );
- iniFile.setValue ( "IP-1", ui.spinIPFirstNibble->value() );
- iniFile.setValue ( "IP-2", ui.spinIPSecondNibble->value() );
- iniFile.setValue ( "IP-3", ui.spinIPThirdNibble->value() );
- iniFile.setValue ( "IP-4", ui.spinIPFourthNibble->value() );
- iniFile.setValue ( "PortNumber", ui.spinPortNumber->value() );
- iniFile.endGroup ();
-
- settingsDirty = false;
-}
-
-//
-// Handle change of the checkbox.
-//
-void FGControls::chkLocalPCOnlyChanged() {
-
- if ( ui.chkLocalPC->isChecked() ) {
- ui.spinIPFirstNibble->setValue( 127 );
- ui.spinIPFirstNibble->setEnabled ( false );
- ui.spinIPSecondNibble->setValue( 0 );
- ui.spinIPSecondNibble->setEnabled ( false );
- ui.spinIPThirdNibble->setValue( 0 );
- ui.spinIPThirdNibble->setEnabled ( false );
- ui.spinIPFourthNibble->setValue( 1 );
- ui.spinIPFourthNibble->setEnabled ( false );
- }
- else {
- ui.spinIPFirstNibble->setEnabled ( true );
- ui.spinIPSecondNibble->setEnabled ( true );
- ui.spinIPThirdNibble->setEnabled ( true );
- ui.spinIPFourthNibble->setEnabled ( true );
- }
-
- settingsDirty = true;
-}
-
-//END
diff --git a/FaceTrackNoIR/FGServer.h b/FaceTrackNoIR/FGServer.h
deleted file mode 100644
index 6efe2ba3..00000000
--- a/FaceTrackNoIR/FGServer.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/********************************************************************************
-* FaceTrackNoIR This program is a private project of the some enthusiastic *
-* gamers from Holland, who don't like to pay much for *
-* head-tracking. *
-* *
-* Copyright (C) 2010 Wim Vriend (Developing) *
-* Ron Hendriks (Researching and Testing) *
-* *
-* Homepage *
-* *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the *
-* Free Software Foundation; either version 3 of the License, or (at your *
-* option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, but *
-* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
-* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
-* more details. *
-* *
-* You should have received a copy of the GNU General Public License along *
-* with this program; if not, see <http://www.gnu.org/licenses/>. *
-* *
-* FGServer FGServer is the Class, that communicates headpose-data *
-* to FlightGear, using UDP. *
-* It is based on the (Linux) example made by Melchior FRANZ. *
-********************************************************************************/
-#pragma once
-#ifndef INCLUDED_FGSERVER_H
-#define INCLUDED_FGSERVER_H
-
-#include "FTNoIR_cxx_protocolserver.h"
-#include "FGTypes.h"
-#include <QString>
-#include <QMessageBox>
-#include <QSettings>
-#include <QFile>
-#include <QApplication>
-#include <QDebug>
-//#include <QThread>
-#include <QMutex>
-#include <QLibrary>
-#include <QUdpSocket>
-
-using namespace std;
-using namespace v4friend::ftnoir;
-
-#include "ui_FTNoIR_FGcontrols.h"
-
-class Tracker; // pre-define parent-class to avoid circular includes
-
-class FGServer : public ProtocolServerBase {
- Q_OBJECT
-
-public:
-
- // public member methods
- FGServer( Tracker *parent );
- ~FGServer();
-
- // protected member methods
-protected:
- bool checkServerInstallationOK( HANDLE handle );
- void sendHeadposeToGame();
-
-private:
- Tracker *headTracker; // For upstream messages...
- TFlightGearData TestData;
- QUdpSocket *inSocket; // Receive from FligthGear
- QUdpSocket *outSocket; // Send to FligthGear
- qint32 cmd;
- qint32 fg_cmd; // Command from FlightGear
- QHostAddress destIP; // Destination IP-address
- int destPort; // Destination port-number
- void loadSettings();
-};
-
-// Widget that has controls for FG server-settings.
-class FGControls: public QWidget, public Ui::UICFGControls
-{
- Q_OBJECT
-public:
-
- explicit FGControls( QWidget *parent=0, Qt::WindowFlags f=0 );
- virtual ~FGControls();
- void showEvent ( QShowEvent * event );
-
-private:
- Ui::UICFGControls ui;
- void loadSettings();
- void save();
-
- /** helper **/
- bool settingsDirty;
-
-private slots:
- void doOK();
- void doCancel();
- void chkLocalPCOnlyChanged();
- void settingChanged() { settingsDirty = true; };
-};
-
-
-
-#endif//INCLUDED_FGSERVER_H
-//END
diff --git a/FaceTrackNoIR/FTNoIR_FGcontrols.ui b/FaceTrackNoIR/FTNoIR_FGcontrols.ui
deleted file mode 100644
index c5f81c29..00000000
--- a/FaceTrackNoIR/FTNoIR_FGcontrols.ui
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>UICFGControls</class>
- <widget class="QWidget" name="UICFGControls">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>411</width>
- <height>194</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>FlightGear settings FaceTrackNoIR</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>images/FaceTrackNoIR.ico</normaloff>images/FaceTrackNoIR.ico</iconset>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <layout class="QVBoxLayout" name="_vertical_layout">
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="2" column="4">
- <widget class="QSpinBox" name="spinIPFourthNibble">
- <property name="maximumSize">
- <size>
- <width>60</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="maximum">
- <number>255</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="spinIPFirstNibble">
- <property name="maximumSize">
- <size>
- <width>60</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="maximum">
- <number>255</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QSpinBox" name="spinIPSecondNibble">
- <property name="maximumSize">
- <size>
- <width>60</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="maximum">
- <number>255</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="QSpinBox" name="spinIPThirdNibble">
- <property name="maximumSize">
- <size>
- <width>60</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="maximum">
- <number>255</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>IP-address remote PC</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="chkLocalPC">
- <property name="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
- <property name="text">
- <string>Local PC only</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Port-number</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QSpinBox" name="spinPortNumber">
- <property name="minimum">
- <number>5550</number>
- </property>
- <property name="maximum">
- <number>10000</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>If FlightGear is on the same PC as FaceTrackNoIR, tick the 'Local PC only' box.</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Otherwise: enter IP-address and port-number for the remote PC.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Remember: you may have to change firewall-settings too!</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="sizeConstraint">
- <enum>QLayout::SetDefaultConstraint</enum>
- </property>
- <item>
- <widget class="QPushButton" name="btnOK">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>OK</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnCancel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>100</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>Cancel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>10</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>spinIPFirstNibble</tabstop>
- <tabstop>spinIPSecondNibble</tabstop>
- <tabstop>spinIPThirdNibble</tabstop>
- <tabstop>spinIPFourthNibble</tabstop>
- <tabstop>spinPortNumber</tabstop>
- <tabstop>btnOK</tabstop>
- <tabstop>btnCancel</tabstop>
- <tabstop>chkLocalPC</tabstop>
- </tabstops>
- <resources/>
- <connections/>
- <slots>
- <slot>startEngineClicked()</slot>
- <slot>stopEngineClicked()</slot>
- <slot>cameraSettingsClicked()</slot>
- </slots>
-</ui>
diff --git a/FaceTrackNoIR/FaceApp.cpp b/FaceTrackNoIR/FaceApp.cpp
index 231a07c9..5998ebcf 100644
--- a/FaceTrackNoIR/FaceApp.cpp
+++ b/FaceTrackNoIR/FaceApp.cpp
@@ -1,7 +1,7 @@
#include "FaceApp.h"
#include "windows.h"
#include "FTTypes.h"
-#include "FTIRTypes.h"
+#include "..\FTNoIR_Protocol_FTIR\FTIRTypes.h"
#include <QDebug>
//
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index d2373824..03f819de 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -23,6 +23,7 @@
*********************************************************************************/
/*
Modifications (last one on top):
+ 20110404 - WVR: Migrated the FlightGear protocol to a separate DLL. The rest must follow...
20110401 - WVR: The about-dialog was shown 'misplaced'. It was corrected.
20110328 - WVR: Added the display for output-pose.
20110207 - WVR: RadioButtons for 'Stop engine' added. It is now possible to choose Stop or Keep tracking.
@@ -32,8 +33,8 @@
#include "tracker.h"
#include "PPJoyServer.h"
#include "FSUIPCServer.h"
-#include "FTIRServer.h"
-#include "FGServer.h"
+//#include "FTIRServer.h"
+//#include "FGServer.h"
#include "FTNServer.h"
@@ -813,6 +814,8 @@ QLibrary *trackerLib;
/** toggles Server Controls Dialog **/
void FaceTrackNoIR::showServerControls() {
+importGetProtocolDialog getIT;
+QLibrary *protocolLib;
//
@@ -839,11 +842,47 @@ void FaceTrackNoIR::showServerControls() {
_server_controls = new FSUIPCControls( this, Qt::Dialog );
break;
case TRACKIR:
- _server_controls = new FTIRControls( this, Qt::Dialog );
+ protocolLib = new QLibrary("FTNoIR_Protocol_FTIR.dll");
+
+ getIT = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog");
+ if (getIT) {
+ IProtocolDialogPtr ptrXyz(getIT());
+ if (ptrXyz)
+ {
+ pProtocolDialog = ptrXyz;
+ pProtocolDialog->Initialize( this );
+ qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
+ }
+ else {
+ qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
+ }
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
+ }
break;
+
case FLIGHTGEAR:
- _server_controls = new FGControls( this, Qt::Dialog );
+ protocolLib = new QLibrary("FTNoIR_Protocol_FG.dll");
+
+ getIT = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog");
+ if (getIT) {
+ IProtocolDialogPtr ptrXyz(getIT());
+ if (ptrXyz)
+ {
+ pProtocolDialog = ptrXyz;
+ pProtocolDialog->Initialize( this );
+ qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
+ }
+ else {
+ qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
+ }
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
+ }
break;
+
case FTNOIR:
_server_controls = new FTNServerControls( this, Qt::Dialog );
break;
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h
index 68c9a744..cd9c925b 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.h
+++ b/FaceTrackNoIR/FaceTrackNoIR.h
@@ -42,7 +42,9 @@
#include "ui_FTNoIR_Preferences.h"
#include "ui_FTNoIR_Curves.h"
-#include "FTNoIR_Tracker_UDP.h"
+//
+#include "..\ftnoir_protocol_base\FTNoIR_Protocol_base.h"
+#include "..\ftnoir_tracker_base\FTNoIR_Tracker_base.h"
#include "AutoClosePtr.h"
// 1a. COM-Like usage with smart pointer.
@@ -50,14 +52,12 @@
// be released automatically in destructor of the smart pointer.
typedef AutoClosePtr<ITrackerDialog, void, &ITrackerDialog::Release> ITrackerDialogPtr;
typedef ITrackerDialog *(WINAPI *importGetTrackerDialog)(void);
+typedef AutoClosePtr<IProtocolDialog, void, &IProtocolDialog::Release> IProtocolDialogPtr;
+typedef IProtocolDialog *(WINAPI *importGetProtocolDialog)(void);
-//#include <sm_api_qt.h>
#include <Dshow.h>
-//using namespace sm::faceapi;
-//using namespace sm::faceapi::qt;
-
class Tracker; // pre-define class to avoid circular includes
void getCurvePoints(QSettings *iniFile, QString prefix, QPointF *one, QPointF *two, QPointF *three, QPointF *four,
@@ -84,6 +84,7 @@ private:
QStringList iniFileList; // List of INI-files, that are present in the Settings folder
ITrackerDialogPtr pTrackerDialog; // Pointer to Tracker dialog instance (in DLL)
+ IProtocolDialogPtr pProtocolDialog; // Pointer to Protocol dialog instance (in DLL)
/** Widget variables **/
QVBoxLayout *l;
diff --git a/FaceTrackNoIR/FaceTrackNoIR.vcproj b/FaceTrackNoIR/FaceTrackNoIR.vcproj
index 10d2f8c7..c16635b9 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.vcproj
+++ b/FaceTrackNoIR/FaceTrackNoIR.vcproj
@@ -212,18 +212,10 @@
>
</File>
<File
- RelativePath=".\FGServer.cpp"
- >
- </File>
- <File
RelativePath=".\FSUIPCServer.cpp"
>
</File>
<File
- RelativePath=".\FTIRServer.cpp"
- >
- </File>
- <File
RelativePath=".\FTNServer.cpp"
>
</File>
@@ -336,36 +328,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\FGServer.h"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_NETWORK_LIB -DQT_DLL -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\GeneratedFiles\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Filter_EWMA2\.&quot; &quot;.\FGServer.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;&#x0D;&#x0A;"
- AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
- Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_DLL -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;.\.&quot; &quot;.\FGServer.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;&#x0D;&#x0A;"
- AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
- Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\FGTypes.h"
- >
- </File>
- <File
RelativePath=".\FSUIPCServer.h"
>
<FileConfiguration
@@ -392,36 +354,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\FTIRServer.h"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_NETWORK_LIB -DQT_DLL -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\GeneratedFiles\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Filter_EWMA2\.&quot; &quot;.\FTIRServer.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;&#x0D;&#x0A;"
- AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
- Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_DLL -I&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;.\.&quot; &quot;.\FTIRServer.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;&#x0D;&#x0A;"
- AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
- Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\FTIRTypes.h"
- >
- </File>
- <File
RelativePath=".\FTNoIR_cxx_protocolserver.h"
>
<FileConfiguration
@@ -674,32 +606,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\FTNoIR_FGcontrols.ui"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Uic&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
- AdditionalDependencies="$(QTDIR)\bin\uic.exe"
- Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Uic&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
- AdditionalDependencies="$(QTDIR)\bin\uic.exe"
- Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\FTNoIR_FSUIPCcontrols.ui"
>
<FileConfiguration
@@ -726,32 +632,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\FTNoIR_FTIRcontrols.ui"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Uic&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
- AdditionalDependencies="$(QTDIR)\bin\uic.exe"
- Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- Description="Uic&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
- AdditionalDependencies="$(QTDIR)\bin\uic.exe"
- Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\FTNoIR_FTNServerControls.ui"
>
<FileConfiguration
@@ -931,18 +811,10 @@
>
</File>
<File
- RelativePath=".\GeneratedFiles\ui_FTNoIR_FGcontrols.h"
- >
- </File>
- <File
RelativePath=".\GeneratedFiles\ui_FTNoIR_FSUIPCcontrols.h"
>
</File>
<File
- RelativePath=".\GeneratedFiles\ui_FTNoIR_FTIRcontrols.h"
- >
- </File>
- <File
RelativePath=".\GeneratedFiles\ui_FTNoIR_FTNServerControls.h"
>
</File>
@@ -1000,18 +872,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\GeneratedFiles\Release\moc_FGServer.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\GeneratedFiles\Release\moc_FSUIPCServer.cpp"
>
<FileConfiguration
@@ -1024,18 +884,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\GeneratedFiles\Release\moc_FTIRServer.cpp"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\GeneratedFiles\Release\moc_FTNoIR_cxx_protocolserver.cpp"
>
<FileConfiguration
@@ -1173,18 +1021,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\GeneratedFiles\Debug\moc_FGServer.cpp"
- >
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\GeneratedFiles\Debug\moc_FSUIPCServer.cpp"
>
<FileConfiguration
@@ -1208,18 +1044,6 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\GeneratedFiles\Debug\moc_FTIRServer.cpp"
- >
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
RelativePath=".\GeneratedFiles\Debug\moc_FTNoIR_cxx_protocolserver.cpp"
>
<FileConfiguration
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index cb881201..46b26237 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -188,8 +188,7 @@ QFrame *video_frame;
case FLIGHTGEAR:
server_Game = QSharedPointer<FTServer>(new FTServer ( )); // Create Free-track protocol-server
-// server_Game = QSharedPointer<FGServer>(new FGServer ( this )); // Create FlightGear protocol-server
-// server_Game = NULL;
+
//
// Load the DLL with the protocol-logic and retrieve a pointer to the Protocol-class.
//
@@ -220,7 +219,27 @@ QFrame *video_frame;
break;
case TRACKIR:
- server_Game = QSharedPointer<FTIRServer>(new FTIRServer ( )); // Create Fake-TIR protocol-server
+ server_Game = QSharedPointer<FTServer>(new FTServer ( )); // Create Free-track protocol-server
+
+ //
+ // Load the DLL with the protocol-logic and retrieve a pointer to the Protocol-class.
+ //
+ protocolLib = new QLibrary("FTNoIR_Protocol_FTIR.dll");
+
+ getProtocol = (importGetProtocol) protocolLib->resolve("GetProtocol");
+ if (getProtocol) {
+ IProtocolPtr ptrXyz(getProtocol());
+ if (ptrXyz)
+ {
+ pProtocol = ptrXyz;
+ pProtocol->Initialize();
+ qDebug() << "Protocol::setup Function Resolved!";
+ }
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "Protocol-DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
+ return;
+ }
break;
case SIMCONNECT:
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 1ffed69c..c5921e85 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -36,9 +36,9 @@
#include <Dinput.h>
#include "FTServer.h" // Freetrack-server
-#include "FGServer.h" // FlightGear-server
+//#include "FGServer.h" // FlightGear-server
#include "PPJoyServer.h" // Virtual Joystick
-#include "FTIRServer.h" // FakeTIR-server
+//#include "FTIRServer.h" // FakeTIR-server
#include "SCServer.h" // SimConnect-server (for MS Flight Simulator X)
#include "FSUIPCServer.h" // FSUIPC-server (for MS Flight Simulator 2004)
#include "ExcelServer.h" // Excel-server (for analysing purposes)
diff --git a/bin/FaceTrackNoIR.exe b/bin/FaceTrackNoIR.exe
index 60dbfc51..c897bb93 100644
--- a/bin/FaceTrackNoIR.exe
+++ b/bin/FaceTrackNoIR.exe
Binary files differ
diff --git a/bin/Settings/Wings of Prey.ini b/bin/Settings/Wings of Prey.ini
index 57b16b37..ea06bfa8 100644
--- a/bin/Settings/Wings of Prey.ini
+++ b/bin/Settings/Wings of Prey.ini
@@ -76,7 +76,7 @@ Z_point3=@Variant(\0\0\0\x1a@L\x80\0\0\0\0\0@A\0\0\0\0\0\0)
Z_point4=@Variant(\0\0\0\x1a@V\0\0\0\0\0\0@I\0\0\0\0\0\0)
[FTIR]
-useTIRViews=false
+useTIRViews=true
[TrackerSource]
Selection=0