gazetk / DesktopConnector / DeviceServer_MyGaze / myGazeAPI.py @ master
History | View | Annotate | Download (3.163 KB)
1 |
# myGazeAPI.py
|
---|---|
2 |
#
|
3 |
# (C) Copyright 2013, Visual Interaction GmbH
|
4 |
# All rights reserved. This work contains unpublished proprietary
|
5 |
# information of Visual Interaction GmbH and is copy protected by law.
|
6 |
# (see accompanying file eula.pdf)
|
7 |
#
|
8 |
# Author: Visual Interaction GmbH
|
9 |
# November, 2012
|
10 |
|
11 |
|
12 |
|
13 |
from ctypes import * |
14 |
|
15 |
|
16 |
# ----------------------------------------------------------------------------
|
17 |
# ---- Struct Definitions
|
18 |
# ---- (for detailed information due to the data
|
19 |
# ---- structuresplease refer to the myGaze SDK Manual)
|
20 |
# ----------------------------------------------------------------------------
|
21 |
|
22 |
class CSystem(Structure): |
23 |
_fields_ = [("samplerate", c_int),
|
24 |
("iV_MajorVersion", c_int),
|
25 |
("iV_MinorVersion", c_int),
|
26 |
("iV_Buildnumber", c_int),
|
27 |
("API_MajorVersion", c_int),
|
28 |
("API_MinorVersion", c_int),
|
29 |
("API_Buildnumber", c_int),
|
30 |
("iV_ETDevice", c_int)]
|
31 |
|
32 |
|
33 |
class CCalibrationPoint(Structure): |
34 |
_fields_ = [("number", c_int),
|
35 |
("positionX", c_int),
|
36 |
("positionY", c_int)]
|
37 |
|
38 |
|
39 |
class CEye(Structure): |
40 |
_fields_ = [("gazeX", c_double),
|
41 |
("gazeY", c_double),
|
42 |
("diam", c_double),
|
43 |
("eyePositionX", c_double),
|
44 |
("eyePositionY", c_double),
|
45 |
("eyePositionZ", c_double)]
|
46 |
|
47 |
|
48 |
class CSample(Structure): |
49 |
_fields_ = [("timestamp", c_longlong),
|
50 |
("leftEye", CEye),
|
51 |
("rightEye", CEye)]
|
52 |
|
53 |
|
54 |
class CEvent(Structure): |
55 |
_fields_ = [("eventType", c_char),
|
56 |
("eye", c_char),
|
57 |
("startTime", c_longlong),
|
58 |
("endTime", c_longlong),
|
59 |
("duration", c_longlong),
|
60 |
("positionX", c_double),
|
61 |
("positionY", c_double)]
|
62 |
|
63 |
|
64 |
class CAccuracy(Structure): |
65 |
_fields_ = [("deviationLX", c_double),
|
66 |
("deviationLY", c_double),
|
67 |
("deviationRX", c_double),
|
68 |
("deviationRY", c_double)]
|
69 |
|
70 |
|
71 |
class CCalibration(Structure): |
72 |
_fields_ = [("method", c_int),
|
73 |
("visualization", c_int),
|
74 |
("displayDevice", c_int),
|
75 |
("speed", c_int),
|
76 |
("autoAccept", c_int),
|
77 |
("foregroundBrightness", c_int),
|
78 |
("backgroundBrightness", c_int),
|
79 |
("targetShape", c_int),
|
80 |
("targetSize", c_int),
|
81 |
("targetFilename", c_char * 256)] |
82 |
|
83 |
|
84 |
class CMonitorAttachedGeometry(Structure): |
85 |
_fields_ = [("setupName", c_char * 256), |
86 |
("stimX", c_int),
|
87 |
("stimY", c_int),
|
88 |
("redStimDistHeight", c_int),
|
89 |
("redStimDistDepth", c_int),
|
90 |
("redInclAngle", c_int)]
|
91 |
|
92 |
|
93 |
class CImage(Structure): |
94 |
_fields_ = [("imageHeight", c_int),
|
95 |
("imageWidth", c_int),
|
96 |
("imageSize", c_int),
|
97 |
("imageBuffer", c_char)]
|
98 |
|
99 |
|
100 |
class CDate(Structure): |
101 |
_fields_ = [("day", c_int),
|
102 |
("month", c_int),
|
103 |
("year", c_int)]
|
104 |
|
105 |
|
106 |
# ----------------------------------------------------------------------------
|
107 |
# ---- loading myGazeAPI.dll
|
108 |
# ----------------------------------------------------------------------------
|
109 |
|
110 |
myGazeAPI = windll.LoadLibrary("myGazeAPI.dll")
|
111 |
|
112 |
|
113 |
# ----------------------------------------------------------------------------
|
114 |
# ---- initializing structs
|
115 |
# ----------------------------------------------------------------------------
|
116 |
|
117 |
systemData = CSystem(0, 0, 0, 0, 0, 0, 0, 0) |
118 |
leftEye = CEye(0, 0, 0, 0, 0, 0) |
119 |
rightEye = CEye(0, 0, 0, 0, 0, 0) |
120 |
sampleData = CSample(0, leftEye, rightEye)
|
121 |
eventData = CEvent('F', 'L', 0, 0, 0, 0, 0) |
122 |
accuracyData = CAccuracy(0,0,0,0) |
123 |
calibrationData = CCalibration(5, 1, 0, 0, 1, 20, 239, 1, 15, b"") |
124 |
geometry = CMonitorAttachedGeometry(b"DefaultSetup", 474, 296, 0, 35, 20); |
125 |
|