#include <stdio.h>
#include <stdbool.h>
#include <inttypes.h>
#if _WIN32 || _WIN64
#include <windows.h>
static void sleep_ms(int time)
{
Sleep(time);
}
#else
#include <unistd.h>
static void sleep_ms(int time)
{
usleep(time * 1000);
}
#endif
bool user_looking_at_screen = false;
{
(void)(user_data);
if (user_looking_at_screen)
{
return;
}
bool left_eye_on_screen = false;
bool right_eye_on_screen = false;
{
left_eye_on_screen = true;
}
{
right_eye_on_screen = true;
}
if (left_eye_on_screen && right_eye_on_screen)
{
user_looking_at_screen = true;
}
printf("Left eye gaze point: (%f, %f)\nRight eye gaze point: (%f, %f)\n",
}
{
{
printf("Failed while subscribing to gaze %d", status);
}
char *serial_number = NULL;
printf("Entered calibration mode for eye tracker with serial number %s. \n", serial_number);
printf(
"Show a point on screen at (%f,%f).\n", point_to_calibrate.
x, point_to_calibrate.
y);
printf("Wait for user to look at the screen until we gather calibration data.\n");
while (!user_looking_at_screen)
{
sleep_ms(100);
}
printf(
"Collecting data at (%f,%f).\n", point_to_calibrate.
x, point_to_calibrate.
y);
{
}
printf("Computing and applying calibration.\n");
{
printf(
"Compute and apply returned %i and collected at %zu points.\n", status, calibration_result->
calibration_point_count);
}
else
{
printf("Calibration failed!\n");
}
{
printf("Failed leaving calibration mode %d.\n", status);
}
else
{
printf("Left calibration mode.\n");
}
{
printf("Failed unsubscribing to gaze %d.\n", status);
}
else
{
printf("Unsubscribed to gaze.\n");
}
}