diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index 67a893093a5c896f6772a892036c50433780a176..0d41fb3f4a88eb732328d9bb13d407b0f7027b34 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} */ @@ -1535,26 +1535,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>; /** @@ -1604,13 +1622,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; /** @@ -1632,13 +1661,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; /** @@ -1658,13 +1697,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; /** @@ -1687,7 +1735,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 @@ -1695,6 +1742,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>; /** @@ -1714,13 +1772,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>; /** @@ -1760,7 +1827,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 @@ -1768,6 +1834,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>; /** @@ -1787,13 +1864,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>; /** @@ -1813,13 +1899,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>; /** @@ -1851,14 +1946,24 @@ declare namespace sensor { * @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. @@ -2019,7 +2124,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 */ } /** diff --git a/api/@ohos.vibrator.d.ts b/api/@ohos.vibrator.d.ts index 7063ef78857ca4845935217c30cf6f4c8135686e..5e5d1878e9053031d3885121943400465c2f668c 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; /** @@ -136,7 +158,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 */