diff options
author | Vince Leung <leungv@google.com> | 2021-02-03 06:21:58 +0000 |
---|---|---|
committer | Vince Leung <leungv@google.com> | 2021-02-17 20:16:47 +0000 |
commit | 4bae4f943d61bca6461cdeaa3da8823ffbd1886a (patch) | |
tree | cf848f121e22d0cfb98bb1ddf8cda764660d9aa2 /vibrator/aidl/default/Vibrator.cpp | |
parent | dbdfdc85c82c204c028bbfdf2270e296c9595998 (diff) |
vibrator: aidl: Add get f0 and get Q APIs
Add APIs to get f0, resonant frequency, and Q factor.
Bug: 178826612
Test: m and verify using idlcli
Change-Id: I834693693a91871f988504d2d9448497ef10e7fc
Diffstat (limited to 'vibrator/aidl/default/Vibrator.cpp')
-rw-r--r-- | vibrator/aidl/default/Vibrator.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/vibrator/aidl/default/Vibrator.cpp b/vibrator/aidl/default/Vibrator.cpp index 1021e620ce..bf61bfec91 100644 --- a/vibrator/aidl/default/Vibrator.cpp +++ b/vibrator/aidl/default/Vibrator.cpp @@ -27,12 +27,16 @@ namespace vibrator { static constexpr int32_t kComposeDelayMaxMs = 1000; static constexpr int32_t kComposeSizeMax = 256; +static constexpr float kResonantFrequency = 150.0; +static constexpr float kQFactor = 11.0; + ndk::ScopedAStatus Vibrator::getCapabilities(int32_t* _aidl_return) { LOG(INFO) << "Vibrator reporting capabilities"; *_aidl_return = IVibrator::CAP_ON_CALLBACK | IVibrator::CAP_PERFORM_CALLBACK | IVibrator::CAP_AMPLITUDE_CONTROL | IVibrator::CAP_EXTERNAL_CONTROL | IVibrator::CAP_EXTERNAL_AMPLITUDE_CONTROL | IVibrator::CAP_COMPOSE_EFFECTS | - IVibrator::CAP_ALWAYS_ON_CONTROL; + IVibrator::CAP_ALWAYS_ON_CONTROL | IVibrator::CAP_GET_RESONANT_FREQUENCY | + IVibrator::CAP_GET_Q_FACTOR; return ndk::ScopedAStatus::ok(); } @@ -201,6 +205,16 @@ ndk::ScopedAStatus Vibrator::alwaysOnDisable(int32_t id) { return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Vibrator::getResonantFrequency(float *resonantFreqHz) { + *resonantFreqHz = kResonantFrequency; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Vibrator::getQFactor(float *qFactor) { + *qFactor = kQFactor; + return ndk::ScopedAStatus::ok(); +} + } // namespace vibrator } // namespace hardware } // namespace android |