This repository was archived by the owner on May 15, 2024. It is now read-only.
GH-582 & GH-575: Updated the sensors to adhere to guidelines#610
Merged
mattleibow merged 1 commit intodev/api-fixfrom Nov 5, 2018
Merged
GH-582 & GH-575: Updated the sensors to adhere to guidelines#610mattleibow merged 1 commit intodev/api-fixfrom
mattleibow merged 1 commit intodev/api-fixfrom
Conversation
- enum names - compas low pass filter is now a param - updated docs - public constructors on data and events - stating an already started sensor will throw - sensor use the same units on all platforms Added a unit conversion API. #575
This comment has been minimized.
This comment has been minimized.
mattleibow
commented
Nov 5, 2018
| var d = await tcs.Task; | ||
|
|
||
| Assert.True(d.Pressure >= 0); | ||
| Assert.True(d.PressureInHectopascals >= 0); |
mattleibow
commented
Nov 5, 2018
| "User Interface" | ||
| }; | ||
| public string[] Speeds { get; } = | ||
| Enum.GetNames(typeof(SensorSpeed)); |
Member
Author
There was a problem hiding this comment.
Using the fancy Enum.GetNames
mattleibow
commented
Nov 5, 2018
| [InlineData(1000, 17.4533)] | ||
| [InlineData(57295.7795, 1000)] | ||
| [InlineData(0, 0)] | ||
| public void DegreesPerSecondToRadiansPerSecond(double degrees, double radians) |
mattleibow
commented
Nov 5, 2018
|
|
||
| if (IsMonitoring) | ||
| return; | ||
| throw new InvalidOperationException("Accelerometer has already been started."); |
Member
Author
There was a problem hiding this comment.
Throw when the sensor is started.
mattleibow
commented
Nov 5, 2018
| public class AccelerometerChangedEventArgs : EventArgs | ||
| { | ||
| internal AccelerometerChangedEventArgs(AccelerometerData reading) => Reading = reading; | ||
| public AccelerometerChangedEventArgs(AccelerometerData reading) => Reading = reading; |
mattleibow
commented
Nov 5, 2018
| public readonly struct AccelerometerData : IEquatable<AccelerometerData> | ||
| { | ||
| internal AccelerometerData(double x, double y, double z) | ||
| public AccelerometerData(double x, double y, double z) |
mattleibow
commented
Nov 5, 2018
| return UnitConverters.CoordinatesToMiles(latitudeStart, longitudeStart, latitudeEnd, longitudeEnd); | ||
| default: | ||
| throw new ArgumentOutOfRangeException(nameof(units)); | ||
| } |
Member
Author
There was a problem hiding this comment.
Moved the conversion logic into the unit conversions API so we can be cool!
mattleibow
commented
Nov 5, 2018
| Default = 0, | ||
| UI = 1, | ||
| Game = 2, | ||
| Fastest = 3, |
Member
Author
There was a problem hiding this comment.
Re ordered enums and renamed values
mattleibow
commented
Nov 5, 2018
| const double milesToKilometers = 1.609344; | ||
| const double milesToMeters = 1609.344; | ||
| const double kilometersToMiles = 1.0 / milesToKilometers; | ||
| const double celsiusToKelvin = 273.15; |
Member
Author
There was a problem hiding this comment.
constants, baby, constants!
jamesmontemagno
approved these changes
Nov 5, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated the sensors to adhere to guidelines:
Added a unit conversion API