1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <aidl/android/hardware/vibrator/BnVibrator.h> 20 21 namespace aidl::android::hardware::vibrator { 22 23 class Vibrator : public BnVibrator { 24 ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override; 25 ndk::ScopedAStatus off() override; 26 ndk::ScopedAStatus on(int32_t timeoutMs, 27 const std::shared_ptr<IVibratorCallback>& callback) override; 28 ndk::ScopedAStatus perform(Effect effect, EffectStrength strength, 29 const std::shared_ptr<IVibratorCallback>& callback, 30 int32_t* _aidl_return) override; 31 ndk::ScopedAStatus getSupportedEffects(std::vector<Effect>* _aidl_return) override; 32 ndk::ScopedAStatus setAmplitude(float amplitude) override; 33 ndk::ScopedAStatus setExternalControl(bool enabled) override; 34 ndk::ScopedAStatus getCompositionDelayMax(int32_t* maxDelayMs); 35 ndk::ScopedAStatus getCompositionSizeMax(int32_t* maxSize); 36 ndk::ScopedAStatus getSupportedPrimitives(std::vector<CompositePrimitive>* supported) override; 37 ndk::ScopedAStatus getPrimitiveDuration(CompositePrimitive primitive, 38 int32_t* durationMs) override; 39 ndk::ScopedAStatus compose(const std::vector<CompositeEffect>& composite, 40 const std::shared_ptr<IVibratorCallback>& callback) override; 41 ndk::ScopedAStatus getSupportedAlwaysOnEffects(std::vector<Effect>* _aidl_return) override; 42 ndk::ScopedAStatus alwaysOnEnable(int32_t id, Effect effect, EffectStrength strength) override; 43 ndk::ScopedAStatus alwaysOnDisable(int32_t id) override; 44 ndk::ScopedAStatus getResonantFrequency(float* resonantFreqHz) override; 45 ndk::ScopedAStatus getQFactor(float* qFactor) override; 46 ndk::ScopedAStatus getFrequencyResolution(float* freqResolutionHz) override; 47 ndk::ScopedAStatus getFrequencyMinimum(float* freqMinimumHz) override; 48 ndk::ScopedAStatus getBandwidthAmplitudeMap(std::vector<float>* _aidl_return) override; 49 ndk::ScopedAStatus getPwlePrimitiveDurationMax(int32_t* durationMs) override; 50 ndk::ScopedAStatus getPwleCompositionSizeMax(int32_t* maxSize) override; 51 ndk::ScopedAStatus getSupportedBraking(std::vector<Braking>* supported) override; 52 ndk::ScopedAStatus composePwle(const std::vector<PrimitivePwle>& composite, 53 const std::shared_ptr<IVibratorCallback>& callback) override; 54 }; 55 56 } // namespace aidl::android::hardware::vibrator 57