summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Protocol_FTIR
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_FTIR
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_FTIR')
-rw-r--r--FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp24
-rw-r--r--FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.h13
-rw-r--r--FTNoIR_Protocol_FTIR/ftnoir_protocol_FTIR_dialog.cpp2
3 files changed, 24 insertions, 15 deletions
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();
}