Skip to content

Commit 6b5c935

Browse files
committed
Release v.0.9.35
1 parent 7dce1f1 commit 6b5c935

22 files changed

Lines changed: 234 additions & 69 deletions

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ The complete API specification used by the Java SDK to communicate with the serv
4444
Changelog
4545
----
4646

47+
0.9.35 (2014-05-20)
48+
49+
- Updated license
50+
- Fixed bug related to ICalibrationResultListener
51+
4752
0.9.34 (2014-05-09)
4853

4954
- Improved documentation

src/com/theeyetribe/client/GazeApiManager.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Copyright (c) 2013-present, The Eye Tribe.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
19
package com.theeyetribe.client;
210

311
import java.io.BufferedReader;
@@ -101,6 +109,7 @@ public void requestCalibrationStates()
101109
{
102110
Protocol.TRACKER_ISCALIBRATED,
103111
Protocol.TRACKER_ISCALIBRATING,
112+
Protocol.TRACKER_CALIBRATIONRESULT
104113
};
105114

106115
request(gson.toJsonTree(gr, TrackerGetRequest.class).toString());
@@ -237,17 +246,17 @@ public boolean connect(String host, int port)
237246
outgoingStreamHandler = new OutgoingStreamHandler();
238247
outgoingStreamHandler.start();
239248
}
240-
catch (IOException ioe)
241-
{
242-
System.out.println("Unable to open socket. Is EyeTribe Server running? Exception: " + ioe.getLocalizedMessage());
249+
catch (IOException ioe)
250+
{
251+
System.out.println("Unable to open socket. Is EyeTribe Server running? Exception: " + ioe.getLocalizedMessage());
243252

244-
//notify connection change
245-
if (null != connectionListener)
246-
connectionListener.onGazeApiConnectionStateChanged(false);
253+
//notify connection change
254+
if (null != connectionListener)
255+
connectionListener.onGazeApiConnectionStateChanged(false);
247256

248-
close();
249-
return false;
250-
}
257+
close();
258+
return false;
259+
}
251260
catch (Exception e)
252261
{
253262
System.out.println("Exception while establishing socket connection. Is EyeTribe Server running? Exception: " + e.getLocalizedMessage());

src/com/theeyetribe/client/GazeManager.java

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Copyright (c) 2013-present, The Eye Tribe.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
19
package com.theeyetribe.client;
210

311
import java.net.HttpURLConnection;
@@ -133,23 +141,23 @@ public boolean activate(final ApiVersion version, final ClientMode mode, final S
133141
//if already running, deactivate before starting anew
134142
if(isActivated())
135143
deactivate();
136-
144+
137145
//lock calling thread while initializing
138146
Object threadLock = Thread.currentThread();
139-
147+
140148
synchronized (threadLock)
141149
{
142150
synchronized (initializationLock)
143151
{
144152
if(!isActivated())
145153
{
146154
isInitializing = true;
147-
155+
148156
try
149157
{
150158
//threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
151159
threadPool = Executors.newCachedThreadPool();
152-
160+
153161
//make sure we do not init networking on calling thread
154162
threadPool.execute(new Runnable()
155163
{
@@ -160,7 +168,7 @@ public void run()
160168
{
161169
apiManager = new GazeApiManager(GazeManager.this, GazeManager.this);
162170
apiManager.connect(hostname, portnumber);
163-
171+
164172
if(apiManager.isConnected())
165173
{
166174
apiManager.requestTracker( mode, version);
@@ -173,10 +181,10 @@ public void run()
173181
}
174182
}
175183
});
176-
184+
177185
//We wait until above requests have been handled by server or timeout occurs
178186
initializationLock.wait( INIT_TIME_DELAY_SECONDS * 1000);
179-
187+
180188
if(!isInitialized)
181189
{
182190
deactivate();
@@ -186,7 +194,7 @@ public void run()
186194
{
187195
if(!heartbeatHandler.isAlive())
188196
heartbeatHandler.start();
189-
197+
190198
isActive = true;
191199
}
192200
}
@@ -198,7 +206,7 @@ public void run()
198206
}
199207
}
200208
}
201-
209+
202210
return isActivated();
203211
}
204212
}
@@ -354,17 +362,17 @@ public ClientMode getClientMode()
354362
{
355363
return clientMode;
356364
}
357-
365+
358366
/**
359367
* Initiate a new calibration process. Must be called before any call to {@link #calibrationPointStart(int, int) CalibrationPointStart}
360368
* or {@link #calibrationPointEnd() calibrationPointEnd}.
361-
* <p>
362-
* Any previous (and possible running) calibration process must be completed or aborted before calling this.
363-
* <p>
364-
* A full calibration process consists of a number of calls to {@link #calibrationPointStart(int, int) calibrationPointStart} and
365-
* {@link #calibrationPointEnd() calibrationPointEnd} matching the total number of calibration points set by the numCalibrationPoints
366-
* parameter.
367-
*
369+
* <p>
370+
* Any previous (and possible running) calibration process must be completed or aborted before calling this.
371+
* <p>
372+
* A full calibration process consists of a number of calls to {@link #calibrationPointStart(int, int) calibrationPointStart} and
373+
* {@link #calibrationPointEnd() calibrationPointEnd} matching the total number of calibration points set by the numCalibrationPoints
374+
* parameter.
375+
*
368376
* @param numCalibrationPoints The number of calibration points that will be used in this calibration
369377
* @param listener The {@link com.theeyetribe.client.ICalibrationProcessHandler} instance that will receive callbacks during the
370378
* calibration process
@@ -381,14 +389,14 @@ public void calibrationStart(int numCalibrationPoints, ICalibrationProcessHandle
381389
else
382390
System.out.println("TET Java Client not activated!");
383391
}
384-
392+
385393
/**
386394
* Called for every calibration point during a calibration process. This call should be followed by a call to
387395
* {@link #calibrationPointEnd() calibrationPointEnd} 1-2 seconds later.
388396
* <p>
389397
* The calibration process must be initiated by a call to {@link #calibrationStart(int, ICalibrationProcessHandler) calibrationStart} before
390398
* calling this.
391-
*
399+
*
392400
* @param x X coordinate of the calibration point
393401
* @param y Y coordinate of the calibration point
394402
*/
@@ -406,7 +414,7 @@ public void calibrationPointStart(int x, int y)
406414
else
407415
System.out.println("TET Java Client not activated!");
408416
}
409-
417+
410418
/**
411419
* Called for every calibration point during a calibration process. This should be called 1-2 seconds after
412420
* {@link #calibrationPointStart(int, int) calibrationPointStart}.
@@ -545,7 +553,7 @@ public int getNumGazeListeners()
545553

546554
return -1;
547555
}
548-
556+
549557
/**
550558
* Checks if a given instance of {@link com.theeyetribe.client.IGazeListener} is currently attached.
551559
*
@@ -807,9 +815,6 @@ public void clearListeners()
807815
gazeBroadcaster.stop();
808816
}
809817

810-
long total;
811-
long frameCount;
812-
813818
@Override
814819
public void onGazeApiResponse(final String response)
815820
{
@@ -827,10 +832,6 @@ public void run()
827832
{
828833
if(reply.request.compareTo(Protocol.TRACKER_REQUEST_GET) == 0)
829834
{
830-
frameCount++;
831-
832-
long timeStamp = System.currentTimeMillis();
833-
834835
JsonParser jsonParser = new JsonParser();
835836
JsonObject jo = (JsonObject)jsonParser.parse(response);
836837
TrackerGetReply tgr = gson.fromJson(jo, TrackerGetReply.class);
@@ -888,15 +889,15 @@ public void run()
888889
isCalibrating = tgr.values.isCalibrating;
889890
if(null != tgr.values.isCalibrated)
890891
isCalibrated = tgr.values.isCalibrated;
891-
892+
892893
//if defined in json response, then set
893894
if (((JsonObject)jo.get(Protocol.KEY_VALUES)).has(Protocol.TRACKER_CALIBRATIONRESULT))
894895
{
895896
//is calibration result different from current?
896897
if(null == lastCalibrationResult || !lastCalibrationResult.equals(tgr.values.calibrationResult) )
897898
{
898899
lastCalibrationResult = tgr.values.calibrationResult;
899-
900+
900901
synchronized (calibrationResultListeners)
901902
{
902903
for(final ICalibrationResultListener listener : calibrationResultListeners)
@@ -993,8 +994,6 @@ public void run()
993994
initializationLock.notify();
994995
}
995996
}
996-
997-
total += System.currentTimeMillis() - timeStamp;
998997
}
999998
else if(reply.request.compareTo(Protocol.TRACKER_REQUEST_SET) == 0)
1000999
{
@@ -1009,14 +1008,14 @@ else if(reply.category.compareTo(Protocol.CATEGORY_CALIBRATION) == 0)
10091008

10101009
if(null != calibrationListener)
10111010
try
1012-
{
1013-
calibrationListener.onCalibrationStarted();
1014-
}
1015-
catch (Exception e)
1016-
{
1017-
System.out.println("Exception while calling ICalibrationProcessHandler.onCalibrationStarted() " +
1018-
"on listener " + calibrationListener + ": " + e.getLocalizedMessage());
1019-
}
1011+
{
1012+
calibrationListener.onCalibrationStarted();
1013+
}
1014+
catch (Exception e)
1015+
{
1016+
System.out.println("Exception while calling ICalibrationProcessHandler.onCalibrationStarted() " +
1017+
"on listener " + calibrationListener + ": " + e.getLocalizedMessage());
1018+
}
10201019
}
10211020
else if(reply.request.compareTo(Protocol.CALIBRATION_REQUEST_POINTSTART) == 0)
10221021
{
@@ -1043,14 +1042,14 @@ else if(reply.request.compareTo(Protocol.CALIBRATION_REQUEST_POINTEND) == 0)
10431042
if (sampledCalibrationPoints == totalCalibrationPoints)
10441043
//Notify calibration listener that all calibration points have been sampled and the analysis of the calibration results has begun
10451044
try
1046-
{
1047-
calibrationListener.onCalibrationProcessing();
1048-
}
1049-
catch (Exception e)
1050-
{
1051-
System.out.println("Exception while calling ICalibrationProcessHandler.OnCalibrationProcessing() on listener " +
1052-
calibrationListener + ": " + e.getLocalizedMessage());
1053-
}
1045+
{
1046+
calibrationListener.onCalibrationProcessing();
1047+
}
1048+
catch (Exception e)
1049+
{
1050+
System.out.println("Exception while calling ICalibrationProcessHandler.OnCalibrationProcessing() on listener " +
1051+
calibrationListener + ": " + e.getLocalizedMessage());
1052+
}
10541053
}
10551054

10561055
final CalibrationPointEndReply cper = gson.fromJson(response, CalibrationPointEndReply.class);

src/com/theeyetribe/client/GazeUtils.java

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Copyright (c) 2013-present, The Eye Tribe.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
19
package com.theeyetribe.client;
210

311
import com.theeyetribe.client.data.GazeData;
@@ -95,17 +103,17 @@ public static double getEyesDistanceNormalized(Eye leftEye, Eye rightEye)
95103
if(null != leftEye && null != rightEye)
96104
{
97105
double dist = Math.abs(getDistancePoint2D(leftEye.pupilCenterCoordinates, rightEye.pupilCenterCoordinates));
98-
106+
99107
if (dist < _MinimumEyesDistance)
100108
_MinimumEyesDistance = dist;
101-
109+
102110
if (dist > _MaximumEyesDistance)
103111
_MaximumEyesDistance = dist;
104-
112+
105113
//return normalized
106114
return dist / (_MaximumEyesDistance - _MinimumEyesDistance);
107115
}
108-
116+
109117
return -1;
110118
}
111119

@@ -189,14 +197,14 @@ public static Point2D getNormalizedMapping(Point2D point, int screenWidth, int s
189197
{
190198
Point2D normMap = getNormalizedCoords(point, screenWidth, screenHeight);
191199

192-
if (null != normMap)
193-
{
194-
//scale up and shift
195-
normMap.x *= 2f;
196-
normMap.x -= 1f;
197-
normMap.y *= 2f;
198-
normMap.y -= 1f;
199-
}
200+
if (null != normMap)
201+
{
202+
//scale up and shift
203+
normMap.x *= 2f;
204+
normMap.x -= 1f;
205+
normMap.y *= 2f;
206+
normMap.y -= 1f;
207+
}
200208

201209
return normMap;
202210
}

src/com/theeyetribe/client/ICalibrationProcessHandler.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Copyright (c) 2013-present, The Eye Tribe.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
19
package com.theeyetribe.client;
210

311
import com.theeyetribe.client.data.CalibrationResult;

src/com/theeyetribe/client/ICalibrationResultListener.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Copyright (c) 2013-present, The Eye Tribe.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
19
package com.theeyetribe.client;
210

311
import com.theeyetribe.client.data.CalibrationResult;

src/com/theeyetribe/client/IConnectionStateListener.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Copyright (c) 2013-present, The Eye Tribe.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
19
package com.theeyetribe.client;
210

311
/**

src/com/theeyetribe/client/IGazeListener.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Copyright (c) 2013-present, The Eye Tribe.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
19
package com.theeyetribe.client;
210

311
import com.theeyetribe.client.data.GazeData;

0 commit comments

Comments
 (0)