SMI RED eye tracking plugin 1.0

lib/iViewXAPI.h

Go to the documentation of this file.
00001 
00002 
00010 #define DLLExport __declspec(dllexport) 
00011 
00012 
00013 #define RET_SUCCESS                                             1
00014 #define RET_NO_VALID_DATA                               2
00015 #define RET_CALIBRATION_ABORTED                 3
00016 #define ERR_COULD_NOT_CONNECT                   100
00017 #define ERR_NOT_CONNECTED                               101
00018 #define ERR_NOT_CALIBRATED                              102
00019 #define ERR_NOT_VALIDATED                               103
00020 #define ERR_WRONG_DEVICE                                111
00021 #define ERR_WRONG_PARAMETER                             112
00022 #define ERR_WRONG_CALIBRATION_METHOD    113
00023 #define ERR_CREATE_SOCKET                               121
00024 #define ERR_CONNECT_SOCKET                              122
00025 #define ERR_BIND_SOCKET                                 123
00026 #define ERR_DELETE_SOCKET                               124
00027 #define ERR_NO_RESPONSE_FROM_IVIEWX             131
00028 #define ERR_INVALID_IVIEWX_VERSION              132
00029 #define ERR_WRONG_IVIEWX_VERSION                133
00030 #define ERR_WRONG_SDK_DLL                       133
00031 #define ERR_ACCESS_TO_FILE                              171
00032 #define ERR_SOCKET_CONNECTION                   181
00033 #define ERR_EMPTY_DATA_BUFFER                   191     
00034 #define ERR_RECORDING_DATA_BUFFER               192     
00035 #define ERR_FULL_DATA_BUFFER                    193     
00036 #define ERR_IVIEWX_IS_NOT_READY                 194     
00037 #define ERR_IVIEWX_NOT_FOUND                    201     
00038 
00039 
00040 /*
00041 * With these defines it is possible to setup the logging status 
00042 * for the function "iV_Log". With "iV_Log" it is possible to observe the 
00043 * communication between a user’s application and iView X and/or function 
00044 * calls. Log levels can be combined (e.g. LOG_BUG | LOG_IV_COMMAND | LOG_ETCOM). 
00045 */ 
00046 #define LOG_LEVEL_BUG                                   1       
00047 #define LOG_LEVEL_iV_FCT                                2       
00048 #define LOG_LEVEL_ALL_FCT                               4       
00049 #define LOG_LEVEL_IV_COMMAND                    8       
00050 #define LOG_LEVEL_RECV_IV_COMMAND               16      
00051 
00052 
00053 /* 
00054 * With ET_PARAM_ and function "iV_SetTrackingParameter" it is possible 
00055 * to change iView X tracking parameters, for example pupil threshold and 
00056 * corneal reflex thresholds, eye image contours, and other parameters.
00057 * 
00058 * Important note: This function can strongly affect tracking stability of 
00059 * your iView X system. Only experienced users should use this function. 
00060 */
00061 #define ET_PARAM_EYE_LEFT                               0
00062 #define ET_PARAM_EYE_RIGHT                              1
00063 #define ET_PARAM_PUPIL_THRESHOLD                0
00064 #define ET_PARAM_REFLEX_THRESHOLD               1
00065 #define ET_PARAM_SHOW_AOI                               2
00066 #define ET_PARAM_SHOW_CONTOUR                   3
00067 #define ET_PARAM_SHOW_PUPIL                             4
00068 #define ET_PARAM_SHOW_REFLEX                    5
00069 #define ET_PARAM_DYNAMIC_THRESHOLD              6
00070 #define ET_PARAM_PUPIL_AREA                             11
00071 #define ET_PARAM_PUPIL_PERIMETER                12
00072 #define ET_PARAM_PUPIL_DENSITY                  13
00073 #define ET_PARAM_REFLEX_PERIMETER               14
00074 #define ET_PARAM_REFLEX_PUPIL_DISTANCE  15
00075 
00076 
00077 /*
00078 * The enumeration ETDevice can be used in connection with 
00079 * "iV_GetSystemInfo" to get information about which type of device is 
00080 * connected to iView X. It is part of the "SystemInfoStruct".
00081 * (NONE = 0, RED = 1, HiSpeed = 2, MRI/MEG = 3, HED = 4, Custom = 5) 
00082 */
00083 enum ETDevice {NONE, RED, HiSpeed, MRI, HED, Custom};
00084 
00085 
00103 struct SystemInfoStruct
00104 {
00105         int samplerate;                                 
00106         int iV_MajorVersion;                    
00107         int iV_MinorVersion;                    
00108         int iV_Buildnumber;                             
00109         int API_MajorVersion;                   
00110         int API_MinorVersion;                   
00111         int API_Buildnumber;                    
00112         enum ETDevice iV_ETDevice;              
00113 };
00114 
00115 
00129 struct CalibrationPointStruct
00130 {
00131         int number;                                                     
00132         int positionX;                                          
00133         int positionY;                                          
00134 };
00135 
00136 
00153 struct EyeDataStruct
00154 {
00155         double gazeX;                                   
00156         double gazeY;                                   
00157         double diam;                                    
00158         double eyePositionX;                    
00159         double eyePositionY;                    
00160         double eyePositionZ;                    
00161 };
00162 
00163 
00179 struct SampleStruct
00180 {
00181         long long timestamp;                            
00182         EyeDataStruct leftEye;                          
00183         EyeDataStruct rightEye;                         
00184         int     planeNumber;                                    
00185 };
00186 
00187 
00203 struct SampleStruct32
00204 {
00205         double timestamp;                                       
00206         EyeDataStruct leftEye;                          
00207         EyeDataStruct rightEye;                         
00208         int     planeNumber;                                    
00209 };
00210 
00211 
00232 struct EventStruct
00233 {
00234         char eventType;                                         
00235         char eye;                                                       
00236         long long startTime;                            
00237         long long endTime;                                      
00238         long long duration;                                     
00239         double positionX;                                       
00240         double positionY;                                       
00241 };
00242 
00243 
00264 struct EventStruct32
00265 {
00266         char eventType;                                         
00267         char eye;                                                       
00268         double startTime;                                       
00269         double endTime;                                         
00270         double duration;                                        
00271         double positionX;                                       
00272         double positionY;                                       
00273 };
00274 
00275 
00289 struct AccuracyStruct
00290 {
00291         double deviationLX;                             
00292         double deviationLY;                             
00293         double deviationRX;                             
00294         double deviationRY;                             
00295 };
00296 
00297 
00325 struct CalibrationStruct
00326 {
00327         int method;                                             
00328         int visualization;                              
00329         int displayDevice;                              
00330         int speed;                                              
00331         int autoAccept;                                 
00332         int foregroundBrightness;               
00333         int backgroundBrightness;               
00334         int targetShape;                                
00335         int targetSize;                                 
00336         char targetFilename[256];               
00337 };
00338 
00339 
00356 struct REDStandAloneModeStruct
00357 {
00358         int stimX;
00359         int stimY;
00360         int stimHeightOverFloor;
00361         int redHeightOverFloor;
00362         int redStimDist;
00363         int redInclAngle;
00364 };
00365 
00366 
00367 
00368 typedef int (CALLBACK *pDLLSetCalibrationPoint)(struct CalibrationPointStruct calibrationPoint);
00369 typedef int (CALLBACK *pDLLSetSample)(struct SampleStruct rawDataSample);
00370 typedef int (CALLBACK *pDLLSetEvent)(struct EventStruct eventDataSample);
00371 
00372 
00373 
00374 
00380 DLLExport int __stdcall iV_SetLicense(char* licenseKey);
00381 
00382 
00390 DLLExport int __stdcall iV_Start();
00391 
00392 
00399 DLLExport int __stdcall iV_Quit();
00400 
00401 
00411 DLLExport int __stdcall iV_SendCommand(char etMessage[256]);
00412 
00413 
00430 DLLExport int __stdcall iV_Connect(char sendIPAddress[16], int sendPort, char recvIPAddress[16], int receivePort);
00431 
00432 
00439 DLLExport int __stdcall iV_IsConnected();
00440 
00441 
00450 DLLExport int __stdcall iV_Disconnect();
00451 
00452 
00462 DLLExport int __stdcall iV_GetSystemInfo(struct SystemInfoStruct *systemInfoData);
00463 
00464 
00476 DLLExport int __stdcall iV_SetTrackingParameter(int ET_PARAM_EYE, int ET_PARAM, int value);
00477 
00478 
00490 DLLExport int __stdcall iV_StartRecording();
00491 
00492 
00504 DLLExport int __stdcall iV_StopRecording();
00505 
00506 
00520 DLLExport int __stdcall iV_ContinueRecording(char etMessage[256]);
00521 
00522 
00534 DLLExport int __stdcall iV_PauseRecording();
00535 
00545 DLLExport int __stdcall iV_ClearRecordingBuffer();
00546         
00547 
00565 DLLExport int __stdcall iV_SaveData(char filename[256], char description[64], char user[64], int overwrite);
00566 
00567 
00580 DLLExport int __stdcall iV_SetupCalibration(struct CalibrationStruct *calibrationData);
00581 
00582 
00595 DLLExport int __stdcall iV_SaveCalibration(char name[256]);
00596 
00597 
00612 DLLExport int __stdcall iV_LoadCalibration(char name[256]);
00613 
00614 
00624 DLLExport int __stdcall iV_AcceptCalibrationPoint();
00625 
00626 
00635 DLLExport int __stdcall iV_AbortCalibration();
00636 
00637 
00650 DLLExport int __stdcall iV_ChangeCalibrationPoint(int number, int positionX, int positionY);
00651 
00652 
00659 DLLExport int __stdcall iV_ResetCalibrationPoints();
00660 
00661 
00674 DLLExport int __stdcall iV_Calibrate();
00675 
00676 
00687 DLLExport int __stdcall iV_Validate();
00688 
00689 
00706 DLLExport int __stdcall iV_GetAccuracy(struct AccuracyStruct *accuracyData, int visualization);
00707 
00708 
00718 DLLExport int __stdcall iV_GetCurrentCalibrationPoint(struct CalibrationPointStruct *actualCalibrationPoint);
00719 
00720 
00727 DLLExport int __stdcall iV_EnableGazeDataFilter();
00728 
00729 
00735 DLLExport int __stdcall iV_DisableGazeDataFilter();
00736 
00737 
00747 DLLExport int __stdcall iV_GetSample(struct SampleStruct *rawDataSample);
00748 
00749 
00759 DLLExport int __stdcall iV_GetSample32(struct SampleStruct32 *rawDataSample);
00760 
00761 
00771 DLLExport int __stdcall iV_SetEventDetectionParameter(int minDuration, int maxDispersion);
00772 
00773 
00783 DLLExport int __stdcall iV_GetEvent(struct EventStruct *eventDataSample);
00784 
00785 
00795 DLLExport int __stdcall iV_GetEvent32(struct EventStruct32 *eventDataSample);
00796 
00797 
00809 DLLExport int __stdcall iV_SendImageMessage(char etMessage[256]);
00810 
00811 
00823 DLLExport int __stdcall iV_SetLogger(int logLevel, char filename[256]);
00824 
00825 
00834 DLLExport int __stdcall iV_Log(char logMessage[256]);
00835 
00836 
00849 DLLExport int __stdcall iV_SetupREDStandAloneMode(struct REDStandAloneModeStruct *standAloneModeGeometry);
00850 
00851 
00861 DLLExport int __stdcall iV_GetActualTimestamp(long long *actualTimestamp);
00862 
00863 
00872 DLLExport int __stdcall iV_ShowEyeImageMonitor();
00873 
00874 
00883 DLLExport int __stdcall iV_ShowSceneVideoMonitor();
00884 
00885 
00894 DLLExport int __stdcall iV_ShowTrackingMonitor(); 
00895 
00896 
00904 DLLExport void __stdcall iV_SetCalibrationCallback(pDLLSetCalibrationPoint pCalibrationCallbackFunction); 
00905 
00906 
00915 DLLExport void __stdcall iV_SetSampleCallback(pDLLSetSample pSampleCallbackFunction); 
00916 
00917 
00924 DLLExport void __stdcall iV_SetEventCallback(pDLLSetEvent pEventCallbackFunction); 
00925 
00926 
00930 DLLExport int __stdcall Test(); 
00931 
00932 
00933 
00934