Tobii Pro SDK C API
tobii_research.h File Reference

Generic SDK functions. More...

Go to the source code of this file.

Data Structures

struct  TobiiResearchEyeTrackers
 
struct  TobiiResearchNormalizedPoint2D
 
struct  TobiiResearchPoint3D
 
struct  TobiiResearchSDKVersion
 

Macros

#define TOBII_RESEARCH_API
 
#define TOBII_RESEARCH_CALL
 

Typedefs

typedef struct TobiiResearchEyeTracker TobiiResearchEyeTracker
 
typedef TobiiResearchPoint3D TobiiResearchNormalizedPoint3D
 
typedef void(* tobii_research_log_callback) (int64_t system_time_stamp, TobiiResearchLogSource source, TobiiResearchLogLevel level, const char *message)
 Log callback. More...
 

Enumerations

enum  TobiiResearchStatus {
  TOBII_RESEARCH_STATUS_OK, TOBII_RESEARCH_STATUS_FATAL_ERROR, TOBII_RESEARCH_STATUS_INITIALIZE_FAILED, TOBII_RESEARCH_STATUS_TERMINATE_FAILED,
  TOBII_RESEARCH_STATUS_LOCALBROWSER_CREATE_FAILED, TOBII_RESEARCH_STATUS_LOCALBROWSER_POLL_FAILED, TOBII_RESEARCH_STATUS_ZEROCONFBROWSER_CREATE_FAILED, TOBII_RESEARCH_STATUS_ZEROCONFBROWSER_POLL_FAILED,
  TOBII_RESEARCH_STATUS_FILEBROWSER_CREATE_FAILED, TOBII_RESEARCH_STATUS_FILEBROWSER_POLL_FAILED, TOBII_RESEARCH_STATUS_INVALID_PARAMETER, TOBII_RESEARCH_STATUS_INVALID_OPERATION,
  TOBII_RESEARCH_STATUS_UNINITIALIZED, TOBII_RESEARCH_STATUS_OUT_OF_BOUNDS, TOBII_RESEARCH_STATUS_DISPLAY_AREA_NOT_VALID, TOBII_RESEARCH_STATUS_BUFFER_TOO_SMALL,
  TOBII_RESEARCH_STATUS_NOT_INITIALIZED, TOBII_RESEARCH_STATUS_ALREADY_INITIALIZED, TOBII_RESEARCH_STATUS_SAVED_LICENSE_FAILED_TO_APPLY, TOBII_RESEARCH_STATUS_SE_INTERNAL = 200,
  TOBII_RESEARCH_STATUS_SE_INSUFFICIENT_LICENSE, TOBII_RESEARCH_STATUS_SE_NOT_SUPPORTED, TOBII_RESEARCH_STATUS_SE_NOT_AVAILABLE, TOBII_RESEARCH_STATUS_SE_CONNECTION_FAILED,
  TOBII_RESEARCH_STATUS_SE_TIMED_OUT, TOBII_RESEARCH_STATUS_SE_ALLOCATION_FAILED, TOBII_RESEARCH_STATUS_SE_ALREADY_INITIALIZED, TOBII_RESEARCH_STATUS_SE_NOT_INITIALIZED,
  TOBII_RESEARCH_STATUS_SE_INVALID_PARAMETER, TOBII_RESEARCH_STATUS_SE_CALIBRATION_ALREADY_STARTED, TOBII_RESEARCH_STATUS_SE_CALIBRATION_NOT_STARTED, TOBII_RESEARCH_STATUS_SE_ALREADY_SUBSCRIBED,
  TOBII_RESEARCH_STATUS_SE_NOT_SUBSCRIBED, TOBII_RESEARCH_STATUS_SE_OPERATION_FAILED, TOBII_RESEARCH_STATUS_SE_CONFLICTING_API_INSTANCES, TOBII_RESEARCH_STATUS_SE_CALIBRATION_BUSY,
  TOBII_RESEARCH_STATUS_SE_CALLBACK_IN_PROGRESS, TOBII_RESEARCH_STATUS_SE_TOO_MANY_SUBSCRIBERS, TOBII_RESEARCH_STATUS_SE_BUFFER_TOO_SMALL, TOBII_RESEARCH_STATUS_SE_FIRMWARE_NO_RESPONSE,
  TOBII_RESEARCH_STATUS_FWUPGRADE_INTERNAL = 400, TOBII_RESEARCH_STATUS_FWUPGRADE_NOT_SUPPORTED, TOBII_RESEARCH_STATUS_FWUPGRADE_UNKNOWN_FIRMWARE_VERSION, TOBII_RESEARCH_STATUS_FWUPGRADE_CONNECTION_FAILED,
  TOBII_RESEARCH_STATUS_FWUPGRADE_INVALID_PARAMETER, TOBII_RESEARCH_STATUS_FWUPGRADE_PACKAGE_DEVICE_MISMATCH, TOBII_RESEARCH_STATUS_FWUPGRADE_PARSE_RESPONSE, TOBII_RESEARCH_STATUS_FWUPGRADE_OPERATION_FAILED,
  TOBII_RESEARCH_STATUS_FWUPGRADE_ALLOCATION_FAILED, TOBII_RESEARCH_STATUS_FWUPGRADE_FIRMWARE_NO_RESPONSE, TOBII_RESEARCH_STATUS_FWUPGRADE_DOWNGRADE_NOT_SUPPORTED, TOBII_RESEARCH_STATUS_UNKNOWN = 1000
}
 
enum  TobiiResearchLogSource { TOBII_RESEARCH_LOG_SOURCE_STREAM_ENGINE, TOBII_RESEARCH_LOG_SOURCE_SDK, TOBII_RESEARCH_LOG_SOURCE_FIRMWARE_UPGRADE }
 
enum  TobiiResearchLogLevel {
  TOBII_RESEARCH_LOG_LEVEL_ERROR, TOBII_RESEARCH_LOG_LEVEL_WARNING, TOBII_RESEARCH_LOG_LEVEL_INFORMATION, TOBII_RESEARCH_LOG_LEVEL_DEBUG,
  TOBII_RESEARCH_LOG_LEVEL_TRACE
}
 

Functions

TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_logging_subscribe (tobii_research_log_callback callback)
 Subscribes to logging. More...
 
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_logging_unsubscribe ()
 Unsubscribes from logging. More...
 
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_find_all_eyetrackers (TobiiResearchEyeTrackers **eyetrackers)
 Finds eye trackers connected to the computer or the network. More...
 
TOBII_RESEARCH_API void TOBII_RESEARCH_CALL tobii_research_free_eyetrackers (TobiiResearchEyeTrackers *eyetrackers)
 Free memory allocation for the result received via tobii_research_find_all_eyetrackers. More...
 
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_eyetracker (const char *address, TobiiResearchEyeTracker **eyetracker)
 Gets data for an eye tracker given an address. More...
 
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_system_time_stamp (int64_t *time_stamp_us)
 Retrieves the time stamp from the system clock in microseconds. More...
 
TOBII_RESEARCH_API void TOBII_RESEARCH_CALL tobii_research_free_string (char *str)
 Free memory allocation for a string allocated by the SDK. More...
 
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_sdk_version (TobiiResearchSDKVersion *sdk_version)
 

Detailed Description

Generic SDK functions.

Macro Definition Documentation

◆ TOBII_RESEARCH_API

#define TOBII_RESEARCH_API

◆ TOBII_RESEARCH_CALL

#define TOBII_RESEARCH_CALL

Typedef Documentation

◆ tobii_research_log_callback

typedef void(* tobii_research_log_callback) (int64_t system_time_stamp, TobiiResearchLogSource source, TobiiResearchLogLevel level, const char *message)

Log callback.

Implement this and send as a parameter to tobii_research_logging_subscribe.

Parameters
system_time_stampThe time stamp according to the computer's internal clock.
sourceSource of log message.
levelLog message level.
messageThe log message.

◆ TobiiResearchEyeTracker

Opaque representation of an eye tracker struct.

◆ TobiiResearchNormalizedPoint3D

Represents a normalized x-, y- and z-coordinate point in a three-dimensional space.

Enumeration Type Documentation

◆ TobiiResearchLogLevel

Log level.

Enumerator
TOBII_RESEARCH_LOG_LEVEL_ERROR 

Error message.

TOBII_RESEARCH_LOG_LEVEL_WARNING 

Warning message.

TOBII_RESEARCH_LOG_LEVEL_INFORMATION 

Information message.

TOBII_RESEARCH_LOG_LEVEL_DEBUG 

Debug message.

TOBII_RESEARCH_LOG_LEVEL_TRACE 

Trace message.

◆ TobiiResearchLogSource

Source of log message.

Enumerator
TOBII_RESEARCH_LOG_SOURCE_STREAM_ENGINE 

The log message is from stream engine.

TOBII_RESEARCH_LOG_SOURCE_SDK 

The log message is from the SDK.

TOBII_RESEARCH_LOG_SOURCE_FIRMWARE_UPGRADE 

The log message is from the firmware upgrade module.

◆ TobiiResearchStatus

Status codes returned by the SDK.

Enumerator
TOBII_RESEARCH_STATUS_OK 

No error.

TOBII_RESEARCH_STATUS_FATAL_ERROR 

Fatal error. This should normally not happen.

TOBII_RESEARCH_STATUS_INITIALIZE_FAILED 

Failed to initialize the API. This is a fatal error.

TOBII_RESEARCH_STATUS_TERMINATE_FAILED 

Failed to terminate the API.

TOBII_RESEARCH_STATUS_LOCALBROWSER_CREATE_FAILED 

Failed to create browser for finding local devices.

TOBII_RESEARCH_STATUS_LOCALBROWSER_POLL_FAILED 

Failed to poll local devices.

TOBII_RESEARCH_STATUS_ZEROCONFBROWSER_CREATE_FAILED 

Failed to create zero configuration browser.

TOBII_RESEARCH_STATUS_ZEROCONFBROWSER_POLL_FAILED 

Failed to poll devices from zero configuration browser.

TOBII_RESEARCH_STATUS_FILEBROWSER_CREATE_FAILED 

Failed to create browser that looks for devices in file.

TOBII_RESEARCH_STATUS_FILEBROWSER_POLL_FAILED 

Failed to poll devices from file browser.

TOBII_RESEARCH_STATUS_INVALID_PARAMETER 

An invalid parameter was given to the method.

TOBII_RESEARCH_STATUS_INVALID_OPERATION 

The operation was invalid.

TOBII_RESEARCH_STATUS_UNINITIALIZED 

Internal core error code. Should never be returned by the SDK.

TOBII_RESEARCH_STATUS_OUT_OF_BOUNDS 

A parameter is out of bounds.

TOBII_RESEARCH_STATUS_DISPLAY_AREA_NOT_VALID 

The display area is not valid. Please configure the eye tracker.

TOBII_RESEARCH_STATUS_BUFFER_TOO_SMALL 

The buffer is too small.

TOBII_RESEARCH_STATUS_NOT_INITIALIZED 

tobii_research_initialize has not been called.

TOBII_RESEARCH_STATUS_ALREADY_INITIALIZED 

tobii_research_initialize has already been called.

TOBII_RESEARCH_STATUS_SAVED_LICENSE_FAILED_TO_APPLY 

The license saved on the device failed to apply when connecting. It has probably expired.

TOBII_RESEARCH_STATUS_SE_INTERNAL 

Internal stream engine error.

TOBII_RESEARCH_STATUS_SE_INSUFFICIENT_LICENSE 

The operation requires a higher license type.

TOBII_RESEARCH_STATUS_SE_NOT_SUPPORTED 

The operations isn't supported in the current context.

TOBII_RESEARCH_STATUS_SE_NOT_AVAILABLE 

The device is unavailable.

TOBII_RESEARCH_STATUS_SE_CONNECTION_FAILED 

Connection to the device failed.

TOBII_RESEARCH_STATUS_SE_TIMED_OUT 

The operation timed out.

TOBII_RESEARCH_STATUS_SE_ALLOCATION_FAILED 

Failed to allocate memory.

TOBII_RESEARCH_STATUS_SE_ALREADY_INITIALIZED 

The API is already initialized.

TOBII_RESEARCH_STATUS_SE_NOT_INITIALIZED 

The API isn't initialized.

TOBII_RESEARCH_STATUS_SE_INVALID_PARAMETER 

An invalid parameter was given to the method.

TOBII_RESEARCH_STATUS_SE_CALIBRATION_ALREADY_STARTED 

Calibration has already started.

TOBII_RESEARCH_STATUS_SE_CALIBRATION_NOT_STARTED 

Calibration isn't started.

TOBII_RESEARCH_STATUS_SE_ALREADY_SUBSCRIBED 

Already subscribed.

TOBII_RESEARCH_STATUS_SE_NOT_SUBSCRIBED 

Not subscribed.

TOBII_RESEARCH_STATUS_SE_OPERATION_FAILED 

Operation failed.

TOBII_RESEARCH_STATUS_SE_CONFLICTING_API_INSTANCES 

Conflicting api instances.

TOBII_RESEARCH_STATUS_SE_CALIBRATION_BUSY 

Calibration busy.

TOBII_RESEARCH_STATUS_SE_CALLBACK_IN_PROGRESS 

Callback in progress.

TOBII_RESEARCH_STATUS_SE_TOO_MANY_SUBSCRIBERS 

Too many users subscribed to a stream.

TOBII_RESEARCH_STATUS_SE_BUFFER_TOO_SMALL 

The buffer is too small.

TOBII_RESEARCH_STATUS_SE_FIRMWARE_NO_RESPONSE 

No response from firmware.

TOBII_RESEARCH_STATUS_FWUPGRADE_INTERNAL 

Internal error.

TOBII_RESEARCH_STATUS_FWUPGRADE_NOT_SUPPORTED 

Firmware upgrade is not supported.

TOBII_RESEARCH_STATUS_FWUPGRADE_UNKNOWN_FIRMWARE_VERSION 

Unknown firmware version.

TOBII_RESEARCH_STATUS_FWUPGRADE_CONNECTION_FAILED 

Connection failed.

TOBII_RESEARCH_STATUS_FWUPGRADE_INVALID_PARAMETER 

Invalid parameter.

TOBII_RESEARCH_STATUS_FWUPGRADE_PACKAGE_DEVICE_MISMATCH 

Device mismatch. The firmware package is not meant for the device.

TOBII_RESEARCH_STATUS_FWUPGRADE_PARSE_RESPONSE 

Parse response.

TOBII_RESEARCH_STATUS_FWUPGRADE_OPERATION_FAILED 

The firmware upgrade operation failed.

TOBII_RESEARCH_STATUS_FWUPGRADE_ALLOCATION_FAILED 

Memory allocation failed during firmware upgrade.

TOBII_RESEARCH_STATUS_FWUPGRADE_FIRMWARE_NO_RESPONSE 

The firmware failed to respond during firmware upgrade.

TOBII_RESEARCH_STATUS_FWUPGRADE_DOWNGRADE_NOT_SUPPORTED 

The firmware downgrade operation is not supported.

TOBII_RESEARCH_STATUS_UNKNOWN 

Unknown error. This is a fatal error.

Function Documentation

◆ tobii_research_find_all_eyetrackers()

TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_find_all_eyetrackers ( TobiiResearchEyeTrackers **  eyetrackers)

Finds eye trackers connected to the computer or the network.

The eye trackers can be used in any tobii_research function that requires an eye tracker.

TobiiResearchEyeTrackers* eyetrackers = NULL;
size_t i = 0;
result = tobii_research_find_all_eyetrackers(&eyetrackers);
if (result != TOBII_RESEARCH_STATUS_OK) {
printf("Finding trackers failed. Error: %d\n", result);
return result;
}
for (i = 0; i < eyetrackers->count; i++) {
TobiiResearchEyeTracker* eyetracker = eyetrackers->eyetrackers[i];
char* address = NULL;
char* serial_number = NULL;
char* device_name = NULL;
tobii_research_get_address(eyetracker, &address);
tobii_research_get_serial_number(eyetracker, &serial_number);
tobii_research_get_device_name(eyetracker, &device_name);
printf("%s\t%s\t%s\n", address, serial_number, device_name);
}
printf("Found %d Eye Trackers \n\n", (int)eyetrackers->count);
Parameters
eyetrackersPointers to found eye trackers will be stored in this struct.
Returns
A TobiiResearchStatus code.
Examples
find_all_eyetrackers.c.

◆ tobii_research_free_eyetrackers()

TOBII_RESEARCH_API void TOBII_RESEARCH_CALL tobii_research_free_eyetrackers ( TobiiResearchEyeTrackers eyetrackers)

Free memory allocation for the result received via tobii_research_find_all_eyetrackers.

Parameters
eyetrackersEye trackers to free.
Examples
find_all_eyetrackers.c.

◆ tobii_research_free_string()

◆ tobii_research_get_eyetracker()

TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_eyetracker ( const char *  address,
TobiiResearchEyeTracker **  eyetracker 
)

Gets data for an eye tracker given an address.

// ex address = "tet-tcp://12.13.14.15"
TobiiResearchEyeTracker* eyetracker = NULL;
TobiiResearchStatus status = tobii_research_get_eyetracker(address, &eyetracker);
char* serial_number = NULL;
char* device_name = NULL;
char* model = NULL;
tobii_research_get_serial_number(eyetracker, &serial_number);
tobii_research_get_device_name(eyetracker, &device_name);
tobii_research_get_model(eyetracker, &model);
printf("Get Eye tracker with status: %i\n", status);
printf("Address: %s\n", address);
printf("Model: %s\n", model);
printf("Name (It's OK if this is empty): %s\n", device_name);
printf("Serial number: %s\n", serial_number);
Parameters
addressAddress of eye tracker to get data for.
eyetrackerEye tracker object returned.
Returns
A TobiiResearchStatus code.
Examples
call_eyetracker_manager_posix.c, call_eyetracker_manager_windows.c, and create_eyetracker.c.

◆ tobii_research_get_sdk_version()

TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_sdk_version ( TobiiResearchSDKVersion sdk_version)

Gets the SDK version.

Parameters
sdk_versionVersion of the SDK.
Returns
A TobiiResearchStatus code.

◆ tobii_research_get_system_time_stamp()

TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_system_time_stamp ( int64_t *  time_stamp_us)

Retrieves the time stamp from the system clock in microseconds.

int64_t system_time_stamp;
printf("The system time stamp in microseconds is %" PRId64 " with status %i.\n", system_time_stamp, status);
Parameters
time_stamp_usThe time stamp of the system in microseconds.
Returns
A TobiiResearchStatus code.
Examples
get_system_time_stamp.c.

◆ tobii_research_logging_subscribe()

Subscribes to logging.

Parameters
callbackCallback that will receive log messages.
Returns
A TobiiResearchStatus code.

◆ tobii_research_logging_unsubscribe()

TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_logging_unsubscribe ( )

Unsubscribes from logging.

Returns
A TobiiResearchStatus code.
tobii_research_get_address
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_address(TobiiResearchEyeTracker *eyetracker, char **address)
Gets the address (URI) of the eye tracker device.
TobiiResearchEyeTrackers
Definition: tobii_research.h:315
tobii_research_get_device_name
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_device_name(TobiiResearchEyeTracker *eyetracker, char **device_name)
Gets the name of the eye tracker.
tobii_research_get_serial_number
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_serial_number(TobiiResearchEyeTracker *eyetracker, char **serial_number)
Gets the serial number of the eye tracker. All physical eye trackers have a unique serial number.
tobii_research_free_string
TOBII_RESEARCH_API void TOBII_RESEARCH_CALL tobii_research_free_string(char *str)
Free memory allocation for a string allocated by the SDK.
TobiiResearchEyeTracker
struct TobiiResearchEyeTracker TobiiResearchEyeTracker
Definition: tobii_research.h:310
TobiiResearchEyeTrackers::count
size_t count
Definition: tobii_research.h:323
TobiiResearchEyeTrackers::eyetrackers
TobiiResearchEyeTracker ** eyetrackers
Definition: tobii_research.h:319
tobii_research_free_eyetrackers
TOBII_RESEARCH_API void TOBII_RESEARCH_CALL tobii_research_free_eyetrackers(TobiiResearchEyeTrackers *eyetrackers)
Free memory allocation for the result received via tobii_research_find_all_eyetrackers.
TOBII_RESEARCH_STATUS_OK
@ TOBII_RESEARCH_STATUS_OK
Definition: tobii_research.h:49
tobii_research_find_all_eyetrackers
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_find_all_eyetrackers(TobiiResearchEyeTrackers **eyetrackers)
Finds eye trackers connected to the computer or the network.
tobii_research_get_system_time_stamp
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_system_time_stamp(int64_t *time_stamp_us)
Retrieves the time stamp from the system clock in microseconds.
tobii_research_get_model
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_model(TobiiResearchEyeTracker *eyetracker, char **model)
Gets the model of the eye tracker.
TobiiResearchStatus
TobiiResearchStatus
Definition: tobii_research.h:45
tobii_research_get_eyetracker
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_eyetracker(const char *address, TobiiResearchEyeTracker **eyetracker)
Gets data for an eye tracker given an address.