예제 #1
0
    public EyeXGazePointDataStream(EyeXHost host, EyeXGazePointType gazePointType)
    {
        _eyeXHost = host;
        _gazePointType = gazePointType;

        // create a global interactor for the data stream and register it with the EyeXHost.
        var interactor = new EyeXGlobalInteractor(InteractorId, AssignGazePointDataBehavior, HandleEvent);
        _eyeXHost.RegisterGlobalInteractor(interactor);
    }
예제 #2
0
 /// <summary>
 /// Stops streaming gaze point data of a given type.
 /// </summary>
 /// <param name="gazePointType">Gaze point type.</param>
 public void StopStreaming(EyeXGazePointType gazePointType)
 {
     EyeXGazePointDataStream dataStream;
     if (_gazePointDataStreams.TryGetValue(gazePointType, out dataStream))
     {
         if (dataStream.UsageCount > 1)
         {
             dataStream.UsageCount--;
         }
         else
         {
             _gazePointDataStreams.Remove(gazePointType);
             dataStream.Dispose();
         }
     }
 }
예제 #3
0
 /// <summary>
 /// Gets the most recent value from a data stream.
 /// </summary>
 /// <param name="gazePointType">Gaze point type.</param>
 /// <returns>The value.</returns>
 public EyeXGazePoint GetLastGazePoint(EyeXGazePointType gazePointType)
 {
     EyeXGazePointDataStream dataStream;
     if (_gazePointDataStreams.TryGetValue(gazePointType, out dataStream))
     {
         return dataStream.Last;
     }
     else
     {
         return EyeXGazePoint.Invalid;
     }
 }
예제 #4
0
 /// <summary>
 /// Starts streaming gaze point data of a given type.
 /// </summary>
 /// <param name="gazePointType">Gaze point type.</param>
 public void StartStreaming(EyeXGazePointType gazePointType)
 {
     EyeXGazePointDataStream dataStream;
     if (_gazePointDataStreams.TryGetValue(gazePointType, out dataStream))
     {
         // already streaming this kind of data.
         dataStream.UsageCount++;
     }
     else
     {
         dataStream = new EyeXGazePointDataStream(EyeXHost.GetInstance(), gazePointType);
         _gazePointDataStreams.Add(gazePointType, dataStream);
     }
 }
예제 #5
0
 /// <summary>
 /// Gets the number of fixations since the stream started
 /// </summary>
 /// <param name="gazePointType">Gaze point type.</param>
 /// <returns>The value.</returns>
 public int GetLastFixationCount(EyeXGazePointType gazePointType)
 {
     EyeXGazePointDataStream dataStream;
     if (_gazePointDataStreams.TryGetValue(gazePointType, out dataStream))
     {
         return dataStream.FixationCount;
     }
     else
     {
         return -1;
     }
 }