From 3a158e6584d0ab9f85617b282cce17b669a4c598 Mon Sep 17 00:00:00 2001 From: bailu1992 Date: Thu, 12 Dec 2024 22:22:23 +0800 Subject: [PATCH] The miscdevice ai alarm is modified Signed-off-by: bailu1992 --- frameworks/js/napi/vibrator/src/vibrator_js.cpp | 2 +- frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp | 2 +- frameworks/native/common/src/miscdevice_service_proxy.cpp | 6 +++--- .../haptic_matcher/src/custom_vibration_matcher.cpp | 2 +- utils/haptic_decoder/interface/vibrator_decoder_creator.cpp | 2 -- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/frameworks/js/napi/vibrator/src/vibrator_js.cpp b/frameworks/js/napi/vibrator/src/vibrator_js.cpp index 7524282..470c1f9 100644 --- a/frameworks/js/napi/vibrator/src/vibrator_js.cpp +++ b/frameworks/js/napi/vibrator/src/vibrator_js.cpp @@ -759,7 +759,7 @@ static napi_value CreateClassVibratePattern(const napi_env env, const napi_value static napi_value CreateEnumEffectId(const napi_env env, const napi_value exports) { napi_value clockTime = nullptr; - napi_create_string_utf8(env, "haptic.clock.timer", NAPI_AUTO_LENGTH, &clockTime); + NAPI_CALL(env, napi_create_string_utf8(env, "haptic.clock.timer", NAPI_AUTO_LENGTH, &clockTime)); napi_property_descriptor desc[] = { DECLARE_NAPI_STATIC_PROPERTY("EFFECT_CLOCK_TIMER", clockTime), }; diff --git a/frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp b/frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp index cdc963d..a23eca5 100644 --- a/frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp +++ b/frameworks/js/napi/vibrator/src/vibrator_napi_error.cpp @@ -29,7 +29,7 @@ napi_value CreateBusinessError(const napi_env &env, const int32_t errCode, const napi_value msg = nullptr; NAPI_CALL(env, napi_create_int32(env, errCode, &code)); NAPI_CALL(env, napi_create_string_utf8(env, errMessage.c_str(), NAPI_AUTO_LENGTH, &msg)); - napi_create_error(env, nullptr, msg, &businessError); + NAPI_CALL(env, napi_create_error(env, nullptr, msg, &businessError)); napi_set_named_property(env, businessError, "code", code); return businessError; } diff --git a/frameworks/native/common/src/miscdevice_service_proxy.cpp b/frameworks/native/common/src/miscdevice_service_proxy.cpp index 8a57286..6905a99 100644 --- a/frameworks/native/common/src/miscdevice_service_proxy.cpp +++ b/frameworks/native/common/src/miscdevice_service_proxy.cpp @@ -48,11 +48,11 @@ int32_t MiscdeviceServiceProxy::Vibrate(int32_t vibratorId, int32_t timeOut, int return WRITE_MSG_ERR; } if (!data.WriteInt32(timeOut)) { - MISC_HILOGE("WriteUint32 timeOut failed"); + MISC_HILOGE("WriteInt32 timeOut failed"); return WRITE_MSG_ERR; } if (!data.WriteInt32(usage)) { - MISC_HILOGE("WriteUint32 usage failed"); + MISC_HILOGE("WriteInt32 usage failed"); return WRITE_MSG_ERR; } if (!data.WriteBool(systemUsage)) { @@ -123,7 +123,7 @@ int32_t MiscdeviceServiceProxy::PlayVibratorEffect(int32_t vibratorId, const std return WRITE_MSG_ERR; } if (!data.WriteInt32(usage)) { - MISC_HILOGE("Writeint32 usage failed"); + MISC_HILOGE("WriteInt32 usage failed"); return WRITE_MSG_ERR; } if (!data.WriteBool(systemUsage)) { diff --git a/services/miscdevice_service/haptic_matcher/src/custom_vibration_matcher.cpp b/services/miscdevice_service/haptic_matcher/src/custom_vibration_matcher.cpp index dc6622b..06a38e8 100644 --- a/services/miscdevice_service/haptic_matcher/src/custom_vibration_matcher.cpp +++ b/services/miscdevice_service/haptic_matcher/src/custom_vibration_matcher.cpp @@ -43,7 +43,7 @@ constexpr int32_t EFFECT_ID_BOUNDARY = 1000; constexpr int32_t DURATION_MAX = 1600; #endif // HDF_DRIVERS_INTERFACE_VIBRATOR constexpr float CURVE_INTENSITY_SCALE = 100.00; -const float EPSILON = 0.00001; +constexpr float EPSILON = 0.00001; #ifdef HDF_DRIVERS_INTERFACE_VIBRATOR constexpr int32_t SLICE_STEP = 50; constexpr int32_t CONTINUOUS_VIBRATION_DURATION_MIN = 15; diff --git a/utils/haptic_decoder/interface/vibrator_decoder_creator.cpp b/utils/haptic_decoder/interface/vibrator_decoder_creator.cpp index aebfa9b..ac9724b 100644 --- a/utils/haptic_decoder/interface/vibrator_decoder_creator.cpp +++ b/utils/haptic_decoder/interface/vibrator_decoder_creator.cpp @@ -42,8 +42,6 @@ IVibratorDecoder *VibratorDecoderCreator::CreateDecoder(const JsonParser &parser HEVibratorDecoderFactory factory; return factory.CreateDecoder(); } - MISC_HILOGE("Create decoder fail"); - return nullptr; } bool VibratorDecoderCreator::CheckJsonMetadata(const JsonParser &parser) -- Gitee