From 9956a103adc0bcc22a6cce3703398efd4f293b79 Mon Sep 17 00:00:00 2001 From: h00514358 Date: Wed, 22 Dec 2021 09:22:19 +0000 Subject: [PATCH 1/2] Signed-off-by:hellohyh001 Signed-off-by: h00514358 --- api/@ohos.sensor.d.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index 73774f2dd4..b1910e91aa 100755 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -411,6 +411,43 @@ declare namespace sensor { */ function off(type: SensorType, callback: AsyncCallback): void; + /** + * Indicates geographic location. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface LocationOptions { + latitude: number; + longitude: number; + altitude: number; + } + + /** + * Indicates geomagnetic field data. + * @devices phone, tablet + * @sysCap SystemCapability.Sensors.Sensor + */ + interface GeomagneticResponse { + x: number; + y: number; + z: number; + geomagneticDip: number; + deflectionAngle: number; + levelIntensity: number; + totalIntensity: number; + } + + /** + * Implements the calculation of the geomagnetic field at a specific location on 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. + * @return Returns the geomagnetic field data, {@code GeomagneticResponse}. + * @since 8 + */ + function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback): void; + function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise; /** * Subscribe to the sensor's optional parameters. * @devices phone, tablet -- Gitee From 290dc63f913a2b5ec46663cd8658d988e6f375d7 Mon Sep 17 00:00:00 2001 From: h00514358 Date: Wed, 22 Dec 2021 09:24:10 +0000 Subject: [PATCH 2/2] Signed-off-by:hellohyh001 Signed-off-by: h00514358 --- api/@ohos.sensor.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index b1910e91aa..e217076ba6 100755 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -448,6 +448,7 @@ declare namespace sensor { */ function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback): void; function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise; + /** * Subscribe to the sensor's optional parameters. * @devices phone, tablet -- Gitee