From 4261d6e6cc366884cd35daf66d9fa35c3dda6267 Mon Sep 17 00:00:00 2001 From: Khoa Nguyen Date: Tue, 26 Sep 2023 12:27:06 +0700 Subject: tracker/tobii: add tobii input --- tracker-tobii/tobii.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tracker-tobii/tobii.h (limited to 'tracker-tobii/tobii.h') diff --git a/tracker-tobii/tobii.h b/tracker-tobii/tobii.h new file mode 100644 index 00000000..dedda7af --- /dev/null +++ b/tracker-tobii/tobii.h @@ -0,0 +1,64 @@ +/* Copyright (c) 2023, Khoa Nguyen + + * 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. + */ + +#pragma once +#include "api/plugin-api.hpp" +#include "ui_tobii.h" + +#include +#include + +#include + +class tobii_tracker : public ITracker +{ +public: + tobii_tracker(); + ~tobii_tracker() override; + module_status start_tracker(QFrame*) override; + void data(double* data) override; + +private: + double last[6]{}; + + tobii_api_t* api = nullptr; + tobii_device_t* device = nullptr; + + tobii_head_pose_t latest_head_pose { + 0LL, + TOBII_VALIDITY_INVALID, + { 0.f, 0.f, 0.f }, + { TOBII_VALIDITY_INVALID, TOBII_VALIDITY_INVALID, TOBII_VALIDITY_INVALID }, + { 0.f, 0.f, 0.f }, + }; + + QMutex mtx; +}; + +class tobii_dialog : public ITrackerDialog +{ + Q_OBJECT + + Ui::tobii_ui ui; + +public: + tobii_dialog(); + void register_tracker(ITracker*) override {} + void unregister_tracker() override {} +private slots: + void doOK(); + void doCancel(); +}; + +class tobii_metadata : public Metadata +{ + Q_OBJECT + + QString name() override { return tr("Tobii Eye Tracker"); } + QIcon icon() override { return QIcon(":/images/tobii_logo.png"); } +}; -- cgit v1.2.3 From a462b5411e4c6e958adb3b2d1a75657d56522942 Mon Sep 17 00:00:00 2001 From: Khoa Nguyen Date: Tue, 26 Sep 2023 14:17:30 +0700 Subject: tracker/tobii: remove unused --- tracker-tobii/tobii.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'tracker-tobii/tobii.h') diff --git a/tracker-tobii/tobii.h b/tracker-tobii/tobii.h index dedda7af..414f9f64 100644 --- a/tracker-tobii/tobii.h +++ b/tracker-tobii/tobii.h @@ -24,17 +24,15 @@ public: void data(double* data) override; private: - double last[6]{}; - tobii_api_t* api = nullptr; tobii_device_t* device = nullptr; - tobii_head_pose_t latest_head_pose { - 0LL, - TOBII_VALIDITY_INVALID, - { 0.f, 0.f, 0.f }, - { TOBII_VALIDITY_INVALID, TOBII_VALIDITY_INVALID, TOBII_VALIDITY_INVALID }, - { 0.f, 0.f, 0.f }, + tobii_head_pose_t latest_head_pose{ + .timestamp_us = 0LL, + .position_validity = TOBII_VALIDITY_INVALID, + .position_xyz = { 0.f, 0.f, 0.f }, + .rotation_validity_xyz = { TOBII_VALIDITY_INVALID, TOBII_VALIDITY_INVALID, TOBII_VALIDITY_INVALID }, + .rotation_xyz = { 0.f, 0.f, 0.f }, }; QMutex mtx; @@ -48,8 +46,7 @@ class tobii_dialog : public ITrackerDialog public: tobii_dialog(); - void register_tracker(ITracker*) override {} - void unregister_tracker() override {} + private slots: void doOK(); void doCancel(); -- cgit v1.2.3