csapi-sensor: modified to not throw an exception if stop() is called twice
authorkibak.yoon <kibak.yoon@samsung.com>
Fri, 21 Oct 2016 06:52:11 +0000 (15:52 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Fri, 21 Oct 2016 10:28:18 +0000 (19:28 +0900)
- this exception isn't much meaning about double-stop scenario

Change-Id: I20125b5ead9431165026fb50f05a24d00f40d3cc
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/Tizen.Sensor/Tizen.Sensor/Sensor.cs

index 0c98272..9bec4f2 100644 (file)
@@ -303,7 +303,7 @@ namespace Tizen.Sensor
         public void Stop()
         {
             Log.Info(Globals.LogTag, "Stopping the sensor");
-            if (_isSensing)
+            if (CheckListenerHandle())
             {
                 int error = Interop.SensorListener.StopListener(_listenerHandle);
                 if (error != (int)SensorError.None)
@@ -315,11 +315,6 @@ namespace Tizen.Sensor
                 _isSensing = false;
                 Log.Info(Globals.LogTag, "Sensor stopped");
             }
-            else
-            {
-                Log.Error(Globals.LogTag, "Can't stop sensor as it is already stopped");
-                throw new InvalidOperationException("Operation Failed: Sensor is already stopped");
-            }
         }
 
         public void Dispose()