From ec77293c65e2646773db122c8281d9111f983532 Mon Sep 17 00:00:00 2001 From: shenpeixing Date: Tue, 2 Sep 2025 11:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A50702=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=88=B00728=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shenpeixing --- .../taihe/author/src/ohos.vibrator.impl.cpp | 7 +++-- frameworks/ets/taihe/idl/ohos.vibrator.taihe | 28 +++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp b/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp index ebb2d56..8d294e9 100644 --- a/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp +++ b/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp @@ -86,7 +86,8 @@ static bool ParseVibratorCurvePoint(::taihe::array<::ohos::vibrator::VibratorCur { CALL_LOG_ENTER; point.time = pointsArray[index].time; - point.intensity = pointsArray[index].intensity.has_value() ? pointsArray[index].intensity.value() : 0; + point.intensity = + pointsArray[index].intensity.has_value() ? static_cast(pointsArray[index].intensity.value()) : 0; point.frequency = pointsArray[index].frequency.has_value() ? pointsArray[index].frequency.value() : 0; return true; } @@ -197,7 +198,7 @@ static void PrintVibratorPattern(::ohos::vibrator::VibratorPattern &vibratorPatt ::taihe::array<::ohos::vibrator::VibratorCurvePoint> point = vibratorPattern.events[i].points.value(); for (int32_t j = 0; j < static_cast(vibratorPattern.events[i].points.value().size()); ++j) { MISC_HILOGD("PrintVibratorPattern, time:%{public}d, intensity:%{public}d, frequency:%{public}d", - point[j].time, point[j].intensity.value(), point[j].frequency.value()); + point[j].time, static_cast(point[j].intensity.value()), point[j].frequency.value()); } } } @@ -218,7 +219,7 @@ static bool CheckVibratorCurvePoint(const ::ohos::vibrator::VibratorEvent &event if ((event.points.value()[j].intensity.value() < 0) || (event.points.value()[j].intensity.value() > CURVE_POINT_INTENSITY_MAX)) { MISC_HILOGE("intensity in points is out of range, intensity:%{public}d", - event.points.value()[j].intensity.value()); + static_cast(event.points.value()[j].intensity.value())); return false; } if ((event.points.value()[j].frequency.value() < CURVE_FREQUENCY_MIN) || diff --git a/frameworks/ets/taihe/idl/ohos.vibrator.taihe b/frameworks/ets/taihe/idl/ohos.vibrator.taihe index bf4e15c..226df2b 100644 --- a/frameworks/ets/taihe/idl/ohos.vibrator.taihe +++ b/frameworks/ets/taihe/idl/ohos.vibrator.taihe @@ -53,20 +53,20 @@ struct VibratePreset { /** * The number of vibration repetitions. * - * @type { Optional } + * @type { Optional } * @syscap SystemCapability.Sensors.MiscDevice * @since 12 */ - count: Optional; + count: Optional; /** * The intensity of vibration effect. * - * @type { Optional } + * @type { Optional } * @syscap SystemCapability.Sensors.MiscDevice * @since 12 */ - intensity: Optional; + intensity: Optional; } /** @@ -110,12 +110,12 @@ struct VibrateTime { /** * The duration of the vibration, in ms. * - * @type { f64 } + * @type { i32 } * @syscap SystemCapability.Sensors.MiscDevice * @atomicservice * @since 11 */ - duration: f64; /** The duration of the vibration, in ms */ + duration: i32; /** The duration of the vibration, in ms */ } /** @@ -165,12 +165,12 @@ struct VibrateAttribute { /** * Vibrator id, default is 0. * - * @type { Optional } + * @type { Optional } * @syscap SystemCapability.Sensors.MiscDevice * @atomicservice * @since 11 */ - id: Optional; + id: Optional; /** * The use of vibration. @@ -412,11 +412,11 @@ struct VibratorCurvePoint { /** * Gain in relative event vibration intensity * - * @type { Optional } + * @type { Optional } * @syscap SystemCapability.Sensors.MiscDevice * @since 18 */ - intensity: Optional; + intensity: Optional; /** * Changes in relative event vibration frequency * @@ -595,21 +595,21 @@ struct HapticFileDescriptor { * The offset into the file where the data to be read, in bytes. By default, * the offset is zero. * - * @type { Optional } + * @type { Optional } * @syscap SystemCapability.Sensors.MiscDevice * @since 10 */ - offset: Optional; + offset: Optional; /** * The length in bytes of the data to be read. By default, the length is the * rest of bytes in the file from the offset. * - * @type { Optional } + * @type { Optional } * @syscap SystemCapability.Sensors.MiscDevice * @since 10 */ - length: Optional; + length: Optional; } /** -- Gitee