Skip to content

Commit

Permalink
SmartEyeTracker is properly closed when refreshing trackers list
Browse files Browse the repository at this point in the history
  • Loading branch information
fisherdog1 committed May 16, 2022
1 parent 780eb5d commit 6927691
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions itrace_core/SmartEyeTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ public SmartEyeTracker()
TrackerInit();
}

//Disconnect any connections, performed before refreshing the tracker list
public void CleanupConnections()
{
if (LatentClient.Connected)
LatentClient.Close();

if (RpcClient.Connected)
RpcClient.Close();

RealtimeClient.Close();
}

//Retrieve the World Model and calibration error vectors. Returns true on success
private Boolean GetWorldCalibration()
{
Expand Down
8 changes: 8 additions & 0 deletions itrace_core/TrackerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ public TrackerManager()

public void FindTrackers()
{
//Ensure all trackers are cleaned up (Namely SmartEye must be fully disconnected)
foreach (ITracker tracker in EyeTrackers)
{
//Consider making this common to ITracker
if (tracker is SmartEyeTracker)
((SmartEyeTracker)tracker).CleanupConnections();
}

EyeTrackers.Clear();
EyeTrackers.Add(new MouseTracker());
FindTobiiDevices();
Expand Down

0 comments on commit 6927691

Please sign in to comment.