public TobiiCoordinatesProvider(Action <TobiiCoordinates> on_coordinates_callback) { this.on_coordinates_callback = on_coordinates_callback; try { host = new Tobii.Interaction.Host(); gaze_point_data_stream = host.Streams.CreateGazePointDataStream(); eye_position_stream = host.Streams.CreateEyePositionStream(); head_pose_stream = host.Streams.CreateHeadPoseStream(); UpdateTobiiStreams(null, null); Options.CalibrationMode.Changed += UpdateTobiiStreams; gaze_point_data_stream.GazePoint(OnGazePoint); eye_position_stream.EyePosition(OnEyePosition); head_pose_stream.HeadPose(OnHeadPose); } catch (Exception e) { if (MessageBox.Show("Eye Tracker isn't installed properly. \n\n" + "Open Tobii software download page? \n", "Failed Connecting to Tobii Eye Tracker", MessageBoxButtons.YesNo) == DialogResult.Yes) { Process.Start("https://gaming.tobii.com/getstarted/"); } } }
static void Main() { loadSettings(); setParams(); var host = new Tobii.Interaction.Host(); var gazePointDataStream = host.Streams.CreateGazePointDataStream(); //gazePointDataStream.GazePoint((gazePointX, gazePointY, _) => Console.WriteLine("X: {0} Y:{1}", gazePointX, gazePointY)); GazeHook gazeHookTarget; gazeHookTarget = GazeHookFunc; gazePointDataStream.GazePoint((gazePointX, gazePointY, _) => gazeHookTarget(gazePointX, gazePointY)); //IntPtr hook = SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle("user32"), 0); //if (hook == IntPtr.Zero) throw new System.ComponentModel.Win32Exception(); //return hook; Application.AddMessageFilter(new MouseMessageFilter()); MouseMessageFilter.MouseMove += new MouseEventHandler(OnGlobalMouseMove); System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10); dispatcherTimer.Start(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
static void Main(string[] args) { var wssv = new WebSocketSharp.Server.WebSocketServer("ws://192.168.178.24:42834"); wssv.AddWebSocketService <GazeServer>("/gaze"); var tobiiHost = new Tobii.Interaction.Host(); var gazePointDataStream = tobiiHost.Streams.CreateGazePointDataStream(); gazePointDataStream.GazePoint((gazePointX, gazePointY, _) => GazeServer.SetGazePoint(gazePointX, gazePointY)); var eyePositionDataStream = tobiiHost.Streams.CreateEyePositionStream(); eyePositionDataStream.EyePosition((eyePosition) => GazeServer.SetEyePosition(eyePosition)); wssv.Start(); Console.WriteLine("Press any key to stop."); Console.ReadKey(true); wssv.Stop(); }
public EyeTrackingMouse() { try { host = new Tobii.Interaction.Host(); gaze_point_data_stream = host.Streams.CreateGazePointDataStream(); eye_position_stream = host.Streams.CreateEyePositionStream(); head_pose_stream = host.Streams.CreateHeadPoseStream(); UpdateTobiiStreams(null, null); Settings.CalibrationModeChanged += UpdateTobiiStreams; gaze_point_data_stream.GazePoint(OnGazePoint); eye_position_stream.EyePosition(OnEyePosition); head_pose_stream.HeadPose(OnHeadPose); } catch (Exception e) { MessageBox.Show(e.Message + ". Try reinstalling driver for Tobii Eye Tracker 4C."); Environment.Exit(0); } }