Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
        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;
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            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.sendCommand("file_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON,INPUT");
                el.sendCommand("file_sample_data = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS,INPUT");
                el.sendCommand("link_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,BUTTON,INPUT");
                el.sendCommand("link_sample_data = LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS,INPUT");


                el.setOfflineMode();
                elutil.pumpDelay(50);

                el.startRecording(true, true, true, true);
                el.waitForBlockStart(500, true, true);

                eye = (SREYELINKLib.EL_EYE)el.eyeAvailable();
                if (eye == SREYELINKLib.EL_EYE.EL_BINOCULAR)
                {
                    eye = SREYELINKLib.EL_EYE.EL_LEFT;
                }

                st = elutil.currentTime();
                while ((st + 20000) > elutil.currentTime())
                {
                    SREYELINKLib.IELData             elData;
                    SREYELINKLib.IStartSaccadeEvent  stsaccevent;
                    SREYELINKLib.IEndSaccadeEvent    ensaccevent;
                    SREYELINKLib.IEyeEvent           eevent;
                    SREYELINKLib.IStartFixationEvent stfixevent;
                    SREYELINKLib.IEndFixationEvent   enfixevent;
                    SREYELINKLib.IFixUpdateEvent     fixupdate;


                    elData = el.getNextData();

                    if (elData != null)
                    {
                        switch (elData.eltype)
                        {
                        case SREYELINKLib.EL_DATA_TYPE.EL_SAMPLE_TYPE:
                            // Console.Write("sample: ");
                            // Console.Write(elData.time);
                            // Console.WriteLine("");
                            break;

                        case SREYELINKLib.EL_DATA_TYPE.EL_STARTSACC:
                            stsaccevent = (SREYELINKLib.IStartSaccadeEvent)elData;
                            eevent      = (SREYELINKLib.IEyeEvent)elData;
                            if (eevent.eye == eye)
                            {
                                Console.Write("start saccade: time= ");
                                Console.Write(elData.time);
                                Console.WriteLine("");
                            }
                            break;

                        case SREYELINKLib.EL_DATA_TYPE.EL_ENDSACC:
                            stsaccevent = (SREYELINKLib.IStartSaccadeEvent)elData;
                            ensaccevent = (SREYELINKLib.IEndSaccadeEvent)elData;
                            eevent      = (SREYELINKLib.IEyeEvent)elData;
                            if (eevent.eye == eye)
                            {
                                Console.Write("end saccade:  start time= ");
                                Console.Write(eevent.sttime);
                                Console.Write(" end time= ");
                                Console.Write(ensaccevent.entime);
                                Console.Write("\t");
                                Console.Write("sgx = ");
                                Console.Write(stsaccevent.gstx);
                                Console.Write(" sgy = ");
                                Console.Write(stsaccevent.gsty);
                                Console.Write("\t");
                                Console.Write("endgx = ");
                                Console.Write(ensaccevent.genx);
                                Console.Write(" endgy = ");
                                Console.Write(ensaccevent.geny);
                                Console.WriteLine("");
                            }
                            break;

                        case SREYELINKLib.EL_DATA_TYPE.EL_STARTFIX:
                            stfixevent = (SREYELINKLib.IStartFixationEvent)elData;
                            eevent     = (SREYELINKLib.IEyeEvent)elData;
                            if (eevent.eye == eye)
                            {
                                Console.Write("start fixation: time= ");
                                Console.Write(elData.time);
                                Console.WriteLine("");
                            }
                            break;

                        case SREYELINKLib.EL_DATA_TYPE.EL_ENDFIX:
                            enfixevent = (SREYELINKLib.IEndFixationEvent)elData;
                            eevent     = (SREYELINKLib.IEyeEvent)elData;
                            if (eevent.eye == eye)
                            {
                                Console.Write("end fixation: start time= ");
                                Console.Write(eevent.sttime);
                                Console.Write(" end time= ");
                                Console.Write(enfixevent.entime);
                                Console.Write("\t");
                                Console.Write("gx = ");
                                Console.Write(enfixevent.gavx);
                                Console.Write(" gy = ");
                                Console.Write(enfixevent.gavy);
                                Console.WriteLine("");
                            }
                            break;

                        case SREYELINKLib.EL_DATA_TYPE.EL_FIXUPDATE:
                            fixupdate = (SREYELINKLib.IFixUpdateEvent)elData;
                            eevent    = (SREYELINKLib.IEyeEvent)elData;
                            if (eevent.eye == eye)
                            {
                                Console.Write("end fixation: start time= ");
                                Console.Write(eevent.time);
                                Console.Write(" end time= ");
                                Console.Write(fixupdate.entime);
                                Console.Write("\t");
                                Console.Write("gx = ");
                                Console.Write(fixupdate.gavx);
                                Console.Write(" gy = ");
                                Console.Write(fixupdate.gavy);
                                Console.WriteLine("");
                            }
                            break;
                        }
                    }
                }
                el.stopRecording();
                el.close();

                el     = null;
                elutil = null;
            }
            catch (Exception)
            {
                throw;
            }
        }