Home › Forums › Eye Tracking Devices › Tobii EyeX Linux? › Reply To: Tobii EyeX Linux?

Hi @my5tery, the final part of the Stream Engine SDK process after installing the debian files is using the c++ libraries within the stream_engine_linux_3.0.4.6031.tar.gz file as included in the ZIP archive to create your first program.
Which IDE are you using for your programming? You will need to add the paths to the header and library files within your IDE to run your first C++ stream engine SDK application.
As a simple example, try compiling the following code after setting the paths:
#include <tobii/tobii.h>
#include <tobii/tobii_streams.h>
#include <stdio.h>
#include <assert.h>
void gaze_point_callback( tobii_gaze_point_t const* gaze_point, void* user_data )
{
if( gaze_point->validity == TOBII_VALIDITY_VALID )
printf( "Gaze point: %f, %f\n",
gaze_point->position_xy[ 0 ],
gaze_point->position_xy[ 1 ] );
}
static void url_receiver( char const* url, void* user_data )
{
char* buffer = (char*)user_data;
if( *buffer != '\0' ) return; // only keep first value
if( strlen( url ) < 256 )
strcpy( buffer, url );
}
int main()
{
tobii_api_t* api;
tobii_error_t error = tobii_api_create( &api, NULL, NULL );
assert( error == TOBII_ERROR_NO_ERROR );
char url[ 256 ] = { 0 };
error = tobii_enumerate_local_device_urls( api, url_receiver, url );
assert( error == TOBII_ERROR_NO_ERROR && *url != '\0' );
tobii_device_t* device;
error = tobii_device_create( api, url, &device );
assert( error == TOBII_ERROR_NO_ERROR );
error = tobii_gaze_point_subscribe( device, gaze_point_callback, 0 );
assert( error == TOBII_ERROR_NO_ERROR );
int is_running = 1000; // in this sample, exit after some iterations
while( --is_running > 0 )
{
error = tobii_wait_for_callbacks( NULL, 1, &device );
assert( error == TOBII_ERROR_NO_ERROR || error == TOBII_ERROR_TIMED_OUT );
error = tobii_device_process_callbacks( device );
assert( error == TOBII_ERROR_NO_ERROR );
}
error = tobii_gaze_point_unsubscribe( device );
assert( error == TOBII_ERROR_NO_ERROR );
error = tobii_device_destroy( device );
assert( error == TOBII_ERROR_NO_ERROR );
error = tobii_api_destroy( api );
assert( error == TOBII_ERROR_NO_ERROR );
return 0;
}
Please bear in mind you *will* need to calibrate otherwise the eye position data will not be reliable.
Try setting up your first program and let us know how you get on. Best Wishes.