chore: Make sensor retrieval ubiquitous
This commit is contained in:
Родитель
a9d3360aed
Коммит
9199193107
|
@ -1,6 +1,8 @@
|
|||
#if __ANDROID__ || __IOS__
|
||||
|
||||
using Uno.Extensions;
|
||||
using Uno.Helpers;
|
||||
using Uno.Logging;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace Windows.Devices.Sensors
|
||||
|
@ -56,6 +58,18 @@ namespace Windows.Devices.Sensors
|
|||
add => _readingChangedWrapper.AddHandler(value);
|
||||
remove => _readingChangedWrapper.RemoveHandler(value);
|
||||
}
|
||||
|
||||
|
||||
private void OnReadingChanged(BarometerReading reading)
|
||||
{
|
||||
if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
|
||||
{
|
||||
this.Log().Debug($"Barometer reading received " +
|
||||
$"StationPressureInHectopascals:{reading.StationPressureInHectopascals}, " +
|
||||
$"Timestamp:{reading.Timestamp}");
|
||||
}
|
||||
_readingChangedWrapper.Invoke(this, new GyrometerReadingChangedEventArgs(reading));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -92,6 +92,6 @@ namespace Windows.Devices.Sensors
|
|||
_hingeAngleSensor.ReadingChanged -= OnNativeReadingChanged;
|
||||
|
||||
private void OnNativeReadingChanged(object sender, NativeHingeAngleReading e) =>
|
||||
_readingChanged.Event?.Invoke(this, new HingeAngleSensorReadingChangedEventArgs(new HingeAngleReading(e.AngleInDegrees, e.Timestamp)));
|
||||
_readingChanged.Invoke(this, new HingeAngleSensorReadingChangedEventArgs(new HingeAngleReading(e.AngleInDegrees, e.Timestamp)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Windows.Devices.Sensors
|
|||
|
||||
private void OnReadingChanged(MagnetometerReading reading)
|
||||
{
|
||||
_readingChangedWrapper.Event?.Invoke(this, new MagnetometerReadingChangedEventArgs(reading));
|
||||
_readingChangedWrapper.Invoke(this, new MagnetometerReadingChangedEventArgs(reading));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace Windows.Devices.Sensors
|
|||
|
||||
private void OnReadingChanged(PedometerReading reading)
|
||||
{
|
||||
_readingChangedWrapper.Event?.Invoke(this, new PedometerReadingChangedEventArgs(reading));
|
||||
_readingChangedWrapper.Invoke(this, new PedometerReadingChangedEventArgs(reading));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче