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
diff --git a/vibrator/aidl/default/Vibrator.cpp b/vibrator/aidl/default/Vibrator.cpp
index 1021e62..bf61bfe 100644
--- a/vibrator/aidl/default/Vibrator.cpp
+++ b/vibrator/aidl/default/Vibrator.cpp
@@ -27,12 +27,16 @@
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 @@
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