From 05d1182bbd0ca9205453ef9a0803ce65fedfedd1 Mon Sep 17 00:00:00 2001 From: HYH Date: Wed, 11 Jan 2023 06:51:29 +0000 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9sensor=20=E6=8E=A5?= =?UTF-8?q?=E8=BF=91=E5=85=89=E6=8E=A5=E5=8F=A3=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: HYH --- api/@ohos.sensor.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index 67a893093a..9b7bfdcf57 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -2019,7 +2019,7 @@ declare namespace sensor { * @since 8 */ interface ProximityResponse extends Response { - distance: number; /**< Indicates the degree of proximity, event 0 indicates proximity, while 1 indicates distance */ + distance: number; /**< Indicates the degree of proximity, event 0 indicates proximity, and greater than 0 indicates distance */ } /** -- Gitee From dd9cc1082fd8f0794a553b21d6e24c6bef2f1de5 Mon Sep 17 00:00:00 2001 From: HYH Date: Wed, 11 Jan 2023 08:51:50 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9sensor=20sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: HYH --- api/@ohos.sensor.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index 9b7bfdcf57..eafeedcaaf 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -1520,7 +1520,7 @@ declare namespace sensor { */ interface Sensor { sensorName:string; /**< Sensor name */ - venderName:string; /**< Sensor vendor */ + vendorName:string; /**< Sensor vendor */ firmwareVersion:string; /**< Sensor firmware version */ hardwareVersion:string; /**< Sensor hardware version */ sensorId:number; /**< Sensor type ID, {@code SensorType} */ -- Gitee From 34ac19e36c4329d1214a79fe5be313f18923cd07 Mon Sep 17 00:00:00 2001 From: HYH Date: Wed, 18 Jan 2023 06:59:05 +0000 Subject: [PATCH 3/6] add Signed-off-by: HYH --- api/@ohos.vibrator.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.vibrator.d.ts b/api/@ohos.vibrator.d.ts index 7063ef7885..81f13647d8 100644 --- a/api/@ohos.vibrator.d.ts +++ b/api/@ohos.vibrator.d.ts @@ -136,7 +136,7 @@ declare namespace vibrator { type VibrateEffect = VibrateTime | VibratePreset; /** - * Specifies the duration of the vibration effect. + * Vibrate continuously for a period of time at the default intensity of the system. * @syscap SystemCapability.Sensors.MiscDevice * @since 9 */ -- Gitee From 439f606dee52035c0e2721b01d77ee61e6a85258 Mon Sep 17 00:00:00 2001 From: HYH Date: Sat, 28 Jan 2023 09:07:28 +0000 Subject: [PATCH 4/6] add Signed-off-by: HYH --- api/@ohos.sensor.d.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index eafeedcaaf..2fe1e2818b 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -1520,7 +1520,17 @@ declare namespace sensor { */ interface Sensor { sensorName:string; /**< Sensor name */ - vendorName:string; /**< Sensor vendor */ + /** + * Sensor vendor. + * @deprecated since 9 + * @useinstead sensor#event:Sensor.vendorName + */ + venderName:string; + /** + * Sensor vendor. + * @since 9 + */ + vendorName:string; firmwareVersion:string; /**< Sensor firmware version */ hardwareVersion:string; /**< Sensor hardware version */ sensorId:number; /**< Sensor type ID, {@code SensorType} */ -- Gitee From 798b7f21c61696fa18543445d6eddfe8eb625ffb Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Mon, 30 Jan 2023 06:59:22 +0000 Subject: [PATCH 5/6] add Signed-off-by: hellohyh001 --- api/@ohos.sensor.d.ts | 131 ++++++++++++++++++++++++++++++++++++---- api/@ohos.vibrator.d.ts | 28 ++++++++- 2 files changed, 143 insertions(+), 16 deletions(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index 2fe1e2818b..38c8e9e553 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -1545,26 +1545,44 @@ declare namespace sensor { * Obtains the sensor information of a specified type. * @param type Indicate the sensor type, {@code SensorId}. * @param { AsyncCallback } callback - callback sensor info. - * @returns { void | Promise } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor * @since 9 */ function getSingleSensor(type: SensorId, callback: AsyncCallback): void; + + /** + * Obtains the sensor information of a specified type. + * @param type Indicate the sensor type, {@code SensorId}. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ function getSingleSensor(type: SensorId): Promise; /** * Obtains all sensor information on the device. * @param type Indicate the sensor type, {@code SensorId}. * @param { AsyncCallback> } callback - callback sensor list. - * @returns { void | Promise> } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor * @since 9 */ function getSensorList(callback: AsyncCallback>): void; + + /** + * Obtains all sensor information on the device. + * @param type Indicate the sensor type, {@code SensorId}. + * @returns { Promise> } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ function getSensorList(): Promise>; /** @@ -1614,13 +1632,24 @@ declare namespace sensor { * @param timeMillis Indicates the time at which the magnetic declination is to be obtained, in milliseconds * since the Unix epoch. * @param { AsyncCallback } callback - callback geomagnetic field. - * @returns { void | Promise } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor * @since 9 */ function getGeomagneticInfo(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback): void; + + /** + * Obtains the geomagnetic field at a specific location on the Earth. + * @param LocationOptions Indicates geographic location, {@code LocationOptions}. + * @param timeMillis Indicates the time at which the magnetic declination is to be obtained, in milliseconds + * since the Unix epoch. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ function getGeomagneticInfo(locationOptions: LocationOptions, timeMillis: number): Promise; /** @@ -1642,13 +1671,23 @@ declare namespace sensor { * @param seaPressure Indicates the sea level pressure, in hPa. * @param currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa. * @param { AsyncCallback } callback - callback device altitude. - * @returns { void | Promise } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor * @since 9 */ function getDeviceAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback): void; + + /** + * Obtains the altitude at which the device is located based on the current atmospheric pressure. + * @param seaPressure Indicates the sea level pressure, in hPa. + * @param currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ function getDeviceAltitude(seaPressure: number, currentPressure: number): Promise; /** @@ -1668,13 +1707,22 @@ declare namespace sensor { * Computes the geomagnetic inclination in radians from the inclination matrix. * @param inclinationMatrix Indicates the inclination matrix. * @param { AsyncCallback } callback - callback inclination in radians. - * @returns { void | Promise } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor * @since 9 */ function getInclination(inclinationMatrix: Array, callback: AsyncCallback): void; + + /** + * Computes the geomagnetic inclination in radians from the inclination matrix. + * @param inclinationMatrix Indicates the inclination matrix. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ function getInclination(inclinationMatrix: Array): Promise; /** @@ -1697,7 +1745,6 @@ declare namespace sensor { * @param currentRotationMatrix Indicates the current rotation matrix. * @param preRotationMatrix Indicates the current rotation matrix. * @param { AsyncCallback> } callback - callback angle variation. - * @returns { void | Promise> } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor @@ -1705,6 +1752,17 @@ declare namespace sensor { */ function getAngleVariation(currentRotationMatrix: Array, preRotationMatrix: Array, callback: AsyncCallback>): void; + + /** + * Get the angle variation between two rotation matrices. + * @param currentRotationMatrix Indicates the current rotation matrix. + * @param preRotationMatrix Indicates the current rotation matrix. + * @returns { Promise> } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ function getAngleVariation(currentRotationMatrix: Array, preRotationMatrix: Array): Promise>; /** @@ -1724,13 +1782,22 @@ declare namespace sensor { * Convert rotation vector to rotation matrix. * @param rotationVector Indicates the rotation vector. * @param { AsyncCallback> } callback - callback rotation matrix. - * @returns { void | Promise> } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor * @since 9 */ function getRotationMatrix(rotationVector: Array, callback: AsyncCallback>): void; + + /** + * Convert rotation vector to rotation matrix. + * @param rotationVector Indicates the rotation vector. + * @returns { Promise> } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ function getRotationMatrix(rotationVector: Array): Promise>; /** @@ -1770,7 +1837,6 @@ declare namespace sensor { * @param inRotationVector Indicates the rotation matrix to be transformed. * @param coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}. * @param { AsyncCallback> } callback - callback rotation matrix. - * @returns { void | Promise> } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor @@ -1778,6 +1844,17 @@ declare namespace sensor { */ function transformRotationMatrix(inRotationVector: Array, coordinates: CoordinatesOptions, callback: AsyncCallback>): void; + + /** + * Rotate the provided rotation matrix so that it can be represented in a different way coordinate System. + * @param inRotationVector Indicates the rotation matrix to be transformed. + * @param coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}. + * @returns { Promise> } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ function transformRotationMatrix(inRotationVector: Array, coordinates: CoordinatesOptions): Promise>; /** @@ -1797,13 +1874,22 @@ declare namespace sensor { * convert a rotation vector to a normalized quaternion. * @param rotationVector Indicates the rotation vector. * @param { AsyncCallback> } callback - callback a normalized quaternion. - * @returns { void | Promise> } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor * @since 9 */ function getQuaternion(rotationVector: Array, callback: AsyncCallback>): void; + + /** + * convert a rotation vector to a normalized quaternion. + * @param rotationVector Indicates the rotation vector. + * @returns { Promise> } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ function getQuaternion(rotationVector: Array): Promise>; /** @@ -1823,13 +1909,22 @@ declare namespace sensor { * Computes the device's orientation based on the rotation matrix. * @param rotationMatrix Indicates the rotation matrix. * @param { AsyncCallback> } callback - callback the angle of rotation around the z, x, y axis. - * @returns { void | Promise> } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor * @since 9 */ function getOrientation(rotationMatrix: Array, callback: AsyncCallback>): void; + + /** + * Computes the device's orientation based on the rotation matrix. + * @param rotationMatrix Indicates the rotation matrix. + * @returns { Promise> } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ function getOrientation(rotationMatrix: Array): Promise>; /** @@ -1854,21 +1949,31 @@ declare namespace sensor { * @useinstead sensor#getRotationMatrix */ function createRotationMatrix(gravity: Array, geomagnetic: Array, callback: AsyncCallback): void; - function createRotationMatrix(gravity: Array, geomagnetic: Array,): Promise; + function createRotationMatrix(gravity: Array, geomagnetic: Array): Promise; /** * Calculate rotation matrix based on gravity vector and geomagnetic vector. * @param gravity Indicates the gravity vector. * @param geomagnetic Indicates the geomagnetic vector. * @param { AsyncCallback> } callback - callback rotation matrix and inclination matrix. - * @returns { void | Promise } no callback return Promise otherwise return void. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14500101 - Service exception. * @syscap SystemCapability.Sensors.Sensor * @since 9 */ function getRotationMatrix(gravity: Array, geomagnetic: Array, callback: AsyncCallback): void; - function getRotationMatrix(gravity: Array, geomagnetic: Array,): Promise; + + /** + * Calculate rotation matrix based on gravity vector and geomagnetic vector. + * @param gravity Indicates the gravity vector. + * @param geomagnetic Indicates the geomagnetic vector. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 9 + */ + function getRotationMatrix(gravity: Array, geomagnetic: Array): Promise; /** * Subscribe to the sensor's optional parameters. diff --git a/api/@ohos.vibrator.d.ts b/api/@ohos.vibrator.d.ts index 81f13647d8..5e5d1878e9 100644 --- a/api/@ohos.vibrator.d.ts +++ b/api/@ohos.vibrator.d.ts @@ -51,7 +51,6 @@ declare namespace vibrator { * @param { VibrateEffect } effect - Indicate vibrate effect, {@code VibrateEffect}. * @param { VibrateAttribute } attribute - Indicate vibrate attribute, {@code VibrateAttribute}. * @param { AsyncCallback } callback - The callback of startVibration. - * @returns {void | Promise} no callback return Promise otherwise return void. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 14600101 - Device operation failed. @@ -60,13 +59,25 @@ declare namespace vibrator { * @since 9 */ function startVibration(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallback): void; + + /** + * Trigger vibrator vibration. + * @param { VibrateEffect } effect - Indicate vibrate effect, {@code VibrateEffect}. + * @param { VibrateAttribute } attribute - Indicate vibrate attribute, {@code VibrateAttribute}. + * @returns { Promise} Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14600101 - Device operation failed. + * @permission ohos.permission.VIBRATE + * @syscap SystemCapability.Sensors.MiscDevice + * @since 9 + */ function startVibration(effect: VibrateEffect, attribute: VibrateAttribute): Promise; /** * Stop the vibrator from vibrating. * @param { VibratorStopMode } stopMode - Indicate the stop mode in which the motor vibrates, {@code VibratorStopMode}. - * @param { AsyncCallback } callback - The callback of stopVibration. - * @returns { void | Promise } no callback return Promise otherwise return void. + * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Parameter error. * @syscap SystemCapability.Sensors.MiscDevice @@ -74,6 +85,17 @@ declare namespace vibrator { * @since 9 */ function stopVibration(stopMode: VibratorStopMode): Promise; + + /** + * Stop the vibrator from vibrating. + * @param { VibratorStopMode } stopMode - Indicate the stop mode in which the motor vibrates, {@code VibratorStopMode}. + * @param { AsyncCallback } callback - The callback of stopVibration. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Sensors.MiscDevice + * @permission ohos.permission.VIBRATE + * @since 9 + */ function stopVibration(stopMode: VibratorStopMode, callback: AsyncCallback): void; /** -- Gitee From af57103e430c695473a2ee10d2b80821b5439fbe Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Thu, 2 Feb 2023 02:19:59 +0000 Subject: [PATCH 6/6] add Signed-off-by: hellohyh001 --- api/@ohos.sensor.d.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index 38c8e9e553..0d41fb3f4a 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -1520,17 +1520,7 @@ declare namespace sensor { */ interface Sensor { sensorName:string; /**< Sensor name */ - /** - * Sensor vendor. - * @deprecated since 9 - * @useinstead sensor#event:Sensor.vendorName - */ - venderName:string; - /** - * Sensor vendor. - * @since 9 - */ - vendorName:string; + vendorName:string; /**< Sensor vendor */ firmwareVersion:string; /**< Sensor firmware version */ hardwareVersion:string; /**< Sensor hardware version */ sensorId:number; /**< Sensor type ID, {@code SensorType} */ @@ -1949,7 +1939,7 @@ declare namespace sensor { * @useinstead sensor#getRotationMatrix */ function createRotationMatrix(gravity: Array, geomagnetic: Array, callback: AsyncCallback): void; - function createRotationMatrix(gravity: Array, geomagnetic: Array): Promise; + function createRotationMatrix(gravity: Array, geomagnetic: Array,): Promise; /** * Calculate rotation matrix based on gravity vector and geomagnetic vector. -- Gitee