88
99package com .theeyetribe .clientsdk ;
1010
11- import com .theeyetribe .clientsdk .GazeApiManager .IGazeApiConnectionListener ;
12- import com .theeyetribe .clientsdk .GazeApiManager .IGazeApiResponseListener ;
1311import com .theeyetribe .clientsdk .data .CalibrationResult ;
1412import com .theeyetribe .clientsdk .data .CalibrationResult .CalibrationPoint ;
1513import com .theeyetribe .clientsdk .data .GazeData ;
1816import com .theeyetribe .clientsdk .response .Response ;
1917import com .theeyetribe .clientsdk .response .ResponseFailed ;
2018import com .theeyetribe .clientsdk .response .TrackerGetResponse ;
19+ import com .theeyetribe .clientsdk .GazeApiManager .IGazeApiResponseListener ;
20+ import com .theeyetribe .clientsdk .GazeApiManager .IGazeApiConnectionListener ;
2121
2222import java .util .ArrayList ;
2323import 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 );
0 commit comments