Пример #1
0
        protected void OnDataAvailable(SensorData data)
        {
            if (!this.IsRunning)
                return;

            lock (this)
            {
                if (this.DataAvailable != null)
                    this.DataAvailable(data);
            }
        }
Пример #2
0
 private void OnSensorData(Sensor sensor, SensorData data)
 {
     if (this.SensorDataReceived != null)
         this.SensorDataReceived(sensor, data);
 }
Пример #3
0
        private void WriteMessage(SensorData data)
        {
            if (data is Sensors.TobiiEyeTracker.EyeTrackerSensorData)
            {
                //if (stopwatch.ElapsedMilliseconds < 10) return;
                //stopwatch.Restart();
            }

            lock (writer)
            {
                VolkeMessageType messageType;

                if (data is MouseSensorData)
                    messageType = VolkeMessageType.MouseSensorData;
                else if (data is Sensors.TobiiEyeTracker.EyeTrackerSensorData)
                    messageType = VolkeMessageType.EyeSensorData;
                else
                    return;

                writer.Write(stopWatch.ElapsedMilliseconds);
                writer.Write((byte)messageType);
                data.Serialize(writer);
                writer.Flush();
            }
        }