SR Research Support Site
Macros | Typedefs | Enumerations | Functions | Variables
eyelink.h File Reference

Declarations and constants for basic EyeLink functions, Ethernet link, and timing. More...

Macros

#define DEPRECATMS
 
#define DEPRECATED
 
#define OK_RESULT   0
 
#define NO_REPLY   1000
 
#define LINK_TERMINATED_RESULT   -100
 
#define ABORT_RESULT   27
 
#define UNEXPECTED_EOL_RESULT   -1
 
#define SYNTAX_ERROR_RESULT   -2
 
#define BAD_VALUE_RESULT   -3
 
#define EXTRA_CHARACTERS_RESULT   -4
 
#define current_msec()   current_time()
 
#define LINK_INITIALIZE_FAILED   -200
 
#define CONNECT_TIMEOUT_FAILED   -201
 
#define WRONG_LINK_VERSION   -202
 
#define TRACKER_BUSY   -203
 
#define IN_DISCONNECT_MODE   16384
 
#define IN_UNKNOWN_MODE   0
 
#define IN_IDLE_MODE   1
 
#define IN_SETUP_MODE   2
 
#define IN_RECORD_MODE   4
 
#define IN_TARGET_MODE   8
 
#define IN_DRIFTCORR_MODE   16
 
#define IN_IMAGE_MODE   32
 
#define IN_USER_MENU   64
 
#define IN_PLAYBACK_MODE   256
 
#define EL_IDLE_MODE   1
 
#define EL_IMAGE_MODE   2
 
#define EL_SETUP_MENU_MODE   3
 
#define EL_USER_MENU_1   5
 
#define EL_USER_MENU_2   6
 
#define EL_USER_MENU_3   7
 
#define EL_OPTIONS_MENU_MODE   8 /* NEW FOR EYELIKN II */
 
#define EL_OUTPUT_MENU_MODE   9
 
#define EL_DEMO_MENU_MODE   10
 
#define EL_CALIBRATE_MODE   11
 
#define EL_VALIDATE_MODE   12
 
#define EL_DRIFT_CORR_MODE   13
 
#define EL_RECORD_MODE   14
 
#define SCENECAM_ALIGN_MODE   15
 
#define SCENECAM_DEPTH_MODE   16
 
#define USER_MENU_NUMBER(mode)   ((mode)-4)
 
#define SAMPLE_TYPE   200
 
#define RECORD_FILE_SAMPLES   1
 
#define RECORD_FILE_EVENTS   2
 
#define RECORD_LINK_SAMPLES   4
 
#define RECORD_LINK_EVENTS   8
 
#define ELIMAGE_2   0 /* 1 plane, 1 bit per pixel (2 colors) */
 
#define ELIMAGE_16   1 /* 4 bits per pixel, packed (16 colors) */
 
#define ELIMAGE_16P   2 /* 1 bit per pixel, 4 planes (16 colors) */
 
#define ELIMAGE_256   3 /* 8 bits per pixel (256 colors, EL-II) */
 
#define ELIMAGE_128HV   4 /* 7 bits per pixel, 2-D compression, EL-II V2.0 and later) */
 
#define ELIMAGE_128HVX   5 /* same as previous, but no crosshairs in image */
 
#define KB_PRESS   10
 
#define KB_RELEASE   -1
 
#define KB_REPEAT   1
 
#define NUM_LOCK_ON   0x20
 
#define CAPS_LOCK_ON   0x40
 
#define ALT_KEY_DOWN   0x08
 
#define CTRL_KEY_DOWN   0x04
 
#define SHIFT_KEY_DOWN   0x03 /* left, right shift keys */
 
#define KB_BUTTON   0xFF00U
 
#define F1_KEY   0x3B00 /* some samples */
 
#define F2_KEY   0x3C00
 
#define F3_KEY   0x3D00
 
#define F4_KEY   0x3E00
 
#define F5_KEY   0x3F00
 
#define F6_KEY   0x4000
 
#define F7_KEY   0x4100
 
#define F8_KEY   0x4200
 
#define F9_KEY   0x4300
 
#define F10_KEY   0x4400
 
#define F11_KEY   0x4500
 
#define F12_KEY   0x4600
 
#define PAGE_UP   0x4900
 
#define PAGE_DOWN   0x5100
 
#define CURS_UP   0x4800
 
#define CURS_DOWN   0x5000
 
#define CURS_LEFT   0x4B00
 
#define CURS_RIGHT   0x4D00
 
#define ESC_KEY   0x001B
 
#define ENTER_KEY   0x000D
 
#define PLUS_KEY   0x002B
 
#define MINUS_KEY   0x002D
 
#define INSERT_KEY   0x5200
 
#define DELETE_KEY   0x5300
 
#define HOME_KEY   0x4700
 
#define END_KEY   0x4F00
 
#define BACKSPACE_KEY   0x0008
 
#define PRINTSCR_KEY   0x2A00
 
#define WMENU_KEY   0x5D00
 
#define WLEFT_KEY   0x5B00
 
#define WRIGHT_KEY   0x5C00
 
#define FILE_XFER_ABORTED   -110
 
#define FILE_CANT_OPEN   -111
 
#define FILE_NO_REPLY   -112 /* no-data returned */
 
#define FILE_BAD_DATA   -113
 
#define FILEDATA_SIZE_FLAG   999 /* start block has name, offset=total size */
 
#define FILE_BLOCK_SIZE   512 /* full block size: if less, it's last block */
 
#define ABORT_BX   -32000 /* signal to abort bitmap send */
 
#define PAUSE_BX   -32001 /* signal that last packet dropped (full queue) */
 
#define DONE_BX   -32002 /* last block received OK */
 
#define eyelink_tracker_time()   eyelink_tracker_msec()
 
#define eyelink_time_offset()   eyelink_double_msec_offset()
 
#define eyelink_msec_offset()   eyelink_double_msec_offset()
 

Typedefs

typedef enum _EL_CLOCK_BASE EL_CLOCK_BASE
 Enum used to configure the behaviour of the time functions.
 
typedef void(* EYELINK_DATA_READY_NOTIFY) (int)
 

Enumerations

enum  _EL_CLOCK_BASE { SR_CLOCK_BASE_APPLICATION_LOCAL =0, SR_CLOCK_BASE_MACHINE_LOCAL =1 }
 Enum used to configure the behaviour of the time functions. More...
 

Functions

UINT16 open_eyelink_system (UINT16 bufsize, char FARTYPE *options)
 
void eyelink_set_name (char FARTYPE *name)
 
void close_eyelink_system (void)
 
void eyelink_set_clock_base (EL_CLOCK_BASE clock_base)
 
EL_CLOCK_BASE eyelink_get_clock_base (void)
 
UINT32 current_time (void)
 
UINT32 current_micro (MICRO FARTYPE *m)
 
UINT32 current_usec (void)
 
void msec_delay (UINT32 n)
 
double current_double_usec (void)
 
INT16 eyelink_open_node (ELINKADDR node, INT16 busytest)
 
INT16 eyelink_open (void)
 
INT16 eyelink_broadcast_open (void)
 
INT16 eyelink_dummy_open (void)
 
INT16 eyelink_close (INT16 send_msg)
 
INT16 eyelink_reset_clock (INT16 enable)
 
INT16 eyelink_is_connected (void)
 
INT16 eyelink_quiet_mode (INT16 mode)
 
INT16 eyelink_poll_trackers (void)
 
INT16 eyelink_poll_remotes (void)
 
INT16 eyelink_poll_responses (void)
 
INT16 eyelink_get_node (INT16 resp, void FARTYPE *data)
 
INT16 eyelink_node_send (ELINKADDR node, void FARTYPE *data, UINT16 dsize)
 
INT16 eyelink_node_receive (ELINKADDR node, void FARTYPE *data)
 
INT16 eyelink_send_command (char FARTYPE *text)
 
INT16 eyelink_command_result (void)
 
INT16 eyelink_timed_command (UINT32 msec, char FARTYPE *text)
 
INT16 eyelink_last_message (char FARTYPE *buf)
 
INT16 eyelink_send_message (char FARTYPE *msg)
 
INT16 eyelink_node_send_message (ELINKADDR node, char FARTYPE *msg)
 
INT16 eyelink_send_message_ex (INT32 exectime, char FARTYPE *msg)
 
INT16 eyelink_node_send_message_ex (INT32 exectime, ELINKADDR node, char FARTYPE *msg)
 
INT16 eyelink_read_request (char const *text)
 
INT16 eyelink_read_reply (char FARTYPE *buf)
 
DEPRECATMS UINT32 eyelink_request_time (void) DEPRECATED
 
UINT32 eyelink_node_request_time (ELINKADDR node)
 
UINT32 eyelink_read_time (void)
 
INT16 eyelink_abort (void)
 
INT16 eyelink_start_setup (void)
 
void eyelink_set_tracker_setup_default (INT16 mode)
 
INT16 eyelink_in_setup (void)
 
INT16 eyelink_target_check (INT16 FARTYPE *x, INT16 FARTYPE *y)
 
INT16 eyelink_target_checkf (float FARTYPE *x, float FARTYPE *y)
 
INT16 eyelink_accept_trigger (void)
 
INT16 eyelink_driftcorr_start (INT16 x, INT16 y)
 
INT16 eyelink_driftcorr_startf (float x, float y)
 
INT16 eyelink_cal_result (void)
 
INT16 eyelink_apply_driftcorr (void)
 
INT16 eyelink_cal_message (char FARTYPE *msg)
 
INT16 eyelink_current_mode (void)
 
INT16 eyelink_tracker_mode (void)
 
INT16 eyelink_wait_for_mode_ready (UINT32 maxwait)
 
INT16 eyelink_user_menu_selection (void)
 
INT16 eyelink_position_prescaler (void)
 
INT16 eyelink_reset_data (INT16 clear)
 
void FARTYPE * eyelink_data_status (void)
 
INT16 eyelink_in_data_block (INT16 samples, INT16 events)
 
INT16 eyelink_wait_for_block_start (UINT32 maxwait, INT16 samples, INT16 events)
 
INT16 eyelink_get_next_data (ALL_DATA *buf)
 
INT16 eyelink_get_float_data (ALLF_DATA *buf)
 
INT16 eyelink_get_all_float_data (ALLF_DATA *buf, int bufferlen)
 
INT16 eyelink_get_double_data (ALLD_DATA *buf)
 
INT16 eyelink_newest_float_sample (void FARTYPE *buf)
 
INT16 eyelink_newest_double_sample (void FARTYPE *buf)
 
INT16 eyelink_wait_for_new_float_sample2 (FSAMPLE2 *buf, UINT32 timeout)
 
INT16 eyelink_wait_for_new_double_sample2 (DSAMPLE2 *buf, UINT32 timeout)
 
INT16 eyelink_newest_double_sample2 (DSAMPLE2 *buf)
 
INT16 eyelink_newest_float_sample2 (FSAMPLE2 *buf)
 
INT16 eyelink_eye_available (void)
 
UINT16 eyelink_sample_data_flags (void)
 
UINT16 eyelink_event_data_flags (void)
 
UINT16 eyelink_event_type_flags (void)
 
INT16 eyelink_data_count (INT16 samples, INT16 events)
 
INT16 eyelink_wait_for_data (UINT32 maxwait, INT16 samples, INT16 events)
 
INT16 eyelink_data_switch (UINT16 flags)
 
INT16 eyelink_data_start (UINT16 flags, INT16 lock)
 
INT16 eyelink_data_stop (void)
 
INT16 eyelink_playback_start (void)
 
INT16 eyelink_playback_stop (void)
 
UINT16 eyelink_read_keybutton (INT16 FARTYPE *mods, INT16 FARTYPE *state, UINT16 *kcode, UINT32 FARTYPE *time)
 
INT16 eyelink_send_keybutton (UINT16 code, UINT16 mods, INT16 state)
 
UINT16 eyelink_button_states (void)
 
UINT16 eyelink_last_button_states (UINT32 FARTYPE *time)
 
UINT16 eyelink_last_button_press (UINT32 FARTYPE *time)
 
INT16 eyelink_flush_keybuttons (INT16 enable_buttons)
 
INT16 eyelink_request_file_read (const char FARTYPE *src)
 
INT16 eyelink_get_file_block (void FARTYPE *buf, INT32 FARTYPE *offset)
 
INT16 eyelink_request_file_block (UINT32 offset)
 
INT16 eyelink_end_file_transfer (void)
 
INT16 eyelink_get_tracker_version (char FARTYPE *c)
 
DEPRECATMS INT16 eyelink2_mode_data (INT16 *sample_rate, INT16 *crmode, INT16 *file_filter, INT16 *link_filter) DEPRECATED
 
INT16 eyelink_mode_data (INT16 *sample_rate, INT16 *crmode, INT16 *file_filter, INT16 *link_filter)
 
void eyelink_set_tracker_node (ELINKADDR node)
 
double eyelink_tracker_double_usec (void)
 
UINT32 eyelink_tracker_msec (void)
 
double eyelink_double_usec_offset (void)
 
double eyelink_double_msec_offset (void)
 
INT16 eyelink_wait_for_next_data (ALLF_DATA *buf, int bufferlen, UINT32 timeout)
 
INT16 eyelink_wait_for_next_double_data (ALLD_DATA *buf, int bufferlen, UINT32 timeout)
 
INT16 eyelink_wait_for_new_float_sample (FSAMPLE *buf, UINT32 timeout)
 
INT16 eyelink_wait_for_new_double_sample (DSAMPLE *buf, UINT32 timeout)
 
INT16 eyelink_wait_for_command_result (UINT32 timeout)
 
INT16 eyelink_set_data_ready_notify (EYELINK_DATA_READY_NOTIFY notify_function)
 
EYELINK_DATA_READY_NOTIFY eyelink_get_data_ready_notify (void)
 

Variables

ELINKADDR eye_broadcast_address
 
ELINKADDR rem_broadcast_address
 
ELINKADDR our_address
 

Detailed Description

Declarations and constants for basic EyeLink functions, Ethernet link, and timing.

Copyright (c) 1996-2026, SR Research Ltd., All Rights Reserved

For use by SR Research licencees only. Redistribution and use in source and binary forms, with or without modification, are NOT permitted.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither name of SR Research Ltd nor the name of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

#define ABORT_BX   -32000 /* signal to abort bitmap send */

Signal to abort bitmap send.

#define ALT_KEY_DOWN   0x08

Alt key pressed.

#define BACKSPACE_KEY   0x0008

Backspace key.

#define CAPS_LOCK_ON   0x40

Caps Lock key enabled.

#define CTRL_KEY_DOWN   0x04

Control key pressed.

#define CURS_DOWN   0x5000

Cursor down key.

#define CURS_LEFT   0x4B00

Cursor left key.

#define CURS_RIGHT   0x4D00

Cursor right key.

#define CURS_UP   0x4800

Cursor up key.

#define DELETE_KEY   0x5300

Delete key.

#define DEPRECATED

Linux and macOS deprecation macro. Macro is empty for Windows.

#define DEPRECATMS

Microsoft deprecation macro. Macro is empty on other platforms.

#define DONE_BX   -32002 /* last block received OK */

Last block received OK.

#define EL_CALIBRATE_MODE   11

EyeLink tracker is in calibration mode.

#define EL_DEMO_MENU_MODE   10

EyeLink tracker is in demo menu mode.

#define EL_DRIFT_CORR_MODE   13

EyeLink tracker is in drift correction mode.

#define EL_IDLE_MODE   1

EyeLink tracker is in idle mode.

#define EL_IMAGE_MODE   2

EyeLink tracker is in image mode.

#define EL_OPTIONS_MENU_MODE   8 /* NEW FOR EYELIKN II */

EyeLink tracker is in options menu mode.

#define EL_OUTPUT_MENU_MODE   9

EyeLink tracker is in output menu mode.

#define EL_RECORD_MODE   14

EyeLink tracker is in recording mode.

#define EL_SETUP_MENU_MODE   3

EyeLink tracker is in menu mode.

#define EL_USER_MENU_1   5

EyeLink tracker is in first user menu mode.

#define EL_USER_MENU_2   6

EyeLink tracker is in second user menu mode.

#define EL_USER_MENU_3   7

EyeLink tracker is in third user menu mode.

#define EL_VALIDATE_MODE   12

EyeLink tracker is in validation mode.

#define ELIMAGE_128HV   4 /* 7 bits per pixel, 2-D compression, EL-II V2.0 and later) */

Type of image. 7 bits per pixel, 2-D compression, EL-II V2.0 and later).

#define ELIMAGE_128HVX   5 /* same as previous, but no crosshairs in image */

Type of image. Same as ELIMAGE_128HV, but no crosshairs in image.

#define ELIMAGE_16   1 /* 4 bits per pixel, packed (16 colors) */

Type of image. 4 bits per pixel, packed (16 colors).

#define ELIMAGE_16P   2 /* 1 bit per pixel, 4 planes (16 colors) */

Type of image. 1 bit per pixel, 4 planes (16 colors).

#define ELIMAGE_2   0 /* 1 plane, 1 bit per pixel (2 colors) */

Type of image. 1 plane, 1 bit per pixel (2 colors).

#define ELIMAGE_256   3 /* 8 bits per pixel (256 colors, EL-II) */

Type of image. 8 bits per pixel (256 colors, EL-II).

#define END_KEY   0x4F00

End key.

#define ENTER_KEY   0x000D

Enter key.

#define ESC_KEY   0x001B

Escape key.

#define F10_KEY   0x4400

Function 10 key.

#define F11_KEY   0x4500

Function 11 key.

#define F12_KEY   0x4600

Function 12 key.

#define F1_KEY   0x3B00 /* some samples */

Function 1 key.

#define F2_KEY   0x3C00

Function 2 key.

#define F3_KEY   0x3D00

Function 3 key.

#define F4_KEY   0x3E00

Function 4 key.

#define F5_KEY   0x3F00

Function 5 key.

#define F6_KEY   0x4000

Function 6 key.

#define F7_KEY   0x4100

Function 7 key.

#define F8_KEY   0x4200

Function 8 key.

#define F9_KEY   0x4300

Function 9 key.

#define FILE_BAD_DATA   -113

Data corruption detected.

#define FILE_BLOCK_SIZE   512 /* full block size: if less, it's last block */

Full block size: if less, it's last block.

#define FILE_CANT_OPEN   -111

Cannot open the EDF on the Host.

#define FILE_NO_REPLY   -112 /* no-data returned */

"No data" returned.

#define FILE_XFER_ABORTED   -110

File transfer was aborted.

#define FILEDATA_SIZE_FLAG   999 /* start block has name, offset=total size */

Start block has name, offset=total size.

#define HOME_KEY   0x4700

Home key.

#define INSERT_KEY   0x5200

Insert key.

#define KB_BUTTON   0xFF00U

A special case. Codes of either 0 or 0xFF00 mean the mod is a button number.

#define KB_PRESS   10

Initial key press.

#define KB_RELEASE   -1

Key released.

#define KB_REPEAT   1

Key held down.

#define MINUS_KEY   0x002D

'-' key.

#define NUM_LOCK_ON   0x20

Num Lock key enabled.

#define PAGE_DOWN   0x5100

Page Down key.

#define PAGE_UP   0x4900

Page Up key.

#define PAUSE_BX   -32001 /* signal that last packet dropped (full queue) */

Signal that last packet dropped (full queue).

#define PLUS_KEY   0x002B

'+' key.

#define PRINTSCR_KEY   0x2A00

Print Screen key.

#define SAMPLE_TYPE   200

The code that indicates a gaze sample.

See also
eyelink_get_next_data( ), eyelink_get_float_data( ), and eyelink_newest_float_sample( ).
#define SCENECAM_ALIGN_MODE   15

EyeLink tracker scene camera is in align mode.

#define SCENECAM_DEPTH_MODE   16

EyeLink tracker scene camera is in depth mode.

#define SHIFT_KEY_DOWN   0x03 /* left, right shift keys */

Shift key pressed.

#define USER_MENU_NUMBER (   mode)    ((mode)-4)

User menu number.

#define WLEFT_KEY   0x5B00

WLeft key.

#define WMENU_KEY   0x5D00

WMenu key.

#define WRIGHT_KEY   0x5C00

WRight key.

Typedef Documentation

EYELINK_DATA_READY_NOTIFY

Callback declaration. The call back function takes in an argument and returns nothing.

Arg==1 means event is available Arg==2 means sample available on the link.

Note: This function should return very quickly. If this takes too long, then the data receive packets may be dropped.


Copyright ©2002-2026, SR Research Ltd.