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

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

#define TOBII_RESEARCH_API
#define TOBII_RESEARCH_CALL

Typedef Documentation

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.

Opaque representation of an eye tracker struct.

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

Enumeration Type Documentation

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.

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.

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_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_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;
char* serial_number;
char* device_name;
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_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_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;
char* device_name;
char* model;
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", 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_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_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.

Subscribes to logging.

Parameters
callbackCallback that will receive log messages.
Returns
A TobiiResearchStatus code.
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_logging_unsubscribe ( )

Unsubscribes from logging.

Returns
A TobiiResearchStatus code.