EyeTracker.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef PSYCHO_EYETRACKER_C_DEFINED
00039 #define PSYCHO_EYETRACKER_C_DEFINED
00040
00041 #include "Psycho/EyeTracker.H"
00042 #include "Component/EventLog.H"
00043 #include "Util/sformat.H"
00044
00045
00046 EyeTracker::EyeTracker(OptionManager& mgr, const std::string& descrName,
00047 const std::string& tagName) :
00048 ModelComponent(mgr, descrName, tagName),
00049 itsEventLog(), itsIsTracking(false)
00050 { }
00051
00052
00053 EyeTracker::~EyeTracker()
00054 { }
00055
00056
00057 void EyeTracker::setEventLog(nub::soft_ref<EventLog> elog)
00058 { itsEventLog = elog; }
00059
00060
00061 void EyeTracker::start1()
00062 {
00063
00064 itsSession = 0;
00065 }
00066
00067
00068 int EyeTracker::getSession() const
00069 { return itsSession; }
00070
00071
00072 void EyeTracker::calibrate(nub::soft_ref<PsychoDisplay> d)
00073 {
00074 LINFO("Calibration not supported in this tracker.");
00075 }
00076
00077
00078 void EyeTracker::setBackgroundColor(nub::soft_ref<PsychoDisplay> d)
00079 {
00080 LINFO("SetBackgroundColor not supported in this tracker.");
00081 }
00082
00083
00084 void EyeTracker::manualDriftCorrection(Point2D<double> eyepos,
00085 Point2D<double> targetpos)
00086 {
00087 LINFO("Recalibration not supported in this tracker.");
00088 }
00089
00090
00091 void EyeTracker::recalibrate(nub::soft_ref<PsychoDisplay> d, int repeats)
00092 {
00093 LINFO("Recalibration not supported in this tracker.");
00094 }
00095
00096
00097 void EyeTracker::calibrateOnline(nub::soft_ref<PsychoDisplay> d)
00098 {
00099 LFATAL("online calibration not supported on this tracker");
00100 }
00101
00102
00103 void EyeTracker::closeSDL()
00104 {
00105 LFATAL("online calibration not supported on this tracker");
00106 }
00107
00108
00109 void EyeTracker::openSDL()
00110 {
00111 LFATAL("online calibration not supported on this tracker");
00112 }
00113
00114
00115 void EyeTracker::track(const bool startstop)
00116 {
00117 if (startstop)
00118 {
00119 if (itsIsTracking)
00120 LERROR("Request to start tracking ignored, already tracking...");
00121 else
00122 {
00123 this->startTracking();
00124 if (itsEventLog.isValid())
00125 itsEventLog->
00126 pushEvent(sformat("----- Eye Tracker Start session %d -----",
00127 itsSession));
00128 itsIsTracking = true;
00129 }
00130 }
00131 else
00132 {
00133 if (itsIsTracking == false)
00134 LERROR("Request to stop tracking ignored, not tracking...");
00135 else
00136 {
00137 this->stopTracking();
00138 if (itsEventLog.isValid())
00139 itsEventLog->
00140 pushEvent(sformat("----- Eye Tracker Stop session %d -----",
00141 itsSession));
00142 ++itsSession;
00143 itsIsTracking = false;
00144 }
00145 }
00146 }
00147
00148
00149 bool EyeTracker::isTracking() const
00150 { return itsIsTracking; }
00151
00152
00153 void EyeTracker::clearEyeStatus()
00154 {
00155 while (isFixating()) ;
00156 while (isSaccade()) ;
00157 }
00158
00159
00160 Point2D<int> EyeTracker::getCalibEyePos()
00161 { LFATAL("not supported");
00162 return Point2D<int>(-1,-1);}
00163
00164
00165 void EyeTracker::requestQuickEyeS()
00166 {
00167 LFATAL("can't save eyeS only eyetrackers with online calibration support this");
00168 }
00169
00170
00171
00172 void EyeTracker::setCurrentStimFile(std::string filename)
00173 {
00174 itsCurrentStimFile = filename;
00175 }
00176
00177
00178
00179 std::string EyeTracker::getCurrentStimFile()
00180 {
00181 if(!itsCurrentStimFile.empty())
00182 return itsCurrentStimFile;
00183 else
00184 { LERROR("itsCurrentStimFile not set");
00185 return NULL;
00186 }
00187
00188
00189 }
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 #endif // PSYCHO_EYETRACKER_C_DEFINED