How to detect if Tobii Eye Tracker 5 is connected without loading the DLL file?

Home Forums Software Development How to detect if Tobii Eye Tracker 5 is connected without loading the DLL file?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18916
    DrMonaLisa
    Participant

    Hello.
    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.

    #18946
    Hongbin Zou
    Participant

    I highly doubt that Tobii ET5 can work under XP. Is your Tobii 4C app working under XP?

    #18983
    Grant [Tobii]
    Keymaster

    Hi @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.

    #18986
    DrMonaLisa
    Participant

    Thanks 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?

    #18991
    Grant [Tobii]
    Keymaster

    Hi @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.

    #18992
    DrMonaLisa
    Participant

    Thank you for the confirmation. Have a great day!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.