From ad37ec007baf1170657ba51baea44688c52290e0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 16 Sep 2013 22:16:21 +0200 Subject: initial libevdev impl --- .../ftnoir_protocol_libevdev.cpp | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp new file mode 100644 index 00000000..6f34d20b --- /dev/null +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -0,0 +1,77 @@ +#include "ftnoir_protocol_libevdev.h" +#include "facetracknoir/global-settings.h" +//#include "ftnoir_tracker_base/ftnoir_tracker_types.h" + +#define CHECK_LIBEVDEV(expr) if ((expr) != 0) goto error; + +FTNoIR_Protocol::FTNoIR_Protocol() : dev(NULL), uidev(NULL) +{ + int error; + + dev = libevdev_new(); + + if (!dev) + goto error; + + libevdev_set_name(dev, "opentrack headpose"); + + struct input_absinfo absinfo; + + absinfo.minimum = -ABS_MAX; + absinfo.maximum = ABS_MAX; + absinfo.resolution= 1; /* units per radian? let's go shopping */ + absinfo.value = 0; + absinfo.fuzz = 1; /* no filtering in evdev subsystem, we do our own */ + + CHECK_LIBEVDEV(libevdev_enable_event_type(dev, EV_ABS)) + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_X, &absinfo)) + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_Y, &absinfo)) + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_Z, &absinfo)) + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RX, &absinfo)) + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RY, &absinfo)) + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RZ, &absinfo)) + + CHECK_LIBEVDEV(error = libevdev_uinput_create_from_device(dev, LIBEVDEV_UINPUT_OPEN_MANAGED, &uidev)) + + return; +error: + if (uidev) + libevdev_uinput_destroy(uidev); + if (dev) + libevdev_free(dev); + uidev = NULL; + dev = NULL; +} + +FTNoIR_Protocol::~FTNoIR_Protocol() +{ + if (uidev) + libevdev_uinput_destroy(uidev); + if (dev) + libevdev_free(dev); +} + +void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose ) { + static const int axes[] = { + /* translation goes first */ + ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ + }; + static const int ranges[] = { + 2, + 2, + 2, + 2, /* | pitch | only goes to 90 */ + 1, + 2 + }; + + const int max_euler = 90; + + for (int i = 0; i < 6; i++) + (void) libevdev_uinput_write_event(uidev, EV_ABS, axes[i], ranges[i] * headpose[i] * max_euler / ABS_MAX); +} + +extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +{ + return new FTNoIR_Protocol; +} -- cgit v1.2.3 From 40f95d58324609d74b1e3a7ff81d4ef3b2388550 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 16 Sep 2013 23:54:16 +0200 Subject: proto-libevdev: first version. NEEDS UDEV RULE --- .../ftnoir_protocol_libevdev.cpp | 57 +++++++++++++++------- .../ftnoir_protocol_libevdev.h | 6 ++- 2 files changed, 43 insertions(+), 20 deletions(-) (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index 6f34d20b..74986299 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -1,37 +1,52 @@ #include "ftnoir_protocol_libevdev.h" #include "facetracknoir/global-settings.h" //#include "ftnoir_tracker_base/ftnoir_tracker_types.h" +#include +#include -#define CHECK_LIBEVDEV(expr) if ((expr) != 0) goto error; +#include +#include + +#define CHECK_LIBEVDEV(expr) if (error = (expr) != 0) goto error; + +static const int max_input = 8192; +static const int mid_input = 4096; +static const int min_input = 0; + +#define HT_PI 3.1415926535 FTNoIR_Protocol::FTNoIR_Protocol() : dev(NULL), uidev(NULL) { - int error; + int error = 0; dev = libevdev_new(); if (!dev) goto error; + CHECK_LIBEVDEV(libevdev_enable_property(dev, INPUT_PROP_BUTTONPAD)); + libevdev_set_name(dev, "opentrack headpose"); struct input_absinfo absinfo; - absinfo.minimum = -ABS_MAX; - absinfo.maximum = ABS_MAX; - absinfo.resolution= 1; /* units per radian? let's go shopping */ - absinfo.value = 0; - absinfo.fuzz = 1; /* no filtering in evdev subsystem, we do our own */ + absinfo.minimum = min_input; + absinfo.maximum = max_input; + absinfo.resolution = 1; + absinfo.value = mid_input; + absinfo.flat = 8192 / 180; + absinfo.fuzz = 1; + + CHECK_LIBEVDEV(libevdev_enable_event_type(dev, EV_ABS)); + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_X, &absinfo)); + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_Y, &absinfo)); + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_Z, &absinfo)); + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RX, &absinfo)); + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RY, &absinfo)); - CHECK_LIBEVDEV(libevdev_enable_event_type(dev, EV_ABS)) - CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_X, &absinfo)) - CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_Y, &absinfo)) - CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_Z, &absinfo)) - CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RX, &absinfo)) - CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RY, &absinfo)) - CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RZ, &absinfo)) + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RZ, &absinfo)); - CHECK_LIBEVDEV(error = libevdev_uinput_create_from_device(dev, LIBEVDEV_UINPUT_OPEN_MANAGED, &uidev)) + CHECK_LIBEVDEV(libevdev_uinput_create_from_device(dev, LIBEVDEV_UINPUT_OPEN_MANAGED, &uidev)); return; error: @@ -39,6 +54,8 @@ error: libevdev_uinput_destroy(uidev); if (dev) libevdev_free(dev); + if (error) + fprintf(stderr, "libevdev error: %d\n", error); uidev = NULL; dev = NULL; } @@ -60,15 +77,19 @@ void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose 2, 2, 2, - 2, /* | pitch | only goes to 90 */ - 1, + 2, + 1, /* |pitch| only goes to 90 */ 2 }; const int max_euler = 90; for (int i = 0; i < 6; i++) - (void) libevdev_uinput_write_event(uidev, EV_ABS, axes[i], ranges[i] * headpose[i] * max_euler / ABS_MAX); + { + int value = headpose[i] * mid_input / (max_euler * ranges[i]) + mid_input; + int normalized = std::max(std::min(max_input, value), min_input); + (void) libevdev_uinput_write_event(uidev, EV_ABS, axes[i], normalized); + } } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h index b71738f1..42864a07 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h @@ -12,8 +12,10 @@ #include #include "facetracknoir/global-settings.h" -#include -#include +extern "C" { +# include +# include +} class FTNoIR_Protocol : public IProtocol { -- cgit v1.2.3 From a1c5b014da305b43da45b57e76c2c273270ad4b4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 17 Sep 2013 00:34:48 +0200 Subject: Pretend to be a joystick a bit harder for udev --- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index 74986299..dec4f847 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -46,6 +46,9 @@ FTNoIR_Protocol::FTNoIR_Protocol() : dev(NULL), uidev(NULL) CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RZ, &absinfo)); + CHECK_LIBEVDEV(libevdev_enable_event_type(dev, EV_KEY)); + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_KEY, BTN_JOYSTICK, NULL)); + CHECK_LIBEVDEV(libevdev_uinput_create_from_device(dev, LIBEVDEV_UINPUT_OPEN_MANAGED, &uidev)); return; -- cgit v1.2.3 From 46029fe376e358a6a3ab021cfd8252945460d84a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 17 Sep 2013 00:42:22 +0200 Subject: Add a note to future self --- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index dec4f847..80b075d6 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -46,6 +46,7 @@ FTNoIR_Protocol::FTNoIR_Protocol() : dev(NULL), uidev(NULL) CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RZ, &absinfo)); + /* do not remove next 2 lines or udev scripts won't assign 0664 permissions -sh */ CHECK_LIBEVDEV(libevdev_enable_event_type(dev, EV_KEY)); CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_KEY, BTN_JOYSTICK, NULL)); -- cgit v1.2.3 From b2dcd14ef0a12803c82b7aaf374d3f88098ad4e8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 17 Sep 2013 00:47:55 +0200 Subject: Take a peek on how uglyDwarf doesIt --- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index 80b075d6..60922967 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -46,9 +46,10 @@ FTNoIR_Protocol::FTNoIR_Protocol() : dev(NULL), uidev(NULL) CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RZ, &absinfo)); - /* do not remove next 2 lines or udev scripts won't assign 0664 permissions -sh */ + /* do not remove next 3 lines or udev scripts won't assign 0664 permissions -sh */ CHECK_LIBEVDEV(libevdev_enable_event_type(dev, EV_KEY)); CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_KEY, BTN_JOYSTICK, NULL)); + CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_KEY, BTN_TRIGGER, NULL)); CHECK_LIBEVDEV(libevdev_uinput_create_from_device(dev, LIBEVDEV_UINPUT_OPEN_MANAGED, &uidev)); -- cgit v1.2.3 From 4109274cf3ae8ddd586a85196680084bee40f5b9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 17 Sep 2013 01:57:42 +0200 Subject: Refactor for proper translation output range --- .../ftnoir_protocol_libevdev.cpp | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index 60922967..a64f252e 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -9,8 +9,8 @@ #define CHECK_LIBEVDEV(expr) if (error = (expr) != 0) goto error; -static const int max_input = 8192; -static const int mid_input = 4096; +static const int max_input = 65535; +static const int mid_input = 32767; static const int min_input = 0; #define HT_PI 3.1415926535 @@ -34,8 +34,8 @@ FTNoIR_Protocol::FTNoIR_Protocol() : dev(NULL), uidev(NULL) absinfo.maximum = max_input; absinfo.resolution = 1; absinfo.value = mid_input; - absinfo.flat = 8192 / 180; - absinfo.fuzz = 1; + absinfo.flat = 1; + absinfo.fuzz = 0; CHECK_LIBEVDEV(libevdev_enable_event_type(dev, EV_ABS)); CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_X, &absinfo)); @@ -78,20 +78,19 @@ void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose /* translation goes first */ ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ }; - static const int ranges[] = { - 2, - 2, - 2, - 2, - 1, /* |pitch| only goes to 90 */ - 2 - }; - const int max_euler = 90; + static const int max_value[] = { + 100, + 100, + 100, + 180, + 90, + 180 + }; for (int i = 0; i < 6; i++) { - int value = headpose[i] * mid_input / (max_euler * ranges[i]) + mid_input; + int value = headpose[i] * mid_input / max_value[i] + mid_input; int normalized = std::max(std::min(max_input, value), min_input); (void) libevdev_uinput_write_event(uidev, EV_ABS, axes[i], normalized); } -- cgit v1.2.3 From b3f2cfa87ba25a85e486f4e45ce419fc0e823ca2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 17 Sep 2013 02:09:23 +0200 Subject: remove empty line --- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index a64f252e..3f74f462 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -43,7 +43,6 @@ FTNoIR_Protocol::FTNoIR_Protocol() : dev(NULL), uidev(NULL) CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_Z, &absinfo)); CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RX, &absinfo)); CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RY, &absinfo)); - CHECK_LIBEVDEV(libevdev_enable_event_code(dev, EV_ABS, ABS_RZ, &absinfo)); /* do not remove next 3 lines or udev scripts won't assign 0664 permissions -sh */ -- cgit v1.2.3 From 169bd7eb0396cd8d9474e47b669f5db7bcaf38bf Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 17 Sep 2013 12:52:43 +0200 Subject: proto-libevdev: End bulk updates with EV_SYN --- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index 3f74f462..f0950d80 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -93,6 +93,8 @@ void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose int normalized = std::max(std::min(max_input, value), min_input); (void) libevdev_uinput_write_event(uidev, EV_ABS, axes[i], normalized); } + + (void) libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0); } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() -- cgit v1.2.3 From 5bedf6f81342356c197604a9484281db0a726611 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 17 Sep 2013 17:34:14 +0200 Subject: Appease GNU CC -Wall -Wno-reorder --- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index f0950d80..60d9e90c 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -7,7 +7,7 @@ #include #include -#define CHECK_LIBEVDEV(expr) if (error = (expr) != 0) goto error; +#define CHECK_LIBEVDEV(expr) if ((error = (expr)) != 0) goto error; static const int max_input = 65535; static const int mid_input = 32767; -- cgit v1.2.3 From b37d9f82420d545f650f5f5eb39de513c9dbce80 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 18 Sep 2013 17:16:46 +0200 Subject: libevdev: since don't care about sensor resolution, cleanup unused macro --- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index 60d9e90c..fc01552e 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -13,8 +13,6 @@ static const int max_input = 65535; static const int mid_input = 32767; static const int min_input = 0; -#define HT_PI 3.1415926535 - FTNoIR_Protocol::FTNoIR_Protocol() : dev(NULL), uidev(NULL) { int error = 0; -- cgit v1.2.3 From da46cf18a2c7ad56c53e9c02014f75c818d39ea3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 16 Oct 2013 23:30:47 +0200 Subject: change protocol ABI: sprinkle const. ABI BREAKAGE! Signed-off-by: Stanislaw Halik --- facetracknoir/tracker.cpp | 2 +- ftnoir_protocol_base/ftnoir_protocol_base.h | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg.cpp | 6 +----- ftnoir_protocol_fg/ftnoir_protocol_fg.h | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn.h | 6 +++--- ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp | 2 +- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp | 2 +- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h | 4 ++-- ftnoir_protocol_wine/ftnoir_protocol_wine.cpp | 2 +- ftnoir_protocol_wine/ftnoir_protocol_wine.h | 8 ++++---- 12 files changed, 18 insertions(+), 22 deletions(-) (limited to 'ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp') diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 53b3ffd3..25b42ece 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -149,7 +149,7 @@ void Tracker::run() { // Send the headpose to the game if (Libraries->pProtocol) { gameoutput_camera = output_camera; - Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes, newpose ); // degrees & centimeters + Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes ); // degrees & centimeters } } } diff --git a/ftnoir_protocol_base/ftnoir_protocol_base.h b/ftnoir_protocol_base/ftnoir_protocol_base.h index 79f0800c..5db49f01 100644 --- a/ftnoir_protocol_base/ftnoir_protocol_base.h +++ b/ftnoir_protocol_base/ftnoir_protocol_base.h @@ -41,7 +41,7 @@ struct IProtocol { virtual ~IProtocol() {} virtual bool checkServerInstallationOK() = 0; - virtual void sendHeadposeToGame( double *headpose, double *rawheadpose ) = 0; + virtual void sendHeadposeToGame( const double* headpose ) = 0; virtual QString getGameName() = 0; }; diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp index 5aa3487e..08e7370b 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp @@ -63,11 +63,7 @@ void FTNoIR_Protocol::loadSettings() { } -void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose ) { - int no_bytes; - QHostAddress sender; - quint16 senderPort; - +void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { FlightData.x = headpose[TX] * 1e-2; FlightData.y = headpose[TY] * 1e-2; FlightData.z = headpose[TZ] * 1e-2; diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.h b/ftnoir_protocol_fg/ftnoir_protocol_fg.h index f399904b..43d1b05a 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.h +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.h @@ -46,7 +46,7 @@ public: FTNoIR_Protocol(); ~FTNoIR_Protocol(); bool checkServerInstallationOK(); - void sendHeadposeToGame( double *headpose, double *rawheadpose ); + void sendHeadposeToGame(const double *headpose); QString getGameName() { return "FlightGear"; } diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index cefc9bf8..45123540 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -91,7 +91,7 @@ void FGControls::doOK() { } // override show event -void FGControls::showEvent ( QShowEvent * event ) { +void FGControls::showEvent ( QShowEvent * ) { loadSettings(); } diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp index 3d04dfd0..80cbfa0a 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp @@ -66,7 +66,7 @@ void FTNoIR_Protocol::loadSettings() { // // Update Headpose in Game. // -void FTNoIR_Protocol::sendHeadposeToGame(double *headpose, double *rawheadpose ) { +void FTNoIR_Protocol::sendHeadposeToGame(const double *headpose) { int no_bytes; double test_data[6]; // diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h index 4c1c34cd..4e814ddf 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h @@ -45,7 +45,7 @@ public: FTNoIR_Protocol(); ~FTNoIR_Protocol(); bool checkServerInstallationOK(); - void sendHeadposeToGame( double *headpose, double *rawheadpose ); + void sendHeadposeToGame(const double *headpose); QString getGameName() { return "UDP Tracker"; } @@ -65,9 +65,9 @@ public: explicit FTNControls(); virtual ~FTNControls(); - void showEvent ( QShowEvent * event ); + void showEvent (QShowEvent *); void Initialize(QWidget *parent); - void registerProtocol(IProtocol *protocol) {} + void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} private: diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp index 0b61fd48..3b4e851c 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp @@ -84,7 +84,7 @@ void FTNControls::doOK() { } // override show event -void FTNControls::showEvent ( QShowEvent * event ) { +void FTNControls::showEvent ( QShowEvent * ) { loadSettings(); } diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index fc01552e..70fde395 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -70,7 +70,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol() libevdev_free(dev); } -void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose ) { +void FTNoIR_Protocol::sendHeadposeToGame(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 e753269e..3c6f591c 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h @@ -25,7 +25,7 @@ public: bool checkServerInstallationOK() { return dev != NULL; } - void sendHeadposeToGame( double *headpose, double *rawheadpose ); + void sendHeadposeToGame(const double *headpose); QString getGameName() { return "Virtual joystick for Linux"; } @@ -45,7 +45,7 @@ public: void showEvent ( QShowEvent *) {} void Initialize(QWidget *); - void registerProtocol(IProtocol *l) {} + void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} private: diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp index 698c2236..c5d0754f 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp @@ -25,7 +25,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol() shm_unlink("/" WINE_SHM_NAME); } -void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose ) { +void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) { if (shm) { lck_shm.lock(); diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.h b/ftnoir_protocol_wine/ftnoir_protocol_wine.h index 300501ad..01bfc93d 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.h +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.h @@ -51,7 +51,7 @@ public: ~FTNoIR_Protocol(); bool checkServerInstallationOK(); - void sendHeadposeToGame(double* headpose, double* rawheadpose ); + void sendHeadposeToGame(const double* headpose); QString getGameName() { QMutexLocker foo(&game_name_mutex); return connected_game; @@ -72,9 +72,9 @@ class FTControls: public QWidget, public IProtocolDialog public: FTControls(); - void showEvent ( QShowEvent * event ) {show();} - void Initialize(QWidget *parent) {show();} - void registerProtocol(IProtocol *protocol) {} + void showEvent ( QShowEvent * ) {show();} + void Initialize(QWidget *) {show();} + void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} private: -- cgit v1.2.3