csapi-sensor: check feature value if sensor is supported or not
authorkibak.yoon <kibak.yoon@samsung.com>
Tue, 18 Oct 2016 17:39:27 +0000 (02:39 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Wed, 19 Oct 2016 01:38:10 +0000 (10:38 +0900)
- it checks the feature value which is in model-config

Change-Id: I41158fee8cfb3dc46a9a57b96551d5ba032520e4
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
31 files changed:
Tizen.System.Sensor/Tizen.System.Sensor.Net45.project.json [changed mode: 0644->0755]
Tizen.System.Sensor/Tizen.System.Sensor.project.json
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/Accelerometer.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/FaceDownGestureDetector.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/GravitySensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/Gyroscope.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/GyroscopeRotationVectorSensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/HeartRateMonitor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/HumiditySensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/InVehicleActivityDetector.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/LightSensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/LinearAccelerationSensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/Magnetometer.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/MagnetometerRotationVectorSensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/OrientationSensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/Pedometer.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/PickUpGestureDetector.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/PressureSensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/ProximitySensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/RotationVectorSensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/RunningActivityDetector.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/SleepMonitor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/StationaryActivityDetector.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/TemperatureSensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/UltravioletSensor.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/UncalibratedGyroscope.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/UncalibratedMagnetometer.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/WalkingActivityDetector.cs
Tizen.System.Sensor/Tizen.System.Sensor/Plugins/WristUpGestureDetector.cs
Tizen.System.Sensor/Tizen.System.Sensor/Sensor.cs
packaging/csapi-system-sensor.spec

old mode 100644 (file)
new mode 100755 (executable)
index ab1a0ee..503a8ff
@@ -1,6 +1,7 @@
 {
   "dependencies": {
-    "Tizen": "1.0.1"
+    "Tizen": "1.0.1",
+    "Tizen.System": "1.0.2"
   },
   "frameworks": {
     "net45": {}
@@ -8,4 +9,4 @@
   "runtimes": {
     "win": {}
   }
-}
+}
\ No newline at end of file
index db7436c..5abf875 100644 (file)
@@ -1,7 +1,8 @@
 {
   "dependencies": {
     "NETStandard.Library": "1.6.0",
-    "Tizen": "1.0.1"
+    "Tizen": "1.0.1",
+    "Tizen.System": "1.0.2"
   },
   "frameworks": {
     "netstandard1.3": {}
index f583f1e..cdc01bc 100644 (file)
@@ -15,6 +15,7 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class Accelerometer : Sensor
     {
+        private static string AccelerometerKey = "http://tizen.org/feature/sensor.accelerometer";
         /// <summary>
         /// Gets the X component of the acceleration.
         /// </summary>
@@ -38,7 +39,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the Accelerometer sensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.Accelerometer, AccelerometerKey);
             }
         }
 
@@ -76,18 +77,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<AccelerometerDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.Accelerometer, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if accelerometer sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 88ed660..2433b43 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// </summary>
     public class FaceDownGestureDetector : Sensor
     {
+        private static string GestureDetectorKey = "http://tizen.org/feature/sensor.gesture_recognition";
+
         /// <summary>
         /// Gets the state of the face down gesture.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the face down gesture detector is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.FaceDownGestureDetector, GestureDetectorKey);
             }
         }
 
@@ -60,18 +62,6 @@ namespace Tizen.System.Sensor
             return SensorType.FaceDownGestureDetector;
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.FaceDownGestureDetector, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if face down gesture detector is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index def7954..1ce4212 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class GravitySensor : Sensor
     {
+        private const string GravitySensorKey = "http://tizen.org/feature/sensor.gravity";
+
         private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
         /// <summary>
         /// Gets the X component of the gravity.
@@ -39,7 +41,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the GravitySensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.GravitySensor, GravitySensorKey);
             }
         }
 
@@ -100,18 +102,6 @@ namespace Tizen.System.Sensor
             }
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.GravitySensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if gravity sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 44dab8b..4766d4c 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class Gyroscope : Sensor
     {
+        private const string GyroscopeKey = "http://tizen.org/feature/sensor.gyroscope";
+
         /// <summary>
         /// Gets the X component of the acceleration.
         /// </summary>
@@ -38,7 +40,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the Gyroscope sensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.Gyroscope, GyroscopeKey);
             }
         }
 
@@ -76,18 +78,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<GyroscopeDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.Gyroscope, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if gyroscope sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index cc0a106..4e73e3e 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class GyroscopeRotationVectorSensor : Sensor
     {
+        private const string GyroscopeRVKey = "http://tizen.org/feature/sensor.gyroscope_rotation_vector";
+
         /// <summary>
         /// Gets the X component of the gyroscope rotation vector.
         /// </summary>
@@ -48,7 +50,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the GyroscopeRotationVectorSensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.GyroscopeRotationVectorSensor, GyroscopeRVKey);
             }
         }
 
@@ -86,18 +88,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<GyroscopeRotationVectorSensorDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.GyroscopeRotationVectorSensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if gyroscope rotation vector sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 3cb37b1..c9da6ce 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class HeartRateMonitor : Sensor
     {
+        private const string HRMKey = "http://tizen.org/feature/sensor.heart_rate_monitor";
+
         /// <summary>
         /// Gets the value of the heart rate monitor.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the HeartRateMonitor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.HeartRateMonitor, HRMKey);
             }
         }
 
@@ -66,18 +68,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<HeartRateMonitorDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.HeartRateMonitor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if heart rate monitor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index cb0dced..27cd506 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class HumiditySensor : Sensor
     {
+        private const string HumiditySensorKey = "http://tizen.org/feature/sensor.humidity";
+
         /// <summary>
         /// Gets the value of the humidity sensor.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the HumiditySensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.HumiditySensor, HumiditySensorKey);
             }
         }
 
@@ -66,18 +68,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<HumiditySensorDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.HumiditySensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if humidity sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 0f1f63e..7fec0e7 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// </summary>
     public class InVehicleActivityDetector : ActivityDetector
     {
+        private const string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
+
         /// <summary>
         /// Gets the state of in-vehicle activity detector
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the in-vehicle activity detector is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.InVehicleActivityDetector, ActivityDetectorKey);
             }
         }
 
@@ -56,18 +58,6 @@ namespace Tizen.System.Sensor
             Log.Info(Globals.LogTag, "Creating in-vehicle activity detector object");
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.InVehicleActivityDetector, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if in-vehicle activity detector is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index edc401c..43eee56 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class LightSensor : Sensor
     {
+        private const string LightSensorKey = "http://tizen.org/feature/sensor.photometer";
+
         /// <summary>
         /// Gets the Level of the light.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the LightSensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.LightSensor, LightSensorKey);
             }
         }
 
@@ -66,18 +68,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<LightSensorDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.LightSensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if light sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 6ca09e4..484181a 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class LinearAccelerationSensor : Sensor
     {
+        private const string LinearAccelerationSensorKey = "http://tizen.org/feature/sensor.linear_acceleration";
+
         private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
         /// <summary>
         /// Gets the X component of the linear acceleration.
@@ -39,7 +41,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the LinearAccelerationSensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.LinearAccelerationSensor, LinearAccelerationSensorKey);
             }
         }
 
@@ -100,18 +102,6 @@ namespace Tizen.System.Sensor
             }
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.LinearAccelerationSensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if linear acceleration sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 33e7eea..06967e9 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class Magnetometer : Sensor
     {
+        private static string MagnetometerKey = "http://tizen.org/feature/sensor.magnetometer";
+
         private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
         /// <summary>
         /// Gets the X component of the magnetometer.
@@ -39,7 +41,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the Magnetometer is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.Magnetometer, MagnetometerKey);
             }
         }
 
@@ -100,18 +102,6 @@ namespace Tizen.System.Sensor
             }
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.Magnetometer, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if magnetometer is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 0987d7f..aeff39f 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class MagnetometerRotationVectorSensor : Sensor
     {
+        private static string MagnetometerRVKey = "http://tizen.org/feature/sensor.geomagnetic_rotation_vector";
+
         private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
         /// <summary>
         /// Gets the X component of the magnetometer rotation vector.
@@ -49,7 +51,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the MagnetometerRotationVectorSensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.MagnetometerRotationVectorSensor, MagnetometerRVKey);
             }
         }
 
index 682db09..4586b13 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class OrientationSensor : Sensor
     {
+        private static string OrientationSensorKey = "http://tizen.org/feature/sensor.tiltmeter";
+
         private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
         /// <summary>
         /// Gets the Azimuth component of the orientation.
@@ -39,7 +41,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the OrientationSensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.OrientationSensor, OrientationSensorKey);
             }
         }
 
@@ -100,18 +102,6 @@ namespace Tizen.System.Sensor
             }
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.OrientationSensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if orientation sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index d399f2c..5e9f611 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class Pedometer : Sensor
     {
+        private static string PedometerKey = "http://tizen.org/feature/sensor.pedometer";
+
         /// <summary>
         /// Gets the step count
         /// </summary>
@@ -63,7 +65,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the Pedometer sensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.Pedometer, PedometerKey);
             }
         }
 
@@ -101,18 +103,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<PedometerDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.Pedometer, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if pedometer sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 48ba166..254cfed 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// </summary>
     public class PickUpGestureDetector : Sensor
     {
+        private static string GestureDetectorKey = "http://tizen.org/feature/sensor.gesture_recognition";
+
         /// <summary>
         /// Gets the state of the pick up gesture.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the pick up gesture detector is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.PickUpGestureDetector, GestureDetectorKey);
             }
         }
 
index aa24f71..557cd8f 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class PressureSensor : Sensor
     {
+        private static string PressureSensorKey = "http://tizen.org/feature/sensor.barometer";
+
         /// <summary>
         /// Gets the value of the pressure sensor.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the PressureSensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.PressureSensor, PressureSensorKey);
             }
         }
 
@@ -66,17 +68,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<PressureSensorDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.PressureSensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if pressure sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
 
         private static int GetCount()
         {
index 55b0a28..58a8943 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class ProximitySensor : Sensor
     {
+        private static string ProximitySensorKey = "http://tizen.org/feature/sensor.proximity";
+
         /// <summary>
         /// Gets the proximity state.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the ProximitySensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.ProximitySensor, ProximitySensorKey);
             }
         }
 
@@ -66,18 +68,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<ProximitySensorDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.ProximitySensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if proximity sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 55505ee..10e6899 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class RotationVectorSensor : Sensor
     {
+        private static string RotationVectorKey = "http://tizen.org/feature/sensor.rotation_vector";
+
         private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
         /// <summary>
         /// Gets the X component of the rotation vector.
@@ -49,7 +51,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the RotationVectorSensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.RotationVectorSensor, RotationVectorKey);
             }
         }
 
@@ -110,18 +112,6 @@ namespace Tizen.System.Sensor
             }
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.RotationVectorSensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if rotation vector sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 25b5e17..a799ace 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// </summary>
     public class RunningActivityDetector : ActivityDetector
     {
+        private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
+
         /// <summary>
         /// Gets the state of running activity detector
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the running activity detector is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.RunningActivityDetector, ActivityDetectorKey);
             }
         }
 
@@ -56,18 +58,6 @@ namespace Tizen.System.Sensor
             Log.Info(Globals.LogTag, "Creating running activity detector object");
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.RunningActivityDetector, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if running activity detector is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index cdb2d5c..9d6ea16 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class SleepMonitor : Sensor
     {
+        private static string SleepMonitorKey = "http://tizen.org/feature/sensor.sleep_monitor";
+
         /// <summary>
         /// Gets the value of the sleep state.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the SleepMonitor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.SleepMonitor, SleepMonitorKey);
             }
         }
 
@@ -66,17 +68,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<SleepMonitorDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.SleepMonitor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if sleep monitor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
 
         private static int GetCount()
         {
index cfa41be..ecfff67 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// </summary>
     public class StationaryActivityDetector : ActivityDetector
     {
+        private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
+
         /// <summary>
         /// Gets the state of stationary activity detector
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the stationary activity detector is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.StationaryActivityDetector, ActivityDetectorKey);
             }
         }
 
@@ -56,18 +58,6 @@ namespace Tizen.System.Sensor
             Log.Info(Globals.LogTag, "Creating stationary activity detector object");
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.StationaryActivityDetector, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if stationary activity detector is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 3be658c..6f3df1b 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class TemperatureSensor : Sensor
     {
+        private static string TemperatureSensorKey = "http://tizen.org/feature/sensor.temperature";
+
         /// <summary>
         /// Gets the value of the temperature sensor.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the TemperatureSensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.TemperatureSensor, TemperatureSensorKey);
             }
         }
 
@@ -66,17 +68,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<TemperatureSensorDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.TemperatureSensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if temperature sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
 
         private static int GetCount()
         {
index 40d21cd..03c9d0a 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class UltravioletSensor : Sensor
     {
+        private static string UltravioletSensorKey = "http://tizen.org/feature/sensor.ultraviolet";
+
         /// <summary>
         /// Gets the value of the ultraviolet sensor.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the UltravioletSensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.UltravioletSensor, UltravioletSensorKey);
             }
         }
 
@@ -66,17 +68,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<UltravioletSensorDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.UltravioletSensor, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if ultraviolet sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
 
         private static int GetCount()
         {
index 8a092c1..c712d83 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class UncalibratedGyroscope : Sensor
     {
+        private static string UncalibratedGyroscopeKey = "http://tizen.org/feature/sensor.gyroscope.uncalibrated";
+
         /// <summary>
         /// Gets the X component of the acceleration.
         /// </summary>
@@ -53,7 +55,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the UncalibratedGyroscope sensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.UncalibratedGyroscope, UncalibratedGyroscopeKey);
             }
         }
 
@@ -91,18 +93,6 @@ namespace Tizen.System.Sensor
 
         public event EventHandler<UncalibratedGyroscopeDataUpdatedEventArgs> DataUpdated;
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.UncalibratedGyroscope, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if uncalibrated gyroscope sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index fb3eb6f..24b080f 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// /// </summary>
     public class UncalibratedMagnetometer : Sensor
     {
+        private static string UncalibratedMagnetometerKey = "http://tizen.org/feature/sensor.magnetometer.uncalibrated";
+
         private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
         /// <summary>
         /// Gets the X component of the acceleration.
@@ -54,7 +56,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the UncalibratedMagnetometer sensor is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.UncalibratedMagnetometer, UncalibratedMagnetometerKey);
             }
         }
 
@@ -115,18 +117,6 @@ namespace Tizen.System.Sensor
             }
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.UncalibratedMagnetometer, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if uncalibrated magnetometer sensor is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 0560ec8..f4ff0a9 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// </summary>
     public class WalkingActivityDetector : ActivityDetector
     {
+        private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
+
         /// <summary>
         /// Gets the state of walking activity detector
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the walking activity detector is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.WalkingActivityDetector, ActivityDetectorKey);
             }
         }
 
@@ -56,18 +58,6 @@ namespace Tizen.System.Sensor
             Log.Info(Globals.LogTag, "Creating walking activity gesture detector object");
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.WalkingActivityDetector, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if walking activity detector is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 2df1a8d..8825709 100644 (file)
@@ -15,6 +15,8 @@ namespace Tizen.System.Sensor
     /// </summary>
     public class WristUpGestureDetector : Sensor
     {
+        private static string WristUpKey = "http://tizen.org/feature/sensor.wrist_up";
+
         /// <summary>
         /// Gets the state of the wrist up gesture.
         /// </summary>
@@ -28,7 +30,7 @@ namespace Tizen.System.Sensor
             get
             {
                 Log.Info(Globals.LogTag, "Checking if the wrist up gesture detector is supported");
-                return CheckIfSupported();
+                return CheckIfSupported(SensorType.WristUpGestureDetector, WristUpKey);
             }
         }
 
@@ -60,18 +62,6 @@ namespace Tizen.System.Sensor
             return SensorType.WristUpGestureDetector;
         }
 
-        private static bool CheckIfSupported()
-        {
-            bool isSupported;
-            int error = Interop.SensorManager.SensorIsSupported(SensorType.WristUpGestureDetector, out isSupported);
-            if (error != (int)SensorError.None)
-            {
-                Log.Error(Globals.LogTag, "Error checking if wrist up gesture detector is supported");
-                isSupported = false;
-            }
-            return isSupported;
-        }
-
         private static int GetCount()
         {
             IntPtr list;
index 3ff750e..b43bdb0 100644 (file)
@@ -7,7 +7,7 @@
 // you entered into with Samsung.
 
 using System;
-
+using Tizen.System;
 
 namespace Tizen.System.Sensor
 {
@@ -249,6 +249,27 @@ namespace Tizen.System.Sensor
             }
         }
 
+        internal static bool CheckIfSupported(SensorType type, String key)
+        {
+            bool isSupported = false;
+            bool error = SystemInfo.TryGetValue(key, out isSupported);
+
+            if (!error || !isSupported)
+            {
+                Log.Error(Globals.LogTag, "Error checking if sensor is supported(systeminfo)");
+                return false;
+            }
+
+            int ret = Interop.SensorManager.SensorIsSupported(type, out isSupported);
+            if (ret != (int)SensorError.None)
+            {
+                Log.Error(Globals.LogTag, "Error checking if sensor is supported");
+                isSupported = false;
+            }
+
+            return isSupported;
+        }
+
         /// <summary>
         /// Starts the sensor.
         /// After this the event handlers will start receiving events.
index 0ca8547..09c18d6 100644 (file)
@@ -25,6 +25,7 @@ BuildRequires: dotnet-build-tools
 
 # C# API Requries
 BuildRequires: csapi-tizen-nuget
+BuildRequires: csapi-system-nuget
 
 %description
 Tizen Sensor API for C#