Home › Forums › Software Development › Waiting until Calibration/Calibration testing is done.
Tagged: calibration, eyex, wait
- This topic has 2 replies, 2 voices, and was last updated 9 years, 9 months ago by Albin Stenström.
- AuthorPosts
- 05/03/2015 at 16:21 #2664Albin StenströmParticipant
Hi!
Is there a good way in EyeX SDKto wait until Calibration or calibration testing is done?
Im right now waiting for a status changed event to Configuring and then Tracking for Calibration.
This does not work for Calibration Testing as far as i have seen.
Thank you!
Albin09/03/2015 at 13:18 #2681Patrik [Tobii]ParticipantHello Albin,
There is currently no way of knowing when calibration testing is completed. There are currently discussions about adding a callback in the API for this, so hopefully this feature will be available in a future release.
There is a workaround though, but it is an unsupported hack and not something that should be relied on:
- You could check for the process
Tobii.TestEyeTracking
and wait for the process to exit.
It’s not very robust, and you should be aware that the name of this process can change at any time.
You might however use it as a temporary hack until there is something proper in the API.Below is a simple Console application (C#) that demonstrates the workaround.
using System; using System.Diagnostics; using System.Threading; namespace CalibrationTestingDetection { public class Program { static void Main(string[] args) { var handle = new ManualResetEvent(false); // Subscribe to CTRL+C Console.CancelKeyPress += (sender, eventArgs) => { eventArgs.Cancel = true; handle.Set(); }; Console.WriteLine("Press CTRL+C to quit.\n"); // Wait for calibration testing to start and finish. if (WaitForCalibrationTestingToComplete(handle)) { Console.WriteLine("Successfully detected start and stop."); } else { Console.WriteLine("Application aborted (CTRL+C pressed)."); } // Wait for the user to quit. Console.WriteLine("\nPress ANY key to quit"); Console.ReadKey(true); } public static bool WaitForCalibrationTestingToComplete(WaitHandle handle) { Console.WriteLine("Waiting for calibration testing to start."); while (!handle.WaitOne(0)) { try { var processes = Process.GetProcessesByName("Tobii.TestEyeTracking"); if (processes.Length > 0) { Console.WriteLine("Calibration testing was started!"); var process = processes[0]; while (!handle.WaitOne(500)) { if (process.HasExited) { Console.WriteLine("Calibration testing completed!"); return true; } } } } finally { handle.WaitOne(500); } } return false; } } }
Best regards
Patrik09/03/2015 at 13:33 #2682Albin StenströmParticipantThank you for your help!
I would NOT have been able to figure that one out on my own!
- You could check for the process
- AuthorPosts
- You must be logged in to reply to this topic.