Loading vibrator/drv2624/Vibrator.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -451,6 +451,7 @@ ndk::ScopedAStatus Vibrator::getCapabilities(int32_t *_aidl_return) { if (mHwApi->hasRtpInput()) { ret |= IVibrator::CAP_AMPLITUDE_CONTROL; } ret |= IVibrator::CAP_GET_RESONANT_FREQUENCY; *_aidl_return = ret; return ndk::ScopedAStatus::ok(); } Loading Loading @@ -709,6 +710,24 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect> & /*comp return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } static float freqPeriodFormulaFloat(std::uint32_t in) { return static_cast<float>(1000000000) / static_cast<float>(24615 * in); } ndk::ScopedAStatus Vibrator::getResonantFrequency(float *resonantFreqHz) { uint32_t lraPeriod; if(!mHwCal->getLraPeriod(&lraPeriod)) { ALOGE("Failed to get resonant frequency (%d): %s", errno, strerror(errno)); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); } *resonantFreqHz = freqPeriodFormulaFloat(lraPeriod); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Vibrator::getQFactor(float * /*qFactor*/) { return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } } // namespace vibrator } // namespace hardware } // namespace android Loading vibrator/drv2624/Vibrator.h +2 −0 Original line number Diff line number Diff line Loading @@ -179,6 +179,8 @@ class Vibrator : public BnVibrator { ndk::ScopedAStatus getSupportedAlwaysOnEffects(std::vector<Effect> *_aidl_return) override; ndk::ScopedAStatus alwaysOnEnable(int32_t id, Effect effect, EffectStrength strength) override; ndk::ScopedAStatus alwaysOnDisable(int32_t id) override; ndk::ScopedAStatus getResonantFrequency(float *resonantFreqHz) override; ndk::ScopedAStatus getQFactor(float *qFactor) override; binder_status_t dump(int fd, const char **args, uint32_t numArgs) override; Loading Loading
vibrator/drv2624/Vibrator.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -451,6 +451,7 @@ ndk::ScopedAStatus Vibrator::getCapabilities(int32_t *_aidl_return) { if (mHwApi->hasRtpInput()) { ret |= IVibrator::CAP_AMPLITUDE_CONTROL; } ret |= IVibrator::CAP_GET_RESONANT_FREQUENCY; *_aidl_return = ret; return ndk::ScopedAStatus::ok(); } Loading Loading @@ -709,6 +710,24 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect> & /*comp return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } static float freqPeriodFormulaFloat(std::uint32_t in) { return static_cast<float>(1000000000) / static_cast<float>(24615 * in); } ndk::ScopedAStatus Vibrator::getResonantFrequency(float *resonantFreqHz) { uint32_t lraPeriod; if(!mHwCal->getLraPeriod(&lraPeriod)) { ALOGE("Failed to get resonant frequency (%d): %s", errno, strerror(errno)); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); } *resonantFreqHz = freqPeriodFormulaFloat(lraPeriod); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Vibrator::getQFactor(float * /*qFactor*/) { return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } } // namespace vibrator } // namespace hardware } // namespace android Loading
vibrator/drv2624/Vibrator.h +2 −0 Original line number Diff line number Diff line Loading @@ -179,6 +179,8 @@ class Vibrator : public BnVibrator { ndk::ScopedAStatus getSupportedAlwaysOnEffects(std::vector<Effect> *_aidl_return) override; ndk::ScopedAStatus alwaysOnEnable(int32_t id, Effect effect, EffectStrength strength) override; ndk::ScopedAStatus alwaysOnDisable(int32_t id) override; ndk::ScopedAStatus getResonantFrequency(float *resonantFreqHz) override; ndk::ScopedAStatus getQFactor(float *qFactor) override; binder_status_t dump(int fd, const char **args, uint32_t numArgs) override; Loading