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

Installing and building the Pro SDK on Windows

Visit our download site for the Pro SDK , and download the latest version of the Tobii Pro SDK C Binding for your platform. 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.

Building with tobii_research

The Tobii Pro SDK has been build using Microsoft's Windows 8.1 SDK. In the example below the tobii_research header files are assumed to be installed at the location path-to-includes and the tobii_research libraries are assumed to be installed at the location path-to-libs. So if your project consist of a file, simple_project.c which is using the Tobii Pro SDK, then it could be compiled and linked by typing:

cl simple_project.c /Ipath-to-includes path-to-libs\tobii_research.lib

Running application built with tobii_research

To run an application using Tobii Pro SDK, e.g the simple_project built in previous section you need to add path-to-libs as a search path for the application. One way of doing this is to add the path-to-libs to the environment variable PATH.

Installing and building the Pro SDK on Linux

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

Installing tobii_research

Open a terminal window where the files where extracted and type:

sudo make install
To install the 64-bit tobii_research.

sudo make install BITNESS=32
To install the 32-bit tobii_research.

Building with tobii_research

Together with the header files and the shared libraries there is also a pkg-config file installed to simplify integrating Tobii Pro SDK in your project. Typing pkg-config --cflags tobii_research returns the compiler flags needed to compile your project with regard to tobii_research, while pkg-config --libs tobii_research returns the linker flags needed to link your project. The pkg-config command can be used together with gcc, so if your project consist of a file, simple_project.c which is using the Tobii Pro SDK, then it could be compiled and linked by typing:

gcc simple_project.c `pkg-config --cflags --libs tobii_research` -o simple_project

Running application built with tobii_research

To run an application using Tobii Pro SDK, e.g the simple_project built in previous section type:

LD_LIBRARY_PATH=/usr/local/lib/tobii_research ./simple_project

There are other and better ways to add search paths for shared libraries then setting the LD_LIBRARY_PATH, but that is not a part of this guide's scope.

Installing and building the Pro SDK on OS X

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

Installing tobii_research

Open a terminal window where the files where extracted and type:

sudo make install

Building with tobii_research

Together with the header files and the shared libraries there is also a pkg-config file installed to simplify integrating Tobii Pro SDK in your project. Typing pkg-config --cflags tobii_research returns the compiler flags needed to compile your project with regard to tobii_research, while pkg-config --libs tobii_research returns the linker flags needed to link your project. The pkg-config command can be used together with clang, so if your project consist of a file, simple_project.c which is using the Tobii Pro SDK, then it could be compiled and linked by typing:

clang simple_project.c `pkg-config --cflags --libs tobii_research` -o simple_project

Running application built with tobii_research

To run an application using Tobii Pro SDK, e.g the simple_project built in previous section type:

DYLD_LIBRARY_PATH=/usr/local/lib/tobii_research ./simple_project

There are other and better ways to add search paths for shared libraries then setting the DYLD_LIBRARY_PATH, but that is not a part of this guide's scope.

* 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 including tobii_research.h, and use either the tobii_research_find_all_eyetrackers function to get a list of available eye trackers, or get a TobiiResearchEyeTracker pointer from an address (URI) via the tobii_research_get_eyetracker function.

Step 2: Connecting to an eye tracker

The returned result from tobii_research_find_all_eyetrackers contains pointers to instances of TobiiResearchEyeTracker. Through those you can interact with the eye trackers.

Step 3: Performing a calibration

To calibrate the eye tracker, use the functions in the tobii_research_calibration.h header file. More information about how a calibration works can be found in the section Calibration.

Step 4: Subscribing to data

When you have a TobiiResearchEyeTracker pointer and want to subscribe to gaze data, subscribe with either function tobii_research_subscribe_to_gaze_data or tobii_research_subscribe_to_hmd_gaze_data (depending on the type of eye tracker). The data will be available as TobiiResearchGazeData or TobiiResearchHMDGazeData respectively, via the callback registered when subscribing.