Connects to an eyetracker. Use a new EyetrackerConnector for each eyetracker connection. GazeData and Framerate change events should be subscribed to through the AddGazeDataHandler(1) and AddFramerateChangedHandler(1) methods which check if eyetracker is connected yet and will delay connection if it isn't.
Ejemplo n.º 1
0
        /// <summary>
        /// Connects to found eyetrackers, synchronizes CPU and eyetracker clocks, and attaches event handlers.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Contains found EyetrackerInfo</param>
        private static void EyetrackerFound(object sender, EyetrackerInfoEventArgs e)
        {
            EyetrackerConnector connector = new EyetrackerConnector(e.EyetrackerInfo);

            connector.Connect();

            // sync CPU and Eyetracker clocks
            SyncManager syncManager = new SyncManager(clock, e.EyetrackerInfo, EventThreadingOptions.BackgroundThread);

            // detect fixations
            FixationDetector fixations = new FixationDetector(syncManager);

            connector.Eyetracker.GazeDataReceived += fixations.GazeDataReceived;

            if (Settings.ProcessorDefinitions.ContainsKey(connector.Info.ProductId))
            {
                foreach (EmdatProcessorSettings settings in Settings.ProcessorDefinitions[connector.Info.ProductId])
                {
                    EmdatProcessor processor = new EmdatProcessor(syncManager);
                    processor.CumulativeData = settings.Cumulative;
                    connector.Eyetracker.GazeDataReceived += processor.GazeDataReceived;
                    fixations.FixDetector.FixationEnd     += processor.FixationEnd;
                    Processors.Add(settings.ProcessorId, processor);
                }
            }
        }
Ejemplo n.º 2
0
        static void EyetrackerFound(object sender, EyetrackerInfoEventArgs e)
        {
            EyetrackerConnector connector = new EyetrackerConnector(e.EyetrackerInfo);
            connector.Connect();

            // sync CPU and Eyetracker clocks
            SyncManager syncManager = new SyncManager(clock, e.EyetrackerInfo, EventThreadingOptions.BackgroundThread);

            // detect fixations
            GazeDataFixationHandler fixations = new GazeDataFixationHandler(syncManager);
            connector.Eyetracker.GazeDataReceived += fixations.GazeDataReceived;

            /*/ print each event to console
            GazeDataConsolePrintHandler printer = new GazeDataConsolePrintHandler(syncManager);
            //connector.Eyetracker.GazeDataReceived += printer.GazeDataReceived;
            fixations.FixationDetector.FixationEnd += printer.FixationEnd;*/

            // windowed print to console
            GazeDataWindowingPrintHandler printer = new GazeDataWindowingPrintHandler(syncManager);
            //connector.Eyetracker.GazeDataReceived += printer.GazeDataReceived;
            fixations.FixationDetector.FixationEnd += printer.FixationEnd;
            printer.StartWindow();

            while (true)
            {
                Thread.Sleep(3000);
                printer.RenewWindow(true);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Connects to found eyetrackers, synchronizes CPU and eyetracker clocks, and attaches event handlers.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Contains found EyetrackerInfo</param>
        static void EyetrackerFound(object sender, EyetrackerInfoEventArgs e)
        {
            EyetrackerConnector connector = new EyetrackerConnector(e.EyetrackerInfo);

            connector.Connect();

            // sync CPU and Eyetracker clocks
            SyncManager syncManager = new SyncManager(clock, e.EyetrackerInfo, EventThreadingOptions.BackgroundThread);

            // detect fixations
            FixationDetector fixations = new FixationDetector(syncManager);

            connector.Eyetracker.GazeDataReceived += fixations.GazeDataReceived;

            /*/ 1. print each event to console
             * ConsolePrinter printer = new ConsolePrinter(syncManager);
             * //connector.Eyetracker.GazeDataReceived += printer.GazeDataReceived;
             * fixations.FixDetector.FixationEnd += printer.FixationEnd;//*/

            /*/ 2. windowed print to console
             * WindowingConsolePrinter printer = new WindowingConsolePrinter(syncManager);
             * //connector.Eyetracker.GazeDataReceived += printer.GazeDataReceived;
             * fixations.FixDetector.FixationEnd += printer.FixationEnd;
             *
             * printer.StartWindow();
             * while (true)
             * {
             *  Thread.Sleep(windowDuration);
             *  printer.ProcessWindow(cumulativeWindows);
             * }//*/

            // 3. process windows with EMDAT
            EmdatProcessor processor = new EmdatProcessor(syncManager);

            if (aoiFilePath != null)
            {
                processor.AoiFilePath = aoiFilePath;
            }

            connector.Eyetracker.GazeDataReceived += processor.GazeDataReceived;
            fixations.FixDetector.FixationEnd     += processor.FixationEnd;

            processor.StartWindow();
            while (true)
            {
                Thread.Sleep(windowDuration);
                processor.ProcessWindow(cumulativeWindows);
            }//*/
        }
Ejemplo n.º 4
0
        static void EyetrackerFound(object sender, EyetrackerInfoEventArgs e)
        {
            EyetrackerConnector connector = new EyetrackerConnector(e.EyetrackerInfo);
            connector.Connect();

            // sync CPU and Eyetracker clocks
            SyncManager syncManager = new SyncManager(clock, e.EyetrackerInfo, EventThreadingOptions.BackgroundThread);

            // detect fixations
            GazeDataFixationHandler fixations = new GazeDataFixationHandler(syncManager);
            connector.AddGazeDataHandler(fixations.GazeDataReceived);

            // print to console
            GazeDataConsolePrintHandler printer = new GazeDataConsolePrintHandler(syncManager);
            //connector.AddGazeDataHandler(printer.GazeDataReceived);
            fixations.FixationDetector.FixationEnd += printer.FixationEnd;
        }
Ejemplo n.º 5
0
        private static int windowDuration = 3000; // ms

        #endregion Fields

        #region Methods

        /// <summary>
        /// Connects to found eyetrackers, synchronizes CPU and eyetracker clocks, and attaches event handlers.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Contains found EyetrackerInfo</param>
        static void EyetrackerFound(object sender, EyetrackerInfoEventArgs e)
        {
            EyetrackerConnector connector = new EyetrackerConnector(e.EyetrackerInfo);
            connector.Connect();

            // sync CPU and Eyetracker clocks
            SyncManager syncManager = new SyncManager(clock, e.EyetrackerInfo, EventThreadingOptions.BackgroundThread);

            // detect fixations
            FixationDetector fixations = new FixationDetector(syncManager);
            connector.Eyetracker.GazeDataReceived += fixations.GazeDataReceived;

            /*/ 1. print each event to console
            ConsolePrinter printer = new ConsolePrinter(syncManager);
            //connector.Eyetracker.GazeDataReceived += printer.GazeDataReceived;
            fixations.FixDetector.FixationEnd += printer.FixationEnd;//*/

            /*/ 2. windowed print to console
            WindowingConsolePrinter printer = new WindowingConsolePrinter(syncManager);
            //connector.Eyetracker.GazeDataReceived += printer.GazeDataReceived;
            fixations.FixDetector.FixationEnd += printer.FixationEnd;

            printer.StartWindow();
            while (true)
            {
                Thread.Sleep(windowDuration);
                printer.ProcessWindow(cumulativeWindows);
            }//*/

            // 3. process windows with EMDAT
            EmdatProcessor processor = new EmdatProcessor(syncManager);
            if (aoiFilePath != null)
            {
                processor.AoiFilePath = aoiFilePath;
            }

            connector.Eyetracker.GazeDataReceived += processor.GazeDataReceived;
            fixations.FixDetector.FixationEnd += processor.FixationEnd;

            processor.StartWindow();
            while (true)
            {
                Thread.Sleep(windowDuration);
                processor.ProcessWindow(cumulativeWindows);
            }//*/
        }
Ejemplo n.º 6
0
        static void EyetrackerFound(object sender, EyetrackerInfoEventArgs e)
        {
            EyetrackerConnector connector = new EyetrackerConnector(e.EyetrackerInfo);

            connector.Connect();

            // sync CPU and Eyetracker clocks
            SyncManager syncManager = new SyncManager(clock, e.EyetrackerInfo, EventThreadingOptions.BackgroundThread);

            // detect fixations
            GazeDataFixationHandler fixations = new GazeDataFixationHandler(syncManager);

            connector.AddGazeDataHandler(fixations.GazeDataReceived);

            // print to console
            GazeDataConsolePrintHandler printer = new GazeDataConsolePrintHandler(syncManager);

            //connector.AddGazeDataHandler(printer.GazeDataReceived);
            fixations.FixationDetector.FixationEnd += printer.FixationEnd;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Connects to found eyetrackers, synchronizes CPU and eyetracker clocks, and attaches event handlers.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Contains found EyetrackerInfo</param>
        private static void EyetrackerFound(object sender, EyetrackerInfoEventArgs e)
        {
            EyetrackerConnector connector = new EyetrackerConnector(e.EyetrackerInfo);
            connector.Connect();

            // sync CPU and Eyetracker clocks
            SyncManager syncManager = new SyncManager(clock, e.EyetrackerInfo, EventThreadingOptions.BackgroundThread);

            // detect fixations
            FixationDetector fixations = new FixationDetector(syncManager);
            connector.Eyetracker.GazeDataReceived += fixations.GazeDataReceived;

            if (Settings.ProcessorDefinitions.ContainsKey(connector.Info.ProductId))
            {
                foreach (EmdatProcessorSettings settings in Settings.ProcessorDefinitions[connector.Info.ProductId])
                {
                    EmdatProcessor processor = new EmdatProcessor(syncManager);
                    processor.CumulativeData = settings.Cumulative;
                    connector.Eyetracker.GazeDataReceived += processor.GazeDataReceived;
                    fixations.FixDetector.FixationEnd += processor.FixationEnd;
                    Processors.Add(settings.ProcessorId, processor);
                }
            }
        }