From 62e3e81381017a6e545850f110f91cc003b3ffa9 Mon Sep 17 00:00:00 2001 From: Pawel Wasowski Date: Wed, 6 Sep 2017 12:58:45 +0200 Subject: [PATCH] [Sensor] Add acceleration sensor Change-Id: Iffa46781e77a51091ba0d4346391f26d09f69281 Signed-off-by: Pawel Wasowski --- .../html/web/sensors/device_sensors_w.htm | 4 + .../html/web/details/app_filtering_w.htm | 10 + .../html/device_api/mobile/tizen/sensor.html | 330 +++++++++++++++++---- .../html/device_api/wearable/tizen/sensor.html | 330 +++++++++++++++++---- 4 files changed, 556 insertions(+), 118 deletions(-) diff --git a/org.tizen.guides/html/web/sensors/device_sensors_w.htm b/org.tizen.guides/html/web/sensors/device_sensors_w.htm index b8951cb..3d3da41 100644 --- a/org.tizen.guides/html/web/sensors/device_sensors_w.htm +++ b/org.tizen.guides/html/web/sensors/device_sensors_w.htm @@ -239,6 +239,10 @@ proximitySensor.getSensorHardwareInfo(onsuccessCB, onerrorCB); Sensor Capability + + Acceleration sensor + http://tizen.org/feature/sensor.accelerometer + Gravity sensor http://tizen.org/feature/sensor.gravity diff --git a/org.tizen.training/html/web/details/app_filtering_w.htm b/org.tizen.training/html/web/details/app_filtering_w.htm index c4ea74f..d869c8f 100644 --- a/org.tizen.training/html/web/details/app_filtering_w.htm +++ b/org.tizen.training/html/web/details/app_filtering_w.htm @@ -379,6 +379,11 @@ 2.2.1 +http://tizen.org/feature/sensor.accelerometer + Specify this key, if the application requires an acceleration sensor. + 4.0 + + http://tizen.org/feature/sensor.barometer Specify this key, if the application requires a barometer sensor for using the Sensor (Pressure Type) API. 2.2.1 @@ -657,6 +662,11 @@ 2.2.1 +http://tizen.org/feature/sensor.accelerometer + Specify this key, if the application requires an acceleration sensor. + 4.0 + + http://tizen.org/feature/sensor.barometer Specify this key, if the application requires a barometer sensor. 2.2.1 diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html index dc46e10..cb526fd 100755 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/sensor.html @@ -53,61 +53,65 @@ For more information about how to use Sensor API, see Sensor -
  • 2.4. GravitySensor +
  • 2.4. AccelerationSensor
  • -
  • 2.5. GyroscopeSensor +
  • 2.5. GravitySensor
  • -
  • 2.6. GyroscopeRotationVectorSensor +
  • 2.6. GyroscopeSensor
  • -
  • 2.7. GyroscopeUncalibratedSensor +
  • 2.7. GyroscopeRotationVectorSensor
  • -
  • 2.8. HRMRawSensor +
  • 2.8. GyroscopeUncalibratedSensor
  • -
  • 2.9. LightSensor +
  • 2.9. HRMRawSensor
  • -
  • 2.10. LinearAccelerationSensor +
  • 2.10. LightSensor
  • -
  • 2.11. MagneticSensor +
  • 2.11. LinearAccelerationSensor
  • -
  • 2.12. MagneticUncalibratedSensor +
  • 2.12. MagneticSensor
  • -
  • 2.13. PressureSensor +
  • 2.13. MagneticUncalibratedSensor
  • -
  • 2.14. ProximitySensor +
  • 2.14. PressureSensor
  • -
  • 2.15. UltravioletSensor +
  • 2.15. ProximitySensor
  • -
  • 2.16. SensorData +
  • 2.16. UltravioletSensor
  • -
  • 2.17. SensorGravityData +
  • 2.17. SensorData
  • -
  • 2.18. SensorGyroscopeData +
  • 2.18. SensorAccelerationData
  • -
  • 2.19. SensorGyroscopeRotationVectorData +
  • 2.19. SensorGravityData
  • -
  • 2.20. SensorGyroscopeUncalibratedData +
  • 2.20. SensorGyroscopeData
  • -
  • 2.21. SensorHRMRawData +
  • 2.21. SensorGyroscopeRotationVectorData
  • -
  • 2.22. SensorLightData +
  • 2.22. SensorGyroscopeUncalibratedData
  • -
  • 2.23. SensorLinearAccelerationData +
  • 2.23. SensorHRMRawData
  • -
  • 2.24. SensorMagneticData +
  • 2.24. SensorLightData
  • -
  • 2.25. SensorMagneticUncalibratedData +
  • 2.25. SensorLinearAccelerationData
  • -
  • 2.26. SensorPressureData +
  • 2.26. SensorMagneticData
  • -
  • 2.27. SensorProximityData +
  • 2.27. SensorMagneticUncalibratedData
  • -
  • 2.28. SensorUltravioletData +
  • 2.28. SensorPressureData
  • -
  • 2.29. SensorHardwareInfo +
  • 2.29. SensorProximityData
  • -
  • 2.30. SensorDataSuccessCallback +
  • 2.30. SensorUltravioletData
  • -
  • 2.31. SensorHardwareInfoSuccessCallback +
  • 2.31. SensorHardwareInfo +
  • +
  • 2.32. SensorDataSuccessCallback +
  • +
  • 2.33. SensorHardwareInfoSuccessCallback
  • @@ -148,6 +152,10 @@ For more information about how to use Sensor API, see AccelerationSensor +
    void getAccelerationSensorData (SensorDataSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    + + GravitySensor
    void getGravitySensorData (SensorDataSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    @@ -200,6 +208,10 @@ For more information about how to use Sensor API, see SensorAccelerationData + + + SensorGravityData @@ -290,7 +302,7 @@ For more information about how to use Sensor API, see Specifies the sensor type available to the API. -
        enum SensorType { "GRAVITY", "GYROSCOPE", "GYROSCOPE_ROTATION_VECTOR", "GYROSCOPE_UNCALIBRATED", "HRM_RAW", "LIGHT", "LINEAR_ACCELERATION", "MAGNETIC",
    +
        enum SensorType { "ACCELERATION", "GRAVITY", "GYROSCOPE", "GYROSCOPE_ROTATION_VECTOR", "GYROSCOPE_UNCALIBRATED", "HRM_RAW", "LIGHT", "LINEAR_ACCELERATION", "MAGNETIC",
                           "MAGNETIC_UNCALIBRATED", "PRESSURE", "PROXIMITY", "ULTRAVIOLET" };

    Since: @@ -302,6 +314,8 @@ The sensor types defined by this enumerator are:

    • +ACCELERATION - Acceleration sensor
    • +
    • GRAVITY - Gravity sensor
    • GYROSCOPE - Gyroscope sensor
    • @@ -334,7 +348,7 @@ ULTRAVIOLET - Ultraviolet sensor GRAVITY, GYROSCOPE, GYROSCOPE_ROTATION_VECTOR and LINEAR ACCELERATION are supported since Tizen 3.0

      Remark : - GYROSCOPE_UNCALIBRATED and MAGNETIC_UNCALIBRATED are supported since Tizen 4.0 + ACCELERATION, GYROSCOPE_UNCALIBRATED and MAGNETIC_UNCALIBRATED are supported since Tizen 4.0

      @@ -393,6 +407,8 @@ The supported sensor types are hardware-dependent.

      To check if the given

      • + ACCELERATION - tizen.systeminfo.getCapability("http://tizen.org/feature/sensor.accelerometer")
      • +
      • GRAVITY - tizen.systeminfo.getCapability("http://tizen.org/feature/sensor.gravity")
      • GYROSCOPE - tizen.systeminfo.getCapability("http://tizen.org/feature/sensor.gyroscope")
      • @@ -836,8 +852,110 @@ function onsuccessCB(hardwareInfo) +
        +

        2.4. AccelerationSensor

        +
        + The AccelerationSensor interface provides methods to access accelerometer data. +
        +
            [NoInterfaceObject] interface AccelerationSensor : Sensor {
        +
        +        void getAccelerationSensorData(SensorDataSuccessCallback successCallback,
        +                                optional ErrorCallback? errorCallback) raises(WebAPIException);
        +    };
        +

        + Since: + 4.0 +

        + +
        +

        Methods

        +
        +
        +getAccelerationSensorData +
        +
        +
        + Gets the current acceleration sensor data. You can refer to SensorAccelerationData interface. +
        +
        void getAccelerationSensorData(SensorDataSuccessCallback successCallback, optional ErrorCallback? errorCallback);
        +             
        +

        + Since: + 4.0 +

        +
        +

        +Note that before calling the getAccelerationSensorData() method, the start() method should be called to turn the sensor on. +

        +

        +The ErrorCallback method is launched with these error types: +

        +
          +
        • + ServiceNotAvailableError : If the getAccelerationSensorData() method is called without first calling the start() method
        • +
        • + AbortError : If the system operation was aborted
        • +
        +
        +
        +

        Parameters:

        +
          +
        • +successCallback: + Callback method to be invoked when the sensor data has been read +
        • +
        • +errorCallback [optional] [nullable]: + Callback method to be invoked when an error occurs +
        • +
        +
        +
        +

        Exceptions:

        +
        • WebAPIException
          • + with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter. +

          +
        +
        +
        +

        Code example:

         var accelerationSensor = tizen.sensorservice.getDefaultSensor("ACCELERATION");
        +
        + function onGetSuccessCB(sensorData)
        + {
        +     console.log("######## Get acceleration sensor data ########");
        +     console.log("x: " + sensorData.x);
        +     console.log("y: " + sensorData.y);
        +     console.log("z: " + sensorData.z);
        + }
        +
        + function onerrorCB(error)
        + {
        +     console.log("error occurred: " + error.message);
        + }
        +
        + function onsuccessCB()
        + {
        +     console.log("acceleration sensor start");
        +     accelerationSensor.getAccelerationSensorData(onGetSuccessCB, onerrorCB);
        + }
        +
        + accelerationSensor.start(onsuccessCB);
        + 
        +
        +
        +

        Output example:

         acceleration sensor start
        + ######## Get acceleration sensor data ########
        + x: -4.311866283416748
        + y: 8.6243314743042
        + z: 2.841476917266846
        + 
        +
        +
        +
        +
        +
        -

        2.4. GravitySensor

        +

        2.5. GravitySensor

        The GravitySensor interface provides methods to access gravity sensor data.
        @@ -940,7 +1058,7 @@ var lightSensor = tizen.sensorservice.getDefaultSensor("LIGHT");
        -

        2.5. GyroscopeSensor

        +

        2.6. GyroscopeSensor

        The GyroscopeSensor interface provides methods to access gyroscope sensor data.
        @@ -1042,7 +1160,7 @@ function onerrorCB(error)
        -

        2.6. GyroscopeRotationVectorSensor

        +

        2.7. GyroscopeRotationVectorSensor

        The GyroscopeRotationVectorSensor interface provides methods to access gyroscope rotation vector sensor data.
        @@ -1146,7 +1264,7 @@ function onerrorCB(error)
        -

        2.7. GyroscopeUncalibratedSensor

        +

        2.8. GyroscopeUncalibratedSensor

        The GyroscopeUncalibratedSensor interface provides methods to access uncalibrated gyroscope sensor data.
        @@ -1243,7 +1361,7 @@ function onerrorCB(error)
        -

        2.8. HRMRawSensor

        +

        2.9. HRMRawSensor

        The HRMRawSensor interface provides methods to access HRM sensor raw data.
        @@ -1351,7 +1469,7 @@ function onerrorCB(error)
        -

        2.9. LightSensor

        +

        2.10. LightSensor

        The LightSensor interface provides methods to access light sensor data.
        @@ -1443,7 +1561,7 @@ function onerrorCB(error)
        -

        2.10. LinearAccelerationSensor

        +

        2.11. LinearAccelerationSensor

        The LinearAccelerationSensor interface provides methods to access linear acceleration sensor data.
        @@ -1545,7 +1663,7 @@ function onerrorCB(error)
        -

        2.11. MagneticSensor

        +

        2.12. MagneticSensor

        The MagneticSensor interface provides methods to access magnetic sensor data.
        @@ -1639,7 +1757,7 @@ function onerrorCB(error)
        -

        2.12. MagneticUncalibratedSensor

        +

        2.13. MagneticUncalibratedSensor

        The MagneticUncalibratedSensor interface provides methods to access uncalibrated magnetic sensor data.
        @@ -1735,7 +1853,7 @@ function onerrorCB(error)
        -

        2.13. PressureSensor

        +

        2.14. PressureSensor

        The PressureSensor interface provides methods to access pressure sensor data.
        @@ -1827,7 +1945,7 @@ function onerrorCB(error)
        -

        2.14. ProximitySensor

        +

        2.15. ProximitySensor

        The ProximitySensor interface provides methods to access proximity sensor data.
        @@ -1919,7 +2037,7 @@ The ErrorCallback method is launched with these error types:
        -

        2.15. UltravioletSensor

        +

        2.16. UltravioletSensor

        The UltravioletSensor interface provides methods to access ultraviolet sensor data.
        @@ -2011,7 +2129,7 @@ The ErrorCallback method is launched with these error types:
        -

        2.16. SensorData

        +

        2.17. SensorData

        The SensorData interface is a common abstract interface used by different types of sensor data objects.
        @@ -2022,8 +2140,70 @@ The ErrorCallback method is launched with these error types: 2.3

        +
        +

        2.18. SensorAccelerationData

        +
        + The SensorAccelerationData interface represents acceleration sensor data. You can refer to this guide to learn more about acceleration sensor data. +
        +
            [NoInterfaceObject] interface SensorAccelerationData : SensorData {
        +
        +        readonly attribute double x;
        +
        +        readonly attribute double y;
        +
        +        readonly attribute double z;
        +    };
        +

        + Since: + 4.0 +

        +
        +

        +The acceleration sensor data represents the sum of acceleration of the device and an acceleration component representing forces opposing the gravity. +

        +
        +

        Remark : + An example of how to access and use this interface can be found in the getAccelerationSensorData() code example. +

        + +
        +

        Attributes

        +
          +
        • + readonly +double x
          + The result of acceleration sensor measurement in the device's X axis in m/s².
          The value can be between -19.6 and 19.6 inclusive. +
          +

          + Since: + 4.0 +

          +
        • +
        • + readonly +double y
          + The result of acceleration sensor measurement in the device's Y axis in m/s².
          The value can be between -19.6 and 19.6 inclusive. +
          +

          + Since: + 4.0 +

          +
        • +
        • + readonly +double z
          + The result of acceleration sensor measurement in the device's Z axis in m/s².
          The value can be between -19.6 and 19.6 inclusive. +
          +

          + Since: + 4.0 +

          +
        • +
        +
        +
        -

        2.17. SensorGravityData

        +

        2.19. SensorGravityData

        The SensorGravityData interface represents gravity sensor data. You can refer to this guide to learn more about gravity sensor data.
        @@ -2079,7 +2259,7 @@ The ErrorCallback method is launched with these error types:
        -

        2.18. SensorGyroscopeData

        +

        2.20. SensorGyroscopeData

        The SensorGyroscopeData interface represents gyroscope sensor data. You can refer to this guide to learn more about gyroscope sensor data.
        @@ -2135,7 +2315,7 @@ The ErrorCallback method is launched with these error types:
        -

        2.19. SensorGyroscopeRotationVectorData

        +

        2.21. SensorGyroscopeRotationVectorData

        The SensorGyroscopeRotationVectorData interface represents gyroscope rotation vector sensor data. You can refer to this guide to learn more about gyroscope sensor data.
        @@ -2209,7 +2389,7 @@ It is equal to the components of a unit quaternion (cos(θ/2), x * sin(θ/2), y
        -

        2.20. SensorGyroscopeUncalibratedData

        +

        2.22. SensorGyroscopeUncalibratedData

        The SensorGyroscopeUncalibratedData interface represents uncalibrated gyroscope sensor data.
        @@ -2306,7 +2486,7 @@ Stated drift values are attached to the data, but the drift compensation of meas
        -

        2.21. SensorHRMRawData

        +

        2.23. SensorHRMRawData

        The SensorHRMRawData interface represents HRM sensor raw data.
        @@ -2361,7 +2541,7 @@ LED_GREEN - The green light spectrum
        -

        2.22. SensorLightData

        +

        2.24. SensorLightData

        The SensorLightData interface represents light sensor data.
        @@ -2388,7 +2568,7 @@ LED_GREEN - The green light spectrum
        -

        2.23. SensorLinearAccelerationData

        +

        2.25. SensorLinearAccelerationData

        The SensorLinearAccelerationData interface represents linear acceleration sensor data.
        @@ -2441,7 +2621,7 @@ LED_GREEN - The green light spectrum
        -

        2.24. SensorMagneticData

        +

        2.26. SensorMagneticData

        The SensorMagneticData interface represents magnetic sensor data.
        @@ -2511,7 +2691,7 @@ For increasing the accuracy, wave the device around in the air in figure-eight p
        -

        2.25. SensorMagneticUncalibratedData

        +

        2.27. SensorMagneticUncalibratedData

        The SensorMagneticUncalibratedData interface represents uncalibrated magnetic sensor data.
        @@ -2610,7 +2790,7 @@ Factory calibration and temperature compensation are applied to the measurement
        -

        2.26. SensorPressureData

        +

        2.28. SensorPressureData

        The SensorPressureData interface represents pressure sensor data.
        @@ -2637,7 +2817,7 @@ Factory calibration and temperature compensation are applied to the measurement
        -

        2.27. SensorProximityData

        +

        2.29. SensorProximityData

        The SensorProximityData interface represents proximity sensor data.
        @@ -2664,7 +2844,7 @@ Factory calibration and temperature compensation are applied to the measurement
        -

        2.28. SensorUltravioletData

        +

        2.30. SensorUltravioletData

        The SensorUltravioletData interface represents ultraviolet sensor data.
        @@ -2696,7 +2876,7 @@ The ultraviolet index is an international standard measurement of the strength o
        -

        2.29. SensorHardwareInfo

        +

        2.31. SensorHardwareInfo

        The SensorHardwareInfo interface represents information about the sensor requested by the getSensorHardwareInfo method
        @@ -2764,6 +2944,8 @@ The ultraviolet index is an international standard measurement of the strength o

        Since: @@ -2898,7 +3087,7 @@ ULTRAVIOLET - UV index (ultraviolet index)

        -

        2.30. SensorDataSuccessCallback

        +

        2.32. SensorDataSuccessCallback

        The SensorDataSuccessCallback interface is a callback interface that is invoked periodically. For example, see the Sensor interface.
        @@ -2939,7 +3128,7 @@ ULTRAVIOLET - UV index (ultraviolet index)
        -

        2.31. SensorHardwareInfoSuccessCallback

        +

        2.33. SensorHardwareInfoSuccessCallback

        The SensorHardwareInfoSuccessCallback callback interface specifies a success callback with SensorHardwareInfo object as an input argument.
        @@ -2986,6 +3175,14 @@ ULTRAVIOLET - UV index (ultraviolet index)

        +To guarantee that the acceleration sensor application runs on a device with an acceleration sensor, declare the following feature requirements in the config file: +

        +

        +
      • http://tizen.org/feature/sensor.accelerometer
      • +
        +
        +

        +

        To guarantee that the gravity sensor application runs on a device with a gravity sensor, declare the following feature requirements in the config file:

        @@ -3089,7 +3286,7 @@ To guarantee that the UV sensor application runs on a device with a UV sensor, d enum ProximityState { "FAR", "NEAR" }; - enum SensorType { "GRAVITY", "GYROSCOPE", "GYROSCOPE_ROTATION_VECTOR", "GYROSCOPE_UNCALIBRATED", "HRM_RAW", "LIGHT", "LINEAR_ACCELERATION", "MAGNETIC", + enum SensorType { "ACCELERATION", "GRAVITY", "GYROSCOPE", "GYROSCOPE_ROTATION_VECTOR", "GYROSCOPE_UNCALIBRATED", "HRM_RAW", "LIGHT", "LINEAR_ACCELERATION", "MAGNETIC", "MAGNETIC_UNCALIBRATED", "PRESSURE", "PROXIMITY", "ULTRAVIOLET" }; [NoInterfaceObject] interface SensorServiceManagerObject { @@ -3121,6 +3318,12 @@ To guarantee that the UV sensor application runs on a device with a UV sensor, d void getSensorHardwareInfo(SensorHardwareInfoSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); }; + [NoInterfaceObject] interface AccelerationSensor : Sensor { + + void getAccelerationSensorData(SensorDataSuccessCallback successCallback, + optional ErrorCallback? errorCallback) raises(WebAPIException); + }; + [NoInterfaceObject] interface GravitySensor : Sensor { void getGravitySensorData(SensorDataSuccessCallback successCallback, @@ -3196,6 +3399,15 @@ To guarantee that the UV sensor application runs on a device with a UV sensor, d [NoInterfaceObject] interface SensorData { }; + [NoInterfaceObject] interface SensorAccelerationData : SensorData { + + readonly attribute double x; + + readonly attribute double y; + + readonly attribute double z; + }; + [NoInterfaceObject] interface SensorGravityData : SensorData { readonly attribute double x; diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html index a96d32c..d05431a 100755 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/sensor.html @@ -53,61 +53,65 @@ For more information about how to use Sensor API, see Sensor -
      • 2.4. GravitySensor +
      • 2.4. AccelerationSensor
      • -
      • 2.5. GyroscopeSensor +
      • 2.5. GravitySensor
      • -
      • 2.6. GyroscopeRotationVectorSensor +
      • 2.6. GyroscopeSensor
      • -
      • 2.7. GyroscopeUncalibratedSensor +
      • 2.7. GyroscopeRotationVectorSensor
      • -
      • 2.8. HRMRawSensor +
      • 2.8. GyroscopeUncalibratedSensor
      • -
      • 2.9. LightSensor +
      • 2.9. HRMRawSensor
      • -
      • 2.10. LinearAccelerationSensor +
      • 2.10. LightSensor
      • -
      • 2.11. MagneticSensor +
      • 2.11. LinearAccelerationSensor
      • -
      • 2.12. MagneticUncalibratedSensor +
      • 2.12. MagneticSensor
      • -
      • 2.13. PressureSensor +
      • 2.13. MagneticUncalibratedSensor
      • -
      • 2.14. ProximitySensor +
      • 2.14. PressureSensor
      • -
      • 2.15. UltravioletSensor +
      • 2.15. ProximitySensor
      • -
      • 2.16. SensorData +
      • 2.16. UltravioletSensor
      • -
      • 2.17. SensorGravityData +
      • 2.17. SensorData
      • -
      • 2.18. SensorGyroscopeData +
      • 2.18. SensorAccelerationData
      • -
      • 2.19. SensorGyroscopeRotationVectorData +
      • 2.19. SensorGravityData
      • -
      • 2.20. SensorGyroscopeUncalibratedData +
      • 2.20. SensorGyroscopeData
      • -
      • 2.21. SensorHRMRawData +
      • 2.21. SensorGyroscopeRotationVectorData
      • -
      • 2.22. SensorLightData +
      • 2.22. SensorGyroscopeUncalibratedData
      • -
      • 2.23. SensorLinearAccelerationData +
      • 2.23. SensorHRMRawData
      • -
      • 2.24. SensorMagneticData +
      • 2.24. SensorLightData
      • -
      • 2.25. SensorMagneticUncalibratedData +
      • 2.25. SensorLinearAccelerationData
      • -
      • 2.26. SensorPressureData +
      • 2.26. SensorMagneticData
      • -
      • 2.27. SensorProximityData +
      • 2.27. SensorMagneticUncalibratedData
      • -
      • 2.28. SensorUltravioletData +
      • 2.28. SensorPressureData
      • -
      • 2.29. SensorHardwareInfo +
      • 2.29. SensorProximityData
      • -
      • 2.30. SensorDataSuccessCallback +
      • 2.30. SensorUltravioletData
      • -
      • 2.31. SensorHardwareInfoSuccessCallback +
      • 2.31. SensorHardwareInfo +
      • +
      • 2.32. SensorDataSuccessCallback +
      • +
      • 2.33. SensorHardwareInfoSuccessCallback
      @@ -148,6 +152,10 @@ For more information about how to use Sensor API, see AccelerationSensor +
      void getAccelerationSensorData (SensorDataSuccessCallback successCallback, optional ErrorCallback? errorCallback)
      + + GravitySensor
      void getGravitySensorData (SensorDataSuccessCallback successCallback, optional ErrorCallback? errorCallback)
      @@ -200,6 +208,10 @@ For more information about how to use Sensor API, see SensorAccelerationData + + + SensorGravityData @@ -290,7 +302,7 @@ For more information about how to use Sensor API, see Specifies the sensor type available to the API. -
          enum SensorType { "GRAVITY", "GYROSCOPE", "GYROSCOPE_ROTATION_VECTOR", "GYROSCOPE_UNCALIBRATED", "HRM_RAW", "LIGHT", "LINEAR_ACCELERATION", "MAGNETIC",
      +
          enum SensorType { "ACCELERATION", "GRAVITY", "GYROSCOPE", "GYROSCOPE_ROTATION_VECTOR", "GYROSCOPE_UNCALIBRATED", "HRM_RAW", "LIGHT", "LINEAR_ACCELERATION", "MAGNETIC",
                             "MAGNETIC_UNCALIBRATED", "PRESSURE", "PROXIMITY", "ULTRAVIOLET" };

      Since: @@ -302,6 +314,8 @@ The sensor types defined by this enumerator are:

      • +ACCELERATION - Acceleration sensor
      • +
      • GRAVITY - Gravity sensor
      • GYROSCOPE - Gyroscope sensor
      • @@ -334,7 +348,7 @@ ULTRAVIOLET - Ultraviolet sensor GRAVITY, GYROSCOPE, GYROSCOPE_ROTATION_VECTOR and LINEAR ACCELERATION are supported since Tizen 3.0

        Remark : - GYROSCOPE_UNCALIBRATED and MAGNETIC_UNCALIBRATED are supported since Tizen 4.0 + ACCELERATION, GYROSCOPE_UNCALIBRATED and MAGNETIC_UNCALIBRATED are supported since Tizen 4.0

        @@ -393,6 +407,8 @@ The supported sensor types are hardware-dependent.

        To check if the given

        • + ACCELERATION - tizen.systeminfo.getCapability("http://tizen.org/feature/sensor.accelerometer")
        • +
        • GRAVITY - tizen.systeminfo.getCapability("http://tizen.org/feature/sensor.gravity")
        • GYROSCOPE - tizen.systeminfo.getCapability("http://tizen.org/feature/sensor.gyroscope")
        • @@ -838,8 +854,110 @@ function onsuccessCB(hardwareInfo) +
          +

          2.4. AccelerationSensor

          +
          + The AccelerationSensor interface provides methods to access accelerometer data. +
          +
              [NoInterfaceObject] interface AccelerationSensor : Sensor {
          +
          +        void getAccelerationSensorData(SensorDataSuccessCallback successCallback,
          +                                optional ErrorCallback? errorCallback) raises(WebAPIException);
          +    };
          +

          + Since: + 4.0 +

          + +
          +

          Methods

          +
          +
          +getAccelerationSensorData +
          +
          +
          + Gets the current acceleration sensor data. You can refer to SensorAccelerationData interface. +
          +
          void getAccelerationSensorData(SensorDataSuccessCallback successCallback, optional ErrorCallback? errorCallback);
          +             
          +

          + Since: + 4.0 +

          +
          +

          +Note that before calling the getAccelerationSensorData() method, the start() method should be called to turn the sensor on. +

          +

          +The ErrorCallback method is launched with these error types: +

          +
            +
          • + ServiceNotAvailableError : If the getAccelerationSensorData() method is called without first calling the start() method
          • +
          • + AbortError : If the system operation was aborted
          • +
          +
          +
          +

          Parameters:

          +
            +
          • +successCallback: + Callback method to be invoked when the sensor data has been read +
          • +
          • +errorCallback [optional] [nullable]: + Callback method to be invoked when an error occurs +
          • +
          +
          +
          +

          Exceptions:

          +
          • WebAPIException
            • + with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter. +

            +
          +
          +
          +

          Code example:

           var accelerationSensor = tizen.sensorservice.getDefaultSensor("ACCELERATION");
          +
          + function onGetSuccessCB(sensorData)
          + {
          +     console.log("######## Get acceleration sensor data ########");
          +     console.log("x: " + sensorData.x);
          +     console.log("y: " + sensorData.y);
          +     console.log("z: " + sensorData.z);
          + }
          +
          + function onerrorCB(error)
          + {
          +     console.log("error occurred: " + error.message);
          + }
          +
          + function onsuccessCB()
          + {
          +     console.log("acceleration sensor start");
          +     accelerationSensor.getAccelerationSensorData(onGetSuccessCB, onerrorCB);
          + }
          +
          + accelerationSensor.start(onsuccessCB);
          + 
          +
          +
          +

          Output example:

           acceleration sensor start
          + ######## Get acceleration sensor data ########
          + x: -4.311866283416748
          + y: 8.6243314743042
          + z: 2.841476917266846
          + 
          +
          +
          +
          +
          +
          -

          2.4. GravitySensor

          +

          2.5. GravitySensor

          The GravitySensor interface provides methods to access gravity sensor data.
          @@ -942,7 +1060,7 @@ function onerrorCB(error)
          -

          2.5. GyroscopeSensor

          +

          2.6. GyroscopeSensor

          The GyroscopeSensor interface provides methods to access gyroscope sensor data.
          @@ -1044,7 +1162,7 @@ function onerrorCB(error)
          -

          2.6. GyroscopeRotationVectorSensor

          +

          2.7. GyroscopeRotationVectorSensor

          The GyroscopeRotationVectorSensor interface provides methods to access gyroscope rotation vector sensor data.
          @@ -1148,7 +1266,7 @@ function onerrorCB(error)
          -

          2.7. GyroscopeUncalibratedSensor

          +

          2.8. GyroscopeUncalibratedSensor

          The GyroscopeUncalibratedSensor interface provides methods to access uncalibrated gyroscope sensor data.
          @@ -1245,7 +1363,7 @@ function onerrorCB(error)
          -

          2.8. HRMRawSensor

          +

          2.9. HRMRawSensor

          The HRMRawSensor interface provides methods to access HRM sensor raw data.
          @@ -1352,7 +1470,7 @@ function onerrorCB(error)
          -

          2.9. LightSensor

          +

          2.10. LightSensor

          The LightSensor interface provides methods to access light sensor data.
          @@ -1444,7 +1562,7 @@ function onerrorCB(error)
          -

          2.10. LinearAccelerationSensor

          +

          2.11. LinearAccelerationSensor

          The LinearAccelerationSensor interface provides methods to access linear acceleration sensor data.
          @@ -1546,7 +1664,7 @@ function onerrorCB(error)
          -

          2.11. MagneticSensor

          +

          2.12. MagneticSensor

          The MagneticSensor interface provides methods to access magnetic sensor data.
          @@ -1640,7 +1758,7 @@ function onerrorCB(error)
          -

          2.12. MagneticUncalibratedSensor

          +

          2.13. MagneticUncalibratedSensor

          The MagneticUncalibratedSensor interface provides methods to access uncalibrated magnetic sensor data.
          @@ -1736,7 +1854,7 @@ function onerrorCB(error)
          -

          2.13. PressureSensor

          +

          2.14. PressureSensor

          The PressureSensor interface provides methods to access pressure sensor data.
          @@ -1828,7 +1946,7 @@ function onerrorCB(error)
          -

          2.14. ProximitySensor

          +

          2.15. ProximitySensor

          The ProximitySensor interface provides methods to access proximity sensor data.
          @@ -1920,7 +2038,7 @@ The ErrorCallback method is launched with these error types:
          -

          2.15. UltravioletSensor

          +

          2.16. UltravioletSensor

          The UltravioletSensor interface provides methods to access ultraviolet sensor data.
          @@ -2012,7 +2130,7 @@ The ErrorCallback method is launched with these error types:
          -

          2.16. SensorData

          +

          2.17. SensorData

          The SensorData interface is a common abstract interface used by different types of sensor data objects.
          @@ -2023,8 +2141,70 @@ The ErrorCallback method is launched with these error types: 2.3

          +
          +

          2.18. SensorAccelerationData

          +
          + The SensorAccelerationData interface represents acceleration sensor data. You can refer to this guide to learn more about acceleration sensor data. +
          +
              [NoInterfaceObject] interface SensorAccelerationData : SensorData {
          +
          +        readonly attribute double x;
          +
          +        readonly attribute double y;
          +
          +        readonly attribute double z;
          +    };
          +

          + Since: + 4.0 +

          +
          +

          +The acceleration sensor data represents the sum of acceleration of the device and an acceleration component representing forces opposing the gravity. +

          +
          +

          Remark : + An example of how to access and use this interface can be found in the getAccelerationSensorData() code example. +

          + +
          +

          Attributes

          +
            +
          • + readonly +double x
            + The result of acceleration sensor measurement in the device's X axis in m/s².
            The value can be between -19.6 and 19.6 inclusive. +
            +

            + Since: + 4.0 +

            +
          • +
          • + readonly +double y
            + The result of acceleration sensor measurement in the device's Y axis in m/s².
            The value can be between -19.6 and 19.6 inclusive. +
            +

            + Since: + 4.0 +

            +
          • +
          • + readonly +double z
            + The result of acceleration sensor measurement in the device's Z axis in m/s².
            The value can be between -19.6 and 19.6 inclusive. +
            +

            + Since: + 4.0 +

            +
          • +
          +
          +
          -

          2.17. SensorGravityData

          +

          2.19. SensorGravityData

          The SensorGravityData interface represents gravity sensor data. You can refer to this guide to learn more about gravity sensor data.
          @@ -2080,7 +2260,7 @@ The ErrorCallback method is launched with these error types:
          -

          2.18. SensorGyroscopeData

          +

          2.20. SensorGyroscopeData

          The SensorGyroscopeData interface represents gyroscope sensor data. You can refer to this guide to learn more about gyroscope sensor data.
          @@ -2136,7 +2316,7 @@ The ErrorCallback method is launched with these error types:
          -

          2.19. SensorGyroscopeRotationVectorData

          +

          2.21. SensorGyroscopeRotationVectorData

          The SensorGyroscopeRotationVectorData interface represents gyroscope rotation vector sensor data. You can refer to this guide to learn more about gyroscope sensor data.
          @@ -2210,7 +2390,7 @@ It is equal to the components of a unit quaternion (cos(θ/2), x * sin(θ/2), y
          -

          2.20. SensorGyroscopeUncalibratedData

          +

          2.22. SensorGyroscopeUncalibratedData

          The SensorGyroscopeUncalibratedData interface represents uncalibrated gyroscope sensor data.
          @@ -2307,7 +2487,7 @@ Stated drift values are attached to the data, but the drift compensation of meas
          -

          2.21. SensorHRMRawData

          +

          2.23. SensorHRMRawData

          The SensorHRMRawData interface represents HRM sensor raw data.
          @@ -2362,7 +2542,7 @@ LED_GREEN - The green light spectrum
          -

          2.22. SensorLightData

          +

          2.24. SensorLightData

          The SensorLightData interface represents light sensor data.
          @@ -2389,7 +2569,7 @@ LED_GREEN - The green light spectrum
          -

          2.23. SensorLinearAccelerationData

          +

          2.25. SensorLinearAccelerationData

          The SensorLinearAccelerationData interface represents linear acceleration sensor data.
          @@ -2442,7 +2622,7 @@ LED_GREEN - The green light spectrum
          -

          2.24. SensorMagneticData

          +

          2.26. SensorMagneticData

          The SensorMagneticData interface represents magnetic sensor data.
          @@ -2512,7 +2692,7 @@ For increasing the accuracy, wave the device around in the air in figure-eight p
          -

          2.25. SensorMagneticUncalibratedData

          +

          2.27. SensorMagneticUncalibratedData

          The SensorMagneticUncalibratedData interface represents uncalibrated magnetic sensor data.
          @@ -2611,7 +2791,7 @@ Factory calibration and temperature compensation are applied to the measurement
          -

          2.26. SensorPressureData

          +

          2.28. SensorPressureData

          The SensorPressureData interface represents pressure sensor data.
          @@ -2638,7 +2818,7 @@ Factory calibration and temperature compensation are applied to the measurement
          -

          2.27. SensorProximityData

          +

          2.29. SensorProximityData

          The SensorProximityData interface represents proximity sensor data.
          @@ -2665,7 +2845,7 @@ Factory calibration and temperature compensation are applied to the measurement
          -

          2.28. SensorUltravioletData

          +

          2.30. SensorUltravioletData

          The SensorUltravioletData interface represents ultraviolet sensor data.
          @@ -2697,7 +2877,7 @@ The ultraviolet index is an international standard measurement of the strength o
          -

          2.29. SensorHardwareInfo

          +

          2.31. SensorHardwareInfo

          The SensorHardwareInfo interface represents information about the sensor requested by the getSensorHardwareInfo method
          @@ -2765,6 +2945,8 @@ The ultraviolet index is an international standard measurement of the strength o

          Since: @@ -2899,7 +3088,7 @@ ULTRAVIOLET - UV index (ultraviolet index)

          -

          2.30. SensorDataSuccessCallback

          +

          2.32. SensorDataSuccessCallback

          The SensorDataSuccessCallback interface is a callback interface that is invoked periodically. For example, see the Sensor interface.
          @@ -2940,7 +3129,7 @@ ULTRAVIOLET - UV index (ultraviolet index)
          -

          2.31. SensorHardwareInfoSuccessCallback

          +

          2.33. SensorHardwareInfoSuccessCallback

          The SensorHardwareInfoSuccessCallback callback interface specifies a success callback with SensorHardwareInfo object as an input argument.
          @@ -2987,6 +3176,14 @@ ULTRAVIOLET - UV index (ultraviolet index)

          +To guarantee that the acceleration sensor application runs on a device with an acceleration sensor, declare the following feature requirements in the config file: +

          +

          +
        • http://tizen.org/feature/sensor.accelerometer
        • +
          +
          +

          +

          To guarantee that the gravity sensor application runs on a device with a gravity sensor, declare the following feature requirements in the config file:

          @@ -3090,7 +3287,7 @@ To guarantee that the UV sensor application runs on a device with a UV sensor, d enum ProximityState { "FAR", "NEAR" }; - enum SensorType { "GRAVITY", "GYROSCOPE", "GYROSCOPE_ROTATION_VECTOR", "GYROSCOPE_UNCALIBRATED", "HRM_RAW", "LIGHT", "LINEAR_ACCELERATION", "MAGNETIC", + enum SensorType { "ACCELERATION", "GRAVITY", "GYROSCOPE", "GYROSCOPE_ROTATION_VECTOR", "GYROSCOPE_UNCALIBRATED", "HRM_RAW", "LIGHT", "LINEAR_ACCELERATION", "MAGNETIC", "MAGNETIC_UNCALIBRATED", "PRESSURE", "PROXIMITY", "ULTRAVIOLET" }; [NoInterfaceObject] interface SensorServiceManagerObject { @@ -3122,6 +3319,12 @@ To guarantee that the UV sensor application runs on a device with a UV sensor, d void getSensorHardwareInfo(SensorHardwareInfoSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); }; + [NoInterfaceObject] interface AccelerationSensor : Sensor { + + void getAccelerationSensorData(SensorDataSuccessCallback successCallback, + optional ErrorCallback? errorCallback) raises(WebAPIException); + }; + [NoInterfaceObject] interface GravitySensor : Sensor { void getGravitySensorData(SensorDataSuccessCallback successCallback, @@ -3197,6 +3400,15 @@ To guarantee that the UV sensor application runs on a device with a UV sensor, d [NoInterfaceObject] interface SensorData { }; + [NoInterfaceObject] interface SensorAccelerationData : SensorData { + + readonly attribute double x; + + readonly attribute double y; + + readonly attribute double z; + }; + [NoInterfaceObject] interface SensorGravityData : SensorData { readonly attribute double x; -- 2.7.4