1/* 2 * Copyright (c) 2023 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 * @addtogroup Vibrator 18 * @{ 19 * 20 * @brief Provides a driver for upper-layer vibrator services. 21 * 22 * After obtaining a driver object or agent, a vibrator service get vibrator ability or 23 * set the vibrator effect using the functions provided by the driver object or agent. 24 * 25 * @since 4.1 26 */ 27 28/** 29 * @file VibratorTypes.idl 30 * 31 * @brief Declares common APIs in the vibrator module. The APIs canObtains information about all the vibrator 32 * that support setting intensity and Start the vibrator according to the incoming vibration effect. 33 * 34 * @since 4.1 35 * @version 1.2 36 */ 37 38package ohos.hdi.vibrator.v1_2; 39 40import ohos.hdi.vibrator.v1_2.VibratorTypes; 41import ohos.hdi.vibrator.v1_1.IVibratorInterface; 42 43interface IVibratorInterface extends ohos.hdi.vibrator.v1_1.IVibratorInterface{ 44 /** 45 * @brief HD vibration data packet delivery. 46 * 47 * @param Indecates the Hd vibration data packet. 48 * 49 * @return Returns <b>0</b> if the operation is successful. 50 * @return Returns negative value if the get failed. 51 * 52 * @since 4.1 53 * @version 1.2 54 */ 55 PlayHapticPattern([in] struct HapticPaket pkg); 56 /** 57 * @brief Obtains the vibration capability of the motor. 58 * 59 * @param Indecates the vibration capability of the motor. 60 * 61 * @return Returns <b>0</b> if the operation is successful. 62 * @return Returns negative value if the get failed. 63 * 64 * @since 4.1 65 * @version 1.2 66 */ 67 GetHapticCapacity([out] struct HapticCapacity HapticCapacity); 68 /** 69 * @brief Obtains the start_up time of the motor. 70 * 71 * @param Indicates the time from command is issued to the time the motor starts. 72 * 73 * @return Returns <b>0</b> if the operation is successful. 74 * @return Returns negative value if the get failed. 75 * 76 * @since 4.1 77 * @version 1.2 78 */ 79 GetHapticStartUpTime([in] int mode, [out] int startUpTime); 80 /** 81 * @brief Stops the vibration. 82 * 83 * Before the vibrator starts, it must stop vibrating in any mode. This function can be used during 84 * and after the vibrating process. 85 * 86 * @param mode Indicates the vibration mode, which can be one-shot or periodic. For details, 87 * see {@link HdfVibratorMode}. 88 * @return Returns <b>0</b> if the operation is successful; returns a negative value otherwise. 89 * 90 * @since 4.1 91 * @version 1.2 92 */ 93 StopV1_2([in] int mode); 94}