diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index c3d3c65bfef44061f12d28369b9e8b34a4b3bae7..696c80a97723fcd934a340a5a4982530876952bb 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -20,19 +20,6 @@ import { AsyncCallback, Callback } from "./basic"; * @since 8 * @syscap SystemCapability.Sensors.Sensor * @import import sensor from '@ohos.sensor' - * @permission ohos.permission.ACCELEROMETER, ohos.permission.GYROSCOPE, - * ohos.permission.ACTIVITY_MOTION, ohos.permission.HEALTH_DATA - * @deprecated since 9 (permission type error) - */ - -/** - * This module provides the capability to subscribe to sensor data. - * - * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@ohos.sensor' - * @permission ohos.permission.ACCELEROMETER or ohos.permission.GYROSCOPE or - * ohos.permission.ACTIVITY_MOTION or ohos.permission.READ_HEALTH_DATA - * @since 9 */ declare namespace sensor { /** @@ -136,17 +123,21 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEALTH_DATA * @since 8 - * @deprecated since 9 (permission type error) + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE */ + function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback, + options?: Options): void; + /** - * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. - * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. + * Subscribe to heart rate sensor data. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE}. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.READ_HEALTH_DATA * @since 9 */ - function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback, + function on(type: SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE, callback: Callback, options?: Options): void; /** @@ -166,10 +157,23 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELEROMETER * @since 8 + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER */ function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback, options?: Options): void; + /** + * Subscribe to linear accelerometer data. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER}. + * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. + * @syscap SystemCapability.Sensors.Sensor + * @permission ohos.permission.ACCELEROMETER + * @since 9 + */ + function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback: Callback, + options?: Options): void; + /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. @@ -344,16 +348,19 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEART_RATE * @since 8 - * @deprecated since 9 (permission type error) + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE */ + function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback): void; + /** - * Subscribe to sensor data once. - * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. + * Subscribe to heart rate sensor data once. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE}. * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.READ_HEALTH_DATA * @since 9 */ - function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback): void; + function once(type: SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE, callback: Callback): void; /** * Subscribe to sensor data once. @@ -369,16 +376,19 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELERATION * @since 8 - * @deprecated since 9 (permission type error) + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER */ + function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback): void; + /** * Subscribe to sensor data once. - * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER}. * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELEROMETER * @since 9 */ - function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback): void; + function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback: Callback): void; /** * Subscribe to sensor data once. @@ -537,17 +547,20 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEALTH_DATA * @since 8 - * @deprecated since 9 (permission type error) + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE */ + function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback): void; + /** * Subscribe to sensor data, If the API is called multiple times, the last call takes effect. - * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}. + * @param type Indicate the sensor type to listen for, {@code SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE}. * @param options Optional parameters specifying the interval at which sensor data is reported, {@code Options}. * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.READ_HEALTH_DATA * @since 9 */ - function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback): void; + function off(type: SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE, callback?: Callback): void; /** * Unsubscribe to sensor data. @@ -563,9 +576,20 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELEROMETER * @since 8 + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER */ function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback): void; + /** + * Unsubscribe to sensor data. + * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER}. + * @syscap SystemCapability.Sensors.Sensor + * @permission ohos.permission.ACCELEROMETER + * @since 9 + */ + function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback?: Callback): void; + /** * Unsubscribe to sensor data. * @param type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}. @@ -843,7 +867,7 @@ declare namespace sensor { } /** - * The type of sensor. + * The type of number. * @syscap SystemCapability.Sensors.Sensor * @since 8 */ @@ -858,7 +882,19 @@ declare namespace sensor { SENSOR_TYPE_ID_HUMIDITY = 13, /**< Humidity sensor */ SENSOR_TYPE_ID_ORIENTATION = 256, /**< Orientation sensor */ SENSOR_TYPE_ID_GRAVITY = 257, /**< Gravity sensor */ + /** + * The type of number. + * @syscap SystemCapability.Sensors.Sensor + * @deprecated since 9 + * @useinstead SENSOR_TYPE_ID_LINEAR_ACCELEROMETER + */ SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */ + /** + * The type of number. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ + SENSOR_TYPE_ID_LINEAR_ACCELEROMETER = 258, /**< Linear acceleration sensor */ SENSOR_TYPE_ID_ROTATION_VECTOR = 259, /**< Rotation vector sensor */ SENSOR_TYPE_ID_AMBIENT_TEMPERATURE = 260, /**< Ambient temperature sensor */ SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< Uncalibrated magnetic field sensor */ @@ -866,9 +902,21 @@ declare namespace sensor { SENSOR_TYPE_ID_SIGNIFICANT_MOTION = 264, /**< Significant motion sensor */ SENSOR_TYPE_ID_PEDOMETER_DETECTION = 265, /**< Pedometer detection sensor */ SENSOR_TYPE_ID_PEDOMETER = 266, /**< Pedometer sensor */ + /** + * The type of number. + * @syscap SystemCapability.Sensors.Sensor + * @deprecated since 9 + * @useinstead SENSOR_TYPE_ID_HEART_BEAT_RATE + */ SENSOR_TYPE_ID_HEART_RATE = 278, /**< Heart rate sensor */ + /** + * The type of number. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ + SENSOR_TYPE_ID_HEART_BEAT_RATE = 278, /**< Heart rate sensor */ SENSOR_TYPE_ID_WEAR_DETECTION = 280, /**< Wear detection sensor */ - SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ + SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281 /**< Uncalibrated acceleration sensor */ } /**