Tobii Pro SDK C API
get_and_set_display_area.c
#include <stdio.h>
#include <string.h>
void get_display_area_example(TobiiResearchEyeTracker* eyetracker) {
TobiiResearchStatus status = tobii_research_get_display_area(eyetracker, &display_area);
char* serial_number = NULL;
tobii_research_get_serial_number(eyetracker, &serial_number);
printf("Got display area from tracker with serial number %s with status %i:\n", serial_number, status);
printf("Bottom Left: (%f, %f, %f)\n",
display_area.bottom_left.x,
display_area.bottom_left.y,
display_area.bottom_left.z);
printf("Bottom Right: (%f, %f, %f)\n",
display_area.bottom_right.x,
display_area.bottom_right.y,
display_area.bottom_right.z);
printf("Height: %f\n", display_area.height);
printf("Top Left: (%f, %f, %f)\n",
display_area.top_left.x,
display_area.top_left.y,
display_area.top_left.z);
printf("Top Right: (%f, %f, %f)\n",
display_area.top_right.x,
display_area.top_right.y,
display_area.top_right.z);
printf("Width: %f\n", display_area.width);
// To set the display area it is possible to either use a previously saved instance of
// the type TobiiResearchDisplayArea, or create a new one as shown below.
TobiiResearchDisplayArea new_display_area;
// For simplicity we are using the same values that are already set on the eye tracker.
memcpy(&new_display_area.top_left, &display_area.top_left, sizeof(display_area.top_left));
memcpy(&new_display_area.top_right, &display_area.top_right, sizeof(display_area.top_right));
memcpy(&new_display_area.bottom_left, &display_area.bottom_left, sizeof(display_area.bottom_left));
status = tobii_research_set_display_area(eyetracker, &new_display_area);
}
Definition: tobii_research_eyetracker.h:132
TobiiResearchPoint3D top_left
Definition: tobii_research_eyetracker.h:151
float height
Definition: tobii_research_eyetracker.h:146
float width
Definition: tobii_research_eyetracker.h:161
TobiiResearchPoint3D bottom_right
Definition: tobii_research_eyetracker.h:141
TobiiResearchPoint3D top_right
Definition: tobii_research_eyetracker.h:156
TobiiResearchPoint3D bottom_left
Definition: tobii_research_eyetracker.h:136
float x
Definition: tobii_research.h:403
float z
Definition: tobii_research.h:411
float y
Definition: tobii_research.h:407
TOBII_RESEARCH_API void TOBII_RESEARCH_CALL tobii_research_free_string(char *str)
Free memory allocation for a string allocated by the SDK.
struct TobiiResearchEyeTracker TobiiResearchEyeTracker
Definition: tobii_research.h:315
TobiiResearchStatus
Definition: tobii_research.h:45
Functionality for an eye tracker.
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_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_set_display_area(TobiiResearchEyeTracker *eyetracker, const TobiiResearchDisplayArea *display_area)
Sets the display area of the eye tracker. It is strongly recommended to use Eye Tracker Manager to ca...
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_get_display_area(TobiiResearchEyeTracker *eyetracker, TobiiResearchDisplayArea *display_area)
Gets the size and corners of the display area.