UEyelinkInterface¶
A class to bridge the Eyelink C API with Unreal C++.
Syntax¶
Remarks¶
Long story short: The Eyelink library makes strong assumptions about the linearity of experiments, which cannot be satisfied in a complex OOP environment. Here we encapsulate information about the Eyelink machine in a single object. Because the Eyelink machine will make incoming calls to display calibration targets, we encapsulate these calls in delegates so that they only will be handled when needed.
Because Eyelink is in C, these delegates have to be static. Thus the class should be used as a singleton. The delegates should only be bound minimally, i.e. bind them right before we do calibration, and unbind right after. This serves two purposes. First, we minimize how much effect the Eyelink machine can have on gameplay. Second, Eyelink, being C, has no concept of object lifecycles; we use UMG to display eyetracking and those are ephemeral.
The delegate binding should be done externally. I.e. this should be a reactive-only object. Eyelink, in no circumstances, should be able to affect gameplay unless in explicit response to a function call to this object.
Lifecycles-wise, because Eyelink is C, it does not seem like the library is elegantly capable of handling start-stops / multiple instances. So this object should be used by GameInstance, which will keep everything alive for the duration of the experiment. UCLASS
Inheritance Hierarchy¶
UObject → UEyelinkInterface
Methods¶
| Method | Signature | Description | Blueprint |
|---|---|---|---|
| AcceptFixation | int UEyelinkInterface::AcceptFixation() |
Tells the host to accept the current fixation for the current calibration point. | yes |
| ClearEyetrackingComputerDisplay | void UEyelinkInterface::ClearEyetrackingComputerDisplay() |
Sends a command to clear the Eyelink host's display. | yes |
| CloseEyelinkConnection | void UEyelinkInterface::CloseEyelinkConnection() |
Closes the connection to the Eyelink host if one is currently open. | yes |
| CloseEyelinkDataFile | bool UEyelinkInterface::CloseEyelinkDataFile(const FString fileName) |
Closes the currently open EDF data file on the Eyelink host computer. | yes |
| ExitCalibration | void UEyelinkInterface::ExitCalibration() const |
Interrupts the current calibration or drift-correction routine. | yes |
| GetEyelinkFileName | FString UEyelinkInterface::GetEyelinkFileName() const |
Returns the name of the currently open (or most recently opened) EDF data file. | yes |
| GetEyelinkResponse | FString UEyelinkInterface::GetEyelinkResponse() const |
Retrieves the most recent response string from the Eyelink host. | yes |
| GetInputKey | INT16 UEyelinkInterface::GetInputKey(void *) |
Static callback: called by Eyelink to retrieve the next input key event. | |
| InitEyelinkLibrary | void UEyelinkInterface::InitEyelinkLibrary() |
Initializes the Eyelink C library and registers all graphics callback hooks. | yes |
| IsEyelinkConnected | bool UEyelinkInterface::IsEyelinkConnected() const |
Returns whether the Eyelink host is currently connected. | yes |
| IsEyelinkDataFileOpen | bool UEyelinkInterface::IsEyelinkDataFileOpen() const |
Returns whether an Eyelink data file is currently open. | yes |
| IsEyetrackingRecording | bool UEyelinkInterface::IsEyetrackingRecording() const |
Returns whether the Eyelink host is currently recording eye data. | yes |
| OpenEyelinkConnection | bool UEyelinkInterface::OpenEyelinkConnection(const FString &address=FString(""), const FVector2D &resolution=FVector2D(0, 0), EEyelinkInterfaceMode mode=EEyelinkInterfaceMode::Simulate) |
Opens a network connection to the Eyelink eyetracker. | yes |
| OpenEyelinkDataFile | bool UEyelinkInterface::OpenEyelinkDataFile(const FString fileName) |
Opens a new EDF data file on the Eyelink host computer for recording. | yes |
| RetrieveRemoteDataFile | bool UEyelinkInterface::RetrieveRemoteDataFile(const FString fileName) |
Transfers the EDF data file from the Eyelink host computer to the local machine. | yes |
| SendBreakKey | int UEyelinkInterface::SendBreakKey() |
Sends the Eyelink "break" key to abort processing. | yes |
| SendEyelinkCommand | void UEyelinkInterface::SendEyelinkCommand(const FString command) const |
Sends a raw command string to the Eyelink host computer. | yes |
| SendEyelinkMessage | void UEyelinkInterface::SendEyelinkMessage(const FString message) const |
Writes a timestamped message into the active EDF data file. | yes |
| SendKey | int UEyelinkInterface::SendKey(int keycode) |
Sends an arbitrary keycode to the Eyelink host as a key-press event. | yes |
| SendTerminateKey | int UEyelinkInterface::SendTerminateKey() |
Sends the Eyelink "terminate" key to end a trial. | yes |
| SendTrialNumber | void UEyelinkInterface::SendTrialNumber(int trialNum) |
Sends the current trial number as a message to the Eyelink data file. | yes |
| SetEyelinkResolution | void UEyelinkInterface::SetEyelinkResolution(const FVector2D &resolution) |
Sends the display resolution to the Eyelink host computer so it can correctly map gaze coordinates to screen pixels. | yes |
| SetEyetrackingComputerStatusText | void UEyelinkInterface::SetEyetrackingComputerStatusText(const FString message) |
Sets the status text shown on the Eyelink host's display. | yes |
| SetupCameraAndCalibrate | void UEyelinkInterface::SetupCameraAndCalibrate() |
Start the Eyelink camera setup and calibration routine. | yes |
| StartEyetrackingRecording | void UEyelinkInterface::StartEyetrackingRecording() |
Starts eyetracking data recording on the Eyelink host. | yes |
| StopEyetrackingRecording | void UEyelinkInterface::StopEyetrackingRecording() |
Stops eyetracking data recording on the Eyelink host. | yes |
| UEyelinkInterface | UEyelinkInterface::UEyelinkInterface()UEyelinkInterface::UEyelinkInterface(const FString eyelinkAddress)UEyelinkInterface::UEyelinkInterface(EEyelinkInterfaceMode interfaceMode)UEyelinkInterface::UEyelinkInterface(const FString eyelinkAddress, EEyelinkInterfaceMode interfaceMode) |
Default constructor. | |
| UnbindDelegates | void UEyelinkInterface::UnbindDelegates() |
Unbinds all currently bound calibration and camera-image delegates. | |
| ValidateEyelinkFileName | bool UEyelinkInterface::ValidateEyelinkFileName(const FString name) |
Validates that a filename conforms to Eyelink EDF naming rules. | yes |
Properties¶
| Property | Type | Description | Blueprint |
|---|---|---|---|
| InterfaceMode | EEyelinkInterfaceMode |
Current operating mode of the interface (library-only, live, or simulate). | yes |
| ScreenResolution | FVector2D |
Screen resolution reported to the Eyelink host for gaze coordinate mapping. | yes |
| eyelinkIP | FString |
IP address of the Eyelink host computer. | yes |
Delegates¶
| Delegate | Type | Description | Blueprint |
|---|---|---|---|
| ClearCalibrationDisplayDelegate | FClearCalibrationDisplayDelegate |
Delegate fired by Eyelink to clear the calibration display. | |
| DrawCalibrationTargetDelegate | FDrawCalibrationTargetDelegate |
Delegate fired by Eyelink to draw a calibration target at screen coordinates (x, y). | |
| DrawOneCameraImageLineDelegate | FDrawOneCameraImageLineDelegate |
Delegate fired by Eyelink to supply one horizontal scan line of camera pixel data. | |
| EraseCalibrationTargetDelegate | FEraseCalibrationTargetDelegate |
Delegate fired by Eyelink to remove the current calibration target. | |
| ExitCalibrationDisplayDelegate | FExitCalibrationDisplayDelegate |
Delegate fired by Eyelink to tear down the calibration display. | |
| ExitCameraImageDisplayDelegate | FExitCameraImageDisplayDelegate |
Delegate fired by Eyelink to close the camera image display. | |
| GetInputDelegate | FGetInputDelegate |
Delegate fired by Eyelink to poll for keyboard input during calibration. | |
| InitCameraImageDisplayDelegate | FInitCameraImageDisplayDelegate |
Delegate fired by Eyelink to initialize the live camera image display. | |
| SetupCalibrationDisplayDelegate | FSetupCalibrationDisplayDelegate |
Delegate fired by Eyelink to request calibration display setup. | |
| UpdateCameraImageTitleDelegate | FUpdateCameraImageTitleDelegate |
Delegate fired by Eyelink to update the camera image window title. |