From 06908c35d416186b49b3e09c80444ab73fb25e78 Mon Sep 17 00:00:00 2001 From: shenpeixing Date: Tue, 2 Sep 2025 11:58:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=9Bsensor=E6=9C=8D=E5=8A=A1=E5=90=8C?= =?UTF-8?q?=E6=AD=A50702=E4=BF=AE=E6=94=B9=E5=88=B00728=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shenpeixing --- api/@ohos.sensor.d.ts | 1903 +++++++++++++++++++++++++++++++-------- api/@ohos.vibrator.d.ts | 150 +-- 2 files changed, 1617 insertions(+), 436 deletions(-) diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index 7bd2714df1..aa0058b9ae 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -43,10 +43,11 @@ declare namespace sensor { */ /** * Enum for obtain the type of sensor. - * @enum { number } + * @enum { int } * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ enum SensorId { /** @@ -58,7 +59,8 @@ declare namespace sensor { * Acceleration sensor. * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ ACCELEROMETER = 1, @@ -71,49 +73,56 @@ declare namespace sensor { * Gyroscope sensor. * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ GYROSCOPE = 2, /** * Ambient light sensor. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ AMBIENT_LIGHT = 5, /** * Magnetic field sensor. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ MAGNETIC_FIELD = 6, /** * Barometric pressure sensor. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ BAROMETER = 8, /** * Hall effect sensor. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ HALL = 10, /** * Proximity sensor. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ PROXIMITY = 12, /** * Humidity sensor. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ HUMIDITY = 13, @@ -121,7 +130,8 @@ declare namespace sensor { * Color sensor. * @syscap SystemCapability.Sensors.Sensor * @systemapi - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ COLOR = 14, @@ -129,7 +139,8 @@ declare namespace sensor { * Sar sensor. * @syscap SystemCapability.Sensors.Sensor * @systemapi - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ SAR = 15, @@ -142,94 +153,1133 @@ declare namespace sensor { * Orientation sensor. * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ ORIENTATION = 256, - /** - * Gravity sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - GRAVITY = 257, + /** + * Gravity sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + GRAVITY = 257, + + /** + * Linear acceleration sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + LINEAR_ACCELEROMETER = 258, + + /** + * Rotation vector sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + ROTATION_VECTOR = 259, + + /** + * Ambient temperature sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + AMBIENT_TEMPERATURE = 260, + + /** + * Uncalibrated magnetic field sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + MAGNETIC_FIELD_UNCALIBRATED = 261, + + /** + * Uncalibrated gyroscope sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + GYROSCOPE_UNCALIBRATED = 263, + + /** + * Significant motion sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + SIGNIFICANT_MOTION = 264, + + /** + * Pedometer detection sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + PEDOMETER_DETECTION = 265, + + /** + * Pedometer sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + PEDOMETER = 266, + + /** + * Heart rate sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + HEART_RATE = 278, + + /** + * Wear detection sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + WEAR_DETECTION = 280, + + /** + * Uncalibrated acceleration sensor. + * @syscap SystemCapability.Sensors.Sensor + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + ACCELEROMETER_UNCALIBRATED = 281 + } + + /** + * Subscribe to orientation sensor data. + * @param { 'orientationChange' } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}. + * @param { Callback } callback - callback orientation data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'orientationChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to color sensor data. + * @param { 'colorChange' } type - Indicate the sensor type to listen for, {@code SensorId.COLOR}. + * @param { Callback } callback - callback color data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @throws { BusinessError } 202 - Permission check failed. A non-system application uses the system API. + * @syscap SystemCapability.Sensors.Sensor + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function on(type: 'colorChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to SAR sensor data. + * @param { 'sarChange' } type - Indicate the sensor type to listen for, {@code SensorId.SAR}. + * @param { Callback } callback - callback sar data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 202 - Permission check failed. A non-system application uses the system API. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function on(type: 'sarChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to accelerometer sensor data. + * @permission ohos.permission.ACCELEROMETER + * @param { 'accelerometerChange' } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}. + * @param { Callback } callback - callback accelerometer data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'accelerometerChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to uncalibrated accelerometer sensor data. + * @permission ohos.permission.ACCELEROMETER + * @param { 'accelerometerUncalibratedChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.ACCELEROMETER_UNCALIBRATED}. + * @param { Callback } callback - callback uncalibrated accelerometer data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'accelerometerUncalibratedChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to ambient light sensor data. + * @param { 'ambientLightChange' } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}. + * @param { Callback } callback - callback ambient light data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'ambientLightChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to ambient temperature sensor data. + * @param { 'ambientTemperatureChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.AMBIENT_TEMPERATURE}. + * @param { Callback } callback - callback ambient temperature data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'ambientTemperatureChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to barometer sensor data. + * @param { 'barometerChange' } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}. + * @param { Callback } callback - callback barometer data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'barometerChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to gravity sensor data. + * @param { 'gravityChange' } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}. + * @param { Callback } callback - callback gravity data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'gravityChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to gyroscope sensor data. + * @permission ohos.permission.GYROSCOPE + * @param { 'gyroscopeChange' } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}. + * @param { Callback } callback - callback gyroscope data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'gyroscopeChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to uncalibrated gyroscope sensor data. + * @permission ohos.permission.GYROSCOPE + * @param { 'gyroscopeUncalibratedChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.GYROSCOPE_UNCALIBRATED}. + * @param { Callback } callback - callback uncalibrated gyroscope data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'gyroscopeUncalibratedChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to hall sensor data. + * @param { 'hallChange' } type - Indicate the sensor type to listen for, {@code SensorId.HALL}. + * @param { Callback } callback - callback hall data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'hallChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to heart rate sensor data. + * @permission ohos.permission.READ_HEALTH_DATA + * @param { 'heartRateChange' } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}. + * @param { Callback } callback - callback heart rate data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'heartRateChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to humidity sensor data. + * @param { 'humidityChange' } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}. + * @param { Callback } callback - callback humidity data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'humidityChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to linear acceleration sensor data. + * @permission ohos.permission.ACCELEROMETER + * @param { 'linearAccelerometerChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.LINEAR_ACCELEROMETER}. + * @param { Callback } callback - callback linear accelerometer data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'linearAccelerometerChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to magnetic field sensor data. + * @param { 'magneticFieldChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.MAGNETIC_FIELD}. + * @param { Callback } callback - callback magnetic field data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'magneticFieldChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to uncalibrated magnetic field sensor data. + * @param { 'magneticFieldUncalibratedChange' } type - Indicate the sensor type to listen for, + * {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}. + * @param { Callback } callback - callback uncalibrated magnetic field data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'magneticFieldUncalibratedChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to pedometer sensor data. + * @permission ohos.permission.ACTIVITY_MOTION + * @param { 'pedometerChange' } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}. + * @param { Callback } callback - callback pedometer data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'pedometerChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to pedometer detection sensor data. + * @permission ohos.permission.ACTIVITY_MOTION + * @param { 'pedometerDetectionChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.PEDOMETER_DETECTION}. + * @param { Callback } callback - callback pedometer detection data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'pedometerDetectionChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to proximity sensor data. + * @param { 'proximityChange' } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}. + * @param { Callback } callback - callback proximity data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'proximityChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to rotation vector sensor data. + * @param { 'rotationVectorChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.ROTATION_VECTOR}. + * @param { Callback } callback - callback rotation vector data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'rotationVectorChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to significant motion sensor data. + * @param { 'significantMotionChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.SIGNIFICANT_MOTION}. + * @param { Callback } callback - callback significant motion data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'significantMotionChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to wear detection sensor data. + * @param { 'wearDetectionChange' } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}. + * @param { Callback } callback - callback wear detection data. + * @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, + *
{@code Options}. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function on(type: 'wearDetectionChange', callback: Callback, options?: Options): void; + + /** + * Subscribe to orientation sensor data once. + * @param { 'orientationChange' } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}. + * @param { Callback } callback - callback orientation data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'orientationChange', callback: Callback): void; + + /** + * Subscribe to accelerometer sensor data once. + * @permission ohos.permission.ACCELEROMETER + * @param { 'accelerometerChange' } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}. + * @param { Callback } callback - callback accelerometer data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'accelerometerChange', callback: Callback): void; + + /** + * Subscribe to uncalibrated accelerometer sensor data once. + * @permission ohos.permission.ACCELEROMETER + * @param { 'accelerometerUncalibratedChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.ACCELEROMETER_UNCALIBRATED}. + * @param { Callback } callback - callback uncalibrated accelerometer data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'accelerometerUncalibratedChange', callback: Callback): void; + + /** + * Subscribe to ambient light sensor data once. + * @param { 'ambientLightChange' } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}. + * @param { Callback } callback - callback ambient light data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'ambientLightChange', callback: Callback): void; + + /** + * Subscribe to ambient temperature sensor data once. + * @param { 'ambientTemperatureChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.AMBIENT_TEMPERATURE}. + * @param { Callback } callback - callback ambient temperature data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'ambientTemperatureChange', callback: Callback): void; + + /** + * Subscribe to barometer sensor data once. + * @param { 'barometerChange' } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}. + * @param { Callback } callback - callback barometer data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'barometerChange', callback: Callback): void; + + /** + * Subscribe to gravity sensor data once. + * @param { 'gravityChange' } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}. + * @param { Callback } callback - callback gravity data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'gravityChange', callback: Callback): void; + + /** + * Subscribe to gyroscope sensor data once. + * @permission ohos.permission.GYROSCOPE + * @param { 'gyroscopeChange' } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}. + * @param { Callback } callback - callback gyroscope data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'gyroscopeChange', callback: Callback): void; + + /** + * Subscribe to uncalibrated gyroscope sensor data once. + * @permission ohos.permission.GYROSCOPE + * @param { 'gyroscopeUncalibratedChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.GYROSCOPE_UNCALIBRATED}. + * @param { Callback } callback - callback uncalibrated gyroscope data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'gyroscopeUncalibratedChange', callback: Callback): void; + + /** + * Subscribe to hall sensor data once. + * @param { 'hallChange' } type - Indicate the sensor type to listen for, {@code SensorId.HALL}. + * @param { Callback } callback - callback hall data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'hallChange', callback: Callback): void; + + /** + * Subscribe to heart rate sensor data once. + * @permission ohos.permission.READ_HEALTH_DATA + * @param { 'heartRateChange' } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}. + * @param { Callback } callback - callback heart rate data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'heartRateChange', callback: Callback): void; + + /** + * Subscribe to humidity sensor data once. + * @param { 'humidityChange' } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}. + * @param { Callback } callback - callback humidity data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'humidityChange', callback: Callback): void; + + /** + * Subscribe to linear acceleration sensor data once. + * @permission ohos.permission.ACCELEROMETER + * @param { 'linearAccelerometerChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.LINEAR_ACCELEROMETER}. + * @param { Callback } callback - callback linear accelerometer data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'linearAccelerometerChange', callback: Callback): void; + + /** + * Subscribe to magnetic field sensor data once. + * @param { 'magneticFieldChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.MAGNETIC_FIELD}. + * @param { Callback } callback - callback magnetic field data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'magneticFieldChange', callback: Callback): void; + + /** + * Subscribe to uncalibrated magnetic field sensor data once. + * @param { 'magneticFieldUncalibratedChange' } type - Indicate the sensor type to listen for, + * {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}. + * @param { Callback } callback - callback uncalibrated magnetic field data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'magneticFieldUncalibratedChange', callback: Callback): void; + + /** + * Subscribe to pedometer sensor data once. + * @permission ohos.permission.ACTIVITY_MOTION + * @param { 'pedometerChange' } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}. + * @param { Callback } callback - callback pedometer data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'pedometerChange', callback: Callback): void; + + /** + * Subscribe to pedometer detection sensor data once. + * @permission ohos.permission.ACTIVITY_MOTION + * @param { 'pedometerDetectionChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.PEDOMETER_DETECTION}. + * @param { Callback } callback - callback pedometer detection data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'pedometerDetectionChange', callback: Callback): void; + + /** + * Subscribe to proximity sensor data once. + * @param { 'proximityChange' } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}. + * @param { Callback } callback - callback proximity data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'proximityChange', callback: Callback): void; + + /** + * Subscribe to rotation vector sensor data once. + * @param { 'rotationVectorChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.ROTATION_VECTOR}. + * @param { Callback } callback - callback rotation vector data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'rotationVectorChange', callback: Callback): void; + + /** + * Subscribe to significant motion sensor data once. + * @param { 'significantMotionChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.SIGNIFICANT_MOTION}. + * @param { Callback } callback - callback significant motion data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'significantMotionChange', callback: Callback): void; + + /** + * Subscribe to wear detection sensor data once. + * @param { 'wearDetectionChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.WEAR_DETECTION}. + * @param { Callback } callback - callback wear detection data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function once(type: 'wearDetectionChange', callback: Callback): void; + + /** + * Unsubscribe to orientation sensor data. + * @param { 'orientationChange' } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback orientation data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'orientationChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to color sensor data. + * @param { 'colorChange' } type - Indicate the sensor type to listen for, {@code SensorId.COLOR}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback color data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 202 - Permission check failed. A non-system application uses the system API. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function off(type: 'colorChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to sar sensor data. + * @param { 'sarChange' } type - Indicate the sensor type to listen for, {@code SensorId.SAR}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback sar data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 202 - Permission check failed. A non-system application uses the system API. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function off(type: 'sarChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to accelerometer sensor data. + * @permission ohos.permission.ACCELEROMETER + * @param { 'accelerometerChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.ACCELEROMETER}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback accelerometer data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'accelerometerChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to uncalibrated accelerometer sensor data. + * @permission ohos.permission.ACCELEROMETER + * @param { 'accelerometerUncalibratedChange' } type - Indicate the sensor type to listen for, + * {@code SensorId.ACCELEROMETER_UNCALIBRATED}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback uncalibrated accelerometer data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'accelerometerUncalibratedChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to ambient light sensor data. + * @param { 'ambientLightChange' } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback ambient light data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'ambientLightChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to ambient temperature sensor data. + * @param { 'ambientTemperatureChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.AMBIENT_TEMPERATURE}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback ambient temperature data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'ambientTemperatureChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to barometer sensor data. + * @param { 'barometerChange' } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback barometer data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'barometerChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to gravity sensor data. + * @param { 'gravityChange' } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback gravity data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'gravityChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to gyroscope sensor data. + * @permission ohos.permission.GYROSCOPE + * @param { 'gyroscopeChange' } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback gyroscope data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'gyroscopeChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to uncalibrated gyroscope sensor data. + * @permission ohos.permission.GYROSCOPE + * @param { 'gyroscopeUncalibratedChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.GYROSCOPE_UNCALIBRATED}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback uncalibrated gyroscope data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'gyroscopeUncalibratedChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Linear acceleration sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - LINEAR_ACCELEROMETER = 258, + /** + * Unsubscribe to hall sensor data. + * @param { 'hallChange' } type - Indicate the sensor type to listen for, {@code SensorId.HALL}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback hall data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'hallChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Rotation vector sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - ROTATION_VECTOR = 259, + /** + * Unsubscribe to heart rate sensor data. + * @permission ohos.permission.READ_HEALTH_DATA + * @param { 'heartRateChange' } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback heart rate data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'heartRateChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Ambient temperature sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - AMBIENT_TEMPERATURE = 260, + /** + * Unsubscribe to humidity sensor data. + * @param { 'humidityChange' } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback humidity data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'humidityChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Uncalibrated magnetic field sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - MAGNETIC_FIELD_UNCALIBRATED = 261, + /** + * Unsubscribe to linear acceleration sensor data. + * @permission ohos.permission.ACCELEROMETER + * @param { 'linearAccelerometerChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.LINEAR_ACCELEROMETER}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback linear accelerometer data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'linearAccelerometerChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Uncalibrated gyroscope sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - GYROSCOPE_UNCALIBRATED = 263, + /** + * Unsubscribe to magnetic field sensor data. + * @param { 'magneticFieldChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.MAGNETIC_FIELD}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback magnetic field data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'magneticFieldChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Significant motion sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - SIGNIFICANT_MOTION = 264, + /** + * Unsubscribe to uncalibrated magnetic field sensor data. + * @param { 'magneticFieldUncalibratedChange' } type - Indicate the sensor type to listen for, + * {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback uncalibrated magnetic field data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'magneticFieldUncalibratedChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Pedometer detection sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - PEDOMETER_DETECTION = 265, + /** + * Unsubscribe to pedometer sensor data. + * @permission ohos.permission.ACTIVITY_MOTION + * @param { 'pedometerChange' } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback pedometer data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'pedometerChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Pedometer sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - PEDOMETER = 266, + /** + * Unsubscribe to pedometer detection sensor data. + * @permission ohos.permission.ACTIVITY_MOTION + * @param { 'pedometerDetectionChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.PEDOMETER_DETECTION}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback pedometer detection data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'pedometerDetectionChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Heart rate sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - HEART_RATE = 278, + /** + * Unsubscribe to proximity sensor data. + * @param { 'proximityChange' } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback proximity data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'proximityChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Wear detection sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - WEAR_DETECTION = 280, + /** + * Unsubscribe to rotation vector sensor data. + * @param { 'rotationVectorChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.ROTATION_VECTOR}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback rotation vector data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'rotationVectorChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; - /** - * Uncalibrated acceleration sensor. - * @syscap SystemCapability.Sensors.Sensor - * @since 9 - */ - ACCELEROMETER_UNCALIBRATED = 281 - } + /** + * Unsubscribe to significant motion sensor data. + * @param { 'significantMotionChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.SIGNIFICANT_MOTION}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback significant motion data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'significantMotionChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; + + /** + * Unsubscribe to wear detection sensor data. + * @param { 'wearDetectionChange' } type - Indicate the sensor type to listen for, + *
{@code SensorId.WEAR_DETECTION}. + * @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device. + * @param { Callback } [callback] - callback wear detection data. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; + *
2. Sensor service ipc exception;3. Sensor data channel exception. + * @syscap SystemCapability.Sensors.Sensor + * @since 20 + * @arkts 1.2 + */ + function off(type: 'wearDetectionChange', sensorInfoParam?: SensorInfoParam, callback?: Callback): void; /** * Subscribe to color sensor data. @@ -2435,14 +3485,16 @@ declare namespace sensor { * Indicates sensor information. * @typedef Sensor * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ interface Sensor { /** * Sensor name. * @type { string } * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ sensorName:string; @@ -2450,7 +3502,8 @@ declare namespace sensor { * Sensor vendor. * @type { string } * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ vendorName:string; @@ -2458,7 +3511,8 @@ declare namespace sensor { * Sensor firmware version. * @type { string } * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ firmwareVersion:string; @@ -2466,57 +3520,64 @@ declare namespace sensor { * Sensor hardware version. * @type { string } * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ hardwareVersion:string; /** * Sensor type ID, {@code SensorType}. - * @type { number } + * @type { int } * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - sensorId:number; + sensorId:int; /** * Maximum measurement range of the sensor. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - maxRange:number; + maxRange:double; /** * Minimum sample period allowed, in ns. - * @type { number } + * @type { long } * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - minSamplePeriod:number; + minSamplePeriod:long; /** * Maximum sample period allowed, in ns. - * @type { number } + * @type { long } * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - maxSamplePeriod:number; + maxSamplePeriod:long; /** * Sensor accuracy. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - precision:number; + precision:double; /** * Sensor power. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - power:number; + power:double; /** * Index of sensors of the same type. @@ -2634,7 +3695,8 @@ declare namespace sensor { * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; *
2. Sensor service ipc exception;3. Sensor data channel exception. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function getSensorList(callback: AsyncCallback>): void; @@ -2646,7 +3708,8 @@ declare namespace sensor { * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; *
2. Sensor service ipc exception;3. Sensor data channel exception. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function getSensorList(): Promise>; @@ -2673,64 +3736,72 @@ declare namespace sensor { * Indicates geomagnetic field data. * @typedef GeomagneticResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface GeomagneticResponse { /** * Geomagnetic x-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: double; /** * Geomagnetic y-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: double; /** * Geomagnetic z-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - z: number; + z: double; /** * The Angle between the earth's magnetic field lines and the horizontal plane. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - geomagneticDip: number; + geomagneticDip: double; /** * The Angle of magnetic north and true north on a horizontal plane. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - deflectionAngle: number; + deflectionAngle: double; /** * The horizontal strength of the geomagnetic field. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - levelIntensity: number; + levelIntensity: double; /** * The total strength of the geomagnetic field. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - totalIntensity: number; + totalIntensity: double; } /** @@ -2999,50 +4070,55 @@ declare namespace sensor { /** * Convert rotation vector to rotation matrix. - * @param { Array } rotationVector - rotationVector Indicates the rotation vector. - * @param { AsyncCallback> } callback - callback rotation matrix. + * @param { Array } rotationVector - rotationVector Indicates the rotation vector. + * @param { AsyncCallback> } callback - callback rotation matrix. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; *
2. Sensor service ipc exception;3. Sensor data channel exception. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - function getRotationMatrix(rotationVector: Array, callback: AsyncCallback>): void; + function getRotationMatrix(rotationVector: Array, callback: AsyncCallback>): void; /** * Convert rotation vector to rotation matrix. - * @param { Array } rotationVector - rotationVector Indicates the rotation vector. - * @returns { Promise> } Promise used to return the result. + * @param { Array } rotationVector - rotationVector Indicates the rotation vector. + * @returns { Promise> } Promise used to return the result. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; *
2. Sensor service ipc exception;3. Sensor data channel exception. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - function getRotationMatrix(rotationVector: Array): Promise>; + function getRotationMatrix(rotationVector: Array): Promise>; /** * Indicates the axis of the new coordinate system that coincides with the XY axis of the original coordinate system. * @typedef CoordinatesOptions * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface CoordinatesOptions { /** Indicates the axis of the new coordinate system that coincides with the X axis of the original coordinate system. - * @type { number } + * @type { int } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: int; /** Indicates the axis of the new coordinate system that coincides with the Y axis of the original coordinate system. - * @type { number } + * @type { int } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: int; } /** @@ -3171,52 +4247,57 @@ declare namespace sensor { /** * Computes the device's orientation based on the rotation matrix. - * @param { Array } rotationMatrix - rotationMatrix Indicates the rotation matrix. - * @param { AsyncCallback> } callback - callback the angle of rotation around the z, x, y axis. + * @param { Array } rotationMatrix - rotationMatrix Indicates the rotation matrix. + * @param { AsyncCallback> } callback - callback the angle of rotation around the z, x, y axis. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; *
2. Sensor service ipc exception;3. Sensor data channel exception. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - function getOrientation(rotationMatrix: Array, callback: AsyncCallback>): void; + function getOrientation(rotationMatrix: Array, callback: AsyncCallback>): void; /** * Computes the device's orientation based on the rotation matrix. - * @param { Array } rotationMatrix - rotationMatrix Indicates the rotation matrix. - * @returns { Promise> } Promise used to return the result. + * @param { Array } rotationMatrix - rotationMatrix Indicates the rotation matrix. + * @returns { Promise> } Promise used to return the result. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; *
2. Sensor service ipc exception;3. Sensor data channel exception. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - function getOrientation(rotationMatrix: Array): Promise>; + function getOrientation(rotationMatrix: Array): Promise>; /** * Indicates the response of rotation matrix. * @typedef RotationMatrixResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface RotationMatrixResponse { /** * rotation matrix. - * @type { Array } + * @type { Array } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - rotation: Array; + rotation: Array; /** * inclination matrix. - * @type { Array } + * @type { Array } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - inclination: Array + inclination: Array } /** @@ -3245,31 +4326,33 @@ declare namespace sensor { /** * Calculate rotation matrix based on gravity vector and geomagnetic vector. - * @param { Array } gravity - gravity Indicates the gravity vector. - * @param { Array } geomagnetic - geomagnetic Indicates the geomagnetic vector. + * @param { Array } gravity - gravity Indicates the gravity vector. + * @param { Array } geomagnetic - geomagnetic Indicates the geomagnetic vector. * @param { AsyncCallback } callback - callback rotation matrix and inclination matrix. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; *
2. Sensor service ipc exception;3. Sensor data channel exception. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - function getRotationMatrix(gravity: Array, geomagnetic: Array, callback: AsyncCallback): void; + function getRotationMatrix(gravity: Array, geomagnetic: Array, callback: AsyncCallback): void; /** * Calculate rotation matrix based on gravity vector and geomagnetic vector. - * @param { Array } gravity - gravity Indicates the gravity vector. - * @param { Array } geomagnetic - geomagnetic Indicates the geomagnetic vector. + * @param { Array } gravity - gravity Indicates the gravity vector. + * @param { Array } geomagnetic - geomagnetic Indicates the geomagnetic vector. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception; *
2. Sensor service ipc exception;3. Sensor data channel exception. * @syscap SystemCapability.Sensors.Sensor - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - function getRotationMatrix(gravity: Array, geomagnetic: Array): Promise; + function getRotationMatrix(gravity: Array, geomagnetic: Array): Promise; /** * Subscribe to the sensor's optional parameters. @@ -3294,13 +4377,13 @@ declare namespace sensor { */ /** * Sensor event reporting event interval. - * @type { ?(number | SensorFrequency) } + * @type { ?(long | SensorFrequency) } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - interval?: number | SensorFrequency; + interval?: long | SensorFrequency; /** * Parameters of sensor on the device. @@ -3502,7 +4585,7 @@ declare namespace sensor { /** * Enumerates the accuracy levels of data reported by a sensor. - * @enum { number } + * @enum { int } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} @@ -3569,13 +4652,13 @@ declare namespace sensor { */ /** * The timestamp of the reported sensor data. - * @type { number } + * @type { long } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - timestamp: number; + timestamp: long; /** * The accuracy levels of data reported by a sensor. @@ -3599,7 +4682,8 @@ declare namespace sensor { * @typedef AccelerometerResponse * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ interface AccelerometerResponse extends Response { /** @@ -3610,12 +4694,13 @@ declare namespace sensor { */ /** * Acceleration x-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: double; /** * Acceleration y-axis component. @@ -3625,12 +4710,13 @@ declare namespace sensor { */ /** * Acceleration y-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: double; /** * Acceleration z-axis component @@ -3640,135 +4726,151 @@ declare namespace sensor { */ /** * Acceleration z-axis component - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - z: number; + z: double; } /** * Linear acceleration sensor event data. * @typedef LinearAccelerometerResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface LinearAccelerometerResponse extends Response { /** * Linear acceleration x-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: double; /** * Linear acceleration y-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: double; /** * Linear acceleration z-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - z: number; + z: double; } /** * Acceleration uncalibrated sensor event data. * @typedef AccelerometerUncalibratedResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface AccelerometerUncalibratedResponse extends Response { /** * Acceleration uncalibrated x-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: double; /** * Acceleration uncalibrated y-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: double; /** * Acceleration uncalibrated z-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - z: number; + z: double; /** * Acceleration uncalibrated x-axis offset. * - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - biasX: number; + biasX: double; /** * Acceleration uncalibrated y-axis offset. * - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - biasY: number; + biasY: double; /** * Acceleration uncalibrated z-axis offset. * - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - biasZ: number; + biasZ: double; } /** * Gravity sensor event data. * @typedef GravityResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface GravityResponse extends Response { /** * Gravity x-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: double; /** * Gravity y-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: double; /** * Gravity z-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - z: number; + z: double; } /** @@ -3794,13 +4896,13 @@ declare namespace sensor { */ /** * The device rotates at an angle around the Z axis. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - alpha: number; + alpha: double; /** * The device rotates at an angle around the X axis. @@ -3810,13 +4912,13 @@ declare namespace sensor { */ /** * The device rotates at an angle around the X axis. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - beta: number; + beta: double; /** * The device rotates at an angle around the Y axis. @@ -3826,53 +4928,58 @@ declare namespace sensor { */ /** * The device rotates at an angle around the Y axis. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - gamma: number; + gamma: double; } /** * Rotation vector sensor event data. * @typedef RotationVectorResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface RotationVectorResponse extends Response { /** * Rotation vector x-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: double; /** * Rotation vector y-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: double; /** * Rotation vector z-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - z: number; + z: double; /** * Scalar quantity. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - w: number; + w: double; } /** @@ -3886,7 +4993,8 @@ declare namespace sensor { * @typedef GyroscopeResponse * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ interface GyroscopeResponse extends Response { /** @@ -3897,12 +5005,13 @@ declare namespace sensor { */ /** * Gyroscope x-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: double; /** * Gyroscope y-axis component. @@ -3912,12 +5021,13 @@ declare namespace sensor { */ /** * Gyroscope y-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: double; /** * Gyroscope z-axis component. @@ -3927,351 +5037,394 @@ declare namespace sensor { */ /** * Gyroscope z-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - z: number; + z: double; } /** * Gyroscope uncalibrated sensor event data. * @typedef GyroscopeUncalibratedResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface GyroscopeUncalibratedResponse extends Response { /** * Gyroscope uncalibrated x-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: double; /** * Gyroscope uncalibrated y-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: double; /** * Gyroscope uncalibrated z-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - z: number; + z: double; /** * Gyroscope uncalibrated x-axis offset. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - biasX: number; + biasX: double; /** * Gyroscope uncalibrated y-axis offset. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - biasY: number; + biasY: double; /** * Gyroscope uncalibrated z-axis offset. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - biasZ: number; + biasZ: double; } /** * Significant motion sensor event data. * @typedef SignificantMotionResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface SignificantMotionResponse extends Response { /** * The degree of significant motion. * Whether the device has a significant motion. * The value 1 means that the device has a significant motion, and 0 means the opposite. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - scalar: number; + scalar: double; } /** * Proximity sensor event data. * @typedef ProximityResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface ProximityResponse extends Response { /** * Indicates the degree of proximity, event 0 indicates proximity, and greater than 0 indicates distance. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - distance: number; + distance: double; } /** * Light sensor event data. * @typedef LightResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface LightResponse extends Response { /** * Indicates light intensity, in lux. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - intensity: number; + intensity: double; /** * Indicates color temperature, in kelvin. - * @type { ?number } + * @type { ?double } * @syscap SystemCapability.Sensors.Sensor - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - colorTemperature?: number; + colorTemperature?: double; /** * Indicates infrared luminance, in cd/m2. - * @type { ?number } + * @type { ?double } * @syscap SystemCapability.Sensors.Sensor - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - infraredLuminance?: number; + infraredLuminance?: double; } /** * Hall sensor event data. * @typedef HallResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface HallResponse extends Response { /** * Indicates hall status, 0 indicates open, and greater than 0 indicates suction. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - status: number; + status: double; } /** * Magnetic field sensor event data. * @typedef MagneticFieldResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface MagneticFieldResponse extends Response { /** * Magnetic field x-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: double; /** * Magnetic field y-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: double; /** * Magnetic field z-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - z: number; + z: double; } /** * Magnetic field uncalibrated sensor event data. * @typedef MagneticFieldUncalibratedResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface MagneticFieldUncalibratedResponse extends Response { /** * Magnetic field uncalibrated x-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - x: number; + x: double; /** * Magnetic field uncalibrated y-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - y: number; + y: double; /** * Magnetic field uncalibrated z-axis component. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - z: number; + z: double; /** * Magnetic field uncalibrated x-axis offset. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - biasX: number; + biasX: double; /** * Magnetic field uncalibrated y-axis offset. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - biasY: number; + biasY: double; /** * Magnetic field uncalibrated z-axis offset. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - biasZ: number; + biasZ: double; } /** * Pedometer sensor event data. * @typedef PedometerResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface PedometerResponse extends Response { /** * Indicates the number of steps. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - steps: number; + steps: double; } /** * Humidity sensor event data. * @typedef HumidityResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface HumidityResponse extends Response { /** * Indicates the number of humidity. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - humidity: number; + humidity: double; } /** * Pedometer detection sensor event data. * @typedef PedometerDetectionResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface PedometerDetectionResponse extends Response { /** * Indicates the pedometer detection status, 1 indicates that a walking action has occurred, * and 0 indicates that no movement has occurred. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - scalar: number; + scalar: double; } /** * Ambient temperature sensor event data. * @typedef AmbientTemperatureResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface AmbientTemperatureResponse extends Response { /** * Indicates ambient temperature, in celsius. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - temperature: number; + temperature: double; } /** * Barometer sensor event data. * @typedef BarometerResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface BarometerResponse extends Response { /** * Indicates the number of barometer, in hpa. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - pressure: number; + pressure: double; } /** * Heart rate sensor event data. * @typedef HeartRateResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface HeartRateResponse extends Response { /** * Indicates the number of heart rate. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - heartRate: number; + heartRate: double; } /** * Wear detection sensor event data. * @typedef WearDetectionResponse * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ interface WearDetectionResponse extends Response { /** * Indicates the status of wear detection, 1 for wearing, 0 for wearing not. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ - value: number; + value: double; } /** @@ -4279,25 +5432,28 @@ declare namespace sensor { * @typedef ColorResponse * @syscap SystemCapability.Sensors.Sensor * @systemapi - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ interface ColorResponse extends Response { /** * Indicates the intensity of light, in lux. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @systemapi - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ - lightIntensity: number; + lightIntensity: double; /** * Indicates the color temperature, in kelvin. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @systemapi - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ - colorTemperature: number; + colorTemperature: double; } /** @@ -4305,17 +5461,19 @@ declare namespace sensor { * @typedef SarResponse * @syscap SystemCapability.Sensors.Sensor * @systemapi - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ interface SarResponse extends Response { /** * Indicates the specific absorption rate, in W/kg. - * @type { number } + * @type { double } * @syscap SystemCapability.Sensors.Sensor * @systemapi - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ - absorptionRatio: number; + absorptionRatio: double; } /** @@ -4402,28 +5560,31 @@ declare namespace sensor { * @typedef SensorInfoParam * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 19 + * @since arkts{ '1.1':'19','1.2':'20'} + * @arkts 1.1&1.2 */ interface SensorInfoParam { /** * Unique identifier for the device that contains one or multiple sensors. * By default, deviceId may default to querying or controlling the local default sensor. * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 19 + * @since arkts{ '1.1':'19','1.2':'20'} + * @arkts 1.1&1.2 */ - deviceId?: number; + deviceId?: int; /** * Index of sensors of the same type. By default, it controls default sensors of the sensor type. - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.Sensor * @atomicservice - * @since 19 + * @since arkts{ '1.1':'19','1.2':'20'} + * @arkts 1.1&1.2 */ - sensorIndex?: number; + sensorIndex?: int; } } diff --git a/api/@ohos.vibrator.d.ts b/api/@ohos.vibrator.d.ts index 85208b0120..25a5638add 100644 --- a/api/@ohos.vibrator.d.ts +++ b/api/@ohos.vibrator.d.ts @@ -167,7 +167,8 @@ declare namespace vibrator { * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Sensors.MiscDevice - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function stopVibration(stopMode: VibratorStopMode): Promise; @@ -181,7 +182,8 @@ declare namespace vibrator { * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Sensors.MiscDevice - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function stopVibration(stopMode: VibratorStopMode, callback: AsyncCallback): void; @@ -202,7 +204,8 @@ declare namespace vibrator { * @throws { BusinessError } 201 - Permission denied. * @syscap SystemCapability.Sensors.MiscDevice * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ function stopVibration(callback: AsyncCallback): void; @@ -223,7 +226,8 @@ declare namespace vibrator { * @throws { BusinessError } 201 - Permission denied. * @syscap SystemCapability.Sensors.MiscDevice * @atomicservice - * @since 11 + * @since arkts {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ function stopVibration(): Promise; @@ -235,7 +239,8 @@ declare namespace vibrator { * @throws { BusinessError } 14600101 - Device operation failed. * @syscap SystemCapability.Sensors.MiscDevice * @atomicservice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function stopVibrationSync(): void; @@ -357,7 +362,8 @@ declare namespace vibrator { * @returns { boolean } Returns whether the high-definition haptic is supported. * @throws { BusinessError } 14600101 - Device operation failed. * @syscap SystemCapability.Sensors.MiscDevice - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function isHdHapticSupported(): boolean; @@ -366,14 +372,16 @@ declare namespace vibrator { * * @enum { string } * @syscap SystemCapability.Sensors.MiscDevice - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ enum EffectId { /** * Describes the vibration effect of the vibrator when a user adjusts the timer. * * @syscap SystemCapability.Sensors.MiscDevice - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ EFFECT_CLOCK_TIMER = 'haptic.clock.timer' } @@ -440,14 +448,16 @@ declare namespace vibrator { * * @enum { string } * @syscap SystemCapability.Sensors.MiscDevice - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ enum VibratorStopMode { /** * Indicates the mode of stopping a one-shot vibration effect. * * @syscap SystemCapability.Sensors.MiscDevice - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ VIBRATOR_STOP_MODE_TIME = 'time', @@ -455,7 +465,8 @@ declare namespace vibrator { * Indicates the mode of stopping a preset vibration effect. * * @syscap SystemCapability.Sensors.MiscDevice - * @since 8 + * @since arkts {'1.1':'8', '1.2':'20'} + * @arkts 1.1&1.2 */ VIBRATOR_STOP_MODE_PRESET = 'preset' } @@ -507,13 +518,13 @@ declare namespace vibrator { /** * Vibrator id, default is 0. * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - id?: number; + id?: int; /** * Unique identifier for the device that contains one or multiple vibrators. @@ -631,13 +642,13 @@ declare namespace vibrator { /** * The duration of the vibration, in ms. * - * @type { number } + * @type { int } * @syscap SystemCapability.Sensors.MiscDevice * @atomicservice * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ - duration: number; /** The duration of the vibration, in ms */ + duration: int; /** The duration of the vibration, in ms */ } /** @@ -678,22 +689,22 @@ declare namespace vibrator { /** * The number of vibration repetitions. * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - count?: number; + count?: int; /** * The intensity of vibration effect. * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - intensity?: number; + intensity?: int; } /** @@ -740,40 +751,40 @@ declare namespace vibrator { * The file descriptor of haptic effect source from file system. The caller * is responsible to close the file descriptor. * - * @type { number } + * @type { int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'10', '1.2':'20'} * @arkts 1.1&1.2 */ - fd: number; + fd: int; /** * The offset into the file where the data to be read, in bytes. By default, * the offset is zero. * - * @type { ?number } + * @type { ?long } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'10', '1.2':'20'} * @arkts 1.1&1.2 */ - offset?: number; + offset?: long; /** * The length in bytes of the data to be read. By default, the length is the * rest of bytes in the file from the offset. * - * @type { ?number } + * @type { ?long } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'10', '1.2':'20'} * @arkts 1.1&1.2 */ - length?: number; + length?: long; } /** * Types of vibration events * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 @@ -810,31 +821,31 @@ declare namespace vibrator { /** * The offset of the starting time of the relative event. * - * @type { number } + * @type { int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ - time: number; + time: int; /** * Gain in relative event vibration intensity * - * @type { ?number } + * @type { ?double } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ - intensity?: number; + intensity?: double; /** * Changes in relative event vibration frequency * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ - frequency?: number; + frequency?: int; } /** @@ -859,52 +870,52 @@ declare namespace vibrator { /** * Relative starting time of vibration * - * @type { number } + * @type { int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ - time: number; + time: int; /** * The duration of vibration * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ - duration?: number; + duration?: int; /** * Intensity of vibration events * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ - intensity?: number; + intensity?: int; /** * Vibration event frequency * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ - frequency?: number; + frequency?: int; /** * Channel number * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ - index?: number; + index?: int; /** * An array representing vibration adjustment curves. @@ -929,12 +940,12 @@ declare namespace vibrator { /** * Absolute starting time of vibration * - * @type { number } + * @type { int } * @syscap SystemCapability.Sensors.MiscDevice * @since arkts {'1.1':'18', '1.2':'20'} * @arkts 1.1&1.2 */ - time: number; + time: int; /** * Vibration event array, where each 'events' attribute represents one vibration event. @@ -952,44 +963,49 @@ declare namespace vibrator { * * @interface ContinuousParam * @syscap SystemCapability.Sensors.MiscDevice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ interface ContinuousParam { /** * Intensity of vibration * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - intensity?: number; + intensity?: int; /** * Frequency of vibration * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - frequency?: number; + frequency?: int; /** * The points of vibration * * @type { ?VibratorCurvePoint[] } * @syscap SystemCapability.Sensors.MiscDevice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ points?: VibratorCurvePoint[]; /** * Index of vibration * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - index?: number; + index?: int; } /** @@ -997,35 +1013,39 @@ declare namespace vibrator { * * @interface TransientParam * @syscap SystemCapability.Sensors.MiscDevice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ interface TransientParam { /** * Intensity of vibration * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - intensity?: number; + intensity?: int; /** * Frequency of vibration * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - frequency?: number; + frequency?: int; /** * Index of vibration * - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Sensors.MiscDevice - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ - index?: number; + index?: int; } /** -- Gitee