From 74879675610729fa674a6607389164ade562b031 Mon Sep 17 00:00:00 2001 From: SUE Date: Wed, 12 Jan 2022 14:32:34 +0000 Subject: [PATCH] Signed-off-by:hellohyh001 --- api/@ohos.sensor.d.ts | 113 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index e217076ba6..52033935f3 100755 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -449,6 +449,119 @@ declare namespace sensor { function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback): void; function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise; + /** + * 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. + * @return Returns the altitude in meters at which the device is located. + * @since 8 + */ + function getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback): void; + function getAltitude(seaPressure: number, currentPressure: number): Promise; + + /** + * Computes the geomagnetic inclination angle in radians from the inclination matrix. + * + * @param inclinationMatrix Indicates the inclination matrix. + * @return Returns the geomagnetic inclination angle in radians. + * @since 8 + */ + function getGeomagneticDip(inclinationMatrix: Array, callback: AsyncCallback): void; + function getGeomagneticDip(inclinationMatrix: Array): Promise; + + /** + * Get the angle change between two rotation matrices + * + * @param currentRotationMatrix Indicates the current rotation matrix. + * @param preRotationMatrix Indicates the current rotation matrix. + * @return Returns the array of number(z, x and y) in which the angle variety. + * @since 8 + */ + function getAngleModifiy(currentRotationMatrix: Array, preRotationMatrix: Array, + callback: AsyncCallback>): void; + function getAngleModifiy(currentRotationMatrix: Array, preRotationMatrix: Array): Promise>; + + /** + * Convert rotation vector to rotation matrix. + * + * @param rotationVector Indicates the rotation vector. + * @return Returns the rotation matrix. + * @since 8 + */ + function createRotationMatrix(rotationVector: Array, callback: AsyncCallback>): void; + function createRotationMatrix(rotationVector: Array): Promise>; + + /** + * Indicates the axis of the new coordinate system that coincides with the XY axis of the + * original coordinate system. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface CoordinatesOptions { + /** Indicates the axis of the new coordinate system that coincides with the X axis of + * the original coordinate system. + */ + x: number; + /** Indicates the axis of the new coordinate system that coincides with the Z axis of + * the original coordinate system. + */ + y: number; + } + + /** + * 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}. + * @return Returns the transformed rotation matrix. + * @since 8 + */ + function transformCoordinateSystem(inRotationVector: Array, coordinates: CoordinatesOptions, + callback: AsyncCallback>): void; + function transformCoordinateSystem(inRotationVector: Array, coordinates: CoordinatesOptions): Promise>; + + /** + * convert a rotation vector to a normalized quaternion. + * + * @param rotationVector Indicates the rotation vector. + * @return Returns the normalized quaternion. + * @since 8 + */ + function createQuaternion(rotationVector: Array, callback: AsyncCallback>): void; + function createQuaternion(rotationVector: Array): Promise>; + + /** + * Computes the device's orientation based on the rotation matrix. + * + * @param rotationMatrix Indicates the rotation matrix. + * @return Returns the array is the angle of rotation around the z, x, y axis. + * @since 8 + */ + function getDirection(rotationMatrix: Array, callback: AsyncCallback>): void; + function getDirection(rotationMatrix: Array): Promise>; + + /** + * Indicates the response of rotation matrix. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface RotationMatrixResponse { + rotation: Array; + inclination: Array + } + + /** + * Calculate rotation matrix based on gravity vector and geomagnetic vector. + * + * @param gravity Indicates the gravity vector. + * @param geomagnetic Indicates the geomagnetic vector. + * @return Returns the rotation matrix, {@code RotationMatrixResponse}. + * @since 8 + */ + function createRotationMatrix(gravity: Array, geomagnetic: Array, callback: AsyncCallback): void; + function createRotationMatrix(gravity: Array, geomagnetic: Array,): Promise; + /** * Subscribe to the sensor's optional parameters. * @devices phone, tablet -- Gitee