Home › Forums › Software Development › How to detect if Tobii Eye Tracker 5 is connected without loading the DLL file?
- This topic has 5 replies, 3 voices, and was last updated 2 years, 11 months ago by
DrMonaLisa.
- AuthorPosts
- 01/10/2020 at 16:13 #18916
DrMonaLisa
ParticipantHello.
I’ve programmed my C++ app to load the “tobii_interaction_lib.dll” and “tobii_stream_engine.dll” on the first call (In Visual Studio 2019 it’s: Linker -> Input -> Delay Loaded Dlls).
It helps to prevent potential crashes, or problems where AV programs remove Tobii’s DLLs and prevent app from starting.I use the Tobii Eye Tracker 4C device, and I used the following method to detect if the special thread should be started in my program:
if (IsProcessRunningPartialName("Tobii.EyeX")) { if ((FileExists("tobii_interaction_lib.dll")) && (FileExists("tobii_stream_engine.dll"))) { if (!TobiiEyeTrackerThreadAlreadyEnabled) { TobiiEyeTrackerThreadAlreadyEnabled = true; boost::thread BoostThreadTobiiEyeTracker(TobiiEyeTrackerThread, false);
Function “IsProcessRunningPartialName” is just returning true if any of “Tobii.EyeX” programs are running.
I noticed, that for Tobii Eye Tracker 5, a different program is used: “Tobii Experience”. Unfortunately I am unable to install this program, because I don’t own the Eye Tracker 5 device.
Following this article: https://help.tobii.com/hc/en-us/articles/360009325857-Installation-or-setup-issues-for-Tobii-Eye-Tracker-5
It seems like Eye Tracker 5 also uses the “Tobii Service” service (visible in the Task Manager -> Services)?So I modified my function to the following:
if ((IsProcessRunningPartialName("Tobii.EyeX")) || (GetServiceStatus("Tobii Service") != 0)) {
The “GetServiceStatus” function is copied from here: https://stackoverflow.com/questions/7808085/how-to-get-the-status-of-a-service-programmatically-running-stopped
Generally, it works. It returns non 0 on my PC, and 0 if I put a random text (not the actual service name).
My question is, is this solution correct for the Eye Tracker 5 device? I know that I could simply test if the device is connected after loading the DLLs, but it’s not worth the “risk”, especially when there still may be some Windows XP users 🙂
Thanks you.
02/10/2020 at 01:24 #18946Hongbin Zou
ParticipantI highly doubt that Tobii ET5 can work under XP. Is your Tobii 4C app working under XP?
02/10/2020 at 20:43 #18983Grant [Tobii]
KeymasterHi @drmonalisa, could you kindly clarify what you are trying to achieve?
If you are trying to find out if the Tobii software stack is installed on the system?
The best approach therefore would be to load the DLL’s and try to enumerate all connected eye trackers. If none are found, then either the software stack is not installed or the tracker is not connected to the PC.
Thank you for further details on your project. Best Wishes.
03/10/2020 at 14:18 #18986DrMonaLisa
ParticipantThanks for the replies!
Generally, I always try to avoid loading DLLs when they’re not needed. It helps to prevent potential crashes or incompatibility with older OS versions. For example, if for some reasons my program was used on Windows XP or Vista, and Tobii’s DLLs failed to load, the program would crash on start.
Due that not many people have Eye Tracker devices, I decided that it’s better to first detect if any Tobii software is installed, and then load DLLs. The previous method I used was checking if a process containing name “Tobii.EyeX” is running. I noticed, that Eye Tracker 5 is not using the old software, so I updated my detection method to check if Service named “Tobii Service” is running. I would just like to confirm that it’s the correct method of detecting the Tobii software for Eye Tracker 5 devices? Is this service running when Eye Tracker 5 drivers are installed?
05/10/2020 at 11:37 #18991Grant [Tobii]
KeymasterHi @drmonalisa, thank you for the clarification. In this case, your method would seem to be appropriate as a means to test if there is either 4C or ET5 Tobii Core software installed. An alternative might be to iterate over connected windows devices but this would not guarantee that the correct drivers and SW are installed so your approach would seem to be the most logical. And yes, the service should always be running if the drivers have been installed (for both trackers).
Do let us know if we can provide any further assistance. Best Wishes.
05/10/2020 at 12:27 #18992DrMonaLisa
ParticipantThank you for the confirmation. Have a great day!
- AuthorPosts
- You must be logged in to reply to this topic.