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 db7436ca655390e41fdac03b99494c5ea36f4bce..5abf8758cd3d71df3d82f77801e8f219b19a48cd 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 f583f1eca5b63a49790403c21fa48bfcb36cf1fd..cdc01bcc7553299f0ffe2868453c518eaac4f484 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 88ed660d14fbe994be9b9ad8aba660b5b460e538..2433b432449cc067ba21174c854eea10fafe12ae 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 def7954f145c2487e1b80c038cf12663f617cf71..1ce4212f1986560ce99d329f14b64f13e7d4559e 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 44dab8bc94ac70908a77855c10c2aab084c7ac16..4766d4c227c69db82a112c3ea7772448c21b8188 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 cc0a1064e618b9c574ebc40a1b88fb57191f292a..4e73e3e781c0110c567399d4c4c8834b7ad73d21 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 3cb37b1b554ff63b850c8d798b1ed87e58bd3322..c9da6cecd24e3a2b908cac08c611a0d606cc2f5f 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 cb0dcedf7c9dbcdb4e375674d52ab2ea72c41c31..27cd50691d1dce1020f304bb5a2afd264e9d0401 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 0f1f63e0381a5a73963f1e8b75e0c8666978dcdd..7fec0e74dc31189689836db7c4da03519211988c 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 edc401c2f22dddd39b2847af4c58e7eac43e6a2c..43eee560933fc7f8c37b64e1ee27f050a36ab1b9 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 6ca09e4048b1faed3314aae3a2144cde6354ccbc..484181a57d4e375f7ba4335f639ee7f214a1c78c 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 33e7eea90a710d58eb5668b8123f1c57c6ecdbde..06967e9c3a7cf8db98aa9b7619ad93f50183ef51 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 0987d7f67ea62a54463e80259c5e9b162d055b7c..aeff39f5e2f47cececa5c5451628d311f6c994a1 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 682db099dc6c4af8109bb48b4992bc703aa1ce0a..4586b131f8abd9b62a3ddc5ba6cc41126fa51505 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 d399f2c0f51992218cd15e6b8a4afe8f9752fcde..5e9f611f41707d0198f87700f9a601f2dc037f57 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 48ba166efd9ecdb51967dc0a05d5c4323ede81c4..254cfedafbbc495854b8696534ff319d1eef83a3 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 aa24f7162491b41dbe4467f0d1f6e721093fb792..557cd8f30054a4ecb92eb841b1820a196ca7904b 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 55b0a28025079314a6d7f8d2542c24ac51c2f23d..58a8943d7424494c431df6090a91146503d5d2a6 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 55505eead0434ed137df25ddd138184dbedbc5d1..10e68995ca58b0c56e8d54291419e6ecc9cdd9e0 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 25b5e17bebf3d6bb4dd9fb586641261074ef2a06..a799acec9a255d7b50f4e05a609945abd04013e3 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 cdb2d5c8815383d408fb8655b5793283aa22b666..9d6ea16a3421f68a2d51096d85d9a502cd5b8be1 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 cfa41bed00aa5820bf7461dcd9195ae47045e3b2..ecfff67a45d4fd327a5f997a61c1d4830abcc8af 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 3be658c522759c896c85c808bd24cf4c690d69ae..6f3df1bc90f14182305f304390398f406d7815f4 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 40d21cde0a0b2ea225e92b06ece1c04a2864ad50..03c9d0ad80537ec4f12057d6e63f247aadbc5c78 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 8a092c1b0c4833c8a085b20fcb38db90d0317b79..c712d83a77a0aaf6ac79d1e139fa12720abc5dbb 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 fb3eb6f0d7c5afefc3601da64c68117efa586501..24b080ff89232f62ac08ef84a0b682b9a646b3d0 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 0560ec8771019436e86dbd89990d9be43f13d3fe..f4ff0a941e89196dc64e12ea9c47745342d15043 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 2df1a8dc4d5d0d9691df69775ffea92b2d4fa72d..8825709dff4c9634bdaf516e2c4704b4baaccb36 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 3ff750ec3b2b87ae8f1247ae1f54f9387448214b..b43bdb01cc94f36ed5b3950606a1fd00b40dc582 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 0ca8547a328e581a1f5794f16b49db6e1a7c60c4..09c18d6dceba9ad7e65452f8faf7ee7a68d4e813 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#