From aed0c48eb717e56068570606975a12a1f092393a Mon Sep 17 00:00:00 2001 From: h00514358 Date: Thu, 21 Jul 2022 17:15:58 +0800 Subject: [PATCH 1/5] Modify sensor apiwq Signed-off-by: h00514358 --- api/@ohos.sensor.d.ts | 64 ++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index c3d3c65bfe..41f5360493 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,20 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEALTH_DATA * @since 8 - * @deprecated since 9 (permission type error) + * @deprecated since 9 */ + 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; /** @@ -344,16 +334,18 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEART_RATE * @since 8 - * @deprecated since 9 (permission type error) + * @deprecated since 9 */ + 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. + * @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 +361,18 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELERATION * @since 8 - * @deprecated since 9 (permission type error) + * @deprecated since 9 */ + 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 +531,19 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEALTH_DATA * @since 8 - * @deprecated since 9 (permission type error) + * @deprecated since 9 */ + 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. @@ -843,7 +839,7 @@ declare namespace sensor { } /** - * The type of sensor. + * The type of number. * @syscap SystemCapability.Sensors.Sensor * @since 8 */ @@ -869,6 +865,18 @@ declare namespace sensor { SENSOR_TYPE_ID_HEART_RATE = 278, /**< Heart rate sensor */ SENSOR_TYPE_ID_WEAR_DETECTION = 280, /**< Wear detection sensor */ SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ + /** + * The type of number. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ + SENSOR_TYPE_ID_HEART_BEAT_RATE = 282, /**< Heart rate sensor */ + /** + * The type of number. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ + SENSOR_TYPE_ID_LINEAR_ACCELEROMETER = 283 /**< Linear acceleration sensor */ } /** -- Gitee From 0256f1213378bbc2fc89696e3fc45a1ba72dd1d0 Mon Sep 17 00:00:00 2001 From: h00514358 Date: Fri, 22 Jul 2022 11:53:53 +0800 Subject: [PATCH 2/5] Modify sensor api Signed-off-by: h00514358 --- api/@ohos.sensor.d.ts | 45 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index 41f5360493..8ae43ad183 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -156,10 +156,22 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELEROMETER * @since 8 + * @deprecated since 9 */ 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}. @@ -339,7 +351,7 @@ declare namespace sensor { function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback): void; /** - * Subscribe to heart rate sensor data. + * 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 @@ -562,6 +574,15 @@ declare namespace sensor { */ 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}. @@ -854,7 +875,18 @@ 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 + */ 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 */ @@ -862,21 +894,20 @@ 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 */ - SENSOR_TYPE_ID_HEART_RATE = 278, /**< Heart rate sensor */ - SENSOR_TYPE_ID_WEAR_DETECTION = 280, /**< Wear detection sensor */ - SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ /** * The type of number. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @deprecated since 9 */ - SENSOR_TYPE_ID_HEART_BEAT_RATE = 282, /**< Heart rate sensor */ + SENSOR_TYPE_ID_HEART_RATE = 278, /**< Heart rate sensor */ /** * The type of number. * @syscap SystemCapability.Sensors.Sensor * @since 9 */ - SENSOR_TYPE_ID_LINEAR_ACCELEROMETER = 283 /**< Linear acceleration sensor */ + 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 */ } /** -- Gitee From 6050e226f91fd769d7fea25a740687e20760e698 Mon Sep 17 00:00:00 2001 From: h00514358 Date: Fri, 22 Jul 2022 15:22:11 +0800 Subject: [PATCH 3/5] Modify sensor api Signed-off-by: h00514358 --- api/@ohos.sensor.d.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index 8ae43ad183..b4ea33bfbc 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -123,7 +123,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEALTH_DATA * @since 8 - * @deprecated since 9 + * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE type instead. */ function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback, options?: Options): void; @@ -156,7 +156,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELEROMETER * @since 8 - * @deprecated since 9 + * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER type instead. */ function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback, options?: Options): void; @@ -346,7 +346,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEART_RATE * @since 8 - * @deprecated since 9 + * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE type instead. */ function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback): void; @@ -373,7 +373,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELERATION * @since 8 - * @deprecated since 9 + * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER type instead. */ function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback): void; @@ -543,7 +543,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEALTH_DATA * @since 8 - * @deprecated since 9 + * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE type instead. */ function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback): void; @@ -571,6 +571,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELEROMETER * @since 8 + * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER type instead. */ function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback): void; @@ -878,7 +879,7 @@ declare namespace sensor { /** * The type of number. * @syscap SystemCapability.Sensors.Sensor - * @deprecated since 9 + * @deprecated since 9, please use @SENSOR_TYPE_ID_LINEAR_ACCELEROMETER instead. */ SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */ /** @@ -897,7 +898,7 @@ declare namespace sensor { /** * The type of number. * @syscap SystemCapability.Sensors.Sensor - * @deprecated since 9 + * @deprecated since 9, please use @SENSOR_TYPE_ID_HEART_BEAT_RATE instead. */ SENSOR_TYPE_ID_HEART_RATE = 278, /**< Heart rate sensor */ /** -- Gitee From fb762d58c207532307e9b6793fba6a9acf3837b9 Mon Sep 17 00:00:00 2001 From: h00514358 Date: Fri, 22 Jul 2022 16:15:14 +0800 Subject: [PATCH 4/5] Modify sensor api Signed-off-by: h00514358 --- api/@ohos.sensor.d.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index b4ea33bfbc..cba6ce911e 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -123,7 +123,8 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEALTH_DATA * @since 8 - * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE type instead. + * @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; @@ -156,7 +157,8 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELEROMETER * @since 8 - * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER type instead. + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER */ function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback, options?: Options): void; @@ -346,7 +348,8 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEART_RATE * @since 8 - * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE type instead. + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE */ function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback): void; @@ -373,7 +376,8 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELERATION * @since 8 - * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER type instead. + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER */ function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback): void; @@ -543,7 +547,8 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.HEALTH_DATA * @since 8 - * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE type instead. + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE */ function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback): void; @@ -571,7 +576,8 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @permission ohos.permission.ACCELEROMETER * @since 8 - * @deprecated since 9, please use subscribe @SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER type instead. + * @deprecated since 9 + * @useinstead SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER */ function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback): void; -- Gitee From 9f4a81b259109c699f75aa7438da0bec14b6afe7 Mon Sep 17 00:00:00 2001 From: h00514358 Date: Fri, 22 Jul 2022 16:20:27 +0800 Subject: [PATCH 5/5] Modify sensor api Signed-off-by: h00514358 --- api/@ohos.sensor.d.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index cba6ce911e..696c80a977 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -137,7 +137,7 @@ declare namespace sensor { * @permission ohos.permission.READ_HEALTH_DATA * @since 9 */ - function on(type: SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE, callback: Callback, + function on(type: SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE, callback: Callback, options?: Options): void; /** @@ -171,7 +171,7 @@ declare namespace sensor { * @permission ohos.permission.ACCELEROMETER * @since 9 */ - function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback: Callback, + function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback: Callback, options?: Options): void; /** @@ -388,7 +388,7 @@ declare namespace sensor { * @permission ohos.permission.ACCELEROMETER * @since 9 */ - function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback: Callback): void; + function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback: Callback): void; /** * Subscribe to sensor data once. @@ -560,7 +560,7 @@ declare namespace sensor { * @permission ohos.permission.READ_HEALTH_DATA * @since 9 */ - function off(type: SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE, callback?: Callback): void; + function off(type: SensorType.SENSOR_TYPE_ID_HEART_BEAT_RATE, callback?: Callback): void; /** * Unsubscribe to sensor data. @@ -588,7 +588,7 @@ declare namespace sensor { * @permission ohos.permission.ACCELEROMETER * @since 9 */ - function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback?: Callback): void; + function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback?: Callback): void; /** * Unsubscribe to sensor data. @@ -885,7 +885,8 @@ declare namespace sensor { /** * The type of number. * @syscap SystemCapability.Sensors.Sensor - * @deprecated since 9, please use @SENSOR_TYPE_ID_LINEAR_ACCELEROMETER instead. + * @deprecated since 9 + * @useinstead SENSOR_TYPE_ID_LINEAR_ACCELEROMETER */ SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */ /** @@ -904,7 +905,8 @@ declare namespace sensor { /** * The type of number. * @syscap SystemCapability.Sensors.Sensor - * @deprecated since 9, please use @SENSOR_TYPE_ID_HEART_BEAT_RATE instead. + * @deprecated since 9 + * @useinstead SENSOR_TYPE_ID_HEART_BEAT_RATE */ SENSOR_TYPE_ID_HEART_RATE = 278, /**< Heart rate sensor */ /** -- Gitee