diff options
27 files changed, 229 insertions, 150 deletions
diff --git a/FTNoIR_Protocol_Base/ftnoir_protocol_base.h b/FTNoIR_Protocol_Base/ftnoir_protocol_base.h index 214aae7f..3f598d35 100644 --- a/FTNoIR_Protocol_Base/ftnoir_protocol_base.h +++ b/FTNoIR_Protocol_Base/ftnoir_protocol_base.h @@ -25,6 +25,7 @@ /*
Modifications (last one on top):
+ 20121115 - WVR: Added RegisterProtocol() and unRegisterProtocol() to Dialog Class
20110415 - WVR: Added overloaded operator - and -=
*/
@@ -81,6 +82,8 @@ struct IProtocolDialog {
virtual ~IProtocolDialog() {}
virtual void Initialize(QWidget *parent) = 0;
+ virtual void registerProtocol(IProtocol *protocol) = 0;
+ virtual void unRegisterProtocol() = 0;
};
typedef IProtocolDialog* IProtocolDialogPtr;
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp index 0eba8333..d5ba964d 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp @@ -39,13 +39,13 @@ //#define LOG_OUTPUT
/** constructor **/
-FTNoIR_Protocol_FG::FTNoIR_Protocol_FG()
+FTNoIR_Protocol::FTNoIR_Protocol()
{
loadSettings();
}
/** destructor **/
-FTNoIR_Protocol_FG::~FTNoIR_Protocol_FG()
+FTNoIR_Protocol::~FTNoIR_Protocol()
{
if (inSocket != 0) {
inSocket->close();
@@ -59,12 +59,12 @@ FTNoIR_Protocol_FG::~FTNoIR_Protocol_FG() }
/** helper to Auto-destruct **/
-void FTNoIR_Protocol_FG::Release()
+void FTNoIR_Protocol::Release()
{
delete this;
}
-void FTNoIR_Protocol_FG::Initialize()
+void FTNoIR_Protocol::Initialize()
{
return;
}
@@ -72,7 +72,7 @@ void FTNoIR_Protocol_FG::Initialize() //
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Protocol_FG::loadSettings() {
+void FTNoIR_Protocol::loadSettings() {
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
@@ -97,7 +97,7 @@ void FTNoIR_Protocol_FG::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FG::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
int no_bytes;
QHostAddress sender;
quint16 senderPort;
@@ -183,7 +183,7 @@ char data[100]; // Check if the Client DLL exists and load it (to test it), if so.
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol_FG::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
{
// Init. the data
FlightData.x = 0.0f;
@@ -224,7 +224,7 @@ bool FTNoIR_Protocol_FG::checkServerInstallationOK( HANDLE handle ) //
// Return a name, if present the name from the Game, that is connected...
//
-void FTNoIR_Protocol_FG::getNameFromGame( char *dest )
+void FTNoIR_Protocol::getNameFromGame( char *dest )
{
sprintf_s(dest, 99, "FlightGear");
return;
@@ -241,5 +241,5 @@ void FTNoIR_Protocol_FG::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
- return new FTNoIR_Protocol_FG;
+ return new FTNoIR_Protocol;
}
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h index b836d321..29c262f6 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h @@ -39,11 +39,11 @@ #include "Windows.h"
#include "math.h"
-class FTNoIR_Protocol_FG : public IProtocol
+class FTNoIR_Protocol : public IProtocol
{
public:
- FTNoIR_Protocol_FG();
- ~FTNoIR_Protocol_FG();
+ FTNoIR_Protocol();
+ ~FTNoIR_Protocol();
void Release();
void Initialize();
@@ -77,6 +77,12 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
+ void registerProtocol(IProtocol *protocol) {
+ theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
+ };
+ void unRegisterProtocol() {
+ theProtocol = NULL; // Reset the pointer
+ };
private:
Ui::UICFGControls ui;
@@ -85,6 +91,7 @@ private: /** helper **/
bool settingsDirty;
+ FTNoIR_Protocol *theProtocol;
private slots:
void doOK();
diff --git a/FTNoIR_Protocol_FG/ftnoir_protocol_fg_dialog.cpp b/FTNoIR_Protocol_FG/ftnoir_protocol_fg_dialog.cpp index 987a81f9..0138a4c1 100644 --- a/FTNoIR_Protocol_FG/ftnoir_protocol_fg_dialog.cpp +++ b/FTNoIR_Protocol_FG/ftnoir_protocol_fg_dialog.cpp @@ -61,6 +61,8 @@ QWidget() connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ theProtocol = NULL;
+
// Load the settings from the current .INI-file
loadSettings();
}
diff --git a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp index 9bada9da..09911866 100644 --- a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp +++ b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp @@ -33,7 +33,7 @@ #include "ftnoir_protocol_fsuipc.h"
/** constructor **/
-FTNoIR_Protocol_FSUIPC::FTNoIR_Protocol_FSUIPC()
+FTNoIR_Protocol::FTNoIR_Protocol()
{
loadSettings();
ProgramName = "Microsoft FS2004";
@@ -47,7 +47,7 @@ FTNoIR_Protocol_FSUIPC::FTNoIR_Protocol_FSUIPC() }
/** destructor **/
-FTNoIR_Protocol_FSUIPC::~FTNoIR_Protocol_FSUIPC()
+FTNoIR_Protocol::~FTNoIR_Protocol()
{
//
// Free the DLL
@@ -56,12 +56,12 @@ FTNoIR_Protocol_FSUIPC::~FTNoIR_Protocol_FSUIPC() }
/** helper to Auto-destruct **/
-void FTNoIR_Protocol_FSUIPC::Release()
+void FTNoIR_Protocol::Release()
{
delete this;
}
-void FTNoIR_Protocol_FSUIPC::Initialize()
+void FTNoIR_Protocol::Initialize()
{
return;
}
@@ -69,7 +69,7 @@ void FTNoIR_Protocol_FSUIPC::Initialize() //
// Scale the measured value to the Joystick values
//
-int FTNoIR_Protocol_FSUIPC::scale2AnalogLimits( float x, float min_x, float max_x ) {
+int FTNoIR_Protocol::scale2AnalogLimits( float x, float min_x, float max_x ) {
double y;
double local_x;
@@ -88,7 +88,7 @@ double local_x; //
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Protocol_FSUIPC::loadSettings() {
+void FTNoIR_Protocol::loadSettings() {
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
@@ -103,7 +103,7 @@ void FTNoIR_Protocol_FSUIPC::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FSUIPC::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
DWORD result;
TFSState pitch;
TFSState yaw;
@@ -187,7 +187,7 @@ float virtRotZ; //
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol_FSUIPC::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
{
qDebug() << "checkServerInstallationOK says: Starting Function";
@@ -209,7 +209,7 @@ bool FTNoIR_Protocol_FSUIPC::checkServerInstallationOK( HANDLE handle ) //
// Return a name, if present the name from the Game, that is connected...
//
-void FTNoIR_Protocol_FSUIPC::getNameFromGame( char *dest )
+void FTNoIR_Protocol::getNameFromGame( char *dest )
{
sprintf_s(dest, 99, "FS2002/2004");
return;
@@ -226,5 +226,5 @@ void FTNoIR_Protocol_FSUIPC::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
- return new FTNoIR_Protocol_FSUIPC;
+ return new FTNoIR_Protocol;
}
diff --git a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h index d073c823..ec99035b 100644 --- a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h +++ b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h @@ -55,11 +55,11 @@ typedef struct } TFSState;
#pragma pack(pop)
-class FTNoIR_Protocol_FSUIPC : public IProtocol
+class FTNoIR_Protocol : public IProtocol
{
public:
- FTNoIR_Protocol_FSUIPC();
- ~FTNoIR_Protocol_FSUIPC();
+ FTNoIR_Protocol();
+ ~FTNoIR_Protocol();
void Release();
void Initialize();
@@ -91,6 +91,12 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
+ void registerProtocol(IProtocol *protocol) {
+ theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
+ };
+ void unRegisterProtocol() {
+ theProtocol = NULL; // Reset the pointer
+ };
private:
Ui::UICFSUIPCControls ui;
@@ -99,6 +105,7 @@ private: /** helper **/
bool settingsDirty;
+ FTNoIR_Protocol *theProtocol;
private slots:
void doOK();
diff --git a/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp b/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp index 27d99e04..08c13c08 100644 --- a/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp +++ b/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp @@ -49,6 +49,8 @@ QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
connect(ui.btnFindDLL, SIGNAL(clicked()), this, SLOT(getLocationOfDLL()));
+ theProtocol = NULL;
+
// Load the settings from the current .INI-file
loadSettings();
}
diff --git a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp index ad532120..789b036f 100644 --- a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp +++ b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp @@ -37,7 +37,7 @@ #include "ftnoir_protocol_ft.h"
/** constructor **/
-FTNoIR_Protocol_FT::FTNoIR_Protocol_FT()
+FTNoIR_Protocol::FTNoIR_Protocol()
{
comhandle = 0;
loadSettings();
@@ -45,7 +45,7 @@ FTNoIR_Protocol_FT::FTNoIR_Protocol_FT() }
/** destructor **/
-FTNoIR_Protocol_FT::~FTNoIR_Protocol_FT()
+FTNoIR_Protocol::~FTNoIR_Protocol()
{
//
// Destroy the File-mapping
@@ -59,12 +59,12 @@ FTNoIR_Protocol_FT::~FTNoIR_Protocol_FT() }
/** helper to Auto-destruct **/
-void FTNoIR_Protocol_FT::Release()
+void FTNoIR_Protocol::Release()
{
delete this;
}
-void FTNoIR_Protocol_FT::Initialize()
+void FTNoIR_Protocol::Initialize()
{
return;
}
@@ -72,13 +72,13 @@ void FTNoIR_Protocol_FT::Initialize() //
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Protocol_FT::loadSettings() {
+void FTNoIR_Protocol::loadSettings() {
}
//
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FT::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
float virtPosX;
float virtPosY;
float virtPosZ;
@@ -176,7 +176,7 @@ PDWORD_PTR MsgResult = 0; // Check if the Client DLL exists and load it (to test it), if so.
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol_FT::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
{
QSettings settings("Freetrack", "FreetrackClient"); // Registry settings (in HK_USER)
QString aLocation; // Location of Client DLL
@@ -238,7 +238,7 @@ bool FTNoIR_Protocol_FT::checkServerInstallationOK( HANDLE handle ) // It contains the tracking data, a handle to the main-window and the program-name of the Game!
//
//
-bool FTNoIR_Protocol_FT::FTCreateMapping( HANDLE handle )
+bool FTNoIR_Protocol::FTCreateMapping( HANDLE handle )
{
qDebug() << "FTCreateMapping says: Starting Function";
@@ -291,7 +291,7 @@ bool FTNoIR_Protocol_FT::FTCreateMapping( HANDLE handle ) //
// Destory the FileMapping to the shared memory
//
-void FTNoIR_Protocol_FT::FTDestroyMapping()
+void FTNoIR_Protocol::FTDestroyMapping()
{
if ( pMemData != NULL ) {
UnmapViewOfFile ( pMemData );
@@ -306,18 +306,18 @@ void FTNoIR_Protocol_FT::FTDestroyMapping() //
// Return a name, if present the name from the Game, that is connected...
//
-void FTNoIR_Protocol_FT::getNameFromGame( char *dest )
+void FTNoIR_Protocol::getNameFromGame( char *dest )
{
sprintf_s(dest, 99, "FreeTrack interface");
- qDebug() << "FTNoIR_Protocol_FT::getNameFromGame says: Started, pMemData = " << pMemData << ", mutex = " << hFTMutex;
+ qDebug() << "FTNoIR_Protocol::getNameFromGame says: Started, pMemData = " << pMemData << ", mutex = " << hFTMutex;
//
// Check if the pointer is OK and wait for the Mutex.
//
// if ( (pMemData != NULL) && (WaitForSingleObject(hFTMutex, 100) == WAIT_OBJECT_0) ) {
if (pMemData != NULL) {
- qDebug() << "FTNoIR_Protocol_FT::getNameFromGame says: Inside MemData";
+ qDebug() << "FTNoIR_Protocol::getNameFromGame says: Inside MemData";
sprintf_s(dest, 99, "%s", pMemData->ProgramName);
}
@@ -336,5 +336,5 @@ void FTNoIR_Protocol_FT::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
- return new FTNoIR_Protocol_FT;
+ return new FTNoIR_Protocol;
}
diff --git a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h index f6daa226..bd461b1e 100644 --- a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h +++ b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h @@ -42,11 +42,11 @@ typedef char *(WINAPI *importProvider)(void);
-class FTNoIR_Protocol_FT : public IProtocol
+class FTNoIR_Protocol : public IProtocol
{
public:
- FTNoIR_Protocol_FT();
- ~FTNoIR_Protocol_FT();
+ FTNoIR_Protocol();
+ ~FTNoIR_Protocol();
void Release();
void Initialize();
@@ -87,6 +87,12 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
+ void registerProtocol(IProtocol *protocol) {
+ theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
+ };
+ void unRegisterProtocol() {
+ theProtocol = NULL; // Reset the pointer
+ };
private:
Ui::UICFTControls ui;
@@ -95,6 +101,7 @@ private: /** helper **/
bool settingsDirty;
+ FTNoIR_Protocol *theProtocol;
private slots:
void doOK();
diff --git a/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp b/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp index a42963e4..62584b43 100644 --- a/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp +++ b/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp @@ -52,6 +52,8 @@ QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
// connect(ui.chkTIRViews, SIGNAL(stateChanged(int)), this, SLOT(chkTIRViewsChanged()));
+ theProtocol = NULL;
+
// Load the settings from the current .INI-file
loadSettings();
}
diff --git a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp index f3585b0e..ab063b04 100644 --- a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp +++ b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp @@ -33,7 +33,7 @@ #include "ftnoir_protocol_ftir.h"
/** constructor **/
-FTNoIR_Protocol_FTIR::FTNoIR_Protocol_FTIR()
+FTNoIR_Protocol::FTNoIR_Protocol()
{
loadSettings();
ProgramName = "";
@@ -43,7 +43,7 @@ FTNoIR_Protocol_FTIR::FTNoIR_Protocol_FTIR() }
/** destructor **/
-FTNoIR_Protocol_FTIR::~FTNoIR_Protocol_FTIR()
+FTNoIR_Protocol::~FTNoIR_Protocol()
{
//
// Destroy the File-mapping
@@ -77,12 +77,12 @@ FTNoIR_Protocol_FTIR::~FTNoIR_Protocol_FTIR() }
/** helper to Auto-destruct **/
-void FTNoIR_Protocol_FTIR::Release()
+void FTNoIR_Protocol::Release()
{
delete this;
}
-void FTNoIR_Protocol_FTIR::Initialize()
+void FTNoIR_Protocol::Initialize()
{
return;
}
@@ -90,7 +90,7 @@ void FTNoIR_Protocol_FTIR::Initialize() //
// Scale the measured value to the Joystick values
//
-float FTNoIR_Protocol_FTIR::scale2AnalogLimits( float x, float min_x, float max_x ) {
+float FTNoIR_Protocol::scale2AnalogLimits( float x, float min_x, float max_x ) {
double y;
double local_x;
@@ -109,7 +109,7 @@ double local_x; //
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Protocol_FTIR::loadSettings() {
+void FTNoIR_Protocol::loadSettings() {
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
@@ -124,7 +124,7 @@ void FTNoIR_Protocol_FTIR::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FTIR::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
float virtPosX;
float virtPosY;
float virtPosZ;
@@ -183,7 +183,7 @@ TRACKIRDATA localdata; // Check if the Client DLL exists and load it (to test it), if so.
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol_FTIR::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
{
QSettings settings("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER)
QString aLocation; // Location of Client DLL
@@ -307,7 +307,7 @@ bool FTNoIR_Protocol_FTIR::checkServerInstallationOK( HANDLE handle ) // It contains the tracking data, a handle to the main-window and the program-name of the Game!
//
//
-bool FTNoIR_Protocol_FTIR::FTIRCreateMapping( HANDLE handle )
+bool FTNoIR_Protocol::FTIRCreateMapping( HANDLE handle )
{
qDebug() << "FTIRCreateMapping says: Starting Function";
@@ -359,7 +359,7 @@ bool FTNoIR_Protocol_FTIR::FTIRCreateMapping( HANDLE handle ) //
// Destory the FileMapping to the shared memory
//
-void FTNoIR_Protocol_FTIR::FTIRDestroyMapping()
+void FTNoIR_Protocol::FTIRDestroyMapping()
{
if ( pMemData != NULL ) {
UnmapViewOfFile ( pMemData );
@@ -380,7 +380,7 @@ void FTNoIR_Protocol_FTIR::FTIRDestroyMapping() //
// Return a name, if present the name from the Game, that is connected...
//
-void FTNoIR_Protocol_FTIR::getNameFromGame( char *dest )
+void FTNoIR_Protocol::getNameFromGame( char *dest )
{
sprintf_s(dest, 99, "TIR compatible game");
return;
@@ -397,5 +397,5 @@ void FTNoIR_Protocol_FTIR::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
- return new FTNoIR_Protocol_FTIR;
+ return new FTNoIR_Protocol;
}
diff --git a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h index 951a2fa8..db50fdbc 100644 --- a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h +++ b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h @@ -46,11 +46,11 @@ typedef void (WINAPI *importTIRViewsStart)(void); typedef void (WINAPI *importTIRViewsStop)(void);
-class FTNoIR_Protocol_FTIR : public IProtocol
+class FTNoIR_Protocol : public IProtocol
{
public:
- FTNoIR_Protocol_FTIR();
- ~FTNoIR_Protocol_FTIR();
+ FTNoIR_Protocol();
+ ~FTNoIR_Protocol();
void Release();
void Initialize();
@@ -97,6 +97,12 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
+ void registerProtocol(IProtocol *protocol) {
+ theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
+ };
+ void unRegisterProtocol() {
+ theProtocol = NULL; // Reset the pointer
+ };
private:
Ui::UICFTIRControls ui;
@@ -105,6 +111,7 @@ private: /** helper **/
bool settingsDirty;
+ FTNoIR_Protocol *theProtocol;
private slots:
void doOK();
diff --git a/FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dialog.cpp b/FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dialog.cpp index 022ca93e..24a9697a 100644 --- a/FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dialog.cpp +++ b/FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dialog.cpp @@ -63,6 +63,8 @@ QWidget() ui.chkTIRViews->setEnabled ( true );
}
+ theProtocol = NULL;
+
// Load the settings from the current .INI-file
loadSettings();
}
diff --git a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp index bcda3dbc..cfb6c618 100644 --- a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp +++ b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp @@ -35,13 +35,13 @@ #include <QFile>
/** constructor **/
-FTNoIR_Protocol_FTN::FTNoIR_Protocol_FTN()
+FTNoIR_Protocol::FTNoIR_Protocol()
{
loadSettings();
}
/** destructor **/
-FTNoIR_Protocol_FTN::~FTNoIR_Protocol_FTN()
+FTNoIR_Protocol::~FTNoIR_Protocol()
{
if (inSocket != 0) {
inSocket->close();
@@ -55,12 +55,12 @@ FTNoIR_Protocol_FTN::~FTNoIR_Protocol_FTN() }
/** helper to Auto-destruct **/
-void FTNoIR_Protocol_FTN::Release()
+void FTNoIR_Protocol::Release()
{
delete this;
}
-void FTNoIR_Protocol_FTN::Initialize()
+void FTNoIR_Protocol::Initialize()
{
return;
}
@@ -68,7 +68,7 @@ void FTNoIR_Protocol_FTN::Initialize() //
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Protocol_FTN::loadSettings() {
+void FTNoIR_Protocol::loadSettings() {
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
@@ -86,7 +86,7 @@ void FTNoIR_Protocol_FTN::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FTN::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
int no_bytes;
QHostAddress sender;
quint16 senderPort;
@@ -137,7 +137,7 @@ quint16 senderPort; // Check if the Client DLL exists and load it (to test it), if so.
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol_FTN::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
{
// Init. the data
TestData.x = 0.0f;
@@ -179,7 +179,7 @@ bool FTNoIR_Protocol_FTN::checkServerInstallationOK( HANDLE handle ) //
// Return a name, if present the name from the Game, that is connected...
//
-void FTNoIR_Protocol_FTN::getNameFromGame( char *dest )
+void FTNoIR_Protocol::getNameFromGame( char *dest )
{
sprintf_s(dest, 99, "FaceTrackNoIR");
return;
@@ -196,5 +196,5 @@ void FTNoIR_Protocol_FTN::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
- return new FTNoIR_Protocol_FTN;
+ return new FTNoIR_Protocol;
}
diff --git a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h index 3eb65f5f..24f760c5 100644 --- a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h +++ b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h @@ -39,11 +39,11 @@ #include "Windows.h"
#include "math.h"
-class FTNoIR_Protocol_FTN : public IProtocol
+class FTNoIR_Protocol : public IProtocol
{
public:
- FTNoIR_Protocol_FTN();
- ~FTNoIR_Protocol_FTN();
+ FTNoIR_Protocol();
+ ~FTNoIR_Protocol();
void Release();
void Initialize();
@@ -77,6 +77,12 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
+ void registerProtocol(IProtocol *protocol) {
+ theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
+ };
+ void unRegisterProtocol() {
+ theProtocol = NULL; // Reset the pointer
+ };
private:
Ui::UICFTNControls ui;
@@ -85,6 +91,7 @@ private: /** helper **/
bool settingsDirty;
+ FTNoIR_Protocol *theProtocol;
private slots:
void doOK();
diff --git a/FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp b/FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp index a2e7813b..58dbfbad 100644 --- a/FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp +++ b/FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp @@ -59,6 +59,8 @@ QWidget() connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ theProtocol = NULL;
+
// Load the settings from the current .INI-file
loadSettings();
}
diff --git a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp index 7c75cd26..f81a38f7 100644 --- a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp +++ b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp @@ -35,7 +35,7 @@ #include "ftnoir_protocol_mouse.h"
/** constructor **/
-FTNoIR_Protocol_MOUSE::FTNoIR_Protocol_MOUSE()
+FTNoIR_Protocol::FTNoIR_Protocol()
{
prev_fMouse_X = 0.0f;
prev_fMouse_Y = 0.0f;
@@ -46,17 +46,17 @@ FTNoIR_Protocol_MOUSE::FTNoIR_Protocol_MOUSE() }
/** destructor **/
-FTNoIR_Protocol_MOUSE::~FTNoIR_Protocol_MOUSE()
+FTNoIR_Protocol::~FTNoIR_Protocol()
{
}
/** helper to Auto-destruct **/
-void FTNoIR_Protocol_MOUSE::Release()
+void FTNoIR_Protocol::Release()
{
delete this;
}
-void FTNoIR_Protocol_MOUSE::Initialize()
+void FTNoIR_Protocol::Initialize()
{
int ScreenX, ScreenY;
@@ -71,7 +71,7 @@ int ScreenX, ScreenY; //
// Scale the measured value to the Joystick values
//
-long FTNoIR_Protocol_MOUSE::scale2AnalogLimits( float x, float min_x, float max_x ) {
+long FTNoIR_Protocol::scale2AnalogLimits( float x, float min_x, float max_x ) {
double y;
y = ((MOUSE_AXIS_MAX - MOUSE_AXIS_MIN)/(max_x - min_x)) * x + ((MOUSE_AXIS_MAX - MOUSE_AXIS_MIN)/2) + MOUSE_AXIS_MIN;
@@ -81,7 +81,7 @@ double y; //
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Protocol_MOUSE::loadSettings() {
+void FTNoIR_Protocol::loadSettings() {
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
@@ -105,7 +105,7 @@ void FTNoIR_Protocol_MOUSE::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_MOUSE::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
float fMouse_X; // The actual value
float fMouse_Y;
float fMouse_Wheel;
@@ -264,7 +264,7 @@ float fMouse_Wheel; //
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol_MOUSE::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
{
return true;
@@ -273,7 +273,7 @@ bool FTNoIR_Protocol_MOUSE::checkServerInstallationOK( HANDLE handle ) //
// Return a name, if present the name from the Game, that is connected...
//
-void FTNoIR_Protocol_MOUSE::getNameFromGame( char *dest )
+void FTNoIR_Protocol::getNameFromGame( char *dest )
{
sprintf_s(dest, 99, "Mouse");
return;
@@ -290,5 +290,5 @@ void FTNoIR_Protocol_MOUSE::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
- return new FTNoIR_Protocol_MOUSE;
+ return new FTNoIR_Protocol;
}
diff --git a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h index a7915780..b7765b96 100644 --- a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h +++ b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h @@ -60,11 +60,11 @@ enum FTN_MouseStyle { };
-class FTNoIR_Protocol_MOUSE : public IProtocol
+class FTNoIR_Protocol : public IProtocol
{
public:
- FTNoIR_Protocol_MOUSE();
- ~FTNoIR_Protocol_MOUSE();
+ FTNoIR_Protocol();
+ ~FTNoIR_Protocol();
void Release();
void Initialize();
@@ -108,6 +108,12 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
+ void registerProtocol(IProtocol *protocol) {
+ theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
+ };
+ void unRegisterProtocol() {
+ theProtocol = NULL; // Reset the pointer
+ };
private:
Ui::UICMOUSEControls ui;
@@ -116,6 +122,7 @@ private: /** helper **/
bool settingsDirty;
+ FTNoIR_Protocol *theProtocol;
private slots:
void doOK();
diff --git a/FTNoIR_Protocol_MOUSE/ftnoir_protocol_MOUSE_dialog.cpp b/FTNoIR_Protocol_MOUSE/ftnoir_protocol_MOUSE_dialog.cpp index 75f96660..b8d7d7ee 100644 --- a/FTNoIR_Protocol_MOUSE/ftnoir_protocol_MOUSE_dialog.cpp +++ b/FTNoIR_Protocol_MOUSE/ftnoir_protocol_MOUSE_dialog.cpp @@ -88,6 +88,8 @@ QWidget() connect(ui.chkUseVirtualDesk, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
+ theProtocol = NULL;
+
// Load the settings from the current .INI-file
loadSettings();
}
diff --git a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp index 4689c92f..d586f0c0 100644 --- a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp +++ b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp @@ -35,7 +35,7 @@ static const char* DevName = "\\\\.\\PPJoyIOCTL";
/** constructor **/
-FTNoIR_Protocol_PPJOY::FTNoIR_Protocol_PPJOY()
+FTNoIR_Protocol::FTNoIR_Protocol()
{
char strDevName[100];
@@ -61,7 +61,7 @@ char strDevName[100]; }
/** destructor **/
-FTNoIR_Protocol_PPJOY::~FTNoIR_Protocol_PPJOY()
+FTNoIR_Protocol::~FTNoIR_Protocol()
{
/* Make sure we could open the device! */
if (h == INVALID_HANDLE_VALUE) {
@@ -75,12 +75,12 @@ FTNoIR_Protocol_PPJOY::~FTNoIR_Protocol_PPJOY() }
/** helper to Auto-destruct **/
-void FTNoIR_Protocol_PPJOY::Release()
+void FTNoIR_Protocol::Release()
{
delete this;
}
-void FTNoIR_Protocol_PPJOY::Initialize()
+void FTNoIR_Protocol::Initialize()
{
return;
}
@@ -88,7 +88,7 @@ void FTNoIR_Protocol_PPJOY::Initialize() //
// Limit the Joystick values
//
-void FTNoIR_Protocol_PPJOY::checkAnalogLimits() {
+void FTNoIR_Protocol::checkAnalogLimits() {
for (int i = 0;i < NUM_ANALOG;i++) {
if (Analog[i]>PPJOY_AXIS_MAX) {
Analog[i]=PPJOY_AXIS_MAX;
@@ -102,7 +102,7 @@ void FTNoIR_Protocol_PPJOY::checkAnalogLimits() { //
// Scale the measured value to the Joystick values
//
-long FTNoIR_Protocol_PPJOY::scale2AnalogLimits( float x, float min_x, float max_x ) {
+long FTNoIR_Protocol::scale2AnalogLimits( float x, float min_x, float max_x ) {
double y;
y = ((PPJOY_AXIS_MAX - PPJOY_AXIS_MIN)/(max_x - min_x)) * x + ((PPJOY_AXIS_MAX - PPJOY_AXIS_MIN)/2) + PPJOY_AXIS_MIN;
@@ -114,7 +114,7 @@ double y; //
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Protocol_PPJOY::loadSettings() {
+void FTNoIR_Protocol::loadSettings() {
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
@@ -128,7 +128,7 @@ void FTNoIR_Protocol_PPJOY::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_PPJOY::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
float virtPosX;
float virtPosY;
float virtPosZ;
@@ -186,7 +186,7 @@ float virtRotZ; //
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol_PPJOY::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
{
/* Make sure we could open the device! */
if (h == INVALID_HANDLE_VALUE) {
@@ -198,7 +198,7 @@ bool FTNoIR_Protocol_PPJOY::checkServerInstallationOK( HANDLE handle ) //
// Return a name, if present the name from the Game, that is connected...
//
-void FTNoIR_Protocol_PPJOY::getNameFromGame( char *dest )
+void FTNoIR_Protocol::getNameFromGame( char *dest )
{
sprintf_s(dest, 99, "Virtual PPJoy joystick");
return;
@@ -215,5 +215,5 @@ void FTNoIR_Protocol_PPJOY::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
- return new FTNoIR_Protocol_PPJOY;
+ return new FTNoIR_Protocol;
}
diff --git a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h index b9220916..4ae9b161 100644 --- a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h +++ b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h @@ -59,11 +59,11 @@ typedef struct #pragma pack(pop)
-class FTNoIR_Protocol_PPJOY : public IProtocol
+class FTNoIR_Protocol : public IProtocol
{
public:
- FTNoIR_Protocol_PPJOY();
- ~FTNoIR_Protocol_PPJOY();
+ FTNoIR_Protocol();
+ ~FTNoIR_Protocol();
void Release();
void Initialize();
@@ -102,6 +102,12 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
+ void registerProtocol(IProtocol *protocol) {
+ theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
+ };
+ void unRegisterProtocol() {
+ theProtocol = NULL; // Reset the pointer
+ };
private:
Ui::UICPPJOYControls ui;
@@ -110,6 +116,7 @@ private: /** helper **/
bool settingsDirty;
+ FTNoIR_Protocol *theProtocol;
private slots:
void doOK();
diff --git a/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp b/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp index fb9e1bd5..910e2ae4 100644 --- a/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp +++ b/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp @@ -55,6 +55,8 @@ QWidget() QString cbxText = QString("Virtual Joystick %1").arg(i);
ui.cbxSelectPPJoyNumber->addItem(QIcon("images/PPJoy.ico"), cbxText);
}
+ theProtocol = NULL;
+
// Load the settings from the current .INI-file
loadSettings();
}
diff --git a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp index 3399955a..a612d731 100644 --- a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp +++ b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License along *
* with this program; if not, see <http://www.gnu.org/licenses/>. *
* *
-* FTNoIR_Protocol_SC FTNoIR_Protocol_SC is the Class, that communicates headpose-data *
+* FTNoIR_Protocol FTNoIR_Protocol is the Class, that communicates headpose-data *
* to games, using the SimConnect.dll. *
* SimConnect.dll is a so called 'side-by-side' assembly, so it *
* must be treated as such... *
@@ -34,27 +34,27 @@ */
#include "ftnoir_protocol_sc.h"
-importSimConnect_CameraSetRelative6DOF FTNoIR_Protocol_SC::simconnect_set6DOF;
-HANDLE FTNoIR_Protocol_SC::hSimConnect = 0; // Handle to SimConnect
+importSimConnect_CameraSetRelative6DOF FTNoIR_Protocol::simconnect_set6DOF;
+HANDLE FTNoIR_Protocol::hSimConnect = 0; // Handle to SimConnect
-float FTNoIR_Protocol_SC::virtSCPosX = 0.0f; // Headpose
-float FTNoIR_Protocol_SC::virtSCPosY = 0.0f;
-float FTNoIR_Protocol_SC::virtSCPosZ = 0.0f;
+float FTNoIR_Protocol::virtSCPosX = 0.0f; // Headpose
+float FTNoIR_Protocol::virtSCPosY = 0.0f;
+float FTNoIR_Protocol::virtSCPosZ = 0.0f;
-float FTNoIR_Protocol_SC::virtSCRotX = 0.0f;
-float FTNoIR_Protocol_SC::virtSCRotY = 0.0f;
-float FTNoIR_Protocol_SC::virtSCRotZ = 0.0f;
+float FTNoIR_Protocol::virtSCRotX = 0.0f;
+float FTNoIR_Protocol::virtSCRotY = 0.0f;
+float FTNoIR_Protocol::virtSCRotZ = 0.0f;
-float FTNoIR_Protocol_SC::prevSCPosX = 0.0f; // previous Headpose
-float FTNoIR_Protocol_SC::prevSCPosY = 0.0f;
-float FTNoIR_Protocol_SC::prevSCPosZ = 0.0f;
+float FTNoIR_Protocol::prevSCPosX = 0.0f; // previous Headpose
+float FTNoIR_Protocol::prevSCPosY = 0.0f;
+float FTNoIR_Protocol::prevSCPosZ = 0.0f;
-float FTNoIR_Protocol_SC::prevSCRotX = 0.0f;
-float FTNoIR_Protocol_SC::prevSCRotY = 0.0f;
-float FTNoIR_Protocol_SC::prevSCRotZ = 0.0f;
+float FTNoIR_Protocol::prevSCRotX = 0.0f;
+float FTNoIR_Protocol::prevSCRotY = 0.0f;
+float FTNoIR_Protocol::prevSCRotZ = 0.0f;
/** constructor **/
-FTNoIR_Protocol_SC::FTNoIR_Protocol_SC()
+FTNoIR_Protocol::FTNoIR_Protocol()
{
ProgramName = "Microsoft FSX";
blnSimConnectActive = false;
@@ -62,26 +62,26 @@ FTNoIR_Protocol_SC::FTNoIR_Protocol_SC() }
/** destructor **/
-FTNoIR_Protocol_SC::~FTNoIR_Protocol_SC()
+FTNoIR_Protocol::~FTNoIR_Protocol()
{
- qDebug() << "~FTNoIR_Protocol_SC says: inside" << FTNoIR_Protocol_SC::hSimConnect;
+ qDebug() << "~FTNoIR_Protocol says: inside" << FTNoIR_Protocol::hSimConnect;
if (hSimConnect != 0) {
- qDebug() << "~FTNoIR_Protocol_SC says: before simconnect_close";
- if (SUCCEEDED( simconnect_close( FTNoIR_Protocol_SC::hSimConnect ) ) ) {
- qDebug() << "~FTNoIR_Protocol_SC says: close SUCCEEDED";
+ qDebug() << "~FTNoIR_Protocol says: before simconnect_close";
+ if (SUCCEEDED( simconnect_close( FTNoIR_Protocol::hSimConnect ) ) ) {
+ qDebug() << "~FTNoIR_Protocol says: close SUCCEEDED";
}
}
// SCClientLib.unload(); Generates crash when tracker is ended...
}
/** helper to Auto-destruct **/
-void FTNoIR_Protocol_SC::Release()
+void FTNoIR_Protocol::Release()
{
delete this;
}
-void FTNoIR_Protocol_SC::Initialize()
+void FTNoIR_Protocol::Initialize()
{
return;
}
@@ -89,14 +89,14 @@ void FTNoIR_Protocol_SC::Initialize() //
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Protocol_SC::loadSettings() {
+void FTNoIR_Protocol::loadSettings() {
// None yet...
}
//
// Update Headpose in Game.
//
-void FTNoIR_Protocol_SC::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
virtSCRotX = -1.0f * headpose->pitch; // degrees
@@ -112,7 +112,7 @@ void FTNoIR_Protocol_SC::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseD //
if (!blnSimConnectActive) {
if (SUCCEEDED(simconnect_open(&hSimConnect, "FaceTrackNoIR", NULL, 0, 0, 0))) {
- qDebug() << "FTNoIR_Protocol_SC::sendHeadposeToGame() says: SimConnect active!";
+ qDebug() << "FTNoIR_Protocol::sendHeadposeToGame() says: SimConnect active!";
//set up the events we want to listen for
HRESULT hr;
@@ -137,7 +137,7 @@ void FTNoIR_Protocol_SC::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseD // if ((prevPosX != virtPosX) || (prevPosY != virtPosY) || (prevPosZ != virtPosZ) ||
// (prevRotX != virtRotX) || (prevRotY != virtRotY) || (prevRotZ != virtRotZ)) {
//// if (S_OK == simconnect_set6DOF(hSimConnect, virtPosX, virtPosY, virtPosZ, virtRotX, virtRotZ, virtRotY)) {
-//// qDebug() << "FTNoIR_Protocol_SC::run() says: SimConnect data written!";
+//// qDebug() << "FTNoIR_Protocol::run() says: SimConnect data written!";
//// }
// }
//
@@ -149,10 +149,10 @@ void FTNoIR_Protocol_SC::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseD // prevRotZ = virtRotZ;
if SUCCEEDED(simconnect_calldispatch(hSimConnect, processNextSimconnectEvent, NULL)) {
- qDebug() << "FTNoIR_Protocol_SC::sendHeadposeToGame() says: Dispatching";
+ qDebug() << "FTNoIR_Protocol::sendHeadposeToGame() says: Dispatching";
}
else {
- qDebug() << "FTNoIR_Protocol_SC::sendHeadposeToGame() says: Error Dispatching!";
+ qDebug() << "FTNoIR_Protocol::sendHeadposeToGame() says: Error Dispatching!";
}
}
}
@@ -160,7 +160,7 @@ void FTNoIR_Protocol_SC::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseD //
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol_SC::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
{
QString aFileName; // File Path and Name
@@ -179,7 +179,7 @@ bool FTNoIR_Protocol_SC::checkServerInstallationOK( HANDLE handle ) QString manifest(QCoreApplication::applicationDirPath());
// manifest += "\\FaceTrackNoIR.exe";
- manifest += "\\FTNoIR_Protocol_SC.dll";
+ manifest += "\\FTNoIR_Protocol.dll";
const wchar_t * encodedName = reinterpret_cast<const wchar_t *>(manifest.utf16());
act.lpSource = encodedName;
@@ -228,17 +228,17 @@ bool FTNoIR_Protocol_SC::checkServerInstallationOK( HANDLE handle ) //
simconnect_open = (importSimConnect_Open) SCClientLib.resolve("SimConnect_Open");
if (simconnect_open == NULL) {
- qDebug() << "FTNoIR_Protocol_SC::checkServerInstallationOK() says: SimConnect_Open function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect_Open function not found in DLL!";
return false;
}
simconnect_set6DOF = (importSimConnect_CameraSetRelative6DOF) SCClientLib.resolve("SimConnect_CameraSetRelative6DOF");
if (simconnect_set6DOF == NULL) {
- qDebug() << "FTNoIR_Protocol_SC::checkServerInstallationOK() says: SimConnect_CameraSetRelative6DOF function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect_CameraSetRelative6DOF function not found in DLL!";
return false;
}
simconnect_close = (importSimConnect_Close) SCClientLib.resolve("SimConnect_Close");
if (simconnect_close == NULL) {
- qDebug() << "FTNoIR_Protocol_SC::checkServerInstallationOK() says: SimConnect_Close function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect_Close function not found in DLL!";
return false;
}
@@ -246,40 +246,40 @@ bool FTNoIR_Protocol_SC::checkServerInstallationOK( HANDLE handle ) simconnect_calldispatch = (importSimConnect_CallDispatch) SCClientLib.resolve("SimConnect_CallDispatch");
if (simconnect_calldispatch == NULL) {
- qDebug() << "FTNoIR_Protocol_SC::checkServerInstallationOK() says: SimConnect_CallDispatch function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect_CallDispatch function not found in DLL!";
return false;
}
simconnect_subscribetosystemevent = (importSimConnect_SubscribeToSystemEvent) SCClientLib.resolve("SimConnect_SubscribeToSystemEvent");
if (simconnect_subscribetosystemevent == NULL) {
- qDebug() << "FTNoIR_Protocol_SC::checkServerInstallationOK() says: SimConnect_SubscribeToSystemEvent function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect_SubscribeToSystemEvent function not found in DLL!";
return false;
}
simconnect_mapclienteventtosimevent = (importSimConnect_MapClientEventToSimEvent) SCClientLib.resolve("SimConnect_MapClientEventToSimEvent");
if (simconnect_subscribetosystemevent == NULL) {
- qDebug() << "FTNoIR_Protocol_SC::checkServerInstallationOK() says: SimConnect_MapClientEventToSimEvent function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect_MapClientEventToSimEvent function not found in DLL!";
return false;
}
simconnect_addclienteventtonotificationgroup = (importSimConnect_AddClientEventToNotificationGroup) SCClientLib.resolve("SimConnect_AddClientEventToNotificationGroup");
if (simconnect_subscribetosystemevent == NULL) {
- qDebug() << "FTNoIR_Protocol_SC::checkServerInstallationOK() says: SimConnect_AddClientEventToNotificationGroup function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect_AddClientEventToNotificationGroup function not found in DLL!";
return false;
}
simconnect_setnotificationgrouppriority = (importSimConnect_SetNotificationGroupPriority) SCClientLib.resolve("SimConnect_SetNotificationGroupPriority");
if (simconnect_subscribetosystemevent == NULL) {
- qDebug() << "FTNoIR_Protocol_SC::checkServerInstallationOK() says: SimConnect_SetNotificationGroupPriority function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect_SetNotificationGroupPriority function not found in DLL!";
return false;
}
- qDebug() << "FTNoIR_Protocol_SC::checkServerInstallationOK() says: SimConnect functions resolved in DLL!";
+ qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect functions resolved in DLL!";
return true;
}
-void CALLBACK FTNoIR_Protocol_SC::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext)
+void CALLBACK FTNoIR_Protocol::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext)
{
// HRESULT hr;
@@ -289,7 +289,7 @@ void CALLBACK FTNoIR_Protocol_SC::processNextSimconnectEvent(SIMCONNECT_RECV* pD {
SIMCONNECT_RECV_EVENT *evt = (SIMCONNECT_RECV_EVENT*)pData;
- qDebug() << "FTNoIR_Protocol_SC::processNextSimconnectEvent() says: SimConnect active!";
+ qDebug() << "FTNoIR_Protocol::processNextSimconnectEvent() says: SimConnect active!";
//switch(evt->uEventID)
//{
// //case EVENT_CAMERA_RIGHT:
@@ -319,11 +319,11 @@ void CALLBACK FTNoIR_Protocol_SC::processNextSimconnectEvent(SIMCONNECT_RECV* pD }
case SIMCONNECT_RECV_ID_EVENT_FRAME:
{
-// qDebug() << "FTNoIR_Protocol_SC::processNextSimconnectEvent() says: Frame event!";
+// qDebug() << "FTNoIR_Protocol::processNextSimconnectEvent() says: Frame event!";
if ((prevSCPosX != virtSCPosX) || (prevSCPosY != virtSCPosY) || (prevSCPosZ != virtSCPosZ) ||
(prevSCRotX != virtSCRotX) || (prevSCRotY != virtSCRotY) || (prevSCRotZ != virtSCRotZ)) {
if (S_OK == simconnect_set6DOF(hSimConnect, virtSCPosX, virtSCPosY, virtSCPosZ, virtSCRotX, virtSCRotZ, virtSCRotY)) {
- // qDebug() << "FTNoIR_Protocol_SC::run() says: SimConnect data written!";
+ // qDebug() << "FTNoIR_Protocol::run() says: SimConnect data written!";
}
}
prevSCPosX = virtSCPosX;
@@ -353,7 +353,7 @@ void CALLBACK FTNoIR_Protocol_SC::processNextSimconnectEvent(SIMCONNECT_RECV* pD case SIMCONNECT_RECV_ID_QUIT:
{
- qDebug() << "FTNoIR_Protocol_SC::processNextSimconnectEvent() says: Quit event!";
+ qDebug() << "FTNoIR_Protocol::processNextSimconnectEvent() says: Quit event!";
// quit = 1;
break;
}
@@ -366,7 +366,7 @@ void CALLBACK FTNoIR_Protocol_SC::processNextSimconnectEvent(SIMCONNECT_RECV* pD //
// Return a name, if present the name from the Game, that is connected...
//
-void FTNoIR_Protocol_SC::getNameFromGame( char *dest )
+void FTNoIR_Protocol::getNameFromGame( char *dest )
{
sprintf_s(dest, 99, "FSX");
return;
@@ -383,5 +383,5 @@ void FTNoIR_Protocol_SC::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
- return new FTNoIR_Protocol_SC;
+ return new FTNoIR_Protocol;
}
diff --git a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h index cfdde6a6..65e523ef 100644 --- a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h +++ b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.h @@ -77,11 +77,11 @@ enum INPUT_ID INPUT0=0,
};
-class FTNoIR_Protocol_SC : public IProtocol
+class FTNoIR_Protocol : public IProtocol
{
public:
- FTNoIR_Protocol_SC();
- ~FTNoIR_Protocol_SC();
+ FTNoIR_Protocol();
+ ~FTNoIR_Protocol();
void Release();
void Initialize();
@@ -139,6 +139,12 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
+ void registerProtocol(IProtocol *protocol) {
+ theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
+ };
+ void unRegisterProtocol() {
+ theProtocol = NULL; // Reset the pointer
+ };
private:
Ui::UICSCControls ui;
@@ -147,6 +153,7 @@ private: /** helper **/
bool settingsDirty;
+ FTNoIR_Protocol *theProtocol;
private slots:
void doOK();
diff --git a/FTNoIR_Protocol_SC/ftnoir_protocol_SC_dialog.cpp b/FTNoIR_Protocol_SC/ftnoir_protocol_SC_dialog.cpp index 08013486..9047fa61 100644 --- a/FTNoIR_Protocol_SC/ftnoir_protocol_SC_dialog.cpp +++ b/FTNoIR_Protocol_SC/ftnoir_protocol_SC_dialog.cpp @@ -50,10 +50,8 @@ QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
//connect(ui.cbxSelectPPJoyNumber, SIGNAL(currentIndexChanged(int)), this, SLOT(virtualJoystickSelected( int )));
- //for (int i = 1 ; i < 17; i++) {
- // QString cbxText = QString("Virtual Joystick %1").arg(i);
- // ui.cbxSelectPPJoyNumber->addItem(QIcon("images/PPJoy.ico"), cbxText);
- //}
+ theProtocol = NULL;
+
// Load the settings from the current .INI-file
loadSettings();
}
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp index e4907284..4d59b85b 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.cpp +++ b/FaceTrackNoIR/FaceTrackNoIR.cpp @@ -715,7 +715,7 @@ void FaceTrackNoIR::startTracker( ) { ui.iconcomboTrackerSource->setEnabled ( false );
ui.cbxSecondTrackerSource->setEnabled ( false );
ui.iconcomboProtocol->setEnabled ( false );
- ui.btnShowServerControls->setEnabled ( false );
+// ui.btnShowServerControls->setEnabled ( false );
ui.iconcomboFilter->setEnabled ( false );
//
@@ -796,6 +796,9 @@ void FaceTrackNoIR::stopTracker( ) { if (pTrackerDialog) {
pTrackerDialog->unRegisterTracker();
}
+ if (pProtocolDialog) {
+ pProtocolDialog->unRegisterProtocol();
+ }
//
// Delete the tracker (after stopping things and all).
@@ -1101,6 +1104,10 @@ QString libName; {
pProtocolDialog = ptrXyz;
pProtocolDialog->Initialize( this );
+ if (tracker) {
+ pProtocolDialog->registerProtocol( tracker->getProtocolPtr() );
+ qDebug() << "FaceTrackNoIR::showServerControls RegisterProtocol Function Executed";
+ }
qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
}
else {
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h index 6a51758b..e6d6a14d 100644 --- a/FaceTrackNoIR/tracker.h +++ b/FaceTrackNoIR/tracker.h @@ -256,6 +256,7 @@ public: static IFilterPtr getFilterPtr() { return pFilter; } // Return the pointer for the active Filter
ITracker *getTrackerPtr() { return pTracker; } // Return the pointer for the active Tracker
ITracker *getSecondTrackerPtr() { return pSecondTracker; } // Return the pointer for the secondary Tracker
+ IProtocol *getProtocolPtr() { return pProtocol; } // Return the pointer for the active Protocol
void doRefreshVideo() { // Call the face-tracker-function RefreshVideo
if (pTracker) {
|