Exemplo n.º 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);
    }
Exemplo n.º 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();
         }
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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;
     }
 }