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 #ifndef OHOS_HDI_VIBRATOR_V1_1_VIBRATORINTERFACEIMPL_VDI_H 17 #define OHOS_HDI_VIBRATOR_V1_1_VIBRATORINTERFACEIMPL_VDI_H 18 19 #include <stdint.h> 20 #include <vector> 21 #include <hdf_base.h> 22 #include "hdf_load_vdi.h" 23 #include "ivibrator_type_vdi.h" 24 #include "v1_3/ivibrator_interface.h" 25 26 namespace OHOS { 27 namespace HDI { 28 namespace Vibrator { 29 namespace V1_1 { 30 31 #define HDI_VIBRATOR_VDI_LIBNAME "libhdi_vibrator_impl.z.so" 32 33 class IVibratorInterfaceVdi { 34 public: 35 virtual ~IVibratorInterfaceVdi() = default; 36 virtual int32_t Init() = 0; 37 virtual int32_t StartOnce(uint32_t duration) = 0; 38 virtual int32_t Start(const std::string &effectType) = 0; 39 virtual int32_t Stop(HdfVibratorModeVdi mode) = 0; 40 virtual int32_t GetVibratorInfo(std::vector<HdfVibratorInfoVdi> &vibratorInfo) = 0; 41 virtual int32_t EnableVibratorModulation(uint32_t duration, uint16_t intensity, int16_t frequency) = 0; 42 virtual int32_t EnableCompositeEffect(const HdfCompositeEffectVdi& effect) = 0; 43 virtual int32_t GetEffectInfo(const std::string &effectType, HdfEffectInfoVdi &effectInfo) = 0; 44 virtual int32_t IsVibratorRunning(bool& state) = 0; 45 virtual int32_t PlayHapticPattern(const HapticPaketVdi& pkg) = 0; 46 virtual int32_t GetHapticCapacity(HapticCapacityVdi& hapticCapacity) = 0; 47 virtual int32_t GetHapticStartUpTime(int32_t mode, int32_t& startUpTime) = 0; StartByIntensity(const std::string & effectType,uint16_t intensity)48 virtual int32_t StartByIntensity(const std::string& effectType, uint16_t intensity) {return HDF_SUCCESS;}; GetAllWaveInfo(int32_t vibratorId,std::vector<V1_3::HdfWaveInformation> & info)49 virtual int32_t GetAllWaveInfo(int32_t vibratorId, std::vector<V1_3::HdfWaveInformation> &info) 50 { 51 return HDF_SUCCESS; 52 }; 53 }; 54 struct VdiWrapperVibrator { 55 struct HdfVdiBase base; 56 IVibratorInterfaceVdi *vibratorModule; 57 }; 58 } // V1_1 59 } // Vibrator 60 } // HDI 61 } // OHOS 62 63 #endif // OHOS_HDI_VIBRATOR_V1_1_VIBRATORINTERFACEIMPL_VDI_H