private void EyeXHost_UserPresenceChanged(object sender, EngineStateValue <UserPresence> value) { //ignore any user presence change during calibration if (_isCalibrating) { return; } //!!With the above checking, below isn't necesary //check state and see if in calibration, then ignore this event //EngineStateValue<EyeTrackingDeviceStatus> deviceState = _eyeXHost.EyeTrackingDeviceStatus; //if (deviceState.IsValid && (deviceState.Value == EyeTrackingDeviceStatus.Configuring || deviceState.Value == EyeTrackingDeviceStatus.Initializing)) // return; bool isUserPresent = value.IsValid && value.Value == UserPresence.Present; //add delay , only call when present for 2s SetDelayedUserPresentAsync(isUserPresent); // State-changed events are received on a background thread. // But operations that affect the GUI must be executed on the main thread. RunOnMainThread(() => { Console.WriteLine("User Presenence changed: " + value.IsValid + " " + value.Value); IsUserPresent = isUserPresent; }); }
void DeviceStatusHandler(object sender, EngineStateValue <EyeTrackingDeviceStatus> e) { _dispatcher.Invoke(() => { _deviceStatus = GetDeviceStatus(e); _semaphore.Release(); }); }
void ConfigurationStatusHandler(object sender, EngineStateValue <EyeTrackingConfigurationStatus> e) { _dispatcher.Invoke(() => { _configurationStatus = GetConfigurationStatus(e); _semaphore.Release(); }); }
private void presenceObserverChange(object sender, EngineStateValue <UserPresence> e) { if (e.IsValid) { NextUserPresenceMessage = new UserPresenceMessage(e.Value == UserPresence.Present); } //Console.WriteLine($"Presence observer value: {e.Value} (Valid: {e.IsValid})"); }
private static void OnGazeTrackingStateChanged(object sender, EngineStateValue<Tobii.Interaction.Framework.GazeTracking> state) { if(state.IsValid) Console.WriteLine("Gaze tracking state is: {0}", state.Value); // Note: To play around with this state, click on Tobii Eye Tracking tray icon, // and in the menu which is appeared try to turn eyetracking on/off again. }
/// <summary> /// Right after calibration has started, awaits for engine to start tracking, meaning the calibration has ended. /// Unregisters itself, and allows command to be terminated /// </summary> /// <param name="source">Engine that sends the event</param> /// <param name="evt">New engine state</param> protected void OnStatusChanged(Object source, EngineStateValue <EyeTrackingDeviceStatus> evt) { if (evt.Value == EyeTrackingDeviceStatus.Tracking) { IsRunning = false; Engine.EyeTrackingDeviceStatusChanged -= OnStatusChanged; Console.WriteLine("calibration finished"); } }
private void EyeXHost_GazeTrackingChanged(object sender, EngineStateValue <GazeTracking> value) { // State-changed events are received on a background thread. // But operations that affect the GUI must be executed on the main thread. RunOnMainThread(() => { IsTrackingGaze = value.IsValid && value.Value == GazeTracking.GazeTracked; }); }
private void EyeXHost_UserPresenceChanged(object sender, EngineStateValue <UserPresence> value) { // State-changed events are received on a background thread. // But operations that affect the GUI must be executed on the main thread. RunOnMainThread(() => { IsUserPresent = value.IsValid && value.Value == UserPresence.Present; }); }
private void EyeXHost_EyeTrackingDeviceStatusChanged(object sender, EngineStateValue <EyeTrackingDeviceStatus> value) { Console.WriteLine(" Tracking Status changed: " + value.IsValid + " " + value.Value); //TEMP workaround to track when calibrating is done: first 'tracking' state deflags calibrating state if (_isCalibrating && value.IsValid && value.Value == EyeTrackingDeviceStatus.Tracking) { _isCalibrating = false; //Console.WriteLine(_calibrationAsyncData); } }
private void EyeXHost_UserPresenceChanged(object sender, EngineStateValue <UserPresence> e) { // State-changed events are received on a background thread. // But operations that affect the GUI must be executed on the main thread. // We use BeginInvoke to marshal the call to the main thread. if (Created) { BeginInvoke(new Action(() => UpdateUserPresence(e))); } }
private void HostOnUserPresenceChanged(object sender, EngineStateValue <UserPresence> engineStateValue) { if (!engineStateValue.IsValid) { return; } UserPresence = engineStateValue.Value; UpdateReason = UpdateReason.UserPresenceChanged; OnUpdate(); }
private void HostOnEyeTrackingDeviceStatusChanged(object sender, EngineStateValue <EyeTrackingDeviceStatus> engineStateValue) { if (!engineStateValue.IsValid) { return; } DeviceStatus = engineStateValue.Value; UpdateReason = UpdateReason.DeviceStatusChanged; OnUpdate(); }
private void HostOnUserProfileNameChanged(object sender, EngineStateValue <string> engineStateValue) { if (!engineStateValue.IsValid) { return; } CurrentProfileName = engineStateValue.Value; UpdateReason = UpdateReason.CurrentProfileNameChanged; OnUpdate(); }
public void GetPresence(object sender, EngineStateValue <UserPresence> e) { if (eHost.UserPresence.ToString() == "NotPresent") { userNotPresence = true; } if (eHost.UserPresence.ToString() == "Present") { userNotPresence = false; } }
private void HostOnDisplaySizeChanged(object sender, EngineStateValue <Size> engineStateValue) { if (!engineStateValue.IsValid) { return; } DisplaySize = engineStateValue.Value; UpdateReason = UpdateReason.DisplaySizeChanged; //OnUpdate(); }
private void HostOnDisplaySizeChanged(object sender, EngineStateValue <Size2> engineStateValue) { if (!engineStateValue.IsValid) { return; } DisplaySize = new Vector2((float)engineStateValue.Value.Width, (float)engineStateValue.Value.Height); UpdateReason = UpdateReason.DisplaySizeChanged; OnUpdate(); }
private void EyeXHost_EyeTrackingDeviceStatusChanged(object sender, EngineStateValue <EyeTrackingDeviceStatus> e) { if (AutoAlarm && e.Value.Equals(EyeTrackingDeviceStatus.DeviceNotConnected)) { ALSAlarm alarm = new ALSAlarm(); if (!alarm.isAlarmOn()) { alarm.PerformClick(); } } }
private void button1_Click(object sender, EventArgs e) { EngineStateValue <Tobii.Interaction.Framework.GazeTracking> status = Program.EyeXHost.States.GetGazeTrackingAsync().Result; Console.WriteLine("XXXXX " + Tobii.Interaction.Framework.GazeTracking.GazeTracked); /*var gazePointDataStream = host.Streams.CreateGazePointDataStream(); * gazePointDataStream.GazePoint((gazePointX, gazePointY, _) => Console.WriteLine("X: {0} Y:{1}", gazePointX, gazePointY));*/ EytrackerInit eyI = new EytrackerInit(); eyI.InitializeEyetracker(); }
private void UpdateUserPresence(EngineStateValue <UserPresence> value) { if (value.IsValid && value.Value == UserPresence.Present) { pictureBox1.ImageLocation = "Images/present.png"; _labelHasUserPresence.Text = "Yes"; } else { pictureBox1.ImageLocation = "Images/not-present.png"; _labelHasUserPresence.Text = "No"; } }
/// <summary> /// getting the gaze's status of the user (looking or not looking at the screen) /// using it to detect blink and depending on wich timer is running /// freeze the cursor, click and/or start another timer /// </summary> /// <param name="source"></param> /// <param name="e">EngineStateValue<GazeTracking></param> public void OnGazeTrackingChangedEvent(Object source, EngineStateValue <GazeTracking> e) { //Console.WriteLine("Gaze tracking (state-changed event): {0}", e); if (e.Value.ToString().Equals("GazeNotTracked")) { OnGazeNotTracked(new EventArgs()); } if (e.Value.ToString().Equals("GazeTracked")) { OnGazeTracked(new EventArgs()); } }
public void GetGaze(object sender, EngineStateValue <GazeTracking> e) { if (eHost.GazeTracking.ToString() == "GazeNotTracked") { gazeNotTracked = true; hasGazed = false; } if (eHost.GazeTracking.ToString() == "GazeTracked") { gazeNotTracked = false; hasGazed = true; } }
/// <summary> /// Combines the provided profiles with a sequence of <see cref="ConsoleKey"/>. /// </summary> /// <param name="profiles">The profiles to create key bindings for.</param> /// <returns>A dictionary of profile key bindings.</returns> private static IDictionary <ConsoleKey, string> CreateKeyBindings(EngineStateValue <string[]> profiles) { var bindings = new Dictionary <ConsoleKey, string>(); if (profiles.IsValid) { const int startIndex = (int)ConsoleKey.F1; var maxIndex = startIndex + profiles.Value.Length; for (var index = startIndex; index < maxIndex; index++) { bindings.Add((ConsoleKey)index, profiles.Value[index - startIndex]); } } return(bindings); }
/// <summary> /// Combines the provided profiles with a sequence of <see cref="ConsoleKey"/>. /// </summary> /// <param name="profiles">The profiles to create key bindings for.</param> /// <returns>A dictionary of profile key bindings.</returns> private static IDictionary<ConsoleKey, string> CreateKeyBindings(EngineStateValue<string[]> profiles) { var bindings = new Dictionary<ConsoleKey, string>(); if (profiles.IsValid) { const int startIndex = (int)ConsoleKey.F1; var maxIndex = startIndex + profiles.Value.Length; for (var index = startIndex; index < maxIndex; index++) { bindings.Add((ConsoleKey)index, profiles.Value[index - startIndex]); } } return bindings; }
private void EyeXHost_UserPresenceChanged(object sender, EngineStateValue <UserPresence> e) { try { if (AutoAlarm && e.Value.Equals(UserPresence.NotPresent)) { StartTimer(); } else { CVInterface.timer.Stop(); } } catch (Exception) { } }
private void EyeXHost_GazeTrackingChanged(object sender, EngineStateValue <GazeTracking> e) { // State-changed events are received on a background thread. // But operations that affect the GUI must be executed on the main thread. // We use BeginInvoke to marshal the call to the main thread. if (Created) { BeginInvoke(new Action(() => { if (e.IsValid && e.Value == GazeTracking.GazeTracked) { _labelHasGazeTracking.Text = "Yes"; } else { _labelHasGazeTracking.Text = "No"; } })); } }
private void EyeXHost_GazeTrackingChanged(object sender, EngineStateValue<GazeTracking> e) { // State-changed events are received on a background thread. // But operations that affect the GUI must be executed on the main thread. // We use BeginInvoke to marshal the call to the main thread. if (Created) { BeginInvoke(new Action(() => { if (e.IsValid && e.Value == GazeTracking.GazeTracked) { _labelHasGazeTracking.Text = "Yes"; } else { _labelHasGazeTracking.Text = "No"; } })); } }
private void UpdateUserPresence(EngineStateValue<UserPresence> value) { if (value.IsValid && value.Value == UserPresence.Present) { pictureBox1.ImageLocation = "Images/present.png"; _labelHasUserPresence.Text = "Yes"; } else { pictureBox1.ImageLocation = "Images/not-present.png"; _labelHasUserPresence.Text = "No"; } }
static EyeTrackingConfigurationStatus GetConfigurationStatus(EngineStateValue <EyeTrackingConfigurationStatus> status) { return(status.IsValid ? status.Value : default(EyeTrackingConfigurationStatus)); }
private void EyeXHost_UserPresenceChanged(object sender, EngineStateValue<UserPresence> value) { // State-changed events are received on a background thread. // But operations that affect the GUI must be executed on the main thread. RunOnMainThread(() => { IsUserPresent = value.IsValid && value.Value == UserPresence.Present; }); }
private void EyeXHost_GazeTrackingChanged(object sender, EngineStateValue<GazeTracking> value) { // State-changed events are received on a background thread. // But operations that affect the GUI must be executed on the main thread. RunOnMainThread(() => { IsTrackingGaze = value.IsValid && value.Value == GazeTracking.GazeTracked; }); }
//############################################################################################ public bool IsStarted() { EngineStateValue <Tobii.Interaction.Framework.GazeTracking> status = Program.EyeXHost.States.GetGazeTrackingAsync().Result; return(status.Value == Tobii.Interaction.Framework.GazeTracking.GazeTracked); }
private void EyeXHost_UserPresenceChanged(object sender, EngineStateValue<UserPresence> e) { try { if (AutoAlarm && e.Value.Equals(UserPresence.NotPresent)) { StartTimer(); } else { CVInterface.timer.Stop(); } } catch (Exception) { } }
private void EyeXHost_EyeTrackingDeviceStatusChanged(object sender, EngineStateValue<EyeTrackingDeviceStatus> e) { if (AutoAlarm && e.Value.Equals(EyeTrackingDeviceStatus.DeviceNotConnected)) { ALSAlarm alarm = new ALSAlarm(); if (!alarm.isAlarmOn()) { alarm.PerformClick(); } } }
static EyeTrackingDeviceStatus GetDeviceStatus(EngineStateValue <EyeTrackingDeviceStatus> status) { return(status.IsValid ? status.Value : default(EyeTrackingDeviceStatus)); }
private void EyeXHost_UserPresenceChanged(object sender, EngineStateValue<UserPresence> e) { // State-changed events are received on a background thread. // But operations that affect the GUI must be executed on the main thread. // We use BeginInvoke to marshal the call to the main thread. if (Created) { BeginInvoke(new Action(() => UpdateUserPresence(e))); } }