public void trial_ith(int ith) { try { el.sendCommand(String.Format("record_status_message 'TRIAL {0}'", ith)); el.sendMessage(String.Format("TRIALID {0}", ith)); } catch (Exception e) { Console.WriteLine(e.Message); } }
public void generate_el_file(string eyelink_fileName) { el = new SREYELINKLib.EyeLink(); el.open("100.1.1.1", 0); el.openDataFile(eyelink_fileName); el.sendCommand("file_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON"); el.sendCommand("file_sample_data = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS"); el.sendCommand("link_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,BUTTON"); el.sendCommand("link_sample_data = LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS"); el.sendCommand("screen_pixel_coords=0,0," + elW.Width + "," + elW.Height); el.sendMessage(eyelink_fileName); }
static void Main(string[] args) { EyelinkWindow elW = new EyelinkWindow(); elW.Show(); try { SREYELINKLib.EL_EYE eye = SREYELINKLib.EL_EYE.EL_EYE_NONE; double st; SREYELINKLib.EyeLinkUtil elutil = new SREYELINKLib.EyeLinkUtil(); SREYELINKLib.EyeLink el = new SREYELINKLib.EyeLink(); el.open("100.1.1.1", 0); el.openDataFile("abc.edf"); el.sendCommand("link_sample_data = LEFT,RIGHT,GAZE"); el.sendCommand("screen_pixel_coords=0,0," + elW.Width + "," + elW.Height); el.sendMessage("abc"); SREYELINKLib.ELGDICal cal = elutil.getGDICal(); cal.setCalibrationWindow(elW.Handle.ToInt32()); cal.enableKeyCollection(true); el.doTrackerSetup(); cal.enableKeyCollection(false); cal.enableKeyCollection(true); el.doDriftCorrect((short)(elW.Width / 2), (short)(elW.Height / 2), true, true); cal.enableKeyCollection(false); elW.setGazeCursor(true); el.startRecording(false, false, true, false); st = elutil.currentTime(); while ((st + 20000) > elutil.currentTime()) { SREYELINKLib.Sample s; s = el.getNewestSample(); if (s != null) { if (eye != SREYELINKLib.EL_EYE.EL_EYE_NONE) { if (eye == SREYELINKLib.EL_EYE.EL_BINOCULAR) { eye = SREYELINKLib.EL_EYE.EL_LEFT; } float x = s.get_gx(SREYELINKLib.EL_EYE.EL_LEFT); float y = s.get_gy(SREYELINKLib.EL_EYE.EL_LEFT); Console.Write(s.time); Console.Write("\t"); Console.Write(x); Console.Write("\t"); Console.Write(y); Console.WriteLine("");// New line elW.setGaze((int)x, (int)y); } else { eye = (SREYELINKLib.EL_EYE)el.eyeAvailable(); } } } el.stopRecording(); el.close(); el = null; elutil = null; } catch (Exception) { throw; } }