summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Protocol_FG
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_FG
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_FG')
-rw-r--r--FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp18
-rw-r--r--FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.h13
-rw-r--r--FTNoIR_Protocol_FG/ftnoir_protocol_fg_dialog.cpp2
3 files changed, 21 insertions, 12 deletions
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();
}