' -----------------------------------------------------------------------
' Copyright (C) 2019-2026, EyeLogic GmbH
'
' Permission Is hereby granted, free Of charge, To any person Or
' organization obtaining a copy Of the software And accompanying
' documentation covered by this license (the "Software") To use,
' reproduce, display, distribute, execute, And transmit the Software,
' And To prepare derivative works Of the Software, And To permit
' third-parties To whom the Software Is furnished To Do so.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
' EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
' MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
' NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
' DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER
' LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
' OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
' THE SOFTWARE.
' -----------------------------------------------------------------------


' check the C-API user manual for description of the function call and the parameters

Declare Function elInitApi Lib "ELCApi32.dll" ( ByVal clientName As String ) As Long 
Declare Sub elDestroyApi Lib "ELCApi32.dll" ( ) 

Declare Function elConnect Lib "ELCApi32.dll" ( ) As Long
Declare Sub elDisconnect Lib "ELCApi32.dll" ( ) 
Declare Function elIsConnected Lib "ELCApi32.dll" ( ) As Boolean

Type ELCScreenConfig 
    id As Long
    resolutionX As Long
	resolutionY As Long
    physicalSizeX_mm As Double
	physicalSizeY_mm As Double
    dpiX As Double
	dpiY As Double
End Type 
Declare Sub elGetScreenConfig Lib "ELCApi32.dll" ( ByRef screenConfig As ELCScreenConfig ) 

Type ELCDeviceConfig 
    deviceSerial1 As Long
	deviceSerial2 As Long
    numFrameRates As Long
    frameRates As String*16
    numCalibrationMethods As Long
    calibrationMethods As String*16
End Type
Declare Sub elGetDeviceConfig Lib "ELCApi32.dll" ( ByRef deviceConfig As ELCDeviceConfig ) 

Type ELCGazeSample
    timestampMicroSec1 As Long
    timestampMicroSec2 As Long
    index As Long
	temp1 As Single 
	porRawX As Double
	porRawY As Double
    porFilteredX As Double 
	porFilteredY As Double     
	porLeftX As Double 
	porLeftY As Double 
    eyePositionLeftX As Double 
	eyePositionLeftY As Double 
	eyePositionLeftZ As Double 
    pupilRadiusLeft As Double 	
    porRightX As Double 
	porRightY As Double 
    eyePositionRightX As Double 
	eyePositionRightY As Double 
	eyePositionRightZ As Double 
    pupilRadiusRight As Double 
End Type

Declare Function elGetNextGazeSample Lib "ELCApi32.dll" ( ByRef sample As ELCGazeSample, ByVal timeoutMillis As Long ) As Long

Declare Function elRequestTracking Lib "ELCApi32.dll" ( ByVal frameRateModeIndex As Long ) As Long
Declare Sub elUnrequestTracking Lib "ELCApi32.dll" ( ) 

Declare Function elCalibrate Lib "ELCApi32.dll" ( ByVal calibrationMethodIndex As Long ) As Long

Dim InvalidValue As Double

' Declaration of EyeLogic variables 
Dim screenConfig As ELCScreenConfig
Dim deviceConfig As ELCDeviceConfig
Dim sample As ELCGazeSample
