public void StartListening() { if (sensorManager != null && hingeSensor != null) { if (sensorListener == null) { sensorListener = new HingeSensorEventListener { SensorChangedHandler = se => { if (se.Sensor == hingeSensor) { OnSensorChanged?.Invoke(hingeSensor, new HingeSensorChangedEventArgs(se)); } } }; } sensorManager.RegisterListener(sensorListener, hingeSensor, SensorDelay.Normal); } }
public void StartListening() { if (_sensorManager != null && _hingeSensor != null) { if (_sensorListener == null) { _sensorListener = new HingeSensorEventListener { SensorChangedHandler = se => { if (se.Sensor == _hingeSensor) { _readingChanged?.Invoke(_hingeSensor, new NativeHingeAngleReading(se.Values[0], TimestampToDateTimeOffset(se.Timestamp))); } } }; } _sensorManager.RegisterListener(_sensorListener, _hingeSensor, SensorDelay.Normal); } }