1/* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit SensorServiceKit 19 */ 20 21/** 22 * @interface VibrateOptions 23 * @permission ohos.permission.VIBRATE 24 * @syscap SystemCapability.Sensors.MiscDevice.Lite 25 * @since 3 26 * @deprecated since 8 27 * @useinstead ohos.vibrator/vibrator.VibrateTime 28 */ 29export interface VibrateOptions { 30 /** 31 * Vibration mode. The value long indicates long vibration, and short indicates short vibration. 32 * The default value is long. 33 * 34 * @permission ohos.permission.VIBRATE 35 * @type { ?('long' | 'short') } 36 * @syscap SystemCapability.Sensors.MiscDevice.Lite 37 * @since 3 38 * @deprecated since 8 39 */ 40 mode?: 'long' | 'short'; 41 42 /** 43 * Called when success to trigger vibration. 44 * 45 * @permission ohos.permission.VIBRATE 46 * @type { function } 47 * @syscap SystemCapability.Sensors.MiscDevice.Lite 48 * @since 3 49 * @deprecated since 8 50 */ 51 success: () => void; 52 53 /** 54 * Called when fail to trigger vibration. 55 * 56 * @permission ohos.permission.VIBRATE 57 * @type { ?function } 58 * @syscap SystemCapability.Sensors.MiscDevice.Lite 59 * @since 3 60 * @deprecated since 8 61 */ 62 fail?: (data: string, code: number) => void; 63 64 /** 65 * Called when the execution is completed. 66 * 67 * @permission ohos.permission.VIBRATE 68 * @type { ?function } 69 * @syscap SystemCapability.Sensors.MiscDevice.Lite 70 * @since 3 71 * @deprecated since 8 72 */ 73 complete?: () => void; 74} 75 76/** 77 * @permission ohos.permission.VIBRATE 78 * @syscap SystemCapability.Sensors.MiscDevice.Lite 79 * @since 3 80 * @deprecated since 8 81 * @useinstead ohos.vibrator/vibrator 82 */ 83export default class Vibrator { 84 /** 85 * Triggers vibration. 86 * 87 * @permission ohos.permission.VIBRATE 88 * @param { VibrateOptions } options Options. 89 * @syscap SystemCapability.Sensors.MiscDevice.Lite 90 * @since 3 91 * @deprecated since 8 92 * @useinstead ohos.vibrator/vibrator#startVibration 93 */ 94 static vibrate(options?: VibrateOptions): void; 95} 96