.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's Learn & Support section of the Tobii 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.

.NET have 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 Tobii Pro SDK using NuGet

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

To install the Tobii Pro SDK with NuGet in Visual Studio, follow these steps:

  1. Change the target architecture to x64 for the project (default for .NET framework applications is "prefer 32bit").
  2. Open the Solution Explorer.
  3. Right-click on References.
  4. Select Manage NuGet Packages... in the context menu.
  5. Ensure that the Package source:-dropdown has nuget.org selected.
  6. Search for Tobii.Research.
  7. Select the Tobii.Research.x64 package.
  8. Click the Install button.
  9. If necessary, click Accept for dependent packages to be installed as well.
  10. 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 go to the NuGet Documentation .

Installing the Tobii Pro SDK manually

Visit our download site for the Tobii 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. Change the target architecture to x64 for the project (default for .NET framework applications is "prefer 32bit").
  3. Add the reference to the Tobii.Research.dll. Do that by right-clicking on the References inside your project and select Add Reference….
  4. When the Reference Manager in Visual Studio opens, click Browse… and locate the Tobii.Reserach.dll file. This will make the Tobii.Research.dll appear in the list in the Reference Manager. Do not use the "Any CPU" platform in any build configuration referencing Tobii.Reserach.dll.
  5. Select the dll from the list and click OK.
  6. 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 two files: 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.

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