diff --git a/BUILD.gn b/BUILD.gn index a88bb2958bd48a46a59ed52175a1ec828ea0f0fc..6bc4bf42765efe5104d10bbaa66da51d1f6b62f7 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -125,9 +125,7 @@ ohos_copy("common_api") { "api/common/@system.prompt.d.ts", "api/common/@system.request.d.ts", "api/common/@system.router.d.ts", - "api/common/@system.sensor.d.ts", "api/common/@system.storage.d.ts", - "api/common/@system.vibrator.d.ts", ] outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] module_source_dir = target_out_dir + "/$target_name" diff --git a/api/common/@system.sensor.d.ts b/api/common/@system.sensor.d.ts deleted file mode 100644 index 0fad549f00475ed0c46d5b8d898bb32674fbf135..0000000000000000000000000000000000000000 --- a/api/common/@system.sensor.d.ts +++ /dev/null @@ -1,936 +0,0 @@ -/* - * Copyright (c) 2021 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ -export interface AccelerometerResponse { - /** - * X-coordinate - * @devices phone, tablet, wearable - * @since 3 - */ - x: number; - - /** - * Y-coordinate - * @devices phone, tablet, wearable - * @since 3 - */ - y: number; - - /** - * Z-coordinate - * @devices phone, tablet, wearable - * @since 3 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ -export interface subscribeAccelerometerOptions { - /** - * Execution frequency of the callback function for listening to acceleration sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @devices phone, tablet, wearable - * @since 3 - */ - interval: string; - - /** - * Called when acceleration sensor data changes. - * @devices phone, tablet, wearable - * @since 3 - */ - success: (data: AccelerometerResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet, wearable - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface CompassResponse { - /** - * Direction of the device (in degrees). - * @devices phone, tablet, wearable - * @since 3 - */ - direction: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeCompassOptions { - /** - * Called when compass sensor data changes. - * @devices phone, tablet, wearable - * @since 3 - */ - success: (data: CompassResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet, wearable - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface ProximityResponse { - /** - * Distance between a visible object and the device screen - * @devices phone, tablet - * @since 3 - */ - distance: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeProximityOptions { - /** - * Called when distance sensor data changes. - * @devices phone, tablet - * @since 3 - */ - success: (data: ProximityResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface LightResponse { - /** - * Light intensity, in lux. - * @devices phone, tablet, wearable - * @since 3 - */ - intensity: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeLightOptions { - /** - * Called when ambient light sensor data changes. - * @devices phone, tablet, wearable - * @since 3 - */ - success: (data: LightResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet, wearable - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable, liteWearable - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ -export interface StepCounterResponse { - /** - * Number of steps counted. - * Each time the device restarts, the value is recalculated from 0 in phone, tablet. - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - steps: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable, liteWearable - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ -export interface SubscribeStepCounterOptions { - /** - * Called when step counter sensor data changes. - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - success: (data: StepCounterResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable, liteWearable - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface BarometerResponse { - /** - * Pressure, in pascal. - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - pressure: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable, liteWearable - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeBarometerOptions { - /** - * Called when the barometer sensor data changes. - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - success: (data: BarometerResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices wearable, liteWearable - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ -export interface HeartRateResponse { - /** - * Heart rate. - * 255 indicates an invalid value in lite wearable. - * @devices wearable, liteWearable - * @since 3 - */ - heartRate: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices wearable, liteWearable - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ -export interface SubscribeHeartRateOptions { - /** - * Called when the heart rate sensor data changes. - * @devices wearable, liteWearable - * @since 3 - */ - success: (data: HeartRateResponse) => void; - - /** - * Called when the listening fails - * @devices wearable, liteWearable - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices wearable, liteWearable - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface OnBodyStateResponse { - /** - * Whether the sensor is worn. - * @devices wearable, liteWearable - * @since 3 - */ - value: boolean; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices wearable, liteWearable - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeOnBodyStateOptions { - /** - * Called when the wearing status changes. - * @devices wearable, liteWearable - * @since 3 - */ - success: (data: OnBodyStateResponse) => void; - - /** - * Called when the listening fails. - * @devices wearable, liteWearable - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices wearable, liteWearable - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface GetOnBodyStateOptions { - /** - * Called when the sensor wearing state is obtained - * @devices wearable, liteWearable - * @since 3 - */ - success: (data: OnBodyStateResponse) => void; - - /** - * Called when the sensor wearing state fails to be obtained - * @devices wearable, liteWearable - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed - * @devices wearable, liteWearable - * @since 3 - */ - complete?: () => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @since 6 - */ -export interface DeviceOrientationResponse { - /** - * alpha - * @devices phone, tablet, wearable - * @since 6 - */ - alpha: number; - - /** - * beta - * @devices phone, tablet, wearable - * @since 6 - */ - beta: number; - - /** - * gamma - * @devices phone, tablet, wearable - * @since 6 - */ - gamma: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @since 6 - */ -export interface SubscribeDeviceOrientationOptions { - /** - * Execution frequency of the callback function for listening to device orientation sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @devices phone, tablet, wearable - * @since 6 - */ - interval: string; - - /** - * Called when device orientation sensor data changes. - * @devices phone, tablet, wearable - * @since 6 - */ - success: (data: DeviceOrientationResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet, wearable - * @since 6 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ -export interface GyroscopeResponse { - /** - * X-coordinate - * @devices phone, tablet, wearable - * @since 6 - */ - x: number; - - /** - * Y-coordinate - * @devices phone, tablet, wearable - * @since 6 - */ - y: number; - - /** - * Z-coordinate - * @devices phone, tablet, wearable - * @since 6 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ -export interface SubscribeGyroscopeOptions { - /** - * Execution frequency of the callback function for listening to gyroscope sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @devices phone, tablet, wearable - * @since 6 - */ - interval: string; - - /** - * Called when gyroscope sensor data changes. - * @devices phone, tablet, wearable - * @since 6 - */ - success: (data: GyroscopeResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet, wearable - * @since 6 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface GravityResponse { - /** - * X-coordinate - * @devices phone, tablet, wearable - * @since 7 - */ - x: number; - - /** - * Y-coordinate - * @devices phone, tablet, wearable - * @since 7 - */ - y: number; - - /** - * Z-coordinate - * @devices phone, tablet, wearable - * @since 7 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeGravityOptions { - /** - * Execution frequency of the callback function for listening to gravity sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @devices phone, tablet, wearable - * @since 7 - */ - interval: string; - - /** - * Called when gravity sensor data changes. - * @devices phone, tablet, wearable - * @since 7 - */ - success: (data: GravityResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet, wearable - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface MagneticResponse { - /** - * X-coordinate - * @devices phone, tablet, wearable - * @since 7 - */ - x: number; - - /** - * Y-coordinate - * @devices phone, tablet, wearable - * @since 7 - */ - y: number; - - /** - * Z-coordinate - * @devices phone, tablet, wearable - * @since 7 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeMagneticOptions { - /** - * Execution frequency of the callback function for listening to magnetic sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @devices phone, tablet, wearable - * @since 7 - */ - interval: string; - - /** - * Called when magnetic sensor data changes. - * @devices phone, tablet, wearable - * @since 7 - */ - success: (data: MagneticResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet, wearable - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface HallResponse { - /** - * Indicates the hall sensor data. - * @devices phone, tablet - * @since 7 - */ - value: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeHallOptions { - /** - * Execution frequency of the callback function for listening to hall sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @devices phone, tablet - * @since 7 - */ - interval: string; - - /** - * Called when hall sensor data changes. - * @devices phone, tablet - * @since 7 - */ - success: (data: HallResponse) => void; - - /** - * Called when the listening fails. - * @devices phone, tablet - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable, liteWearable - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export default class Sensor { - /** - * Listens to acceleration sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ - static subscribeAccelerometer(options: subscribeAccelerometerOptions): void; - - /** - * Cancels listening to acceleration sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ - static unsubscribeAccelerometer(): void; - - /** - * Listens to compass sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 3 - */ - static subscribeCompass(options: SubscribeCompassOptions): void; - - /** - * Cancels listening to compass sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 3 - */ - static unsubscribeCompass(): void; - - /** - * Listens to distance sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet - * @since 3 - */ - static subscribeProximity(options: SubscribeProximityOptions): void; - - /** - * Cancels listening to distance sensor data. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet - * @since 3 - */ - static unsubscribeProximity(): void; - - /** - * Listens to ambient light sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 3 - */ - static subscribeLight(options: SubscribeLightOptions): void; - - /** - * Cancels listening to ambient light sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 3 - */ - static unsubscribeLight(): void; - - /** - * Listens to step counter sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable, liteWearable - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ - static subscribeStepCounter(options: SubscribeStepCounterOptions): void; - - /** - * Cancels listening to step counter sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable, liteWearable - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ - static unsubscribeStepCounter(): void; - - /** - * Listens to barometer sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - static subscribeBarometer(options: SubscribeBarometerOptions): void; - - /** - * Cancels listening to barometer sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - static unsubscribeBarometer(): void; - - /** - * Listens to changes of heart rate sensor data. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices wearable, liteWearable - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ - static subscribeHeartRate(options: SubscribeHeartRateOptions): void; - - /** - * Cancels listening to heart rate sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices wearable, liteWearable - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ - static unsubscribeHeartRate(): void; - - /** - * Listens to whether a sensor is worn. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices wearable, liteWearable - * @since 3 - */ - static subscribeOnBodyState(options: SubscribeOnBodyStateOptions): void; - - /** - * Cancels listening to whether the sensor is worn. - * @SysCap SystemCapability.Sensors.Sensor - * @devices wearable, liteWearable - * @since 3 - */ - static unsubscribeOnBodyState(): void; - - /** - * Obtains the sensor wearing state. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices wearable, liteWearable - * @since 3 - */ - static getOnBodyState(options: GetOnBodyStateOptions): void; - - /** - * Listens to device orientation sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 6 - */ - static subscribeDeviceOrientation(options: SubscribeDeviceOrientationOptions): void; - - /** - * Cancels listening to device orientation sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 6 - */ - static unsubscribeDeviceOrientation(): void; - - /** - * Listens to gyroscope sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ - static subscribeGyroscope(options: SubscribeGyroscopeOptions): void; - - /** - * Cancels listening to gyroscope sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ - static unsubscribeGyroscope(): void; - - /** - * Listens to gravity sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 7 - */ - static subscribeGravity(options: SubscribeGravityOptions): void; - - /** - * Cancels listening to gravity sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 7 - */ - static unsubscribeGravity(): void; - - /** - * Listens to magnetic sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 7 - */ - static subscribeMagnetic(options: SubscribeMagneticOptions): void; - - /** - * Cancels listening to magnetic sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 7 - */ - static unsubscribeMagnetic(): void; - - /** - * Listens to hall sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 7 - */ - static subscribeHall(options: SubscribeHallOptions): void; - - /** - * Cancels listening to hall sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @devices phone, tablet, wearable - * @since 7 - */ - static unsubscribeHall(): void; -} diff --git a/api/common/@system.vibrator.d.ts b/api/common/@system.vibrator.d.ts deleted file mode 100644 index 903806100e6f4d486eb884743c1543075b936d32..0000000000000000000000000000000000000000 --- a/api/common/@system.vibrator.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2020 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @SysCap SystemCapability.Sensors.MiscDevice - * @devices phone, tablet, wearable, liteWearable - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - */ -export interface VibrateOptions { - /** - * Vibration mode. The value long indicates long vibration, and short indicates short vibration. - * The default value is long. - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - mode?: "long" | "short"; - - /** - * Called when success to trigger vibration. - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - success: () => void; - - /** - * Called when fail to trigger vibration. - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @devices phone, tablet, wearable, liteWearable - * @since 3 - */ - complete?: () => void; -} - -/** - * @SysCap SystemCapability.Sensors.MiscDevice - * @devices phone, tablet, wearable, liteWearable - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - */ -export default class Vibrator { - /** - * Triggers vibration. - * @param options Options. - * @devices phone, tablet, wearable, liteWearable - * @permission ohos.permission.VIBRATE - * @since 3 - */ - static vibrate(options?: VibrateOptions): void; -} diff --git a/api/liteWearable/@system.sensor.d.ts b/api/liteWearable/@system.sensor.d.ts deleted file mode 100644 index 4f77d0f015c43ea8af2ca60bd1ff95f8093bf7ed..0000000000000000000000000000000000000000 --- a/api/liteWearable/@system.sensor.d.ts +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2020 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ -export interface StepCounterResponse { - /** - * Number of steps counted. - * Each time the device restarts, the value is recalculated from 0. - * @since 3 - */ - steps: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ -export interface SubscribeStepCounterOptions { - /** - * Called when step counter sensor data changes. - * @since 3 - */ - success: (data: StepCounterResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface BarometerResponse { - /** - * Pressure, in pascal. - * @since 3 - */ - pressure: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeBarometerOptions { - /** - * Called when the barometer sensor data changes. - * @since 3 - */ - success: (data: BarometerResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ -export interface HeartRateResponse { - /** - * Heart rate. - * @since 3 - */ - heartRate: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ -export interface SubscribeHeartRateOptions { - /** - * Called when the heart rate sensor data changes. - * @since 3 - */ - success: (data: HeartRateResponse) => void; - - /** - * Called when the listening fails - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface OnBodyStateResponse { - /** - * Whether the sensor is worn. - * @since 3 - */ - value: boolean; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeOnBodyStateOptions { - /** - * Called when the wearing status changes. - * @since 3 - */ - success: (data: OnBodyStateResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface GetOnBodyStateOptions { - /** - * Called when the sensor wearing state is obtained - * @since 3 - */ - success: (data: OnBodyStateResponse) => void; - - /** - * Called when the sensor wearing state fails to be obtained - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed - * @since 3 - */ - complete?: () => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export default class Sensor { - /** - * Listens to step counter sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ - static subscribeStepCounter(options: SubscribeStepCounterOptions): void; - - /** - * Cancels listening to step counter sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ - static unsubscribeStepCounter(): void; - - /** - * Listens to barometer sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeBarometer(options: SubscribeBarometerOptions): void; - - /** - * Cancels listening to barometer sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeBarometer(): void; - - /** - * Listens to changes of heart rate sensor data. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ - static subscribeHeartRate(options: SubscribeHeartRateOptions): void; - - /** - * Cancels listening to heart rate sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ - static unsubscribeHeartRate(): void; - - /** - * Listens to whether a sensor is worn. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeOnBodyState(options: SubscribeOnBodyStateOptions): void; - - /** - * Cancels listening to whether the sensor is worn. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeOnBodyState(): void; - - /** - * Obtains the sensor wearing state. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static getOnBodyState(options: GetOnBodyStateOptions): void; -} diff --git a/api/liteWearable/@system.vibrator.d.ts b/api/liteWearable/@system.vibrator.d.ts deleted file mode 100644 index cf23b8a6de9c3af921df85dda15ecb65679837a8..0000000000000000000000000000000000000000 --- a/api/liteWearable/@system.vibrator.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2020 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @SysCap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - */ -export interface VibrateOptions { - /** - * Vibration mode. The value long indicates long vibration, and short indicates short vibration. - * The default value is long. - * @since 3 - */ - mode?: "long" | "short"; - - /** - * Called when success to trigger vibration. - * @since 3 - */ - success: () => void; - - /** - * Called when fail to trigger vibration. - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @since 3 - */ - complete?: () => void; -} - -/** - * @SysCap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - */ -export default class Vibrator { - /** - * Triggers vibration. - * @param options Options. - * @permission ohos.permission.VIBRATE - * @since 3 - */ - static vibrate(options?: VibrateOptions): void; -} \ No newline at end of file diff --git a/api/phone/@system.sensor.d.ts b/api/phone/@system.sensor.d.ts deleted file mode 100644 index 487c87973e5d0bde86add41f8ea866ff4a419b5e..0000000000000000000000000000000000000000 --- a/api/phone/@system.sensor.d.ts +++ /dev/null @@ -1,689 +0,0 @@ -/* - * Copyright (c) 2021 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ -export interface AccelerometerResponse { - /** - * X-coordinate - * @since 3 - */ - x: number; - - /** - * Y-coordinate - * @since 3 - */ - y: number; - - /** - * Z-coordinate - * @since 3 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ -export interface subscribeAccelerometerOptions { - /** - * Execution frequency of the callback function for listening to acceleration sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 3 - */ - interval: string; - - /** - * Called when acceleration sensor data changes. - * @since 3 - */ - success: (data: AccelerometerResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface CompassResponse { - /** - * Direction of the device (in degrees). - * @since 3 - */ - direction: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeCompassOptions { - /** - * Called when compass sensor data changes. - * @since 3 - */ - success: (data: CompassResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface ProximityResponse { - /** - * Distance between a visible object and the device screen - * @since 3 - */ - distance: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeProximityOptions { - /** - * Called when distance sensor data changes. - * @since 3 - */ - success: (data: ProximityResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface LightResponse { - /** - * Light intensity, in lux. - * @since 3 - */ - intensity: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeLightOptions { - /** - * Called when ambient light sensor data changes. - * @since 3 - */ - success: (data: LightResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ -export interface StepCounterResponse { - /** - * Number of steps counted. - * Each time the device restarts, the value is recalculated from 0. - * @since 3 - */ - steps: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ -export interface SubscribeStepCounterOptions { - /** - * Called when step counter sensor data changes. - * @since 3 - */ - success: (data: StepCounterResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface BarometerResponse { - /** - * Pressure, in pascal. - * @since 3 - */ - pressure: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeBarometerOptions { - /** - * Called when the barometer sensor data changes. - * @since 3 - */ - success: (data: BarometerResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 6 - */ -export interface DeviceOrientationResponse { - /** - * alpha - * @since 6 - */ - alpha: number; - - /** - * beta - * @since 6 - */ - beta: number; - - /** - * gamma - * @since 6 - */ - gamma: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 6 - */ -export interface SubscribeDeviceOrientationOptions { - /** - * Execution frequency of the callback function for listening to device orientation sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 6 - */ - interval: string; - - /** - * Called when device orientation sensor data changes. - * @since 6 - */ - success: (data: DeviceOrientationResponse) => void; - - /** - * Called when the listening fails. - * @since 6 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ -export interface GyroscopeResponse { - /** - * X-coordinate - * @since 6 - */ - x: number; - - /** - * Y-coordinate - * @since 6 - */ - y: number; - - /** - * Z-coordinate - * @since 6 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ -export interface SubscribeGyroscopeOptions { - /** - * Execution frequency of the callback function for listening to gyroscope sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 6 - */ - interval: string; - - /** - * Called when gyroscope sensor data changes. - * @since 6 - */ - success: (data: GyroscopeResponse) => void; - - /** - * Called when the listening fails. - * @since 6 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface GravityResponse { - /** - * X-coordinate - * @since 7 - */ - x: number; - - /** - * Y-coordinate - * @since 7 - */ - y: number; - - /** - * Z-coordinate - * @since 7 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeGravityOptions { - /** - * Execution frequency of the callback function for listening to gravity sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 7 - */ - interval: string; - - /** - * Called when gravity sensor data changes. - * @since 7 - */ - success: (data: GravityResponse) => void; - - /** - * Called when the listening fails. - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface MagneticResponse { - /** - * X-coordinate - * @since 7 - */ - x: number; - - /** - * Y-coordinate - * @since 7 - */ - y: number; - - /** - * Z-coordinate - * @since 7 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeMagneticOptions { - /** - * Execution frequency of the callback function for listening to magnetic sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 7 - */ - interval: string; - - /** - * Called when magnetic sensor data changes. - * @since 7 - */ - success: (data: MagneticResponse) => void; - - /** - * Called when the listening fails. - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface HallResponse { - /** - * Indicates the hall sensor data. - * @since 7 - */ - value: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeHallOptions { - /** - * Execution frequency of the callback function for listening to hall sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 7 - */ - interval: string; - - /** - * Called when hall sensor data changes. - * @since 7 - */ - success: (data: HallResponse) => void; - - /** - * Called when the listening fails. - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export default class Sensor { - /** - * Listens to acceleration sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ - static subscribeAccelerometer(options: subscribeAccelerometerOptions): void; - - /** - * Cancels listening to acceleration sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ - static unsubscribeAccelerometer(): void; - - /** - * Listens to compass sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeCompass(options: SubscribeCompassOptions): void; - - /** - * Cancels listening to compass sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeCompass(): void; - - /** - * Listens to distance sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeProximity(options: SubscribeProximityOptions): void; - - /** - * Cancels listening to distance sensor data. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeProximity(): void; - - /** - * Listens to ambient light sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeLight(options: SubscribeLightOptions): void; - - /** - * Cancels listening to ambient light sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeLight(): void; - - /** - * Listens to step counter sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ - static subscribeStepCounter(options: SubscribeStepCounterOptions): void; - - /** - * Cancels listening to step counter sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ - static unsubscribeStepCounter(): void; - - /** - * Listens to barometer sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeBarometer(options: SubscribeBarometerOptions): void; - - /** - * Cancels listening to barometer sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeBarometer(): void; - - /** - * Listens to device orientation sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 6 - */ - static subscribeDeviceOrientation(options: SubscribeDeviceOrientationOptions): void; - - /** - * Cancels listening to device orientation sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 6 - */ - static unsubscribeDeviceOrientation(): void; - - /** - * Listens to gyroscope sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ - static subscribeGyroscope(options: SubscribeGyroscopeOptions): void; - - /** - * Cancels listening to gyroscope sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ - static unsubscribeGyroscope(): void; - - /** - * Listens to gravity sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static subscribeGravity(options: SubscribeGravityOptions): void; - - /** - * Cancels listening to gravity sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static unsubscribeGravity(): void; - - /** - * Listens to magnetic sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static subscribeMagnetic(options: SubscribeMagneticOptions): void; - - /** - * Cancels listening to magnetic sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static unsubscribeMagnetic(): void; - - /** - * Listens to hall sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static subscribeHall(options: SubscribeHallOptions): void; - - /** - * Cancels listening to hall sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static unsubscribeHall(): void; -} diff --git a/api/phone/@system.vibrator.d.ts b/api/phone/@system.vibrator.d.ts deleted file mode 100644 index cf23b8a6de9c3af921df85dda15ecb65679837a8..0000000000000000000000000000000000000000 --- a/api/phone/@system.vibrator.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2020 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @SysCap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - */ -export interface VibrateOptions { - /** - * Vibration mode. The value long indicates long vibration, and short indicates short vibration. - * The default value is long. - * @since 3 - */ - mode?: "long" | "short"; - - /** - * Called when success to trigger vibration. - * @since 3 - */ - success: () => void; - - /** - * Called when fail to trigger vibration. - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @since 3 - */ - complete?: () => void; -} - -/** - * @SysCap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - */ -export default class Vibrator { - /** - * Triggers vibration. - * @param options Options. - * @permission ohos.permission.VIBRATE - * @since 3 - */ - static vibrate(options?: VibrateOptions): void; -} \ No newline at end of file diff --git a/api/tablet/@system.sensor.d.ts b/api/tablet/@system.sensor.d.ts deleted file mode 100644 index 487c87973e5d0bde86add41f8ea866ff4a419b5e..0000000000000000000000000000000000000000 --- a/api/tablet/@system.sensor.d.ts +++ /dev/null @@ -1,689 +0,0 @@ -/* - * Copyright (c) 2021 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ -export interface AccelerometerResponse { - /** - * X-coordinate - * @since 3 - */ - x: number; - - /** - * Y-coordinate - * @since 3 - */ - y: number; - - /** - * Z-coordinate - * @since 3 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ -export interface subscribeAccelerometerOptions { - /** - * Execution frequency of the callback function for listening to acceleration sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 3 - */ - interval: string; - - /** - * Called when acceleration sensor data changes. - * @since 3 - */ - success: (data: AccelerometerResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface CompassResponse { - /** - * Direction of the device (in degrees). - * @since 3 - */ - direction: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeCompassOptions { - /** - * Called when compass sensor data changes. - * @since 3 - */ - success: (data: CompassResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface ProximityResponse { - /** - * Distance between a visible object and the device screen - * @since 3 - */ - distance: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeProximityOptions { - /** - * Called when distance sensor data changes. - * @since 3 - */ - success: (data: ProximityResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface LightResponse { - /** - * Light intensity, in lux. - * @since 3 - */ - intensity: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeLightOptions { - /** - * Called when ambient light sensor data changes. - * @since 3 - */ - success: (data: LightResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ -export interface StepCounterResponse { - /** - * Number of steps counted. - * Each time the device restarts, the value is recalculated from 0. - * @since 3 - */ - steps: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ -export interface SubscribeStepCounterOptions { - /** - * Called when step counter sensor data changes. - * @since 3 - */ - success: (data: StepCounterResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface BarometerResponse { - /** - * Pressure, in pascal. - * @since 3 - */ - pressure: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeBarometerOptions { - /** - * Called when the barometer sensor data changes. - * @since 3 - */ - success: (data: BarometerResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 6 - */ -export interface DeviceOrientationResponse { - /** - * alpha - * @since 6 - */ - alpha: number; - - /** - * beta - * @since 6 - */ - beta: number; - - /** - * gamma - * @since 6 - */ - gamma: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 6 - */ -export interface SubscribeDeviceOrientationOptions { - /** - * Execution frequency of the callback function for listening to device orientation sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 6 - */ - interval: string; - - /** - * Called when device orientation sensor data changes. - * @since 6 - */ - success: (data: DeviceOrientationResponse) => void; - - /** - * Called when the listening fails. - * @since 6 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ -export interface GyroscopeResponse { - /** - * X-coordinate - * @since 6 - */ - x: number; - - /** - * Y-coordinate - * @since 6 - */ - y: number; - - /** - * Z-coordinate - * @since 6 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ -export interface SubscribeGyroscopeOptions { - /** - * Execution frequency of the callback function for listening to gyroscope sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 6 - */ - interval: string; - - /** - * Called when gyroscope sensor data changes. - * @since 6 - */ - success: (data: GyroscopeResponse) => void; - - /** - * Called when the listening fails. - * @since 6 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface GravityResponse { - /** - * X-coordinate - * @since 7 - */ - x: number; - - /** - * Y-coordinate - * @since 7 - */ - y: number; - - /** - * Z-coordinate - * @since 7 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeGravityOptions { - /** - * Execution frequency of the callback function for listening to gravity sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 7 - */ - interval: string; - - /** - * Called when gravity sensor data changes. - * @since 7 - */ - success: (data: GravityResponse) => void; - - /** - * Called when the listening fails. - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface MagneticResponse { - /** - * X-coordinate - * @since 7 - */ - x: number; - - /** - * Y-coordinate - * @since 7 - */ - y: number; - - /** - * Z-coordinate - * @since 7 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeMagneticOptions { - /** - * Execution frequency of the callback function for listening to magnetic sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 7 - */ - interval: string; - - /** - * Called when magnetic sensor data changes. - * @since 7 - */ - success: (data: MagneticResponse) => void; - - /** - * Called when the listening fails. - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface HallResponse { - /** - * Indicates the hall sensor data. - * @since 7 - */ - value: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeHallOptions { - /** - * Execution frequency of the callback function for listening to hall sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 7 - */ - interval: string; - - /** - * Called when hall sensor data changes. - * @since 7 - */ - success: (data: HallResponse) => void; - - /** - * Called when the listening fails. - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export default class Sensor { - /** - * Listens to acceleration sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ - static subscribeAccelerometer(options: subscribeAccelerometerOptions): void; - - /** - * Cancels listening to acceleration sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ - static unsubscribeAccelerometer(): void; - - /** - * Listens to compass sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeCompass(options: SubscribeCompassOptions): void; - - /** - * Cancels listening to compass sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeCompass(): void; - - /** - * Listens to distance sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeProximity(options: SubscribeProximityOptions): void; - - /** - * Cancels listening to distance sensor data. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeProximity(): void; - - /** - * Listens to ambient light sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeLight(options: SubscribeLightOptions): void; - - /** - * Cancels listening to ambient light sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeLight(): void; - - /** - * Listens to step counter sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ - static subscribeStepCounter(options: SubscribeStepCounterOptions): void; - - /** - * Cancels listening to step counter sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ - static unsubscribeStepCounter(): void; - - /** - * Listens to barometer sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeBarometer(options: SubscribeBarometerOptions): void; - - /** - * Cancels listening to barometer sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeBarometer(): void; - - /** - * Listens to device orientation sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 6 - */ - static subscribeDeviceOrientation(options: SubscribeDeviceOrientationOptions): void; - - /** - * Cancels listening to device orientation sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 6 - */ - static unsubscribeDeviceOrientation(): void; - - /** - * Listens to gyroscope sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ - static subscribeGyroscope(options: SubscribeGyroscopeOptions): void; - - /** - * Cancels listening to gyroscope sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ - static unsubscribeGyroscope(): void; - - /** - * Listens to gravity sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static subscribeGravity(options: SubscribeGravityOptions): void; - - /** - * Cancels listening to gravity sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static unsubscribeGravity(): void; - - /** - * Listens to magnetic sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static subscribeMagnetic(options: SubscribeMagneticOptions): void; - - /** - * Cancels listening to magnetic sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static unsubscribeMagnetic(): void; - - /** - * Listens to hall sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static subscribeHall(options: SubscribeHallOptions): void; - - /** - * Cancels listening to hall sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static unsubscribeHall(): void; -} diff --git a/api/tablet/@system.vibrator.d.ts b/api/tablet/@system.vibrator.d.ts deleted file mode 100644 index cf23b8a6de9c3af921df85dda15ecb65679837a8..0000000000000000000000000000000000000000 --- a/api/tablet/@system.vibrator.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2020 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @SysCap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - */ -export interface VibrateOptions { - /** - * Vibration mode. The value long indicates long vibration, and short indicates short vibration. - * The default value is long. - * @since 3 - */ - mode?: "long" | "short"; - - /** - * Called when success to trigger vibration. - * @since 3 - */ - success: () => void; - - /** - * Called when fail to trigger vibration. - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @since 3 - */ - complete?: () => void; -} - -/** - * @SysCap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - */ -export default class Vibrator { - /** - * Triggers vibration. - * @param options Options. - * @permission ohos.permission.VIBRATE - * @since 3 - */ - static vibrate(options?: VibrateOptions): void; -} \ No newline at end of file diff --git a/api/wearable/@system.sensor.d.ts b/api/wearable/@system.sensor.d.ts deleted file mode 100644 index a090153c5a5f925ace217aa338b89b55f302de58..0000000000000000000000000000000000000000 --- a/api/wearable/@system.sensor.d.ts +++ /dev/null @@ -1,714 +0,0 @@ -/* - * Copyright (c) 2021 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ -export interface AccelerometerResponse { - /** - * X-coordinate - * @since 3 - */ - x: number; - - /** - * Y-coordinate - * @since 3 - */ - y: number; - - /** - * Z-coordinate - * @since 3 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ -export interface subscribeAccelerometerOptions { - /** - * Execution frequency of the callback function for listening to acceleration sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 3 - */ - interval: string; - - /** - * Called when acceleration sensor data changes. - * @since 3 - */ - success: (data: AccelerometerResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface CompassResponse { - /** - * Direction of the device (in degrees). - * @since 3 - */ - direction: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeCompassOptions { - /** - * Called when compass sensor data changes. - * @since 3 - */ - success: (data: CompassResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface LightResponse { - /** - * Light intensity, in lux. - * @since 3 - */ - intensity: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeLightOptions { - /** - * Called when ambient light sensor data changes. - * @since 3 - */ - success: (data: LightResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ -export interface StepCounterResponse { - /** - * Number of steps counted. - * Each time the device restarts, the value is recalculated from 0. - * @since 3 - */ - steps: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ -export interface SubscribeStepCounterOptions { - /** - * Called when step counter sensor data changes. - * @since 3 - */ - success: (data: StepCounterResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface BarometerResponse { - /** - * Pressure, in pascal. - * @since 3 - */ - pressure: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeBarometerOptions { - /** - * Called when the barometer sensor data changes. - * @since 3 - */ - success: (data: BarometerResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ -export interface HeartRateResponse { - /** - * Heart rate. - * @since 3 - */ - heartRate: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ -export interface SubscribeHeartRateOptions { - /** - * Called when the heart rate sensor data changes. - * @since 3 - */ - success: (data: HeartRateResponse) => void; - - /** - * Called when the listening fails - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface OnBodyStateResponse { - /** - * Whether the sensor is worn. - * @since 3 - */ - value: boolean; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface SubscribeOnBodyStateOptions { - /** - * Called when the wearing status changes. - * @since 3 - */ - success: (data: OnBodyStateResponse) => void; - - /** - * Called when the listening fails. - * @since 3 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 3 - */ -export interface GetOnBodyStateOptions { - /** - * Called when the sensor wearing state is obtained - * @since 3 - */ - success: (data: OnBodyStateResponse) => void; - - /** - * Called when the sensor wearing state fails to be obtained - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed - * @since 3 - */ - complete?: () => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 6 - */ -export interface DeviceOrientationResponse { - /** - * alpha - * @since 6 - */ - alpha: number; - - /** - * beta - * @since 6 - */ - beta: number; - - /** - * gamma - * @since 6 - */ - gamma: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 6 - */ -export interface SubscribeDeviceOrientationOptions { - /** - * Execution frequency of the callback function for listening to device orientation sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 6 - */ - interval: string; - - /** - * Called when device orientation sensor data changes. - * @since 6 - */ - success: (data: DeviceOrientationResponse) => void; - - /** - * Called when the listening fails. - * @since 6 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ -export interface GyroscopeResponse { - /** - * X-coordinate - * @since 6 - */ - x: number; - - /** - * Y-coordinate - * @since 6 - */ - y: number; - - /** - * Z-coordinate - * @since 6 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ -export interface SubscribeGyroscopeOptions { - /** - * Execution frequency of the callback function for listening to gyroscope sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 6 - */ - interval: string; - - /** - * Called when gyroscope sensor data changes. - * @since 6 - */ - success: (data: GyroscopeResponse) => void; - - /** - * Called when the listening fails. - * @since 6 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface GravityResponse { - /** - * X-coordinate - * @since 7 - */ - x: number; - - /** - * Y-coordinate - * @since 7 - */ - y: number; - - /** - * Z-coordinate - * @since 7 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeGravityOptions { - /** - * Execution frequency of the callback function for listening to gravity sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 7 - */ - interval: string; - - /** - * Called when gravity sensor data changes. - * @since 7 - */ - success: (data: GravityResponse) => void; - - /** - * Called when the listening fails. - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface MagneticResponse { - /** - * X-coordinate - * @since 7 - */ - x: number; - - /** - * Y-coordinate - * @since 7 - */ - y: number; - - /** - * Z-coordinate - * @since 7 - */ - z: number; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export interface SubscribeMagneticOptions { - /** - * Execution frequency of the callback function for listening to magnetic sensor data. - * Available values are as follows: - * 1. game: Extremely high frequency (20 ms per callback), which is applicable to gaming. - * 2. ui: High frequency (60 ms per callback), which is applicable to UI updating. - * 3. normal: Regular frequency (200 ms per callback), which is application to low power consumption. - * The default value is normal. - * @since 7 - */ - interval: string; - - /** - * Called when magnetic sensor data changes. - * @since 7 - */ - success: (data: MagneticResponse) => void; - - /** - * Called when the listening fails. - * @since 7 - */ - fail?: (data: string, code: number) => void; -} - -/** - * @SysCap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; - * @since 7 - */ -export default class Sensor { - /** - * Listens to acceleration sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ - static subscribeAccelerometer(options: subscribeAccelerometerOptions): void; - - /** - * Cancels listening to acceleration sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACCELEROMETER - * @since 3 - */ - static unsubscribeAccelerometer(): void; - - /** - * Listens to compass sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeCompass(options: SubscribeCompassOptions): void; - - /** - * Cancels listening to compass sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeCompass(): void; - - /** - * Listens to ambient light sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeLight(options: SubscribeLightOptions): void; - - /** - * Cancels listening to ambient light sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeLight(): void; - - /** - * Listens to step counter sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ - static subscribeStepCounter(options: SubscribeStepCounterOptions): void; - - /** - * Cancels listening to step counter sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.ACTIVITY_MOTION - * @since 3 - */ - static unsubscribeStepCounter(): void; - - /** - * Listens to barometer sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeBarometer(options: SubscribeBarometerOptions): void; - - /** - * Cancels listening to barometer sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeBarometer(): void; - - /** - * Listens to changes of heart rate sensor data. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ - static subscribeHeartRate(options: SubscribeHeartRateOptions): void; - - /** - * Cancels listening to heart rate sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.READ_HEALTH_DATA - * @since 3 - */ - static unsubscribeHeartRate(): void; - - /** - * Listens to whether a sensor is worn. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static subscribeOnBodyState(options: SubscribeOnBodyStateOptions): void; - - /** - * Cancels listening to whether the sensor is worn. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static unsubscribeOnBodyState(): void; - - /** - * Obtains the sensor wearing state. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 3 - */ - static getOnBodyState(options: GetOnBodyStateOptions): void; - - /** - * Listens to device orientation sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 6 - */ - static subscribeDeviceOrientation(options: SubscribeDeviceOrientationOptions): void; - - /** - * Cancels listening to device orientation sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 6 - */ - static unsubscribeDeviceOrientation(): void; - - /** - * Listens to gyroscope sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ - static subscribeGyroscope(options: SubscribeGyroscopeOptions): void; - - /** - * Cancels listening to gyroscope sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @permission ohos.permission.GYROSCOPE - * @since 6 - */ - static unsubscribeGyroscope(): void; - - /** - * Listens to gravity sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static subscribeGravity(options: SubscribeGravityOptions): void; - - /** - * Cancels listening to gravity sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static unsubscribeGravity(): void; - - /** - * Listens to magnetic sensor data changes. - * If this API is called multiple times, the last call takes effect. - * @param options Options. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static subscribeMagnetic(options: SubscribeMagneticOptions): void; - - /** - * Cancels listening to magnetic sensor data. - * @SysCap SystemCapability.Sensors.Sensor - * @since 7 - */ - static unsubscribeMagnetic(): void; -} diff --git a/api/wearable/@system.vibrator.d.ts b/api/wearable/@system.vibrator.d.ts deleted file mode 100644 index cf23b8a6de9c3af921df85dda15ecb65679837a8..0000000000000000000000000000000000000000 --- a/api/wearable/@system.vibrator.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2020 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @SysCap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - */ -export interface VibrateOptions { - /** - * Vibration mode. The value long indicates long vibration, and short indicates short vibration. - * The default value is long. - * @since 3 - */ - mode?: "long" | "short"; - - /** - * Called when success to trigger vibration. - * @since 3 - */ - success: () => void; - - /** - * Called when fail to trigger vibration. - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @since 3 - */ - complete?: () => void; -} - -/** - * @SysCap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - */ -export default class Vibrator { - /** - * Triggers vibration. - * @param options Options. - * @permission ohos.permission.VIBRATE - * @since 3 - */ - static vibrate(options?: VibrateOptions): void; -} \ No newline at end of file