Tobii Pro SDK C API
time_synchronization_data.c
#include <stdio.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
void time_synchronization_data_callback(TobiiResearchTimeSynchronizationData* time_synchronization_data,
void* user_data){
(void)(user_data); // Is NULL, see subscribing call
printf("Device time stamp: %" PRId64 "\n", time_synchronization_data->device_time_stamp);
printf("System request time stamp: %" PRId64 "\n", time_synchronization_data->system_request_time_stamp);
printf("System response time stamp: %" PRId64 "\n", time_synchronization_data->system_response_time_stamp);
}
void time_synchronization_data_example(TobiiResearchEyeTracker* eyetracker) {
char* serial_number = NULL;
tobii_research_get_serial_number(eyetracker, &serial_number);
printf("Subscribing to time synchronization data for eye tracker with serial number %s.\n", serial_number);
tobii_research_subscribe_to_time_synchronization_data(eyetracker, time_synchronization_data_callback, NULL);
/* Wait while some time synchronization data is collected. */
sleep_ms(2000);
tobii_research_unsubscribe_from_time_synchronization_data(eyetracker, time_synchronization_data_callback);
printf("Unsubscribed from time synchronization data.\n");
}
TobiiResearchTimeSynchronizationData::system_request_time_stamp
int64_t system_request_time_stamp
Definition: tobii_research_streams.h:274
tobii_research_unsubscribe_from_time_synchronization_data
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_unsubscribe_from_time_synchronization_data(TobiiResearchEyeTracker *eyetracker, tobii_research_time_synchronization_data_callback callback)
Unsubscribes from time synchronization data for the eye tracker.
TobiiResearchTimeSynchronizationData::system_response_time_stamp
int64_t system_response_time_stamp
Definition: tobii_research_streams.h:284
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_eyetracker.h
Functionality for an eye tracker.
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.
tobii_research_streams.h
Functionality for eye tracker streams.
TobiiResearchTimeSynchronizationData::device_time_stamp
int64_t device_time_stamp
Definition: tobii_research_streams.h:279
TobiiResearchEyeTracker
struct TobiiResearchEyeTracker TobiiResearchEyeTracker
Definition: tobii_research.h:310
TobiiResearchTimeSynchronizationData
Definition: tobii_research_streams.h:270
tobii_research_subscribe_to_time_synchronization_data
TOBII_RESEARCH_API TobiiResearchStatus TOBII_RESEARCH_CALL tobii_research_subscribe_to_time_synchronization_data(TobiiResearchEyeTracker *eyetracker, tobii_research_time_synchronization_data_callback callback, void *user_data)
Subscribes to time synchronization data for the eye tracker.