summaryrefslogtreecommitdiffhomepage
path: root/tracker-tobii-eyex/tobii-eyex.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-07-09 07:18:25 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-07-09 07:18:25 +0200
commitf5610a1ac847f17402415e4bf1080f84fd8d185f (patch)
treed8dda5864941a1d903a1fcf87ece585aa24d532b /tracker-tobii-eyex/tobii-eyex.hpp
parent793cea587159a0ba01fec6af28e899697ef4da79 (diff)
tracker/tobii: add prototype support for accumulative mode
Diffstat (limited to 'tracker-tobii-eyex/tobii-eyex.hpp')
-rw-r--r--tracker-tobii-eyex/tobii-eyex.hpp57
1 files changed, 28 insertions, 29 deletions
diff --git a/tracker-tobii-eyex/tobii-eyex.hpp b/tracker-tobii-eyex/tobii-eyex.hpp
index 84407930..def2ea2e 100644
--- a/tracker-tobii-eyex/tobii-eyex.hpp
+++ b/tracker-tobii-eyex/tobii-eyex.hpp
@@ -23,6 +23,20 @@ using namespace options;
#include <QObject>
#include <QMutex>
+//using real = TX_REAL;
+using real = double;
+
+struct state
+{
+ real display_res_x = -1, display_res_y = -1;
+ real px = -1, py = -1;
+ real last_timestamp = -1;
+ bool fresh = false;
+
+ state();
+ bool is_valid() const { return !(display_res_x < 0 || px < 0); }
+};
+
class tobii_eyex_tracker : public TR, public ITracker
{
Q_OBJECT
@@ -30,13 +44,9 @@ class tobii_eyex_tracker : public TR, public ITracker
public:
tobii_eyex_tracker();
~tobii_eyex_tracker() override;
- module_status start_tracker(QFrame *) override;
+ module_status start_tracker(QFrame*) override;
void data(double *data) override;
- bool center() override
- {
- do_center = true;
- return true;
- }
+ bool center() override;
private:
static constexpr inline const char* const client_id = "opentrack-tobii-eyex";
@@ -44,47 +54,36 @@ private:
static bool register_state_snapshot(TX_CONTEXTHANDLE ctx, TX_HANDLE* state_snapshot_ptr);
static std::atomic_flag atexit_done;
- static void TX_CALLCONVENTION connection_state_change_handler(TX_CONNECTIONSTATE state, TX_USERPARAM param);
+ static void TX_CALLCONVENTION state_change_handler(TX_CONNECTIONSTATE state, TX_USERPARAM param);
static void TX_CALLCONVENTION event_handler(TX_CONSTHANDLE async_data_handle, TX_USERPARAM param);
void gaze_data_handler(TX_HANDLE gaze_data_handle);
static void TX_CALLCONVENTION snapshot_committed_handler(TX_CONSTHANDLE async_data_handle, TX_USERPARAM param);
static void TX_CALLCONVENTION display_state_handler(TX_CONSTHANDLE async_data_handle, TX_USERPARAM param);
void process_display_state(TX_HANDLE display_state_handle);
- using num = double;
+ real gain(real x);
- num gain(num x);
+ state dev_state;
+ real yaw = 0, pitch = 0;
- TX_CONTEXTHANDLE dev_ctx;
- TX_TICKET conn_state_changed_ticket;
- TX_TICKET event_handler_ticket;
- TX_HANDLE state_snapshot;
- TX_HANDLE display_state;
+ TX_CONTEXTHANDLE ctx = TX_EMPTY_HANDLE;
+ TX_TICKET state_changed_ticket = TX_INVALID_TICKET;
+ TX_TICKET event_handler_ticket = TX_INVALID_TICKET;
+ TX_HANDLE state_snapshot = TX_EMPTY_HANDLE;
+ TX_HANDLE display_state = TX_EMPTY_HANDLE;
QMutex global_state_mtx;
settings s;
Timer t;
- struct state
- {
- TX_REAL display_res_x, display_res_y;
- TX_REAL px, py;
- TX_REAL last_timestamp;
- bool fresh;
-
- state() : display_res_x(-1), display_res_y(-1), px(-1), py(-1), last_timestamp(0), fresh(false) {}
- bool is_valid() const { return !(display_res_x < 0 || px < 0); }
- } dev_state;
-
- double yaw, pitch;
- std::atomic<bool> do_center;
+ std::atomic<bool> do_center = false;
};
class tobii_eyex_metadata : public Metadata
{
Q_OBJECT
- QString name() { return QString("Tobii EyeX"); }
- QIcon icon() { return QIcon(":/images/tobii-eyex-logo.png"); }
+ QString name() override { return QString("Tobii EyeX"); }
+ QIcon icon() override { return QIcon(":/images/tobii-eyex-logo.png"); }
};