Home Forums Software Development Get GazePoints and TimeStamps by Event Reply To: Get GazePoints and TimeStamps by Event

#9344
Pedro Coelho
Participant

Hello Grant,
I did that but it is not printing on the console, it just prints one time. And I want the single timestamp when the OnGaze event occurs, how can I do that?
Can you test it with the program please?

            _host = new Host();

            // 2. Create stream.
            gazePointDataStream = _host.Streams.CreateGazePointDataStream();

            // 3. Get the gaze data!
            gazePointDataStream.GazePoint((x, y, ts) => Console.WriteLine("Timestamp: {0}\t X: {1} Y:{2}", ts, x, y));
           
            // Add eye-gaze interaction behaviors to the panels on the form.
            Program.EyeXHost.Connect(behaviorMap1);
            behaviorMap1.Add(panel1, new EyeXFramework.GazeAwareBehavior(OnGaze1) { DelayMilliseconds = 500 });
            behaviorMap1.Add(panel2, new EyeXFramework.GazeAwareBehavior(OnGaze2) { DelayMilliseconds = 500 });
            behaviorMap1.Add(panel3, new EyeXFramework.GazeAwareBehavior(OnGaze3) { DelayMilliseconds = 500 });
            behaviorMap1.Add(panel4, new EyeXFramework.GazeAwareBehavior(OnGaze4) { DelayMilliseconds = 500 });
            behaviorMap1.Add(panel5, new EyeXFramework.GazeAwareBehavior(OnGaze5) { DelayMilliseconds = 500 });
            behaviorMap1.Add(panel6, new EyeXFramework.GazeAwareBehavior(OnGaze6) { DelayMilliseconds = 500 });
            behaviorMap1.Add(panel7, new EyeXFramework.GazeAwareBehavior(OnGaze7) { DelayMilliseconds = 500 });
            behaviorMap1.Add(panel8, new EyeXFramework.GazeAwareBehavior(OnGaze8) { DelayMilliseconds = 500 });
            behaviorMap1.Add(panel9, new EyeXFramework.GazeAwareBehavior(OnGaze9) { DelayMilliseconds = 500 });
            
            // Close the coonection to the Tobii Engine before exit.
            _host.DisableConnection();

        }

        private void OnGaze1(object sender, GazeAwareEventArgs e)
        {
            if (e.HasGaze)
            {
                gazePoint = "Esquerda Cima";
                gazeType = "Fixação";
                gazePoints.Add(gazePoint);
                SendMessage(gazeType, gazePoint /*, timestamp, x, y*/ );
                Console.WriteLine("Fixação em " + gazePoint);
                PrintPanel1(this.panel1);
            }
        }

Thank you