summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-10-19 13:39:50 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-10-19 13:39:50 +0200
commita8ffbb76f3e3bbca547fccf5135323e06cae9d2a (patch)
treecd77a5302cb4ead5995a2a86d5b5b6324ebf43ff
parent0f0d663c6263a59e2cb14f555a00b39b19c134e7 (diff)
update modules to refactored API
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp2
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.h11
-rw-r--r--ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp2
-rw-r--r--ftnoir_filter_ewma2/ftnoir_filter_ewma2.h10
-rw-r--r--ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp3
-rwxr-xr-xftnoir_filter_kalman/ftnoir_filter_kalman.h10
-rw-r--r--ftnoir_filter_kalman/kalman.cpp2
-rw-r--r--ftnoir_protocol_fg/ftnoir_protocol_fg.cpp4
-rw-r--r--ftnoir_protocol_fg/ftnoir_protocol_fg.h18
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp10
-rw-r--r--ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h18
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.cpp15
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.h40
-rw-r--r--ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp4
-rw-r--r--ftnoir_protocol_ftn/ftnoir_protocol_ftn.h19
-rw-r--r--ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp3
-rw-r--r--ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp2
-rw-r--r--ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h28
-rw-r--r--ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp2
-rw-r--r--ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp8
-rw-r--r--ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp4
-rw-r--r--ftnoir_protocol_mouse/ftnoir_protocol_mouse.h18
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc.cpp22
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc.h18
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp2
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h22
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp8
-rw-r--r--ftnoir_protocol_wine/ftnoir_protocol_wine.cpp4
-rw-r--r--ftnoir_protocol_wine/ftnoir_protocol_wine.h22
-rw-r--r--ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp2
-rw-r--r--ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp8
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp33
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.h10
-rw-r--r--ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp4
-rw-r--r--ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h16
-rw-r--r--ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp20
-rw-r--r--ftnoir_tracker_ht/ftnoir_tracker_ht.cpp25
-rw-r--r--ftnoir_tracker_ht/ftnoir_tracker_ht.h10
-rw-r--r--ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h15
-rw-r--r--ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp4
-rw-r--r--ftnoir_tracker_hydra/ftnoir_tracker_hydra.h18
-rw-r--r--ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp20
-rw-r--r--ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp6
-rw-r--r--ftnoir_tracker_joystick/ftnoir_tracker_joystick.h24
-rw-r--r--ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp21
-rw-r--r--ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp70
-rw-r--r--ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.h36
-rw-r--r--ftnoir_tracker_libevdev/ftnoir_tracker_libevdev_dll.cpp20
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt.cpp8
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt.h6
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp6
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h6
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp22
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h6
-rw-r--r--ftnoir_tracker_pt/point_tracker.h2
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift.cpp4
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift.h25
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp32
-rw-r--r--ftnoir_tracker_udp/ftnoir_tracker_udp.cpp4
-rw-r--r--ftnoir_tracker_udp/ftnoir_tracker_udp.h16
-rw-r--r--ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp3
-rw-r--r--ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp20
62 files changed, 291 insertions, 562 deletions
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
index 9b7b2cb2..f6ffd68c 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
@@ -23,7 +23,7 @@ static inline double parabola(const double a, const double x, const double dz, c
return a1 * pow(std::max<double>(fabs(x) - dz, 0), expt) * sign;
}
-void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position,
+void FTNoIR_Filter::filter(const double* target_camera_position,
double *new_camera_position)
{
if (first_run)
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h
index 0a736042..c1b325fa 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.h
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.h
@@ -36,7 +36,7 @@ class FTNoIR_Filter : public IFilter
{
public:
FTNoIR_Filter();
- void FilterHeadPoseData(const double* target_camera_position, double *new_camera_position);
+ void filter(const double* target_camera_position, double *new_camera_position);
void reset() {
first_run = true;
}
@@ -50,7 +50,7 @@ private:
double last_output[3][6];
};
-class FilterControls: public QWidget, public IFilterDialog
+class FilterControls: public IFilterDialog
{
Q_OBJECT
public:
@@ -71,9 +71,6 @@ private slots:
class FTNoIR_FilterDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Accela Filter Mk4"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Accela Mk4"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Accela filter Mk4"); }
-
- void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); }
+ QString name() { return QString("Accela"); }
+ QIcon icon() { return QIcon(":/images/filter-16.png"); }
};
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp
index 320b95ad..5214b37b 100644
--- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp
+++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp
@@ -40,7 +40,7 @@ void FTNoIR_Filter::receiveSettings()
s.b->reload();
}
-void FTNoIR_Filter::FilterHeadPoseData(const double *target_camera_position,
+void FTNoIR_Filter::filter(const double *target_camera_position,
double *new_camera_position)
{
double new_delta, new_noise, norm_noise;
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h
index aacf4916..f2baaa22 100644
--- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h
+++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h
@@ -25,7 +25,7 @@ class FTNoIR_Filter : public IFilter
public:
FTNoIR_Filter();
void reset() { first_run=true; }
- void FilterHeadPoseData(const double *target_camera_position,
+ void filter(const double *target_camera_position,
double *new_camera_position);
void receiveSettings();
private:
@@ -38,7 +38,7 @@ private:
settings s;
};
-class FilterControls: public QWidget, public IFilterDialog
+class FilterControls: public IFilterDialog
{
Q_OBJECT
public:
@@ -60,8 +60,6 @@ private slots:
class FTNoIR_FilterDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("EWMA Filter Mk3"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("EWMA"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Exponentially Weighted Moving Average filter with dynamic smoothing parameter"); }
- void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); }
+ QString name() { return QString("EWMA"); }
+ QIcon icon() { return QIcon(":/images/filter-16.png"); }
};
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp
index b6bde553..bdc6e1bf 100644
--- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp
+++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp
@@ -4,8 +4,7 @@
#include "facetracknoir/plugin-support.h"
#include "ui_ftnoir_ewma_filtercontrols.h"
-FilterControls::FilterControls() :
- QWidget(), pFilter(NULL)
+FilterControls::FilterControls() : pFilter(NULL)
{
ui.setupUi( this );
diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h
index 558aebd6..7dcd0f7d 100755
--- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h
+++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h
@@ -24,7 +24,7 @@ class OPENTRACK_EXPORT FTNoIR_Filter : public IFilter
public:
FTNoIR_Filter();
void reset();
- void FilterHeadPoseData(const double *target_camera_position,
+ void filter(const double *target_camera_position,
double *new_camera_position);
double accel_variance;
double noise_variance;
@@ -36,13 +36,11 @@ public:
class OPENTRACK_EXPORT FTNoIR_FilterDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Kalman filter"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Kalman filter"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Kalman filter"); }
- void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); }
+ QString name() { return QString("Kalman"); }
+ QIcon icon() { return QIcon(":/images/filter-16.png"); }
};
-class OPENTRACK_EXPORT FilterControls: public QWidget, public IFilterDialog
+class OPENTRACK_EXPORT FilterControls: public IFilterDialog
{
Q_OBJECT
public:
diff --git a/ftnoir_filter_kalman/kalman.cpp b/ftnoir_filter_kalman/kalman.cpp
index 14b0e8ab..9a902643 100644
--- a/ftnoir_filter_kalman/kalman.cpp
+++ b/ftnoir_filter_kalman/kalman.cpp
@@ -67,7 +67,7 @@ void FTNoIR_Filter::reset() {
timer.invalidate();
}
-void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position,
+void FTNoIR_Filter::filter(const double* target_camera_position,
double *new_camera_position)
{
// Start the timer if it's not running.
diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp
index b2d29118..8b5baaa8 100644
--- a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp
+++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp
@@ -35,7 +35,7 @@ void FTNoIR_Protocol::reloadSettings()
s.b->reload();
}
-void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) {
+void FTNoIR_Protocol::pose(const double* headpose) {
FlightData.x = headpose[TX] * 1e-2;
FlightData.y = headpose[TY] * 1e-2;
FlightData.z = headpose[TZ] * 1e-2;
@@ -52,7 +52,7 @@ void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) {
(void) outSocket.writeDatagram(reinterpret_cast<const char*>(&FlightData), sizeof(FlightData), destIP, static_cast<quint16>(destPort));
}
-bool FTNoIR_Protocol::checkServerInstallationOK()
+bool FTNoIR_Protocol::correct()
{
return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
}
diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.h b/ftnoir_protocol_fg/ftnoir_protocol_fg.h
index 4b25a3e1..44b79c06 100644
--- a/ftnoir_protocol_fg/ftnoir_protocol_fg.h
+++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.h
@@ -52,9 +52,9 @@ struct settings {
class FTNoIR_Protocol : public IProtocol
{
public:
- bool checkServerInstallationOK();
- void sendHeadposeToGame(const double *headpose);
- QString getGameName() {
+ bool correct();
+ void pose(const double *headpose);
+ QString game_name() {
return "FlightGear";
}
void reloadSettings();
@@ -65,15 +65,15 @@ private:
};
// Widget that has controls for FTNoIR protocol client-settings.
-class FGControls: public QWidget, public IProtocolDialog
+class FGControls: public IProtocolDialog
{
Q_OBJECT
public:
FGControls();
- void registerProtocol(IProtocol *protocol) {
+ void register_protocol(IProtocol *protocol) {
theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
}
- void unRegisterProtocol() {
+ void unregister_protocol() {
theProtocol = NULL; // Reset the pointer
}
private:
@@ -88,8 +88,6 @@ private slots:
class FTNoIR_ProtocolDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("FlightGear UDP protocol"); }
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/flightgear.png"); }
+ QString name() { return QString("FlightGear"); }
+ QIcon icon() { return QIcon(":/images/flightgear.png"); }
};
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
index 822cdb4d..16f116f6 100644
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
+++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp
@@ -58,7 +58,7 @@ double local_x;
return (int) y;
}
-void FTNoIR_Protocol::sendHeadposeToGame(const double *headpose ) {
+void FTNoIR_Protocol::pose(const double *headpose ) {
DWORD result;
TFSState pitch;
TFSState yaw;
@@ -139,20 +139,20 @@ void FTNoIR_Protocol::sendHeadposeToGame(const double *headpose ) {
prevRotZ = virtRotZ;
}
-bool FTNoIR_Protocol::checkServerInstallationOK()
+bool FTNoIR_Protocol::correct()
{
- qDebug() << "checkServerInstallationOK says: Starting Function";
+ qDebug() << "correct says: Starting Function";
//
// Load the DLL.
//
FSUIPCLib.setFileName( s.LocationOfDLL );
if (FSUIPCLib.load() != true) {
- qDebug() << "checkServerInstallationOK says: Error loading FSUIPC DLL";
+ qDebug() << "correct says: Error loading FSUIPC DLL";
return false;
}
else {
- qDebug() << "checkServerInstallationOK says: FSUIPC DLL loaded.";
+ qDebug() << "correct says: FSUIPC DLL loaded.";
}
return true;
diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h
index bde16d8f..06428df3 100644
--- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h
+++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h
@@ -67,9 +67,9 @@ class FTNoIR_Protocol : public IProtocol
public:
FTNoIR_Protocol();
~FTNoIR_Protocol() override;
- bool checkServerInstallationOK();
- void sendHeadposeToGame(const double* headpose);
- QString getGameName() {
+ bool correct();
+ void pose(const double* headpose);
+ QString game_name() {
return "Microsoft Flight Simulator X";
}
private:
@@ -79,13 +79,13 @@ private:
settings s;
};
-class FSUIPCControls: public QWidget, public IProtocolDialog
+class FSUIPCControls: public IProtocolDialog
{
Q_OBJECT
public:
FSUIPCControls();
- void registerProtocol(IProtocol *) {}
- void unRegisterProtocol() {}
+ void register_protocol(IProtocol *) {}
+ void unregister_protocol() {}
private:
Ui::UICFSUIPCControls ui;
settings s;
@@ -98,10 +98,8 @@ private slots:
class FTNoIR_ProtocolDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FS2002/FS2004"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FSUIPC"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft FS2004 protocol"); }
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/fs9.png"); }
+ QString name() { return QString("FSUIPC -- Microsoft FS2002/FS2004"); }
+ QIcon icon() { return QIcon(":/images/fs9.png"); }
};
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
index ae23be3c..c0a186ff 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
@@ -28,13 +28,12 @@
#include "ftnoir_csv/csv.h"
FTNoIR_Protocol::FTNoIR_Protocol() :
- shm(FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap))
+ pMemData((FTHeap*) shm.ptr()),
+ shm(FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap)),
+ viewsStart(nullptr),
+ viewsStop(nullptr),
+ intGameID(0)
{
- pMemData = (FTHeap*) shm.ptr();
- ProgramName = "";
- intGameID = 0;
- viewsStart = 0;
- viewsStop = 0;
}
FTNoIR_Protocol::~FTNoIR_Protocol()
@@ -48,7 +47,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
dummyTrackIR.waitForFinished(50);
}
-void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) {
+void FTNoIR_Protocol::pose(const double* headpose) {
float yaw = getRadsFromDegrees(headpose[Yaw]);
float pitch = getRadsFromDegrees(headpose[Pitch]);
float roll = getRadsFromDegrees(headpose[Roll]);
@@ -128,7 +127,7 @@ void FTNoIR_Protocol::start_dummy() {
dummyTrackIR.start();
}
-bool FTNoIR_Protocol::checkServerInstallationOK()
+bool FTNoIR_Protocol::correct()
{
QSettings settings("Freetrack", "FreetrackClient"); // Registry settings (in HK_USER)
QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER)
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h
index 5a9e5cdd..51079f20 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h
@@ -60,42 +60,38 @@ class FTNoIR_Protocol : public IProtocol
public:
FTNoIR_Protocol();
~FTNoIR_Protocol() override;
- bool checkServerInstallationOK( );
- void sendHeadposeToGame( const double *headpose );
- QString getGameName() {
+ bool correct( );
+ void pose( const double *headpose );
+ QString game_name() override {
QMutexLocker foo(&game_name_mutex);
return connected_game;
}
private:
- importTIRViewsStart viewsStart;
- importTIRViewsStop viewsStop;
-
+ settings s;
FTHeap *pMemData;
- QString game_name;
PortableLockedShm shm;
- QString ProgramName;
QLibrary FTIRViewsLib;
QProcess dummyTrackIR;
- static inline double getRadsFromDegrees ( double degrees )
- {
- return degrees * 0.017453;
- }
+ importTIRViewsStart viewsStart;
+ importTIRViewsStop viewsStop;
+
int intGameID;
- void start_tirviews();
- void start_dummy();
QString connected_game;
QMutex game_name_mutex;
- settings s;
+
+ static inline double getRadsFromDegrees(double degrees) { return degrees * 0.017453; }
+ void start_tirviews();
+ void start_dummy();
};
-class FTControls: public QWidget, public IProtocolDialog
+class FTControls: public IProtocolDialog
{
Q_OBJECT
public:
- explicit FTControls();
- void registerProtocol(IProtocol *) {}
- void unRegisterProtocol() {}
+ FTControls();
+ void register_protocol(IProtocol *) {}
+ void unregister_protocol() {}
private:
Ui::UICFTControls ui;
settings s;
@@ -108,8 +104,6 @@ private slots:
class FTNoIR_ProtocolDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack 2.0"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack 2.0"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Enhanced FreeTrack protocol"); }
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/freetrack.png"); }
+ QString name() { return QString("freetrack 2.0 Enhanced"); }
+ QIcon icon() { return QIcon(":/images/freetrack.png"); }
};
diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp
index ccff1ba5..c8759bc1 100644
--- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp
+++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp
@@ -33,7 +33,7 @@ FTNoIR_Protocol::FTNoIR_Protocol()
{
}
-void FTNoIR_Protocol::sendHeadposeToGame(const double *headpose) {
+void FTNoIR_Protocol::pose(const double *headpose) {
int destPort = s.port;
QHostAddress destIP(QString("%1.%2.%3.%4").arg(
QString::number(static_cast<int>(s.ip1)),
@@ -43,7 +43,7 @@ void FTNoIR_Protocol::sendHeadposeToGame(const double *headpose) {
outSocket.writeDatagram((const char *) headpose, sizeof( double[6] ), destIP, destPort);
}
-bool FTNoIR_Protocol::checkServerInstallationOK()
+bool FTNoIR_Protocol::correct()
{
return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
}
diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h
index c14a7dba..587f0034 100644
--- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h
+++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h
@@ -53,9 +53,9 @@ class FTNoIR_Protocol : public IProtocol
{
public:
FTNoIR_Protocol();
- bool checkServerInstallationOK();
- void sendHeadposeToGame(const double *headpose);
- QString getGameName() {
+ bool correct();
+ void pose(const double *headpose);
+ QString game_name() {
return "UDP Tracker";
}
private:
@@ -64,13 +64,13 @@ private:
};
// Widget that has controls for FTNoIR protocol client-settings.
-class FTNControls: public QWidget, public IProtocolDialog
+class FTNControls: public IProtocolDialog
{
Q_OBJECT
public:
FTNControls();
- void registerProtocol(IProtocol *) {}
- void unRegisterProtocol() {}
+ void register_protocol(IProtocol *) {}
+ void unregister_protocol() {}
private:
Ui::UICFTNControls ui;
settings s;
@@ -82,9 +82,6 @@ private slots:
class FTNoIR_ProtocolDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("UDP"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("UDP"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("opentrack UDP protocol"); }
-
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/facetracknoir.png"); }
+ QString name() { return QString("UDP receiver"); }
+ QIcon icon() { return QIcon(":/images/facetracknoir.png"); }
};
diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp
index 8af12ad7..4637223d 100644
--- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp
+++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp
@@ -25,8 +25,7 @@
#include "ftnoir_protocol_ftn.h"
#include "facetracknoir/plugin-support.h"
-FTNControls::FTNControls() :
- QWidget()
+FTNControls::FTNControls()
{
ui.setupUi( this );
diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp
index 1840fa03..8b7db62a 100644
--- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp
+++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp
@@ -69,7 +69,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
libevdev_free(dev);
}
-void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) {
+void FTNoIR_Protocol::pose(const double* headpose) {
static const int axes[] = {
/* translation goes first */
ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ
diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h
index e613885a..af6b3142 100644
--- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h
+++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h
@@ -20,11 +20,11 @@ class FTNoIR_Protocol : public IProtocol
public:
FTNoIR_Protocol();
~FTNoIR_Protocol() override;
- bool checkServerInstallationOK() {
+ bool correct() {
return dev != NULL;
}
- void sendHeadposeToGame(const double *headpose);
- QString getGameName() {
+ void pose(const double *headpose);
+ QString game_name() {
return "Virtual joystick for Linux";
}
private:
@@ -32,14 +32,13 @@ private:
struct libevdev_uinput* uidev;
};
-class LibevdevControls: public QWidget, public IProtocolDialog
+class LibevdevControls: public IProtocolDialog
{
Q_OBJECT
public:
-
- explicit LibevdevControls();
- void registerProtocol(IProtocol *) {}
- void unRegisterProtocol() {}
+ LibevdevControls();
+ void register_protocol(IProtocol *) {}
+ void unregister_protocol() {}
private:
Ui::UICLibevdevControls ui;
@@ -50,18 +49,9 @@ private slots:
void doCancel();
};
-//*******************************************************************************************************
-// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
-//*******************************************************************************************************
class FTNoIR_ProtocolDll : public Metadata
{
public:
- FTNoIR_ProtocolDll();
- ~FTNoIR_ProtocolDll();
-
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("libevdev"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("libevdev"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("libevdev"); }
-
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/linux.png"); }
+ QString name() { return QString("libevdev joystick receiver"); }
+ QIcon icon() { return QIcon(":/images/linux.png"); }
};
diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp
index d522610b..15e8097c 100644
--- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp
+++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp
@@ -1,7 +1,7 @@
#include "ftnoir_protocol_libevdev.h"
#include "facetracknoir/plugin-support.h"
-LibevdevControls::LibevdevControls() : QWidget()
+LibevdevControls::LibevdevControls()
{
ui.setupUi( this );
connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp
index e258b077..75898715 100644
--- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp
+++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp
@@ -2,14 +2,6 @@
#include <QDebug>
#include "facetracknoir/plugin-support.h"
-FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
-}
-
-FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
-{
-
-}
-
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new FTNoIR_ProtocolDll;
diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp
index 47f7a67e..ca3ba805 100644
--- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp
+++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp
@@ -29,7 +29,7 @@
#include "ftnoir_protocol_mouse.h"
#include "facetracknoir/plugin-support.h"
-void FTNoIR_Protocol::sendHeadposeToGame(const double *headpose ) {
+void FTNoIR_Protocol::pose(const double *headpose ) {
double fMouse_X = 0;
double fMouse_Y = 0;
@@ -58,7 +58,7 @@ void FTNoIR_Protocol::reload()
s.b->reload();
}
-bool FTNoIR_Protocol::checkServerInstallationOK()
+bool FTNoIR_Protocol::correct()
{
return true;
}
diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h
index 8f1f3ff1..55a37e12 100644
--- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h
+++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h
@@ -60,9 +60,9 @@ class FTNoIR_Protocol : public IProtocol
{
public:
FTNoIR_Protocol() {}
- bool checkServerInstallationOK();
- void sendHeadposeToGame( const double *headpose);
- QString getGameName() {
+ bool correct();
+ void pose( const double *headpose);
+ QString game_name() {
return "Mouse tracker";
}
void reload();
@@ -70,15 +70,15 @@ private:
struct settings s;
};
-class MOUSEControls: public QWidget, public IProtocolDialog
+class MOUSEControls: public IProtocolDialog
{
Q_OBJECT
public:
MOUSEControls();
- void registerProtocol(IProtocol *protocol) {
+ void register_protocol(IProtocol *protocol) {
_proto = (FTNoIR_Protocol *) protocol;
}
- void unRegisterProtocol() {
+ void unregister_protocol() {
_proto = NULL;
}
private:
@@ -93,10 +93,8 @@ private slots:
class FTNoIR_ProtocolDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look protocol"); }
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/mouse.png"); }
+ QString name() { return QString("mouse emulation"); }
+ QIcon icon() { return QIcon(":/images/mouse.png"); }
};
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
index 72b800d2..b56585df 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp
@@ -68,7 +68,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
}
}
-void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) {
+void FTNoIR_Protocol::pose( const double *headpose ) {
virtSCRotX = -headpose[Pitch]; // degrees
virtSCRotY = -headpose[Yaw];
virtSCRotZ = headpose[Roll];
@@ -134,7 +134,7 @@ private:
HANDLE hactctx;
};
-bool FTNoIR_Protocol::checkServerInstallationOK()
+bool FTNoIR_Protocol::correct()
{
if (!SCClientLib.isLoaded())
{
@@ -152,17 +152,17 @@ bool FTNoIR_Protocol::checkServerInstallationOK()
//
simconnect_open = (importSimConnect_Open) SCClientLib.resolve("SimConnect_Open");
if (simconnect_open == NULL) {
- qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect_Open function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::correct() 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::checkServerInstallationOK() says: SimConnect_CameraSetRelative6DOF function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::correct() 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::checkServerInstallationOK() says: SimConnect_Close function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::correct() says: SimConnect_Close function not found in DLL!";
return false;
}
@@ -170,35 +170,35 @@ bool FTNoIR_Protocol::checkServerInstallationOK()
simconnect_calldispatch = (importSimConnect_CallDispatch) SCClientLib.resolve("SimConnect_CallDispatch");
if (simconnect_calldispatch == NULL) {
- qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect_CallDispatch function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::correct() 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::checkServerInstallationOK() says: SimConnect_SubscribeToSystemEvent function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::correct() 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::checkServerInstallationOK() says: SimConnect_MapClientEventToSimEvent function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::correct() 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::checkServerInstallationOK() says: SimConnect_AddClientEventToNotificationGroup function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::correct() 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::checkServerInstallationOK() says: SimConnect_SetNotificationGroupPriority function not found in DLL!";
+ qDebug() << "FTNoIR_Protocol::correct() says: SimConnect_SetNotificationGroupPriority function not found in DLL!";
return false;
}
- qDebug() << "FTNoIR_Protocol::checkServerInstallationOK() says: SimConnect functions resolved in DLL!";
+ qDebug() << "FTNoIR_Protocol::correct() says: SimConnect functions resolved in DLL!";
return true;
}
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h
index 02cb7b0e..784c915c 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h
@@ -89,9 +89,9 @@ class FTNoIR_Protocol : public IProtocol
public:
FTNoIR_Protocol();
~FTNoIR_Protocol() override;
- bool checkServerInstallationOK();
- void sendHeadposeToGame(const double* headpose);
- QString getGameName() {
+ bool correct();
+ void pose(const double* headpose);
+ QString game_name() {
return "FS2004/FSX";
}
private:
@@ -127,13 +127,13 @@ private:
settings s;
};
-class SCControls: public QWidget, public IProtocolDialog
+class SCControls: public IProtocolDialog
{
Q_OBJECT
public:
SCControls();
- void registerProtocol(IProtocol *) {}
- void unRegisterProtocol() {}
+ void register_protocol(IProtocol *) {}
+ void unregister_protocol() {}
private:
Ui::UICSCControls ui;
settings s;
@@ -145,8 +145,6 @@ private slots:
class FTNoIR_ProtocolDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FSX SimConnect"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("SimConnect"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft SimConnect protocol"); }
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/fsx.png"); }
+ QString name() { return QString("Microsoft FSX SimConnect"); }
+ QIcon icon() { return QIcon(":/images/fsx.png"); }
};
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp
index 58fa2ab1..c29eb11e 100644
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp
+++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp
@@ -12,7 +12,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
VJoy_Shutdown();
}
-void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) {
+void FTNoIR_Protocol::pose( const double *headpose ) {
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
JOYSTICK_STATE state[2] = { 0 };
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h
index eac3c610..e9a6e704 100644
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h
+++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h
@@ -37,25 +37,25 @@ class FTNoIR_Protocol : public IProtocol
public:
FTNoIR_Protocol();
~FTNoIR_Protocol() override;
- bool checkServerInstallationOK() {
+ bool correct() {
return true;
}
- void sendHeadposeToGame( const double *headpose );
- QString getGameName() {
+ void pose( const double *headpose );
+ QString game_name() {
return "Virtual joystick";
}
private:
};
// Widget that has controls for FTNoIR protocol client-settings.
-class VJoyControls: public QWidget, public IProtocolDialog
+class VJoyControls: public IProtocolDialog
{
Q_OBJECT
public:
explicit VJoyControls();
- void registerProtocol(IProtocol *) {}
- void unRegisterProtocol() {}
+ void register_protocol(IProtocol *) {}
+ void unregister_protocol() {}
private:
Ui::UICVJoyControls ui;
@@ -69,14 +69,8 @@ private slots:
class FTNoIR_ProtocolDll : public Metadata
{
public:
- FTNoIR_ProtocolDll();
- ~FTNoIR_ProtocolDll();
-
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("VJoy"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("VJoy"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("VJoy"); }
-
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/vjoy.png"); }
+ QString name() { return QString("Joystick emulation -- VJoy"); }
+ QIcon icon() { return QIcon(":/images/vjoy.png"); }
};
#define VJOY_AXIS_MIN -32768
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp
index 367a0df6..cdfdc361 100644
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp
+++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp
@@ -2,14 +2,6 @@
#include <QDebug>
#include "facetracknoir/plugin-support.h"
-FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
-}
-
-FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
-{
-
-}
-
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new FTNoIR_ProtocolDll;
diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
index 29a2a70c..db030554 100644
--- a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
+++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
@@ -29,7 +29,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
//shm_unlink("/" WINE_SHM_NAME);
}
-void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) {
+void FTNoIR_Protocol::pose( const double *headpose ) {
if (shm)
{
lck_shm.lock();
@@ -51,7 +51,7 @@ void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) {
}
}
-bool FTNoIR_Protocol::checkServerInstallationOK()
+bool FTNoIR_Protocol::correct()
{
return lck_shm.success();
}
diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.h b/ftnoir_protocol_wine/ftnoir_protocol_wine.h
index 9a7fb7d5..685c3010 100644
--- a/ftnoir_protocol_wine/ftnoir_protocol_wine.h
+++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.h
@@ -18,9 +18,9 @@ public:
FTNoIR_Protocol();
~FTNoIR_Protocol() override;
- bool checkServerInstallationOK();
- void sendHeadposeToGame(const double* headpose);
- QString getGameName() {
+ bool correct();
+ void pose(const double* headpose);
+ QString game_name() {
QMutexLocker foo(&game_name_mutex);
return connected_game;
}
@@ -33,13 +33,13 @@ private:
QMutex game_name_mutex;
};
-class FTControls: public QWidget, public IProtocolDialog
+class FTControls: public IProtocolDialog
{
Q_OBJECT
public:
FTControls();
- void registerProtocol(IProtocol *) {}
- void unRegisterProtocol() {}
+ void register_protocol(IProtocol *) {}
+ void unregister_protocol() {}
private:
Ui::UICFTControls ui;
@@ -52,12 +52,6 @@ private slots:
class FTNoIR_ProtocolDll : public Metadata
{
public:
- FTNoIR_ProtocolDll();
- ~FTNoIR_ProtocolDll();
-
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Wine"); }
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Wine"); }
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Wine glue wrapper"); }
-
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/wine.png"); }
+ QString name() { return QString("Wine -- Windows layer for Unix"); }
+ QIcon icon() { return QIcon(":/images/wine.png"); }
};
diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp
index c092de42..4e3d72ac 100644
--- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp
+++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp
@@ -2,7 +2,7 @@
#include <QDebug>
#include "facetracknoir/plugin-support.h"
-FTControls::FTControls() : QWidget()
+FTControls::FTControls()
{
ui.setupUi( this );
connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp
index c6e3d433..df26e49f 100644
--- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp
+++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp
@@ -1,14 +1,6 @@
#include "ftnoir_protocol_wine.h"
#include "facetracknoir/plugin-support.h"
-FTNoIR_ProtocolDll::FTNoIR_ProtocolDll()
-{
-}
-
-FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
-{
-}
-
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new FTNoIR_ProtocolDll;
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
index fa7bf398..066b782a 100644
--- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
+++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
@@ -117,7 +117,7 @@ Tracker::~Tracker()
qDebug() << "all done!";
}
-void Tracker::StartTracker(QFrame* videoframe)
+void Tracker::start_tracker(QFrame* videoframe)
{
videoframe->show();
videoWidget = new ArucoVideoWidget(videoframe);
@@ -398,7 +398,7 @@ void Tracker::run()
}
}
-void Tracker::GetHeadPoseData(double *data)
+void Tracker::data(double *data)
{
QMutexLocker lck(&mtx);
@@ -412,36 +412,11 @@ void Tracker::GetHeadPoseData(double *data)
class TrackerDll : public Metadata
{
- // ITrackerDll interface
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ QString name() { return QString("aruco -- paper marker tracker"); }
+ QIcon icon() { return QIcon(":/images/aruco.png"); }
};
//-----------------------------------------------------------------------------
-void TrackerDll::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = "aruco";
-}
-
-void TrackerDll::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = "aruco";
-}
-
-void TrackerDll::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = "";
-}
-
-void TrackerDll::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/aruco.png");
-}
-
-
-//-----------------------------------------------------------------------------
//#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0")
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
index 090cf478..67392d40 100644
--- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
+++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
@@ -47,8 +47,8 @@ class Tracker : protected QThread, public ITracker
public:
Tracker();
~Tracker() override;
- void StartTracker(QFrame* frame);
- void GetHeadPoseData(double *data);
+ void start_tracker(QFrame* frame);
+ void data(double *data);
void run();
void reload() { s.b->reload(); }
void getRT(cv::Matx33d &r, cv::Vec3d &t);
@@ -65,13 +65,13 @@ private:
cv::Vec3d t;
};
-class TrackerControls : public QWidget, public ITrackerDialog
+class TrackerControls : public ITrackerDialog
{
Q_OBJECT
public:
TrackerControls();
- void registerTracker(ITracker * x) { tracker = dynamic_cast<Tracker*>(x); }
- void unRegisterTracker() { tracker = nullptr; }
+ void register_tracker(ITracker * x) { tracker = static_cast<Tracker*>(x); }
+ void unregister_tracker() { tracker = nullptr; }
private:
Ui::Form ui;
Tracker* tracker;
diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp
index ad505229..0870e67d 100644
--- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp
+++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp
@@ -73,13 +73,13 @@ void TrackerImpl::run() {
}
}
-void TrackerImpl::StartTracker(QFrame*)
+void TrackerImpl::start_tracker(QFrame*)
{
(void) sock.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
start();
}
-void TrackerImpl::GetHeadPoseData(double *data)
+void TrackerImpl::data(double *data)
{
QMutexLocker foo(&mtx);
diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h
index de32e64b..92d42319 100644
--- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h
+++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h
@@ -27,8 +27,8 @@ class TrackerImpl : public ITracker, private QThread
public:
TrackerImpl();
~TrackerImpl() override;
- void StartTracker(QFrame *);
- void GetHeadPoseData(double *data);
+ void start_tracker(QFrame *);
+ void data(double *data);
protected:
void run() override;
private:
@@ -39,13 +39,13 @@ private:
volatile bool should_quit;
};
-class TrackerDialog : public QWidget, public ITrackerDialog
+class TrackerDialog : public ITrackerDialog
{
Q_OBJECT
public:
TrackerDialog();
- void registerTracker(ITracker *) {}
- void unRegisterTracker() {}
+ void register_tracker(ITracker *) {}
+ void unregister_tracker() {}
private:
Ui::UI_freepie_udp_dialog ui;
settings s;
@@ -57,9 +57,7 @@ private slots:
class TrackerMeta : public Metadata
{
public:
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ QString name() { return QString("FreePIE UDP receiver"); }
+ QIcon icon() { return QIcon(":/glovepie.png"); }
};
diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp
index afcc8c6e..3c7fce9a 100644
--- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp
+++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp
@@ -1,26 +1,6 @@
#include "ftnoir_tracker_freepie-udp.h"
#include "facetracknoir/plugin-support.h"
-void TrackerMeta::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = "FreePIE UDP";
-}
-
-void TrackerMeta::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = "FreePIE";
-}
-
-void TrackerMeta::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = "FreePIE UDP";
-}
-
-void TrackerMeta::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/glovepie.png");
-}
-
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new TrackerMeta;
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
index a1cb33a5..13b6aabb 100644
--- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
+++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
@@ -161,7 +161,7 @@ Tracker::~Tracker()
delete videoWidget;
}
-void Tracker::StartTracker(QFrame* videoframe)
+void Tracker::start_tracker(QFrame* videoframe)
{
videoframe->show();
videoWidget = new HTVideoWidget(videoframe);
@@ -185,7 +185,7 @@ void Tracker::StartTracker(QFrame* videoframe)
#endif
}
-void Tracker::GetHeadPoseData(double *data)
+void Tracker::data(double *data)
{
lck_shm.lock();
shm->timer = 0;
@@ -208,27 +208,6 @@ void Tracker::GetHeadPoseData(double *data)
lck_shm.unlock();
}
-//-----------------------------------------------------------------------------
-void TrackerDll::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = "HT face tracker";
-}
-
-void TrackerDll::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = "HT";
-}
-
-void TrackerDll::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = "";
-}
-
-void TrackerDll::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/ht.png");
-}
-
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new TrackerDll;
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h
index ea2cb75e..119ffa7d 100644
--- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h
+++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h
@@ -37,8 +37,8 @@ class Tracker : public QObject, public ITracker
public:
Tracker();
~Tracker() override;
- void StartTracker(QFrame* frame);
- void GetHeadPoseData(double *data);
+ void start_tracker(QFrame* frame);
+ void data(double *data);
void load_settings(ht_config_t* config);
private:
settings s;
@@ -50,13 +50,13 @@ private:
};
// Widget that has controls for FTNoIR protocol client-settings.
-class TrackerControls : public QWidget, public ITrackerDialog
+class TrackerControls : public ITrackerDialog
{
Q_OBJECT
public:
explicit TrackerControls();
- void registerTracker(ITracker *) {}
- void unRegisterTracker() {}
+ void register_tracker(ITracker *) {}
+ void unregister_tracker() {}
private:
Ui::Form ui;
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h b/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h
index 66e57100..d684f72f 100644
--- a/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h
+++ b/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h
@@ -1,18 +1,7 @@
-/* Copyright (c) 2013 Stanisław Halik <sthalik@misaki.pl>
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- */
-
#include "facetracknoir/plugin-api.hpp"
-//-----------------------------------------------------------------------------
class TrackerDll : public Metadata
{
- // ITrackerDll interface
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ QString name() { return QString("ht -- face tracker"); }
+ QIcon icon() { return QIcon(":/images/ht.png"); }
};
diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
index b7d078c2..b7f088e9 100644
--- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
+++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
@@ -19,12 +19,12 @@ Hydra_Tracker::~Hydra_Tracker()
sixenseExit();
}
-void Hydra_Tracker::StartTracker(QFrame*)
+void Hydra_Tracker::start_tracker(QFrame*)
{
sixenseInit();
}
-void Hydra_Tracker::GetHeadPoseData(double *data)
+void Hydra_Tracker::data(double *data)
{
sixenseSetActiveBase(0);
diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h
index 672efa28..a498a1cb 100644
--- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h
+++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h
@@ -15,21 +15,21 @@ class Hydra_Tracker : public ITracker
public:
Hydra_Tracker();
~Hydra_Tracker();
- void StartTracker(QFrame *) override;
- void GetHeadPoseData(double *data) override;
+ void start_tracker(QFrame *) override;
+ void data(double *data) override;
volatile bool should_quit;
private:
settings s;
QMutex mutex;
};
-class TrackerControls: public QWidget, public ITrackerDialog
+class TrackerControls: public ITrackerDialog
{
Q_OBJECT
public:
- explicit TrackerControls();
- void registerTracker(ITracker *) {}
- void unRegisterTracker() {}
+ TrackerControls();
+ void register_tracker(ITracker *) {}
+ void unregister_tracker() {}
private:
settings s;
Ui::UIHydraControls ui;
@@ -41,9 +41,7 @@ private slots:
class FTNoIR_TrackerDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ QString name() { return QString("Razer Hydra -- inertial device"); }
+ QIcon icon() { return QIcon(":/images/facetracknoir.png"); }
};
diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp
index 18efea05..871312d1 100644
--- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp
+++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp
@@ -3,26 +3,6 @@
#include <QDebug>
#include "facetracknoir/plugin-support.h"
-void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = "Hydra";
-}
-
-void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = "Hydra";
-}
-
-void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = "Hydra";
-}
-
-void FTNoIR_TrackerDll::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/facetracknoir.png");
-}
-
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new FTNoIR_TrackerDll;
diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
index bb1076dd..97f36b67 100644
--- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
+++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
@@ -25,7 +25,7 @@ void FTNoIR_Tracker::reload()
g_pJoystick = nullptr;
g_pDI = nullptr;
- StartTracker(frame);
+ start_tracker(frame);
}
FTNoIR_Tracker::~FTNoIR_Tracker()
@@ -81,7 +81,7 @@ static BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance
return stop ? DIENUM_STOP : DIENUM_CONTINUE;
}
-void FTNoIR_Tracker::StartTracker(QFrame* frame)
+void FTNoIR_Tracker::start_tracker(QFrame* frame)
{
QMutexLocker foo(&mtx);
this->frame = frame;
@@ -144,7 +144,7 @@ fail:
qDebug() << "joy init failure";
}
-void FTNoIR_Tracker::GetHeadPoseData(double *data)
+void FTNoIR_Tracker::data(double *data)
{
QMutexLocker foo(&mtx);
DIJOYSTATE js = {0};
diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h
index 04a933db..03bcc383 100644
--- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h
+++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h
@@ -43,8 +43,8 @@ class FTNoIR_Tracker : public ITracker
public:
FTNoIR_Tracker();
~FTNoIR_Tracker();
- void StartTracker(QFrame *frame);
- void GetHeadPoseData(double *data);
+ void start_tracker(QFrame *frame);
+ void data(double *data);
void reload();
LPDIRECTINPUT8 g_pDI;
LPDIRECTINPUTDEVICE8 g_pJoystick;
@@ -56,17 +56,13 @@ public:
static constexpr int AXIS_MAX = 65535;
};
-class TrackerControls: public QWidget, public ITrackerDialog
+class TrackerControls: public ITrackerDialog
{
Q_OBJECT
public:
TrackerControls();
- void registerTracker(ITracker *foo) {
- tracker = dynamic_cast<FTNoIR_Tracker*>(foo);
- }
- void unRegisterTracker() {
- tracker = NULL;
- }
+ void register_tracker(ITracker *foo) {}
+ void unregister_tracker() {}
QList<GUID> guids;
Ui::UIJoystickControls ui;
FTNoIR_Tracker* tracker;
@@ -79,13 +75,7 @@ private slots:
class FTNoIR_TrackerDll : public Metadata
{
public:
- 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;
+ QString name() { return QString("Joystick input"); }
+ QIcon icon() { return QIcon(":/images/facetracknoir.png"); }
};
diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp
index af1a9679..c2328a90 100644
--- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp
+++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp
@@ -1,27 +1,6 @@
#include "ftnoir_tracker_joystick.h"
-#include <QDebug>
#include "facetracknoir/plugin-support.h"
-void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = "Joystick";
-}
-
-void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = "Joystick";
-}
-
-void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = "Joystick";
-}
-
-void FTNoIR_TrackerDll::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/facetracknoir.png");
-}
-
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new FTNoIR_TrackerDll;
diff --git a/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp b/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp
index 8bb35314..13669cf9 100644
--- a/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp
+++ b/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.cpp
@@ -15,38 +15,43 @@
static const int ot_libevdev_joystick_axes[6] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ };
-FTNoIR_Tracker::FTNoIR_Tracker() : node(nullptr), success(false)
+FTNoIR_Tracker::FTNoIR_Tracker() : node(nullptr), success(false), should_quit(false)
{
}
FTNoIR_Tracker::~FTNoIR_Tracker()
{
+ if (success)
+ {
+ should_quit = true;
+ wait();
+ }
if (node)
libevdev_free(node);
if (fd != -1)
close(fd);
}
-void FTNoIR_Tracker::StartTracker(QFrame*)
+void FTNoIR_Tracker::start_tracker(QFrame*)
{
QString node_name = s.device_name;
std::string str = (QString("/dev/input/by-id/") + node_name).toStdString();
const char* filename = str.c_str();
-
- fd = open(filename, O_NONBLOCK, O_RDWR);
+
+ fd = open(filename, 0, O_RDWR);
if (fd == -1)
{
qDebug() << "error opening" << filename;
return;
}
-
+
int ret = libevdev_new_from_fd(fd, &node);
if (ret)
{
qDebug() << "libevdev open error" << ret;
return;
}
-
+
for (int i = 0; i < 6; i++)
{
// no error checking here, errors result in SIGFPE
@@ -54,32 +59,65 @@ void FTNoIR_Tracker::StartTracker(QFrame*)
a_max[i] = libevdev_get_abs_maximum(node, ot_libevdev_joystick_axes[i]);
qDebug() << "axis limits" << i << a_min[i] << "->" << a_max[i];
}
-
+
success = true;
+
+ QThread::start();
}
-void FTNoIR_Tracker::GetHeadPoseData(double *data)
+void FTNoIR_Tracker::run()
{
- if (node)
+ bool absp = libevdev_has_event_code(node, EV_ABS, ABS_X) &&
+ !libevdev_has_event_code(node, EV_REL, ABS_X);
+ while (!should_quit)
{
- while (libevdev_has_event_pending(node) == 1)
+ struct input_event ev;
+ int status = libevdev_next_event(node, LIBEVDEV_READ_FLAG_NORMAL, &ev);
+ if (status != LIBEVDEV_READ_STATUS_SUCCESS)
+ continue;
+ if (absp)
{
- struct input_event ev;
- int status = libevdev_next_event(node, LIBEVDEV_READ_FLAG_NORMAL, &ev);
- if (status != LIBEVDEV_READ_STATUS_SUCCESS)
- continue;
if (ev.type == EV_ABS)
{
- const int val = ev.value, code = ev.code;
+ const int code = ev.code;
for (int i = 0; i < 6; i++)
{
if (ot_libevdev_joystick_axes[i] == code)
{
- data[i] = (val - a_min[i])*(i >= Yaw ? 180. : 100.) / a_max[i] - a_min[i];
+ QMutexLocker l(&mtx);
+ values[i] = ev.value;
break;
}
}
}
+ } else {
+ if (ev.type == EV_REL)
+ {
+ const int code = ev.code;
+ for (int i = 0; i < 6; i++)
+ {
+ if (ot_libevdev_joystick_axes[i] == code)
+ {
+ QMutexLocker l(&mtx);
+ values[i] += ev.value;
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+void FTNoIR_Tracker::data(double *data)
+{
+ if (node)
+ {
+ QMutexLocker l(&mtx);
+ for (int i = 0; i < 6; i++)
+ {
+ int val = values[i];
+ double v = (val - a_min[i])*(i >= Yaw ? 180. : 100.) / a_max[i] - a_min[i];
+ data[i] = v;
}
}
}
diff --git a/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.h b/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.h
index 2474fb35..4251435c 100644
--- a/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.h
+++ b/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev.h
@@ -4,6 +4,9 @@
#include "facetracknoir/plugin-api.hpp"
#include "facetracknoir/options.h"
#include "./ui_ftnoir_libevdev.h"
+#include <QThread>
+#include <QMutex>
+#include <QMutexLocker>
using namespace options;
struct settings {
@@ -15,41 +18,42 @@ struct settings {
{}
};
-class FTNoIR_Tracker : public ITracker
+class FTNoIR_Tracker : public ITracker, private QThread
{
public:
- FTNoIR_Tracker();
+ FTNoIR_Tracker();
~FTNoIR_Tracker() override;
- void StartTracker(QFrame *);
- void GetHeadPoseData(double *data);
+ void start_tracker(QFrame *);
+ void data(double *data);
private:
+ void run() override;
struct libevdev* node;
int fd;
settings s;
bool success;
- int a_min[6], a_max[6];
+ int a_min[6], a_max[6], values[6];
+ QMutex mtx;
+ volatile bool should_quit;
};
-class TrackerControls: public QWidget, public ITrackerDialog
+class TrackerControls: public ITrackerDialog
{
Q_OBJECT
public:
- TrackerControls();
- void registerTracker(ITracker *) {}
- void unRegisterTracker() {}
+ TrackerControls();
+ void register_tracker(ITracker *) {}
+ void unregister_tracker() {}
private:
- Ui::ui_libevdev_tracker_dialog ui;
+ Ui::ui_libevdev_tracker_dialog ui;
settings s;
private slots:
- void doOK();
- void doCancel();
+ void doOK();
+ void doCancel();
};
class FTNoIR_TrackerDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ QString name() { return QString("libevdev joystick input"); }
+ QIcon icon() { return QIcon(":/images/facetracknoir.png"); }
};
diff --git a/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev_dll.cpp b/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev_dll.cpp
index 6ad13c8c..e6216d7f 100644
--- a/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev_dll.cpp
+++ b/ftnoir_tracker_libevdev/ftnoir_tracker_libevdev_dll.cpp
@@ -1,26 +1,6 @@
#include "ftnoir_tracker_libevdev.h"
#include "facetracknoir/plugin-support.h"
-void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = "Joystick";
-}
-
-void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = "Joystick";
-}
-
-void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = "Joystick";
-}
-
-void FTNoIR_TrackerDll::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/facetracknoir.png");
-}
-
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new FTNoIR_TrackerDll;
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
index cb4a6e21..9b3795b9 100644
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
@@ -147,12 +147,12 @@ void Tracker::center()
{
point_tracker.reset(); // we also do a reset here since there is no reset shortkey yet
QMutexLocker lock(&mutex);
- FrameTrafo X_CM_0 = point_tracker.get_pose();
+ FrameTrafo X_CM_0 = point_tracker.pose();
FrameTrafo X_MH(Matx33f::eye(), t_MH);
X_GH_0 = R_GC * X_CM_0 * X_MH;
}
-void Tracker::StartTracker(QFrame *parent_window)
+void Tracker::start_tracker(QFrame *parent_window)
{
this->video_frame = parent_window;
video_frame->setAttribute(Qt::WA_NativeWindow);
@@ -180,12 +180,12 @@ void Tracker::StopTracker(bool exit)
#define THeadPoseData double
#endif
-void Tracker::GetHeadPoseData(THeadPoseData *data)
+void Tracker::data(THeadPoseData *data)
{
{
QMutexLocker lock(&mutex);
- FrameTrafo X_CM = point_tracker.get_pose();
+ FrameTrafo X_CM = point_tracker.pose();
FrameTrafo X_MH(Matx33f::eye(), t_MH);
FrameTrafo X_GH = R_GC * X_CM * X_MH;
Matx33f R = X_GH.R * X_GH_0.R.t();
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h
index fff8d4ab..4295b6f9 100644
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h
@@ -38,15 +38,15 @@ class Tracker : public ITracker, protected QThread
public:
Tracker();
~Tracker() override;
- void StartTracker(QFrame* parent_window) override;
- void GetHeadPoseData(double* data) override;
+ void start_tracker(QFrame* parent_window) override;
+ void data(double* data) override;
void apply(settings& s);
void apply_inner();
void center();
void reset(); // reset the trackers internal state variables
- void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); }
+ void pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.pose(); }
int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); }
void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); }
protected:
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp
index 981cbea0..a15e97b9 100644
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp
@@ -180,7 +180,7 @@ void TrackerDialog::trans_calib_step()
if (tracker)
{
FrameTrafo X_CM;
- tracker->get_pose(&X_CM);
+ tracker->pose(&X_CM);
trans_calib.update(X_CM.R, X_CM.t);
cv::Vec3f t_MH = trans_calib.get_estimate();
s.t_MH_x = t_MH[0];
@@ -234,7 +234,7 @@ void TrackerDialog::doCancel()
close();
}
-void TrackerDialog::registerTracker(ITracker *t)
+void TrackerDialog::register_tracker(ITracker *t)
{
qDebug()<<"TrackerDialog:: Tracker registered";
tracker = static_cast<Tracker*>(t);
@@ -244,7 +244,7 @@ void TrackerDialog::registerTracker(ITracker *t)
//ui.center_button->setEnabled(true);
}
-void TrackerDialog::unRegisterTracker()
+void TrackerDialog::unregister_tracker()
{
qDebug()<<"TrackerDialog:: Tracker un-registered";
tracker = NULL;
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h
index bff12dd0..8b6309da 100644
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h
@@ -23,13 +23,13 @@
//-----------------------------------------------------------------------------
// The dialog that shows up when the user presses "Settings"
-class TrackerDialog : public QWidget, public ITrackerDialog
+class TrackerDialog : public ITrackerDialog
{
Q_OBJECT
public:
TrackerDialog();
- void registerTracker(ITracker *tracker) override;
- void unRegisterTracker() override;
+ void register_tracker(ITracker *tracker) override;
+ void unregister_tracker() override;
void save();
void trans_calib_step();
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp
index fb756a86..9b73ee37 100644
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp
@@ -8,28 +8,6 @@
#include "ftnoir_tracker_pt_dll.h"
#include <QIcon>
-//-----------------------------------------------------------------------------
-void TrackerDll::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = "PointTracker 1.1";
-}
-
-void TrackerDll::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = "PointTracker";
-}
-
-void TrackerDll::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = "Tracks a 3-point model with know geometry like Freetrack / TrackIR";
-}
-
-void TrackerDll::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/Resources/Logo_IR.png");
-}
-
-
#ifdef OPENTRACK_API
# include "facetracknoir/plugin-support.h"
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h
index 50f66a35..d9b9adf6 100644
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h
@@ -19,8 +19,6 @@ class TrackerDll :
public ITrackerDll
#endif
{
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ QString name() { return QString("PointTracker 1.1"); }
+ QIcon icon() { return QIcon(":/Resources/Logo_IR.png"); }
};
diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h
index d65494a4..dac99b87 100644
--- a/ftnoir_tracker_pt/point_tracker.h
+++ b/ftnoir_tracker_pt/point_tracker.h
@@ -91,7 +91,7 @@ public:
// f : (focal length)/(sensor width)
// dt : time since last call
void track(const std::vector<cv::Vec2f>& projected_points, const PointModel& model);
- FrameTrafo get_pose() const { return X_CM; }
+ FrameTrafo pose() const { return X_CM; }
void reset();
private:
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
index 68a520ad..9f44c78e 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
@@ -17,7 +17,7 @@ Rift_Tracker::~Rift_Tracker()
ovr_Shutdown();
}
-void Rift_Tracker::StartTracker(QFrame*)
+void Rift_Tracker::start_tracker(QFrame*)
{
ovr_Initialize();
hmd = ovrHmd_Create(0);
@@ -34,7 +34,7 @@ void Rift_Tracker::StartTracker(QFrame*)
}
-void Rift_Tracker::GetHeadPoseData(double *data)
+void Rift_Tracker::data(double *data)
{
if (hmd)
{
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h
index b862555c..db14a536 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h
@@ -27,22 +27,22 @@ class Rift_Tracker : public ITracker
public:
Rift_Tracker();
~Rift_Tracker() override;
- void StartTracker(QFrame *) override;
- void GetHeadPoseData(double *data) override;
+ void start_tracker(QFrame *) override;
+ void data(double *data) override;
private:
double old_yaw;
ovrHmd hmd;
settings s;
};
-class TrackerControls: public QWidget, public ITrackerDialog
+class TrackerControls: public ITrackerDialog
{
Q_OBJECT
public:
- explicit TrackerControls();
+ TrackerControls();
- void registerTracker(ITracker *) {}
- void unRegisterTracker() {}
+ void register_tracker(ITracker *) {}
+ void unregister_tracker() {}
private:
Ui::UIRiftControls ui;
@@ -55,16 +55,7 @@ private slots:
class FTNoIR_TrackerDll : public Metadata
{
public:
- FTNoIR_TrackerDll();
- ~FTNoIR_TrackerDll();
- 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;
+ QString name() { return QString("Oculus Rift -- HMD"); }
+ QIcon icon() { return QIcon(":/images/rift_tiny.png"); }
};
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp
index 902c8051..fd50f75f 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp
@@ -3,38 +3,6 @@
#include <QDebug>
#include "facetracknoir/plugin-support.h"
-FTNoIR_TrackerDll::FTNoIR_TrackerDll() {
- //populate the description strings
- trackerFullName = "Rift";
- trackerShortName = "Rift";
- trackerDescription = "Rift";
-}
-
-FTNoIR_TrackerDll::~FTNoIR_TrackerDll()
-{
-
-}
-
-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/rift_tiny.png");
-}
-
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new FTNoIR_TrackerDll;
diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp
index 136e075d..cbea79a4 100644
--- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp
+++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp
@@ -23,13 +23,13 @@ void FTNoIR_Tracker::run() {
}
}
-void FTNoIR_Tracker::StartTracker(QFrame*)
+void FTNoIR_Tracker::start_tracker(QFrame*)
{
(void) sock.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
start();
}
-void FTNoIR_Tracker::GetHeadPoseData(double *data)
+void FTNoIR_Tracker::data(double *data)
{
QMutexLocker foo(&mutex);
for (int i = 0; i < 6; i++)
diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h
index a6f2e6d3..1ec63866 100644
--- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h
+++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h
@@ -21,8 +21,8 @@ class FTNoIR_Tracker : public ITracker, protected QThread
public:
FTNoIR_Tracker();
~FTNoIR_Tracker();
- void StartTracker(QFrame *);
- void GetHeadPoseData(double *data);
+ void start_tracker(QFrame *);
+ void data(double *data);
protected:
void run() override;
private:
@@ -33,13 +33,13 @@ private:
volatile bool should_quit;
};
-class TrackerControls: public QWidget, public ITrackerDialog
+class TrackerControls: public ITrackerDialog
{
Q_OBJECT
public:
TrackerControls();
- void registerTracker(ITracker *) {}
- void unRegisterTracker() {}
+ void register_tracker(ITracker *) {}
+ void unregister_tracker() {}
private:
Ui::UICFTNClientControls ui;
settings s;
@@ -51,8 +51,6 @@ private slots:
class FTNoIR_TrackerDll : public Metadata
{
public:
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ QString name() { return QString("UDP sender"); }
+ QIcon icon() { return QIcon(":/images/facetracknoir.png"); }
};
diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp
index 062b1899..0b4dd74e 100644
--- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp
+++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp
@@ -1,8 +1,7 @@
#include "ftnoir_tracker_udp.h"
#include "facetracknoir/plugin-support.h"
-TrackerControls::TrackerControls() :
-QWidget()
+TrackerControls::TrackerControls()
{
ui.setupUi( this );
diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp
index 7cd23552..d6cb5db3 100644
--- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp
+++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp
@@ -1,26 +1,6 @@
#include "ftnoir_tracker_udp.h"
#include "facetracknoir/plugin-support.h"
-void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled)
-{
- *strToBeFilled = "UDP";
-}
-
-void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled)
-{
- *strToBeFilled = "UDP";
-}
-
-void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled)
-{
- *strToBeFilled = "UDP";
-}
-
-void FTNoIR_TrackerDll::getIcon(QIcon *icon)
-{
- *icon = QIcon(":/images/facetracknoir.png");
-}
-
extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new FTNoIR_TrackerDll;