.NET - Getting started

With this SDK you will be able to easily find and get data from your Tobii eye tracker. If you are new to eye tracking we recommend that you spend some time exploring the content in Tobii Pro's Learn & Support section of the Tobii Pro website . There you will find a lot of information about how eye tracking works in general and how to design studies.

In the Common concepts section of this website, you will find information about concept referenced in the SDK documentation which are common for all SDK languages. This includes, but are not limited to, things like the different coordinate systems used as well as how time stamps are defined.

The Tobii Pro SDK for .NET is designed to be a natural part of the .NET Framework and, as such, there are two ways you can install it; either by downloading it and installing it manually, or by using NuGet which requires an internet connection.

Installing the Pro SDK using NuGet

If you do not already have NuGet installed, you can download and install it from here .

To install the Pro SDK using NuGet, follow these steps:

  1. Start up Visual Studio.
  2. Open the Solution Explorer.
  3. Right-click on References.
  4. Ensure that the Package source:-dropdown has nuget.org selected.
  5. Select the Tobii.Research.x64 or Tobii.Research.x86 package, depending on if you're developing a 64-bit or 32-bit application.
  6. Click the Install button.
  7. If necessary, click Accept for dependent packages to be installed as well.
  8. Once the installation is completed, open up the Installed section to verify that the installation completed successfully.
For more information about how to use NuGet, please to the NuGet Documentation .

Installing the Pro SDK manually

Visit our download site for the Pro SDK , and download the latest version of the Tobii Pro SDK .NET Binding. The package includes all files you will need to develop an application that communicates with a Tobii Pro eye tracker. Extract the files and put them where you usually keep your development files.

Adding Tobii.Research.dll to your project

  1. If you do not already have one created, create a new .NET Project in Visual Studio.
  2. Add the reference to the Tobii.Research.dll. Do that by right-clicking on the References inside your project and select Add Reference….
  3. When the Reference Manager in Visual Studio opens, click Browse… and locate the Tobii.Reserach.dll file that corresponds to your build (x64 or x86). This will make the Tobii.Research.dll appear in the list in the Reference Manager. Take care to reference the x64 .dll in all x64 platform build configurations and/or reference the x86 .dll in all x86 platform build configurations. Do not use the "Any CPU" platform in any build configuration referencing Tobii.Reserach.dll.
  4. Select the dll from the list and click OK.
  5. To verify that the installation was done correctly, check that Tobii.Research appears in the References list.

Since the Tobii Pro SDK is using some other DLLs needed to communicate with the eye trackers, make sure they get included in the build by including them in your project. To do this, follow these steps:

  1. Right click on your project.
  2. Select Add -> Existing Item….
  3. Go to the API folder that corresponds to your build.
  4. Select the three files: tobii_stream_engine.dll, tobii_pro.dll and tobii_firmware_upgrade.dll.
  5. You should now be able to see the newly added files in the Solution explorer. Select them one by one and change the property Copy to Output Directory from Do not copy to Copy always.

Installing the Eye Tracker Manager

The Eye Tracker Manager (ETM) is an independent tool that can be handy to use when developing eye tracking applications. With the ETM you can browse and change settings, as well as perform calibrations, on all screen based eye trackers* compatible with the Pro SDK as well as update the firmware on some eye tracker models. The ETM can also be used to troubleshoot your own application for connection errors since if the ETM can find and interact with an eye tracker, then the SDK should be able to do the same. The ETM can be downloaded from here .

* Note: HMD eye trackers are currently not supported by Eye Tracker Manager.

A quick guide to a functional application

Most eye tracking applications follow the same pattern in terms of in which order functionality is used. The order is usually as follows:

  1. Browsing for eye trackers or selecting an eye tracker with known address.
  2. Establishing a connection with the eye tracker.
  3. Running a calibration procedure in which the eye tracker is calibrated to the user.
  4. Setting up a subscription to gaze data, and collecting and saving the data on the computer running the application. In some cases, the data is also shown live by the application.

To do this with the Pro SDK is very simple:

Step 1: Browsing

Start with the EyeTrackingOperations, a static class residing in Tobii.Research namespace. Use either the FindAllEyeTrackers function to get a list of available eye trackers or the GetEyeTracker function that only returns one eye tracker specified by the eye tracker URI.

Step 2: Connecting to an eye tracker

The objects returned from the functions FindAllEyeTrackers and GetEyeTracker are instances of the class IEyeTracker. Through those objects you can interact with the eye trackers.

Step 3: Performing a calibration

To calibrate the eye tracker, use either a ScreenBasedCalibration or a HMDBasedCalibration object (depending on the type of eye tracker). The ScreenBasedCalibration / HMDBasedCalibration class requires an IEyeTracker object in the constructor. More information about how a calibration works can be found in the section Calibration.

Step 4: Subscribing to data

When you have the IEyeTracker object and want to subscribe to gaze data, subscribe to either the GazeDataReceived or the HMDGazeDataReceived event (depending on the type of eye tracker). The data will be available as GazeDataEventArgs or HMDGazeDataEventArgs respectively.