Skip to content

Commit 55f031f

Browse files
authored
Merge pull request #20 from arnebp/master
release 0.9.77.1
2 parents 6d21278 + 3bd6f47 commit 55f031f

File tree

9 files changed

+88
-23
lines changed

9 files changed

+88
-23
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Change Log #
22
---
33

4+
Version 0.9.77.1 (2016-11-23)
5+
---
6+
- Default states for all GazeManager enum types
7+
- Fixed default network state
8+
- Update Gradle version & dependencies
9+
410
Version 0.9.77 (2016-05-17)
511
---
612
- Moving all data types from 64-bit to 32-bit floating point precision

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ allprojects {
2727
}
2828

2929
task wrapper(type: Wrapper) {
30-
gradleVersion = '2.14.1'
30+
gradleVersion = '3.1'
3131
}

eyetribe.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
currentVersion=0.9.77
2-
releaseDate=2016-05-17
1+
currentVersion=0.9.77.1
2+
releaseDate=2016-11-23

javafx-sample/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ apply from: 'javafx.plugin'
33
dependencies {
44
compile fileTree(dir: 'libs', include: ['*.jar'])
55
compile 'com.google.guava:guava:19.0'
6-
compile 'org.controlsfx:controlsfx:8.40.10'
7-
compile 'com.theeyetribe:eyetribe-java:0.9.77'
6+
compile 'org.controlsfx:controlsfx:8.40.12'
7+
compile 'com.google.code.findbugs:jsr305:3.0.1'
8+
compile 'com.theeyetribe:eyetribe-java:0.9.77+'
89
}
910

1011
jar {

javafx-sample/src/main/java/com/theeyetribe/javafx/utils/FrameRateGazeDataDeque.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
*/
1616
public class FrameRateGazeDataDeque extends GazeDataDeque
1717
{
18+
private static final long BUFFER_SIZE_MILLIS = 5000;
19+
20+
public FrameRateGazeDataDeque()
21+
{
22+
super(BUFFER_SIZE_MILLIS);
23+
}
24+
1825
public FrameRateGazeDataDeque(long timeLimit)
1926
{
2027
super(timeLimit);
@@ -24,7 +31,7 @@ public float getAvgFramesPerSecond()
2431
{
2532
float avgMillis;
2633
if((avgMillis = getAvgMillisFrame()) > 0 )
27-
return (float)1000/avgMillis;
34+
return 1000f / avgMillis;
2835

2936
return -1;
3037
}
@@ -37,7 +44,10 @@ public float getAvgMillisFrame()
3744
if(null != first && null != last)
3845
{
3946
float delta = first.timeStamp - last.timeStamp;
40-
return delta / size();
47+
48+
// only return value when buffer populated
49+
if (delta > (timeLimit >> 1))
50+
return delta / size();
4151
}
4252

4353
return -1;

javafx-sample/src/main/java/com/theeyetribe/javafx/utils/GazeDataDeque.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public class GazeDataDeque extends LinkedBlockingDeque<GazeData>
2626
{
2727
private static final long serialVersionUID = -7224237939138791310L;
28-
private long timeLimit;
28+
protected long timeLimit;
2929

3030
public GazeDataDeque(long timeLimit)
3131
{

sdk/src/main/java/com/theeyetribe/clientsdk/GazeApiManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*/
3636
class GazeApiManager
3737
{
38-
static String DEFAULT_SERVER_HOST = "localhost";
38+
static String DEFAULT_SERVER_HOST = "127.0.0.1";
3939
static int DEFAULT_SERVER_PORT = 6555;
4040

4141
private Socket mSocket;
@@ -250,6 +250,7 @@ public synchronized boolean connect(String host, int port, long timeOut)
250250
// connect to socket, with timeout
251251
mSocket = new Socket();
252252
mSocket.connect(new InetSocketAddress(host, port), (int) timeOut);
253+
mSocket.setKeepAlive(true);
253254
mSocket.setSoTimeout((int) timeOut);
254255

255256
// notify connection change
@@ -605,7 +606,7 @@ public void run()
605606
}
606607

607608
/**
608-
* Callback interface responsible for handling messages returned from the GazeApiManager
609+
* Callback interface responsible for handling responses returned from the GazeApiManager
609610
*/
610611
protected interface IGazeApiResponseListener
611612
{

sdk/src/main/java/com/theeyetribe/clientsdk/GazeManagerCore.java

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
package com.theeyetribe.clientsdk;
1010

11-
import com.theeyetribe.clientsdk.GazeApiManager.IGazeApiConnectionListener;
12-
import com.theeyetribe.clientsdk.GazeApiManager.IGazeApiResponseListener;
1311
import com.theeyetribe.clientsdk.data.CalibrationResult;
1412
import com.theeyetribe.clientsdk.data.CalibrationResult.CalibrationPoint;
1513
import com.theeyetribe.clientsdk.data.GazeData;
@@ -18,6 +16,8 @@
1816
import com.theeyetribe.clientsdk.response.Response;
1917
import com.theeyetribe.clientsdk.response.ResponseFailed;
2018
import com.theeyetribe.clientsdk.response.TrackerGetResponse;
19+
import com.theeyetribe.clientsdk.GazeApiManager.IGazeApiResponseListener;
20+
import com.theeyetribe.clientsdk.GazeApiManager.IGazeApiConnectionListener;
2121

2222
import java.util.ArrayList;
2323
import java.util.Collections;
@@ -77,6 +77,7 @@ abstract class GazeManagerCore implements IGazeApiResponseListener, IGazeApiConn
7777
mTrackerStateListeners = Collections.synchronizedList(new ArrayList<>());
7878
mScreenStateListeners = Collections.synchronizedList(new ArrayList<>());
7979
mConnectionStateListeners = Collections.synchronizedList(new ArrayList<>());
80+
resetEnums();
8081
}
8182

8283
/**
@@ -650,6 +651,8 @@ public void deactivate()
650651

651652
shutDownThreadpool();
652653

654+
resetEnums();
655+
653656
isInitialized = false;
654657
isActive = false;
655658
}
@@ -1753,7 +1756,7 @@ public void onGazeApiConnectionStateChanged(final boolean isConnected)
17531756

17541757

17551758
/**
1756-
* Mode in witch the EyeTribe server delivers gaze data stream to the Java SDK SDK
1759+
* Mode in witch the EyeTribe server delivers gaze data stream
17571760
*/
17581761
public enum ClientMode
17591762
{
@@ -1771,11 +1774,16 @@ private ClientMode(int clientMode)
17711774
}
17721775

17731776
/**
1774-
* Version of the EyeTribe API to be compliant to
1777+
* The EyeTribe API compliance levels
17751778
*/
17761779
public enum ApiVersion
17771780
{
1778-
VERSION_1_0(1);
1781+
/**
1782+
* ApiVersion is undefined. GazeManager not activated
1783+
*/
1784+
VERSION_UNDEFINED(0),
1785+
VERSION_1_0(1),
1786+
;
17791787

17801788
private int version;
17811789

@@ -1807,8 +1815,31 @@ public static int toInt(ApiVersion v)
18071815
*/
18081816
public enum TrackerState
18091817
{
1810-
TRACKER_CONNECTED(0), TRACKER_NOT_CONNECTED(1), TRACKER_CONNECTED_BADFW(2), TRACKER_CONNECTED_NOUSB3(3), TRACKER_CONNECTED_NOSTREAM(
1811-
4);
1818+
/**
1819+
* Tracker device is detected and working
1820+
*/
1821+
TRACKER_CONNECTED(0),
1822+
/**
1823+
* Tracker device is not detected
1824+
*/
1825+
TRACKER_NOT_CONNECTED(1),
1826+
/**
1827+
* Tracker device is detected but not working due to wrong/unsupported firmware
1828+
*/
1829+
TRACKER_CONNECTED_BADFW(2),
1830+
/**
1831+
* Tracker device is detected but not working due to unsupported USB host
1832+
*/
1833+
TRACKER_CONNECTED_NOUSB3(3),
1834+
/**
1835+
* Tracker device is detected but not working due to no stream could be received
1836+
*/
1837+
TRACKER_CONNECTED_NOSTREAM(4),
1838+
/**
1839+
* Tracker state is undefined. GazeManager not activated
1840+
*/
1841+
TRACKER_UNDEFINED(-1),
1842+
;
18121843

18131844
private int trackerState;
18141845

@@ -1839,10 +1870,17 @@ public static int toInt(TrackerState ts)
18391870
}
18401871

18411872
/**
1842-
* The current state of the connected TrackerDevice.
1873+
* The possible frame rates of the EyeTribe Server
18431874
*/
1844-
public enum FrameRate {
1845-
FPS_30(30), FPS_60(60);
1875+
public enum FrameRate
1876+
{
1877+
/**
1878+
* FrameRate is undefined. GazeManager not activated
1879+
*/
1880+
FPS_UNDEFINED(0),
1881+
FPS_30(30),
1882+
FPS_60(60),
1883+
;
18461884

18471885
private int frameRate;
18481886

@@ -1870,6 +1908,13 @@ public static int toInt(FrameRate fr) {
18701908
}
18711909
}
18721910

1911+
private void resetEnums()
1912+
{
1913+
trackerState = TrackerState.TRACKER_UNDEFINED;
1914+
frameRate = FrameRate.FPS_UNDEFINED;
1915+
version = ApiVersion.VERSION_UNDEFINED;
1916+
}
1917+
18731918
abstract protected GazeApiManager createApiManager(IGazeApiResponseListener responseListener, IGazeApiConnectionListener connectionListener);
18741919

18751920
abstract protected boolean parseApiResponse(final Response response, final Request request);

sdk/src/test/java/com/theeyetribe/test/TestApiClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void testActivateAsync() throws Exception
135135

136136
deactivateServer();
137137
}
138-
138+
139139
@Test
140140
public void testActivateAsyncRetry() throws Exception
141141
{
@@ -257,13 +257,15 @@ public void testAsyncLocks() throws Exception
257257

258258
lock.await(1, TimeUnit.SECONDS);
259259

260-
GazeManager.getInstance().calibrationStartAsync(9, null).get(5, TimeUnit.SECONDS);
261-
GazeManager.getInstance().calibrationAbortAsync().get(5, TimeUnit.SECONDS);
260+
Assert.assertTrue(GazeManager.getInstance().calibrationStartAsync(9, null).get(5, TimeUnit.SECONDS));
261+
Assert.assertTrue(GazeManager.getInstance().calibrationAbortAsync().get(5, TimeUnit.SECONDS));
262262

263263
lock.await(1, TimeUnit.SECONDS);
264264

265265
GazeManager.getInstance().deactivate();
266+
266267
lock.await(1, TimeUnit.SECONDS);
268+
267269
Assert.assertFalse(GazeManager.getInstance().isActivated());
268270
}
269271

0 commit comments

Comments
 (0)