1 /*
2  * Copyright (C) 2019 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 {
22 namespace android {
23 namespace hardware {
24 namespace vibrator {
25 
26 class Vibrator : public BnVibrator {
27     ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override;
28     ndk::ScopedAStatus off() override;
29     ndk::ScopedAStatus on(int32_t timeoutMs,
30                           const std::shared_ptr<IVibratorCallback>& callback) override;
31     ndk::ScopedAStatus perform(Effect effect, EffectStrength strength,
32                                const std::shared_ptr<IVibratorCallback>& callback,
33                                int32_t* _aidl_return) override;
34     ndk::ScopedAStatus getSupportedEffects(std::vector<Effect>* _aidl_return) override;
35     ndk::ScopedAStatus setAmplitude(float amplitude) override;
36     ndk::ScopedAStatus setExternalControl(bool enabled) override;
37     ndk::ScopedAStatus getCompositionDelayMax(int32_t* maxDelayMs);
38     ndk::ScopedAStatus getCompositionSizeMax(int32_t* maxSize);
39     ndk::ScopedAStatus getSupportedPrimitives(std::vector<CompositePrimitive>* supported) override;
40     ndk::ScopedAStatus getPrimitiveDuration(CompositePrimitive primitive,
41                                             int32_t* durationMs) override;
42     ndk::ScopedAStatus compose(const std::vector<CompositeEffect>& composite,
43                                const std::shared_ptr<IVibratorCallback>& callback) override;
44     ndk::ScopedAStatus getSupportedAlwaysOnEffects(std::vector<Effect>* _aidl_return) override;
45     ndk::ScopedAStatus alwaysOnEnable(int32_t id, Effect effect, EffectStrength strength) override;
46     ndk::ScopedAStatus alwaysOnDisable(int32_t id) override;
47     ndk::ScopedAStatus getResonantFrequency(float *resonantFreqHz) override;
48     ndk::ScopedAStatus getQFactor(float *qFactor) override;
49     ndk::ScopedAStatus getFrequencyResolution(float *freqResolutionHz) override;
50     ndk::ScopedAStatus getFrequencyMinimum(float *freqMinimumHz) override;
51     ndk::ScopedAStatus getBandwidthAmplitudeMap(std::vector<float> *_aidl_return) override;
52     ndk::ScopedAStatus getPwlePrimitiveDurationMax(int32_t *durationMs) override;
53     ndk::ScopedAStatus getPwleCompositionSizeMax(int32_t *maxSize) override;
54     ndk::ScopedAStatus getSupportedBraking(std::vector<Braking>* supported) override;
55     ndk::ScopedAStatus composePwle(const std::vector<PrimitivePwle> &composite,
56                                    const std::shared_ptr<IVibratorCallback> &callback) override;
57 
58 };
59 
60 }  // namespace vibrator
61 }  // namespace hardware
62 }  // namespace android
63 }  // namespace aidl
64