diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2012-09-13 17:07:47 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2012-09-13 17:07:47 +0000 |
commit | 57b8e22873f804c831cb40d9bee1f75ff877c6a4 (patch) | |
tree | a46a54f5c711c016c4c3be7572beb2d988a8b12b | |
parent | df690e02ea1bdfa06e735fd1da3a94fdee93714a (diff) |
Class TrackerDll added, to get info about the Tracker
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@130 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r-- | FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h | 48 | ||||
-rw-r--r-- | FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.vcproj | 4 | ||||
-rw-r--r-- | FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp | 27 | ||||
-rw-r--r-- | FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp | 32 | ||||
-rw-r--r-- | FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dll.cpp | 85 |
5 files changed, 110 insertions, 86 deletions
diff --git a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h index 4cae5e62..10cccb08 100644 --- a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h +++ b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h @@ -13,17 +13,12 @@ public: FTNoIR_Tracker();
~FTNoIR_Tracker();
- void Release();
void Initialize( QFrame *videoframe );
void StartTracker( HWND parent_window );
void StopTracker( bool exit );
bool GiveHeadPoseData(THeadPoseData *data);
void loadSettings();
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
-
protected:
void run(); // qthread override run method
@@ -42,19 +37,7 @@ private: THeadPoseData newHeadPose; // Structure with new headpose
- ////parameter list for the filter-function(s)
- //enum
- //{
- // kPortAddress=0, // Index in QList
- // kNumFilterParameters // Indicate number of parameters used
- //};
- //QList<std::pair<float,float>> parameterRange;
- //QList<float> parameterValueAsFloat;
-
float portAddress; // Port-number
- QString trackerFullName; // Trackers' name and description
- QString trackerShortName;
- QString trackerDescription;
};
// Widget that has controls for FTNoIR protocol client-settings.
@@ -67,14 +50,8 @@ public: virtual ~TrackerControls();
void showEvent ( QShowEvent * event );
- void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
-
private:
Ui::UICFTNClientControls ui;
void loadSettings();
@@ -83,14 +60,31 @@ private: /** helper **/
bool settingsDirty;
- QString trackerFullName; // Trackers' name and description
- QString trackerShortName;
- QString trackerDescription;
-
private slots:
void doOK();
void doCancel();
void settingChanged() { settingsDirty = true; };
};
+//*******************************************************************************************************
+// FaceTrackNoIR Tracker DLL. Functions used to get general info on the Tracker
+//*******************************************************************************************************
+class FTNoIR_TrackerDll : public ITrackerDll
+{
+public:
+ FTNoIR_TrackerDll();
+ ~FTNoIR_TrackerDll();
+
+ void Initialize();
+
+ void getFullName(QString *strToBeFilled);
+ void getShortName(QString *strToBeFilled);
+ void getDescription(QString *strToBeFilled);
+ void getIcon(QIcon *icon);
+
+private:
+ QString trackerFullName; // Trackers' name and description
+ QString trackerShortName;
+ QString trackerDescription;
+};
diff --git a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.vcproj b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.vcproj index a1533b0a..b25303f4 100644 --- a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.vcproj +++ b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.vcproj @@ -175,6 +175,10 @@ RelativePath=".\ftnoir_tracker_udp_dialog.cpp"
>
</File>
+ <File
+ RelativePath=".\ftnoir_tracker_udp_dll.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp index bd7d1d3d..4d367013 100644 --- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp +++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp @@ -44,11 +44,6 @@ FTNoIR_Tracker::FTNoIR_Tracker() portAddress = 5551;
- //populate the description strings
- trackerFullName = "FaceTrackNoIR UDP";
- trackerShortName = "UDP";
- trackerDescription = "FaceTrackNoIR UDP";
-
newHeadPose.x = 0.0f;
newHeadPose.y = 0.0f;
newHeadPose.z = 0.0f;
@@ -123,11 +118,6 @@ quint16 senderPort; }
}
-void FTNoIR_Tracker::Release()
-{
- delete this;
-}
-
void FTNoIR_Tracker::Initialize( QFrame *videoframe )
{
qDebug() << "FTNoIR_Tracker::Initialize says: Starting ";
@@ -178,23 +168,6 @@ bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) return true;
}
-void FTNoIR_Tracker::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = trackerFullName;
-};
-
-
-void FTNoIR_Tracker::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = trackerShortName;
-};
-
-
-void FTNoIR_Tracker::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = trackerDescription;
-};
-
//
// Load the current Settings from the currently 'active' INI-file.
//
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp index f524f398..48e61ba4 100644 --- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp +++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp @@ -45,11 +45,6 @@ QWidget() //connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- //populate the description strings
- trackerFullName = "FaceTrackNoIR UDP";
- trackerShortName = "UDP";
- trackerDescription = "FaceTrackNoIR UDP";
-
// Load the settings from the current .INI-file
loadSettings();
}
@@ -61,11 +56,6 @@ TrackerControls::~TrackerControls() { qDebug() << "~TrackerControls() says: started";
}
-void TrackerControls::Release()
-{
- delete this;
-}
-
//
// Initialize tracker-client-dialog
//
@@ -124,28 +114,6 @@ void TrackerControls::doCancel() { }
}
-void TrackerControls::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = trackerFullName;
-};
-
-
-void TrackerControls::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = trackerShortName;
-};
-
-
-void TrackerControls::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = trackerDescription;
-};
-
-void TrackerControls::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/FaceTrackNoIR.ico");
-};
-
//
// Load the current Settings from the currently 'active' INI-file.
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dll.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dll.cpp new file mode 100644 index 00000000..be81ac80 --- /dev/null +++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dll.cpp @@ -0,0 +1,85 @@ +/********************************************************************************
+* 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) 2012 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/>. *
+* *
+********************************************************************************/
+/*
+ Modifications (last one on top):
+ 20120830 - WVR: The Dialog class was used to get general info on the DLL. This
+ had a big disadvantage: the complete dialog was loaded, just to get
+ some data and then it was deleted again (without ever showing the dialog).
+ The TrackerDll class solves this.
+ The functions to get the name(s) and icon were removed from the two other classes.
+*/
+#include "ftnoir_tracker_udp.h"
+#include <QDebug>
+
+FTNoIR_TrackerDll::FTNoIR_TrackerDll() {
+ //populate the description strings
+ trackerFullName = "FaceTrackNoIR UDP";
+ trackerShortName = "UDP";
+ trackerDescription = "FaceTrackNoIR UDP";
+}
+
+FTNoIR_TrackerDll::~FTNoIR_TrackerDll()
+{
+
+}
+
+void FTNoIR_TrackerDll::Initialize()
+{
+ return;
+}
+
+void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled)
+{
+ *strToBeFilled = trackerFullName;
+};
+
+void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled)
+{
+ *strToBeFilled = trackerShortName;
+};
+
+void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled)
+{
+ *strToBeFilled = trackerDescription;
+};
+
+void FTNoIR_TrackerDll::getIcon(QIcon *icon)
+{
+ *icon = QIcon(":/images/FaceTrackNoIR.ico");
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// Factory function that creates instances if the Tracker object.
+
+// Export both decorated and undecorated names.
+// GetTrackerDll - Undecorated name, which can be easily used with GetProcAddress
+// Win32 API function.
+// _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language.
+#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0")
+
+FTNOIR_TRACKER_BASE_EXPORT TRACKERDLLHANDLE __stdcall GetTrackerDll()
+{
+ return new FTNoIR_TrackerDll;
+}
|