protected void OnDataAvailable(SensorData data) { if (!this.IsRunning) return; lock (this) { if (this.DataAvailable != null) this.DataAvailable(data); } }
private void OnSensorData(Sensor sensor, SensorData data) { if (this.SensorDataReceived != null) this.SensorDataReceived(sensor, data); }
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(); } }