[Sensor] Fix invalid value matching between native and csharp API (#1173)
authorMuHong Byun <mh.byun@samsung.com>
Wed, 11 Dec 2019 05:02:41 +0000 (14:02 +0900)
committerTizenAPI-Bot <37820187+TizenAPI-Bot@users.noreply.github.com>
Wed, 11 Dec 2019 05:02:41 +0000 (14:02 +0900)
* auto_rotation sensor

Signed-off-by: MuHong Byun <mh.byun@samsung.com>
src/Tizen.Sensor/Tizen.Sensor/EventArgs/AutoRotationSensorDataUpdatedEventArgs.cs
src/Tizen.Sensor/Tizen.Sensor/Plugins/AutoRotationSensor.cs
src/Tizen.Sensor/Tizen.Sensor/SensorEnumerations.cs

index 28e7602..f666ba4 100644 (file)
@@ -34,14 +34,12 @@ namespace Tizen.Sensor
         /// <summary>
         /// Gets the value of the rotation state.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <value> The rotation state. </value>
         public AutoRotationState Rotaion { get; private set; } = AutoRotationState.Degree_0;
 
         /// <summary>
         /// Gets the accuracy of the auto rotation data.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <value> Accuracy </value>
         public SensorDataAccuracy Accuracy { get; private set; }
     }
index 5f2b978..1ea71e4 100644 (file)
@@ -32,7 +32,6 @@ namespace Tizen.Sensor
         /// <summary>
         /// Gets the value of the rotation state.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <value> The rotation state. </value>
         public AutoRotationState Rotaion { get; private set; } = AutoRotationState.Degree_0;
 
@@ -40,14 +39,12 @@ namespace Tizen.Sensor
         /// <summary>
         /// Gets the accuracy of the auto rotation data.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <value> Accuracy </value>
         public SensorDataAccuracy Accuracy { get; private set; } = SensorDataAccuracy.Undefined;
 
         /// <summary>
         /// Returns true or false based on whether the auto rotation sensor is supported by the device.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <value><c>true</c> if supported; otherwise <c>false</c>.</value>
         public static bool IsSupported
         {
@@ -61,7 +58,6 @@ namespace Tizen.Sensor
         /// <summary>
         /// Initializes a new instance of the <see cref="Tizen.Sensor.AutoRotationSensor"/> class.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         /// <feature>http://tizen.org/feature/sensor.auto_rotation</feature>
         /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception>
         /// <exception cref="NotSupportedException">Thrown when the sensor is not supported.</exception>
@@ -82,14 +78,12 @@ namespace Tizen.Sensor
         /// <summary>
         /// An event handler for storing the callback functions for the event corresponding to the change in the auto rotation sensor data.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
 
         public event EventHandler<AutoRotationSensorDataUpdatedEventArgs> DataUpdated;
 
         /// <summary>
         /// An event handler for accuracy changed events.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
         public event EventHandler<SensorAccuracyChangedEventArgs> 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));
index 5001667..073d33f 100755 (executable)
@@ -328,32 +328,27 @@ namespace Tizen.Sensor
     /// <summary>
     /// The auto rotation state.
     /// </summary>
-    /// <since_tizen> 3 </since_tizen>
     [EditorBrowsable(EditorBrowsableState.Never)]
     public enum AutoRotationState
     {
         /// <summary>
         /// Degree_0 sate.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Degree_0 = 0,
+        Degree_0 = 1,
 
         /// <summary>
         /// Degree_90 state.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Degree_90 = 1,
+        Degree_90 = 2,
 
         /// <summary>
         /// Degree_180 state.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Degree_180 = 2,
+        Degree_180 = 3,
 
         /// <summary>
         /// Degree_270 state.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        Degree_270 = 3
+        Degree_270 = 4
     }
 }