Esempio n. 1
0
        public Task StartAsync(IDialogContext context)
        {
            message_count = 0;
            EyeTrackerCollection ec = EyeTrackingOperations.FindAllEyeTrackers(); // もしくはGetEyeTracker で URI指定できるらしい

            eyeTracker = null;
            int i = ec.Count;

            //Console.WriteLine(
            System.Diagnostics.Debug.WriteLine("FindAllEyeTrackers()... {0} devices found.", i.ToString());
            //label1.Text = i.ToString();
            if (i > 0)
            {
                eyeTracker = ec[0];
            }

            //label2.Text = eyeTracker.Address.ToString();
            //label2.Text = label2.Text + ", " + eyeTracker.DeviceName;
            // return our reply to the user
            if (eyeTracker != null)
            {
                ApplyLicense(eyeTracker, @"c:\tobii\license\license_key_00401181_-_Kyoto_University_IS404-100106332951");
                GazeData(eyeTracker);
            }
            context.Wait(MessageReceivedAsync);

            return(Task.CompletedTask);
        }
Esempio n. 2
0
        protected override void StartAutoConnectThread()
        {
            if (_autoConnectThread != null)
            {
                return;
            }

            _autoConnectThread = new Thread(() => {
                AutoConnectThreadRunning = true;

                while (AutoConnectThreadRunning)
                {
                    var eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();

                    foreach (var eyeTrackerEntry in eyeTrackers)
                    {
                        FoundEyeTracker         = eyeTrackerEntry;
                        Settings.eyetrackerName = FoundEyeTracker.SerialNumber.ToString();
                        // Debug.Log (FoundEyeTracker.SerialNumber.ToString ());
                        AutoConnectThreadRunning   = false;
                        Settings.isFoundEyetracker = true;
                        return;
                    }

                    Thread.Sleep(200);
                }
            });

            _autoConnectThread.IsBackground = true;
            _autoConnectThread.Start();
        }
Esempio n. 3
0
    // Use this for initialization
    void Awake()
    {
        if (_instance == null)
        {
            _instance = this;

            bool result   = false;
            var  trackers = EyeTrackingOperations.FindAllEyeTrackers();
            EyeTrackerInstance = trackers.FirstOrDefault(s => (s.DeviceCapabilities & Capabilities.HasHMDGazeData) != 0);
            if (EyeTrackerInstance == null)
            {
                result = false;

                Debug.Log("No HMD eye tracker detected!");
            }
            else
            {
                result = true;
                isEyeTrackerConnected = true;
                Debug.Log("Selected eye tracker with serial number {0}" + EyeTrackerInstance.SerialNumber);
            }


            if (result == false)
            {
                Debug.LogError("TobiiPro: Failed to create tracker.");
            }
        }
    }
Esempio n. 4
0
        private void addUser_button_Click(object sender, EventArgs e)
        {
            if (mConfiguration.userNameList.Count == 0)
            {
                DialogResult result = MessageBox.Show("There is allready Profile in system." + "\nDo you want to add a new Profile?",
                                                      "Critical Warning",
                                                      MessageBoxButtons.YesNo,
                                                      MessageBoxIcon.Question,
                                                      MessageBoxDefaultButton.Button2);

                if (result == DialogResult.Yes)
                {
                    var eyeTracker = EyeTrackingOperations.FindAllEyeTrackers().FirstOrDefault();
                    // EyeTrackerCollection eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();

                    if (eyeTracker == null)
                    {
                        MessageBox.Show("Cant find the Eye Tracker! \nPlease trye again.",
                                        "Critical Warning",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }


                    if (eyeTracker != null)
                    {
                        //FirstCalibrationWindow firstCalibrationWindow = new FirstCalibrationWindow();
                        // firstCalibrationWindow.Show();

                        CalibrationForm t = new CalibrationForm(eyeTracker);
                    }
                }
            }
        }
Esempio n. 5
0
        protected override void StartAutoConnectThread()
        {
            if (_autoConnectThread != null)
            {
                return;
            }

            _autoConnectThread = new Thread(() =>
            {
                AutoConnectThreadRunning = true;

                while (AutoConnectThreadRunning)
                {
                    var eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();

                    foreach (var eyeTrackerEntry in eyeTrackers)
                    {
                        if (_connectToFirst || eyeTrackerEntry.SerialNumber.StartsWith(_eyeTrackerSerialStart))
                        {
                            FoundEyeTracker          = eyeTrackerEntry;
                            AutoConnectThreadRunning = false;
                            return;
                        }
                    }

                    Thread.Sleep(200);
                }
            });

            _autoConnectThread.IsBackground = true;
            _autoConnectThread.Start();
        }
Esempio n. 6
0
        public Keyhole(Keys overlayKey)
        {
            m_overlayKey = overlayKey;
            m_Ts         = new ThreadStart(DrawLoop);
            m_DrawThread = new Thread(m_Ts);

            // setup eye tracker
            m_EyeTracker = EyeTrackingOperations.FindAllEyeTrackers().FirstOrDefault();
            m_EyeTracker.GazeDataReceived += GazeDataReceived;

            // init gaze points
            ScreenGaze  = new ScreenGaze();
            GazeTargets = new List <GazeTarget>();

            Screen   = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
            window   = new Form1(this);
            m_Active = false;

            // keyboard / mouse
            m_Events          = Hook.GlobalEvents();
            m_Events.KeyDown += OnKeyDown;
            //m_Events.KeyUp += OnKeyUp;
            //m_Events.KeyPress += HookManager_KeyPress;
            m_Events.MouseMove += OnMouseMove;

            m_DrawThread.Start();
        }
Esempio n. 7
0
        public void InitializeEyetracker()
        {
            var eyeTracker = EyeTrackingOperations.FindAllEyeTrackers().FirstOrDefault();

            getEyetrackerInformation();
            //ApplyLicense(eyeTracker, "C:\\Users\\Eyetracker\\OneDrive\\Eye tracking\\Magnifier Projects\\Experimentssss\\MagnifierLast\\MagnifierLast\\license\\license_key_00454713__-__Karlsruhe_Institute_of_IS404-100108245121");
            Console.WriteLine("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
        }
Esempio n. 8
0
 //get 'all' of the eyetrackers (should only be 1) and puts it into array
 private void SetEyeTrackers()
 {
     eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();
     if (eyeTrackers.Count == 0)
     {
         Console.WriteLine("Eye tracker failed");
         TobiiEyeTrackerProcess.Close();
         Environment.Exit(-1);
     }
 }
        public void Execute()
        {
            //tobi pro
            EyeTrackerCollection eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();

            //var eyeTracker = EyeTrackingOperations.FindAllEyeTrackers();
            foreach (IEyeTracker eyeTracker in eyeTrackers)
            {
                Console.WriteLine("xxx" + eyeTracker.Address);
                GazeData(eyeTracker);
            }
        }
Esempio n. 10
0
 private void Start()
 {
     try
     {
         eyeTracker = EyeTrackingOperations.FindAllEyeTrackers()[0];
         eyeTracker.GazeDataReceived += EyeTracker_GazeDataReceived;
     }
     catch
     {
         Debug.LogError("Eye tracker not found!");
     }
 }
Esempio n. 11
0
        /* protected void UpdateGazePosition(object s, StreamData<GazePointData> streamData)
         * {
         * sampleCount++;
         * sampleIndex++;
         * if (sampleIndex >= samples.Length)
         *     sampleIndex = 0;
         * samples[sampleIndex] = new Point((int)streamData.Data.X, (int)streamData.Data.Y);
         * }*/

        //############################################################################################

        public void Execute()
        {
            EyeTrackerCollection eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();

            //var eyeTracker = EyeTrackingOperations.FindAllEyeTrackers();
            foreach (IEyeTracker eyeTracker in eyeTrackers)
            {
                Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", eyeTracker.Address, eyeTracker.DeviceName, eyeTracker.Model, eyeTracker.SerialNumber, eyeTracker.FirmwareVersion, eyeTracker.RuntimeVersion);

                GazeData(eyeTracker);
            }
        }
Esempio n. 12
0
        void Awake()
        {
            var trackers = EyeTrackingOperations.FindAllEyeTrackers();

            _eyeTracker = trackers.FirstOrDefault(s => (s.DeviceCapabilities & Capabilities.HasHMDGazeData) != 0);
            if (_eyeTracker == null)
            {
                Debug.Log("No HMD eye tracker detected!");
            }
            else
            {
                Debug.Log("Selected eye tracker with serial number {0}" + _eyeTracker.SerialNumber);
            }
        }
        private void StartCalibration_button_Click(object sender, EventArgs e)
        {
            //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
            var eyeTracker = EyeTrackingOperations.FindAllEyeTrackers().FirstOrDefault();

            // EyeTrackerCollection eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();

            if (eyeTracker != null)
            {
                Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}",
                                  eyeTracker.Address,
                                  eyeTracker.DeviceName,
                                  eyeTracker.Model,
                                  eyeTracker.SerialNumber,
                                  eyeTracker.FirmwareVersion,
                                  eyeTracker.RuntimeVersion);


                if (eyeTracker != null)
                {
                    if (BothEye_checkBox.Checked)
                    {
                        CalibrationTobii t = new CalibrationTobii(eyeTracker, mConfiguration, "BothEyes");
                        t.Show();
                    }

                    else if (RightEye_checkBox.Checked)
                    {
                        CalibrationTobii t = new CalibrationTobii(eyeTracker, mConfiguration, "RightEye");
                        t.Show();
                    }

                    else if (LeftEye_checkBox.Checked)
                    {
                        CalibrationTobii t = new CalibrationTobii(eyeTracker, mConfiguration, "LeftEye");
                        t.Show();
                    }
                }
            }

            else
            {
                DialogResult result = MessageBox.Show("Please connect the Eye tracker, then try again!",
                                                      "Critical Warning",
                                                      MessageBoxButtons.OK,
                                                      MessageBoxIcon.Error,
                                                      MessageBoxDefaultButton.Button2);
            }
        }
Esempio n. 14
0
            internal static EyeTrackerCollection Execute(Form1 formObject)
            {
                // <BeginExample>
                //Console.WriteLine("\nSearching for all eye trackers");
                EyeTrackerCollection eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();

                foreach (IEyeTracker eyeTracker in eyeTrackers)
                {
                    //Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", eyeTracker.Address, eyeTracker.DeviceName, eyeTracker.Model, eyeTracker.SerialNumber, eyeTracker.FirmwareVersion, eyeTracker.RuntimeVersion);
                    var t_str = String.Format("{0}, {1}, {2}, {3}, {4}, {5}", eyeTracker.Address, eyeTracker.DeviceName, eyeTracker.Model, eyeTracker.SerialNumber, eyeTracker.FirmwareVersion, eyeTracker.RuntimeVersion);
                    formObject.UpdateLabel2Text(t_str);
                }
                // <EndExample>
                return(eyeTrackers);
            }
        void Awake()
        {
            var trackers = EyeTrackingOperations.FindAllEyeTrackers();

            foreach (IEyeTracker eyeTracker in trackers)
            {
                Debug.Log(string.Format("{0}, {1}, {2}, {3}, {4}", eyeTracker.Address, eyeTracker.DeviceName, eyeTracker.Model, eyeTracker.SerialNumber, eyeTracker.FirmwareVersion));
            }
            _eyeTracker = trackers.FirstOrDefault(s => (s.DeviceCapabilities & Capabilities.HasGazeData) != 0);
            if (_eyeTracker == null)
            {
                Debug.Log("No screen based eye tracker detected!");
            }
            else
            {
                Debug.Log("Selected eye tracker with serial number {0}" + _eyeTracker.SerialNumber);
            }
        }
Esempio n. 16
0
        static EyeTrackerCollection getEyetrackerInformation()
        {
            // <BeginExample>
            Console.WriteLine("\nSearching for all eye trackers");
            EyeTrackerCollection eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();

            foreach (IEyeTracker eyeTracker in eyeTrackers)
            {
                Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}",
                                  eyeTracker.Address,
                                  eyeTracker.DeviceName,
                                  eyeTracker.Model,
                                  eyeTracker.SerialNumber,
                                  eyeTracker.FirmwareVersion,
                                  eyeTracker.RuntimeVersion);
            }
            // <EndExample>
            return(eyeTrackers);
        }
Esempio n. 17
0
        private void ConnectToEyeTracker()
        {
            var eyeTracker = EyeTrackingOperations.FindAllEyeTrackers().FirstOrDefault();

            Console.WriteLine("Found eye tracker {0}", eyeTracker.Address);

            var calibrationValidation = new ScreenBasedCalibrationValidation(eyeTracker);

            var points = new NormalizedPoint2D[] {
                new NormalizedPoint2D(0.1f, 0.1f),
                new NormalizedPoint2D(0.1f, 0.9f),
                new NormalizedPoint2D(0.5f, 0.5f),
                new NormalizedPoint2D(0.9f, 0.1f),
                new NormalizedPoint2D(0.9f, 0.9f)
            };

            calibrationValidation.EnterValidationMode();

            foreach (var point in points)
            {
                Console.WriteLine("Collecting for point {0}, {1}", point.X, point.Y);

                calibrationValidation.StartCollectingData(point);
                while (calibrationValidation.State == ScreenBasedCalibrationValidation.ValidationState.CollectingData)
                {
                    System.Threading.Thread.Sleep(25);
                }
            }

            var result = calibrationValidation.Compute();

            Console.WriteLine(calibrationValidation);
            calibrationValidation.LeaveValidationMode();


            // mogucnost 2

            /*
             * var host = new Host();
             * var gazePointDataStream = host.Streams.CreateGazePointDataStream();
             * gazePointDataStream.GazePoint((gazePointX, gazePointY, _) => Console.WriteLine("X: {0} Y:{1}", gazePointX, gazePointY));
             */
        }
Esempio n. 18
0
        private void Calibration_Button_Click(object sender, EventArgs e)
        {
            var eyeTracker = EyeTrackingOperations.FindAllEyeTrackers().FirstOrDefault();

            // EyeTrackerCollection eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();

            if (eyeTracker != null)
            {
                Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}",
                                  eyeTracker.Address,
                                  eyeTracker.DeviceName,
                                  eyeTracker.Model,
                                  eyeTracker.SerialNumber,
                                  eyeTracker.FirmwareVersion,
                                  eyeTracker.RuntimeVersion);

                CalibrationForm t = new CalibrationForm(eyeTracker);
                t.Show();
                //CalibrationWindow cal = new CalibrationWindow(eyeTracker);
                //cal.Show();
            }
        }
Esempio n. 19
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nSearching for all eye trackers");
            EyeTrackerCollection eyeTrackers = EyeTrackingOperations.FindAllEyeTrackers();

            foreach (IEyeTracker eyeTracker in eyeTrackers)
            {
                Console.WriteLine("{0}, {1}, {2}, {3}, {4}", eyeTracker.Address, eyeTracker.DeviceName, eyeTracker.Model, eyeTracker.SerialNumber, eyeTracker.FirmwareVersion);
            }
            var    myEyeTracker = eyeTrackers.First();
            string license      = @"license_key_IS404-100106240232";

            ApplyLicense(myEyeTracker, license);

            Console.WriteLine("\nWrite the output file name (without extension): ");
            string filenameWithoutExtention = Console.ReadLine();

            Record record = new Record(filenameWithoutExtention, myEyeTracker);

            Console.WriteLine("Listening for gaze data, press 'q' to quit or any key to start/stop the recording...");
            // Let it run until a key is pressed.
            record.recordLoop();

            //Save the files
            record.saveFiles();

            //Dispose
            record.Dispose();

            string screenShot = filenameWithoutExtention + ".png";

            record.screenshot(screenShot);
            //Process the fix file
            string fileOutput = AnalazingEyeGaze.Program.processOneFile(filenameWithoutExtention, screenShot);

            ModelUtpal.Program.processOnefile(fileOutput);
        }
Esempio n. 20
0
        private void FillInAvailableTrackers()
        {
            try
            {
                AvailableTrackers = EyeTrackingOperations.FindAllEyeTrackers();
                foreach (IEyeTracker eyeTracker in AvailableTrackers)
                {
                    if (!TrackerListComboBox.Items.Contains(eyeTracker.SerialNumber))
                    {
                        TrackerListComboBox.Items.Add(eyeTracker.SerialNumber);
                    }
                }
                TrackerListComboBox.SelectedIndex = 0;

                CalibrationPanel.Enabled = (AvailableTrackers.Count > 0);
                WAMPPanel.Enabled        = (AvailableTrackers.Count > 0);
                SelectedTracker          = AvailableTrackers.ElementAt(TrackerListComboBox.SelectedIndex);
            }
            catch (Exception exp)
            {
                SelectedTracker = null;
                Console.Write(exp);
            }
        }
Esempio n. 21
0
 public static IEnumerable <IEyeTracker> GetAllTrackers()
 {
     _trackers = EyeTrackingOperations.FindAllEyeTrackers().ToList();
     return(_trackers);
 }