From: MuHong Byun Date: Wed, 11 Dec 2019 05:02:41 +0000 (+0900) Subject: [Sensor] Fix invalid value matching between native and csharp API (#1173) X-Git-Tag: accepted/tizen/5.5/unified/20191211.073940~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98931ed3900150c947d00f4553b853011ee2ec5f;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Sensor] Fix invalid value matching between native and csharp API (#1173) * auto_rotation sensor Signed-off-by: MuHong Byun --- diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/AutoRotationSensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/AutoRotationSensorDataUpdatedEventArgs.cs index 28e7602..f666ba4 100644 --- a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/AutoRotationSensorDataUpdatedEventArgs.cs +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/AutoRotationSensorDataUpdatedEventArgs.cs @@ -34,14 +34,12 @@ namespace Tizen.Sensor /// /// Gets the value of the rotation state. /// - /// 3 /// The rotation state. public AutoRotationState Rotaion { get; private set; } = AutoRotationState.Degree_0; /// /// Gets the accuracy of the auto rotation data. /// - /// 3 /// Accuracy public SensorDataAccuracy Accuracy { get; private set; } } diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/AutoRotationSensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/AutoRotationSensor.cs index 5f2b978..1ea71e4 100644 --- a/src/Tizen.Sensor/Tizen.Sensor/Plugins/AutoRotationSensor.cs +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/AutoRotationSensor.cs @@ -32,7 +32,6 @@ namespace Tizen.Sensor /// /// Gets the value of the rotation state. /// - /// 3 /// The rotation state. public AutoRotationState Rotaion { get; private set; } = AutoRotationState.Degree_0; @@ -40,14 +39,12 @@ namespace Tizen.Sensor /// /// Gets the accuracy of the auto rotation data. /// - /// 3 /// Accuracy public SensorDataAccuracy Accuracy { get; private set; } = SensorDataAccuracy.Undefined; /// /// Returns true or false based on whether the auto rotation sensor is supported by the device. /// - /// 3 /// true if supported; otherwise false. public static bool IsSupported { @@ -61,7 +58,6 @@ namespace Tizen.Sensor /// /// Initializes a new instance of the class. /// - /// 3 /// http://tizen.org/feature/sensor.auto_rotation /// Thrown when an invalid argument is used. /// Thrown when the sensor is not supported. @@ -82,14 +78,12 @@ namespace Tizen.Sensor /// /// An event handler for storing the callback functions for the event corresponding to the change in the auto rotation sensor data. /// - /// 3 public event EventHandler DataUpdated; /// /// An event handler for accuracy changed events. /// - /// 3 public event EventHandler AccuracyChanged { add @@ -133,7 +127,11 @@ namespace Tizen.Sensor Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); TimeSpan = new TimeSpan((Int64)sensorData.timestamp); - Rotaion = (AutoRotationState)sensorData.values[0]; + if (sensorData.values[0] == 0) { + Rotaion = AutoRotationState.Degree_0; + } else { + Rotaion = (AutoRotationState)sensorData.values[0]; + } Accuracy = sensorData.accuracy; DataUpdated?.Invoke(this, new AutoRotationSensorDataUpdatedEventArgs(sensorData.values, sensorData.accuracy)); diff --git a/src/Tizen.Sensor/Tizen.Sensor/SensorEnumerations.cs b/src/Tizen.Sensor/Tizen.Sensor/SensorEnumerations.cs index 5001667..073d33f 100755 --- a/src/Tizen.Sensor/Tizen.Sensor/SensorEnumerations.cs +++ b/src/Tizen.Sensor/Tizen.Sensor/SensorEnumerations.cs @@ -328,32 +328,27 @@ namespace Tizen.Sensor /// /// The auto rotation state. /// - /// 3 [EditorBrowsable(EditorBrowsableState.Never)] public enum AutoRotationState { /// /// Degree_0 sate. /// - /// 3 - Degree_0 = 0, + Degree_0 = 1, /// /// Degree_90 state. /// - /// 3 - Degree_90 = 1, + Degree_90 = 2, /// /// Degree_180 state. /// - /// 3 - Degree_180 = 2, + Degree_180 = 3, /// /// Degree_270 state. /// - /// 3 - Degree_270 = 3 + Degree_270 = 4 } }