summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Protocol_FT
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2012-11-16 12:00:53 +0000
committerWim Vriend <facetracknoir@gmail.com>2012-11-16 12:00:53 +0000
commitb3d3a1f1d4f9739a506990edefcd2d81502368d4 (patch)
tree3bf2d14c5294060757325d5c3d25c1713c06c714 /FTNoIR_Protocol_FT
parenta04cfffdd5cf40a51a6becc3d4a09172864bf99d (diff)
Added registerProtocol and unRegisterProtocol to the Protocol classes.
Now the Protocol Dialog can get data from the protocol, when the Tracker is running. git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@192 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Protocol_FT')
-rw-r--r--FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp26
-rw-r--r--FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.h13
-rw-r--r--FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp2
3 files changed, 25 insertions, 16 deletions
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();
}